ble-server/ble/main-service.js
Jay a7f7653efa 修改服務啟動動作與QRCode產生按鈕
1.啟動時連接印表機
2.判斷是否要開啟藍芽
3.畫面加入QRCode產生按鈕,方便APP設定
2017-09-07 23:41:56 +08:00

25 lines
574 B
JavaScript

const bleno = require('bleno')
const config = require('../config.json')
const localEvent = require('../localEvent')
const GdataCharacteristic = require('./gdata-characteristic')
const dataCharacteristic = new GdataCharacteristic()
class MainService extends bleno.PrimaryService {
constructor () {
super({
uuid: config.ble.uuid.service,
characteristics: [
dataCharacteristic
]
})
}
}
localEvent.on('printResult', async state => {
let str = state ? 'ok' : 'fail'
dataCharacteristic.sendNotidy(str)
})
module.exports = MainService