diff --git a/lib/ble/index.js b/lib/ble/index.js index c79a023..c4812a3 100644 --- a/lib/ble/index.js +++ b/lib/ble/index.js @@ -3,7 +3,11 @@ /** @module ble */ /** Bluetooth Low Energy module */ +const util = require('util') +const os = require('os') +const log = require('../log')('ble') +const wifi = require('../wifi') const DEVICE_NAME = process.env.DEVICE_ID || 'intval3' const SERVICE_ID = process.env.SERVICE_ID || 'intval3_ble' @@ -13,13 +17,8 @@ const NETWORK = os.networkInterfaces() const MAC = getMac() || spoofMac() 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 getState @@ -135,7 +134,7 @@ class BLE { bleno.on('stateChange', state => { log.info('stateChange', { state : state }) if (state === 'poweredOn') { - log.info('Starting advertising', { DEVICE_NAME: DEVICE_NAME }) + log.info('Starting advertising', { DEVICE_NAME: DEVICE_NAME, DEVICE_ID : process.env.BLENO_DEVICE_NAME }) bleno.startAdvertising(DEVICE_NAME, [CHAR_ID]) } else { bleno.stopAdvertising()