Write with response #507
Answered
by
twyatt
HaniFakhouri
asked this question in
Q&A
|
Hi. If I write to characteristic using writeType set to WriteType.WithResponse, how can I observe/consume the response? |
Answered by
twyatt
Jun 17, 2023
Replies: 1 comment
|
Write with response configures whether or not the link layer will handle the acknowledgement of receipt of a packet. Internally in Kable, we only have visibility into when the link layer is ready to receive the next packet. So, write with response has little to do with getting data back from your peripheral. How you get data from your peripheral is really up to you, but a common design I've seen is to have your peripheral have a characteristic dedicated to writes (we'll call it val response = B.onSubscription { A.write(request) }.first()Some considerations with the above pseudo code:
|
0 replies
Answer selected by
HaniFakhouri
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Write with response configures whether or not the link layer will handle the acknowledgement of receipt of a packet. Internally in Kable, we only have visibility into when the link layer is ready to receive the next packet. So, write with response has little to do with getting data back from your peripheral.
How you get data from your peripheral is really up to you, but a common design I've seen is to have your peripheral have a characteristic dedicated to writes (we'll call it
A) and a characteristic for observing "responses" (characteristic changes — we'll call itB):Some considerations with the above pseudo code: