Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writing data to characteristic and getting response data back example #72

Open
MartinKopecky opened this issue Feb 7, 2025 · 0 comments

Comments

@MartinKopecky
Copy link

Hey, I would like to kindly ask you to try to extend the Usage description to provide one more slightly more advanced example

Sample function implementing the writing to the 'request' characteristic and get the response data back on 'response' characteristic using writeValue() and characteristicValueUpdatedPublisher. The API may look like this:

func command(request: Data) async throw -> Data {...}

The function may setup the characteristicValueUpdatedPublisher to observe response UUID characteristic which shall contain the response data received from the peripheral as the response once the request message is sent out by writeValue(request,...)

I tried to look into the cookbook project but It mostly covers the procedures up to getting the peripheral connected, but there is no best practice to be found covering sending the message to the peripheral and receive the response once asynchronously sent from the peripheral and processing it.

I would prefer to have Data() in and Data() out containing pure byte data...

I know it is partly my kind request for help doing so but I also think it may help anyone else in understanding how to use the AsyncBluetooth lib more easily.

Many thanks in advance Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant