android - Response from readCharacteristic is not always as expected after issue writeCharacteristic -
i'm working on android ble app. have ble device storing coordinates of device went.
in order data device after connected, need send several commands , read response. steps follow:
- send first command device
- read response (some data..)
- send second command device
- read response (coordinates)
and how did
- after connected, sending command device using writecharacteristic
- when receiving gatt_success in oncharacteristicwrite callback, call readcharacteristic read response
- when receiving gatt_success in oncharacteristicread callback, continue send second command device using writecharacteristic
- when receiving gatt_success in oncharacteristicwrite callback, call readcharacteristic read response
so here's problem, when issued readcharacteristic after write operation succeeded, response not expected , sometime return same command wrote. however, if put delay (e.g. 1 second) after write, response correct when read delay may different every time.
i wondering if having same issue or can explain me why happening? possible can know when correct time read characteristic?
note: device not provide notification/indication.
Comments
Post a Comment