Require bleno AFTER unique name is applied (this was messing up)

This commit is contained in:
mmcwilliams 2017-12-13 18:34:00 -05:00
parent 6cabd0e926
commit 35feed7775
1 changed files with 8 additions and 6 deletions

View File

@ -3,12 +3,7 @@
/** @module ble */ /** @module ble */
/** Bluetooth Low Energy module */ /** Bluetooth Low Energy module */
const os = require('os')
const bleno = require('bleno')
const util = require('util')
const log = require('../log')('ble')
const wifi = require('../wifi')
const DEVICE_NAME = process.env.DEVICE_ID || 'intval3' const DEVICE_NAME = process.env.DEVICE_ID || 'intval3'
const SERVICE_ID = process.env.SERVICE_ID || 'intval3_ble' const SERVICE_ID = process.env.SERVICE_ID || 'intval3_ble'
@ -16,9 +11,16 @@ const CHAR_ID = process.env.CHAR_ID || 'intval3char'
const WIFI_ID = process.env.WIFI_ID || 'wifichar' const WIFI_ID = process.env.WIFI_ID || 'wifichar'
const NETWORK = os.networkInterfaces() const NETWORK = os.networkInterfaces()
const MAC = getMac() || spoofMac() const MAC = getMac() || spoofMac()
//
process.env.BLENO_DEVICE_NAME += '_' + MAC process.env.BLENO_DEVICE_NAME += '_' + MAC
const os = require('os')
const bleno = require('bleno')
const util = require('util')
const log = require('../log')('ble')
const wifi = require('../wifi')
let currentWifi = 'disconnected' let currentWifi = 'disconnected'
let getState let getState