Comments (6)
You have forgotten an await
before client.write_gatt_char
; that method is still a coroutine. It might be the reason for the FileLoadException, but I am not sure.
I just released verion 0.4.0 of bleak; install that from PyPI and run the service_explorer.py example on your peripheral and show me your output here. It should display all services and characteristics discovered on the peripheral, similar to Bluetooth LE Explorer.
In 0.4.0, the client.services
now returns a BleakGATTServiceCollection which should be simpler to handle than the .NET objects returned in v0.3.0.
from bleak.
Thanks for the fast reply!
With this output, all services and their characteristics get printed as expected, just like in Bluetooth LE Explorer :) and it doesn't throw the UUID not found
Exception anymore when paging the rw_charac
.
However, when I request a write operation with response, I get no response:
await client.write_gatt_char(rw_charac, b'~HELLO', response=True)
# nothing happens. also running the script above again, no Value is put out
Output of the service_explorer:
click me
[Service] 00001800-0000-1000-8000-00805f9b34fb: Generic Access Profile
[Characteristic] 00002a00-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'DeviceName'
[Characteristic] 00002a01-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'\x00\x00'
[Service] 00001801-0000-1000-8000-00805f9b34fb: Generic Attribute Profile
[Characteristic] 00002a05-0000-1000-8000-00805f9b34fb: (indicate) | Name: , Value: None
[Descriptor] 00002902-0000-1000-8000-00805f9b34fb: (Handle: 15) | Value: b'\x00\x00'
[Service] 0000180a-0000-1000-8000-00805f9b34fb: Device Information
[Characteristic] 00002a29-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'Microchip'
[Characteristic] 00002a24-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'RNXXXX'
[Characteristic] 00002a25-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'0000'
[Characteristic] 00002a27-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'5505 1XXX3'
[Characteristic] 00002a26-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'XXXXX'
[Characteristic] 00002a28-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'X.XX'
[Characteristic] 00002a23-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'\x00\x00\x00\x00\x00\x00\x00\x00'
[Characteristic] 00002a2a-0000-1000-8000-00805f9b34fb: (read) | Name: , Value: b'\x00\x00\x00\x00\x01\x00\x00\x00'
[Service] 49535343-fe7d-4ae5-8fa9-9fafd205e455: Unknown
[Characteristic] 49535343-1e4d-4bd9-ba61-23c647249616: (write-without-response,write,notify,indicate) | Name: , Value: None
[Descriptor] 00002902-0000-1000-8000-00805f9b34fb: (Handle: 83) | Value: b'\x00\x00'
[Characteristic] 49535343-8841-43f4-a8d4-ecbe34729bb3: (write-without-response,write) | Name: , Value: None
[Characteristic] 49535343-4c8a-39b3-2f49-511cff073b7e: (write,notify) | Name: , Value: None
[Descriptor] 00002902-0000-1000-8000-00805f9b34fb: (Handle: 88) | Value: b'\x00\x00'
from bleak.
The response=True
mean that the write
method is used rather than the write-without-response
. The response does not contain anything special though (https://docs.microsoft.com/en-us/uwp/api/windows.devices.bluetooth.genericattributeprofile.gattwriteresult), so nothing is returned by the write_gatt_char
method.
You can check the value of your characteristic by a read afterwards to verify that your data has been written:
value = await client.read_gatt_char(rw_charac)
print("Pre-Write Value: {0}".format(value))
await client.write_gatt_char(rw_charac, b'~HELLO', response=True)
value = await client.read_gatt_char(rw_charac)
print("Post-Write Value: {0}".format(value))
from bleak.
Somehow I can't read from this characteristic.
BleakError: Could not read characteristic value for 49535343-1e4d-4bd9-ba61-23c647249616: 2
which makes sense, as permissions for this attribute are
(write-without-response,write,notify,indicate)
from bleak.
Ah, i did not see that; of course it fails. The read was not important anyway, it was just meant to visualize what the write achieved.
The issue in general is to be regarded as closed then? There is nothing left to solve of the original request is there?
from bleak.
Yes, I'll open another issue for the non-response :) thank's!
from bleak.
Related Issues (20)
- Add option to supress thread is not MTA exception HOT 4
- macOS 10.14 returns empty list after discovery HOT 2
- Service UUID filter does not apply to dict of discovered devices. HOT 1
- How do I decode bytearray for power data HOT 1
- NSLocalizedDescription The request is not supported
- List adapters and specify which adapter to use? HOT 2
- WinError The operation was canceled by the user HOT 3
- Asyncio task hang during connection attempt HOT 1
- bleak data reading rate through notification with one uuid (57 samples per second ) and with 2 uuid subscribe (72 samples per second which is 36 sample of each uuid)
- unable to use start_notify HOT 6
- Bleak Version is not supporting in the win11 HOT 11
- Bleak issue of time to display data
- Connect bleak client to GATT Server running in MicroPython on ESP32
- On Raspberry pi bleakscanner scanning not working :BleakDBusError[org.bluez.Error.InProgress] Operation already in progress . HOT 6
- Changing Lego Remote Handset name ... HOT 1
- Unable to write to the device using bleak library through write_gatt
- cannot connect again unless reboot HOT 7
- Android permissions HOT 2
- Set Target Inclination doesn't work
- Immediate disconnect after successful connection With esp as server and raspi as client
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bleak.