Retrieve connection list
Used to retrieve the list of currently connected devices.
Refer RESTful-API Get the Device List Connected.
Example
1import asyncio
2import cassiablue
3
4
5async def main():
6 print("start get connected devices")
7 ok, ret = await cassiablue.get_connected_devices()
8 print("get connected devices done:", type(ok), ok, type(ret), ret)
9
10
11asyncio.run(main())
API
- async cassiablue.get_connected_devices() tuple[bool, str]
Used to retrieve the list of currently connected devices. The result is returned as a JSON string.
Connection list is empty
{ "nodes": {} }
Connection list contains devices
{ "nodes": [ { "bdaddrs": { "bdaddr": "20:00:00:00:00:01", "bdaddrType": "random" }, "handle": "", "id": "20:00:00:00:00:01", "connectionState": "connected", "name": "", "chipId": 0, "pairStatus": "none", "rssi": -21, "packetLossRate": 3, "tx_phy": "1M", "rx_phy": "1M" } ] }
Field Description Field
Type
Description
Example
bdaddr
str
Device MAC address
20:00:00:00:00:01
bdaddrType
str
Device address type
random
id
str
Device MAC address
20:00:00:00:00:01
chipId
int
Chip
0
rssi
int
RSSI
-21
packetLossRate
int
Packet loss rate
3
tx_phy
str
Tx Phy
1M
rx_phy
str
Rx Phy
1M