diff --git a/services/bluetooth/index.js b/services/bluetooth/index.js index 5f284db..8fbe53a 100644 --- a/services/bluetooth/index.js +++ b/services/bluetooth/index.js @@ -31,11 +31,11 @@ function createChar(name, uuid, prop, write, read) { }) } util.inherits(characteristic, bleno.Characteristic) - if (prop.indexOf('read')) { + if (prop.indexOf('read') !== -1) { //data, offset, withoutResponse, callback characteristic.prototype.onReadRequest = read } - if (prop.indexOf('write')) { + if (prop.indexOf('write') !== -1) { characteristic.prototype.onWriteRequest = write } chars.push(new characteristic())