objective c - iOS bluetooth: Unknown error when writing to characteristic -
in application find peripheral given service. check characteristics wanted nowadays before moving on.
when write value characteristics, callback didwritevalueforcharacteristic:
trigger:
- (void) peripheral:(cbperipheral *)peripheral didwritevalueforcharacteristic:(cbcharacteristic *)characteristic error:(nserror *)error{ nslog(@"did write characteristic value : %@ id %@", characteristic.value, characteristic.uuid); nslog(@"with error: %@", [error localizeddescription]); }
and yields output:
did write characteristic value : <005c> id unknown (<00005004 1212efde 1523785f eabcd123>) error: unknown error.
the value correct, same goes 128bit uuid of characteristic, in peripheral never value written.
any suggestions might wrong?
i sent writewithoutresponse
, changing writewithresponse
gave me corebluetooth[warning] error 13
mentioned @larme in comments. value corresponded to invalid attribute value length, meaning sent wrong number format, i.e sent 16bit value while peripheral expected 8bit.
changing peripheral take 16bit info solved issue.
ios objective-c core-bluetooth bluetooth-lowenergy
No comments:
Post a Comment