Home > Blockchain >  BLE: Can it be that to read a Value we need to send Write Request first?
BLE: Can it be that to read a Value we need to send Write Request first?

Time:05-30

I have a BLE watch and looked up the connection log via Wireshark. The characteristics responsible for receiving data I'm interested in apparently are Write only. Wireshark log shows that those characteristic send data after receiving Write Request and Write Command from my phone. Only then the watch sends the data to my phone. Is this even possible? How do I figure it out without the watch documentation?

CodePudding user response:

Write Requests cannot have any embedded data in their corresponding Write Response and Write Without Response doesn't have any response at all. Read Requests on the other hand cannot have any embedded data in the request but the corresponding Read Response contains data.

Since it's common that one wants to design protocols that have a request - response structure, it's a bit awkward that GATT has not been designed for this use case.

The simple solution is therefore often to combine Write requests with notifications (Handle value notification as you see in the log). Notifications are one way messages from GATT server to GATT client. The benefit of notifications compared to Read Request - Read Response is that they can be sent at any time.

  • Related