ble-server/main-service.js
2017-08-23 14:51:42 +08:00

25 lines
597 B
JavaScript

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