Check for actual prop index and compare

This commit is contained in:
mmcwilliams 2017-08-21 23:45:56 -04:00
parent e7347af656
commit 07d73d74bc
1 changed files with 2 additions and 2 deletions

View File

@ -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())