Bluetooth Low Energy (BLE)¶
A Bluetooth Low Energy (BLE) SMPTransport.
SMP_SERVICE_UUID: Final = UUID('8D53DC1D-1DB7-4CD3-868B-8A527460AA84')
module-attribute
¶
SMP_CHARACTERISTIC_UUID: Final = UUID('DA2E7828-FBCE-4E01-AE9E-261174997C48')
module-attribute
¶
MAC_ADDRESS_PATTERN: Final = re.compile('([0-9A-F]{2}[:]){5}[0-9A-F]{2}$', flags=re.IGNORECASE)
module-attribute
¶
UUID_PATTERN: Final = re.compile('^[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}\\Z', flags=re.IGNORECASE)
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
GattSession
¶
SMPBLETransportException
¶
SMPBLETransportDeviceNotFound
¶
Bases: SMPBLETransportException
Raised when a BLE device is not found.
SMPBLETransportNotSMPServer
¶
Bases: SMPBLETransportException
Raised when the SMP characteristic UUID is not found.
SMPBLETransport
¶
Bases: SMPTransport
A Bluetooth Low Energy (BLE) SMPTransport.
Source code in smpclient/transport/ble.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
mtu: int
property
¶
The Maximum Transmission Unit (MTU) in 8-bit bytes.
__init__() -> None
¶
Source code in smpclient/transport/ble.py
connect(address: str, timeout_s: float) -> None
async
¶
Connect the SMPTransport
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
address |
str
|
The SMP server address. |
required |
timeout_s |
float
|
The connection timeout in seconds. |
required |
Source code in smpclient/transport/ble.py
disconnect() -> None
async
¶
send(data: bytes) -> None
async
¶
Send the encoded SMPRequest
data
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
The encoded |
required |
Source code in smpclient/transport/ble.py
receive() -> bytes
async
¶
Receive the decoded SMPResponse
data.
Returns:
Type | Description |
---|---|
bytes
|
The |
Source code in smpclient/transport/ble.py
send_and_receive(data: bytes) -> bytes
async
¶
Send the encoded SMPRequest
data
and receive the decoded SMPResponse
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
The encoded |
required |
Returns:
Type | Description |
---|---|
bytes
|
The |
scan(timeout: int = 5) -> List[BLEDevice]
async
staticmethod
¶
Scan for BLE devices.