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:

  1. send first command device
  2. read response (some data..)
  3. send second command device
  4. read response (coordinates)

and how did

  1. after connected, sending command device using writecharacteristic
  2. when receiving gatt_success in oncharacteristicwrite callback, call readcharacteristic read response
  3. when receiving gatt_success in oncharacteristicread callback, continue send second command device using writecharacteristic
  4. 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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -