Skip to content

Write with response #507

Answered by twyatt
HaniFakhouri asked this question in Q&A
Discussion options

You must be logged in to vote

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 it B):

val response = B.onSubscription { A.write(request) }.first()

Some considerations with the above pseudo code:

  • You'll wan…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by HaniFakhouri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants