Send a buffer of a string, not the entire string.

This commit is contained in:
mmcwilliams 2017-12-12 13:24:26 -05:00
parent 9d95ffa483
commit 601d0cf581
1 changed files with 3 additions and 1 deletions

View File

@ -174,7 +174,9 @@ class BLE {
obj = JSON.parse(utf8) obj = JSON.parse(utf8)
result = bleno.Characteristic.RESULT_SUCCESS result = bleno.Characteristic.RESULT_SUCCESS
if (obj.type && this[`_on${capitalize(obj.type)}`]) { if (obj.type && this[`_on${capitalize(obj.type)}`]) {
this[`_on${capitalize(obj.type)}`]( data => { this[`_on${capitalize(obj.type)}`]( obj => {
let str = JSON.stringify(obj)
let data = new Buffer(str)
return callback(result, data.slice(offset, data.length)) return callback(result, data.slice(offset, data.length))
}) })
} else { } else {