ubluetooth - FLAG_WRITE (without response) ?

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
prem111
Posts: 33
Joined: Sun Feb 23, 2020 3:18 pm

ubluetooth - FLAG_WRITE (without response) ?

Post by prem111 » Thu Feb 27, 2020 9:47 pm

Hi, im have problem in ubluetooth module.

Standard in the characteristics to write is: FLAG_WRITE (default with reposnse) how to call with without reponse?

Or maybe you know another library that handles it?

Best Regards.

User avatar
jimmo
Posts: 1381
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ubluetooth - FLAG_WRITE (without response) ?

Post by jimmo » Thu Feb 27, 2020 10:15 pm

Code: Select all

_WRITE_RESPONSE = const(1)
ble.gattc_write(conn_handle, value_handle, data, _WRITE_RESPONSE)
See http://docs.micropython.org/en/latest/l ... attc_write for more info

prem111
Posts: 33
Joined: Sun Feb 23, 2020 3:18 pm

Re: ubluetooth - FLAG_WRITE (without response) ?

Post by prem111 » Thu Feb 27, 2020 10:18 pm

I mean gatt server not client...

prem111
Posts: 33
Joined: Sun Feb 23, 2020 3:18 pm

Re: ubluetooth - FLAG_WRITE (without response) ?

Post by prem111 » Fri Feb 28, 2020 6:49 am

What are other recommendable ble library?

Or maybe you can solve this problem using ubluetooth?

User avatar
jimmo
Posts: 1381
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ubluetooth - FLAG_WRITE (without response) ?

Post by jimmo » Fri Feb 28, 2020 7:53 am

Can you clarify what you mean by writing from a gatt server? Maybe can you link to how this is implemented in another BLE library on another platform and I can see how to map that to ubluetooth?

My understanding is that a gatt server notifies or indicates the client when it wants the client to see the new value. The writes are purely local (waiting for the client to read them).

prem111
Posts: 33
Joined: Sun Feb 23, 2020 3:18 pm

Re: ubluetooth - FLAG_WRITE (without response) ?

Post by prem111 » Fri Feb 28, 2020 9:20 am


User avatar
jimmo
Posts: 1381
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: ubluetooth - FLAG_WRITE (without response) ?

Post by jimmo » Fri Feb 28, 2020 2:11 pm

prem111 wrote:
Fri Feb 28, 2020 9:20 am
e.g: write_no_response
Https://circuitpython.readthedocs.io/en ... istic.html
My understanding is that CircuitPython uses the same Characteristic class for both client-side and server-side characteristics.

But note that the thing you linked to is a property "bool write_no_response". And it says " Clients may write this characteristic; no response will be sent back". My understanding is that only clients can issue a write_no_response operation.

So perhaps I misunderstood your question though -- do you want to create a characteristic on a client that tells the server that it's allowed to do a write_no_response? In which case, in addition to bluetooth.FLAG_WRITE, you can define your own

Code: Select all

_FLAG_WRITE_NO_RESPONSE = const(0x04)
and use that when defining the characteristic.

prem111
Posts: 33
Joined: Sun Feb 23, 2020 3:18 pm

Re: ubluetooth - FLAG_WRITE (without response) ?

Post by prem111 » Fri Feb 28, 2020 3:06 pm

It works! Thank you very much for help !!!

Post Reply