characteristics
Characteristic #
Bases: Enum
Lists all characteristics in the micro:bit GATT profile
See Also: https://lancaster-university.github.io/microbit-docs/resources/bluetooth/bluetooth_profile.html
Source code in src/kaspersmicrobit/bluetoothprofile/characteristics.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
|
DEVICE_NAME
class-attribute
instance-attribute
#
DEVICE_NAME = '00002a00-0000-1000-8000-00805f9b34fb'
Read Mandatory
Write Mandatory
Fields
- Name : utf8s
APPEARANCE
class-attribute
instance-attribute
#
APPEARANCE = '00002a01-0000-1000-8000-00805f9b34fb'
The external appearance of this device. The values are composed of a category (10-bits) and sub-categories (6-bits).
Read Mandatory
Fields
- Category : 16bit
PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS
class-attribute
instance-attribute
#
PERIPHERAL_PREFERRED_CONNECTION_PARAMETERS = (
"00002a04-0000-1000-8000-00805f9b34fb"
)
Read Mandatory
Fields
- Minimum Connection Interval : uint16
- Maximum Connection Interval : uint16
- Slave Latency : uint16
- Connection Supervision Timeout Multiplier : uint16
SERVICE_CHANGED
class-attribute
instance-attribute
#
SERVICE_CHANGED = '2a05'
Indicate Mandatory
Fields
- Start of Affected Attribute Handle Range : uint16
- End of Affected Attribute Handle Range : uint16
Descriptors
- Client Characteristic Configuration : 2902
MODEL_NUMBER_STRING
class-attribute
instance-attribute
#
MODEL_NUMBER_STRING = "00002a24-0000-1000-8000-00805f9b34fb"
The value of this characteristic is a UTF-8 string representing the model number assigned by the device vendor.
Read Mandatory
Fields
- Model Number : utf8s
SERIAL_NUMBER_STRING
class-attribute
instance-attribute
#
SERIAL_NUMBER_STRING = (
"00002a25-0000-1000-8000-00805f9b34fb"
)
The value of this characteristic is a variable-length UTF-8 string representing the serial number for a particular instance of the device.
Read Mandatory
Fields
- Serial Number : utf8s
HARDWARE_REVISION_STRING
class-attribute
instance-attribute
#
HARDWARE_REVISION_STRING = (
"00002a27-0000-1000-8000-00805f9b34fb"
)
The value of this characteristic is a UTF-8 string representing the hardware revision for the hardware within the device.
Read Mandatory
Fields
- Hardware Revision : utf8s
FIRMWARE_REVISION_STRING
class-attribute
instance-attribute
#
FIRMWARE_REVISION_STRING = (
"00002a26-0000-1000-8000-00805f9b34fb"
)
The value of this characteristic is a UTF-8 string representing the firmware revision for the firmware within the device.
Read Mandatory
Fields
- Firmware Revision : utf8s
MANUFACTURER_NAME_STRING
class-attribute
instance-attribute
#
MANUFACTURER_NAME_STRING = (
"00002a29-0000-1000-8000-00805f9b34fb"
)
The value of this characteristic is a UTF-8 string representing the name of the manufacturer of the device.
Read Mandatory
Fields
- Manufacturer Name : utf8s
ACCELEROMETER_DATA
class-attribute
instance-attribute
#
ACCELEROMETER_DATA = 'e95dca4b-251d-470a-a062-fa1922dfa9a8'
Contains accelerometer measurements for X, Y and Z axes as 3 signed 16 bit values in that order and in little endian format. X, Y and Z values should be divided by 1000.
Read Mandatory
Notify Mandatory
Fields
- Accelerometer_X : sint16
- Accelerometer_Y : sint16
- Accelerometer_Z : sint16
Descriptors
- Client Characteristic Configuration : 2902
ACCELEROMETER_PERIOD
class-attribute
instance-attribute
#
ACCELEROMETER_PERIOD = (
"e95dfb24-251d-470a-a062-fa1922dfa9a8"
)
Determines the frequency with which accelerometer data is reported in milliseconds. Valid values are 1, 2, 5, 10, 20, 80, 160 and 640.
Read Mandatory
Write Mandatory
Fields
- Accelerometer_Period : uint16
MAGNETOMETER_DATA
class-attribute
instance-attribute
#
MAGNETOMETER_DATA = 'e95dfb11-251d-470a-a062-fa1922dfa9a8'
Contains magnetometer measurements for X, Y and Z axes as 3 signed 16 bit values in that order and in little endian format. Data can be read on demand or notified periodically.
Read Mandatory
Notify Mandatory
Fields
- Magnetometer_X : sint16
- Magnetometer_Y : sint16
- Magnetometer_Z : sint16
Descriptors
- Client Characteristic Configuration : 2902
MAGNETOMETER_PERIOD
class-attribute
instance-attribute
#
MAGNETOMETER_PERIOD = "e95d386c-251d-470a-a062-fa1922dfa9a8"
Determines the frequency with which magnetometer data is reported in milliseconds. Valid values are 1, 2, 5, 10, 20, 80, 160 and 640.
Read Mandatory
Write Mandatory
Fields
- Magnetometer_Period : uint16
MAGNETOMETER_BEARING
class-attribute
instance-attribute
#
MAGNETOMETER_BEARING = (
"e95d9715-251d-470a-a062-fa1922dfa9a8"
)
Compass bearing in degrees from North.
Read Mandatory
Notify Mandatory
Fields
- bearing value : uint16
Descriptors
- Client Characteristic Configuration : 2902
MAGNETOMETER_CALIBRATION
class-attribute
instance-attribute
#
MAGNETOMETER_CALIBRATION = (
"e95db358-251d-470a-a062-fa1922dfa9a8"
)
Write Mandatory
Notify Mandatory
Fields
- calibration field : uint8
0 - state unknown 1 - calibration requested 2 - calibration completed OK 3 - calibration completed with error
Descriptors
- Client Characteristic Configuration : 2902
BUTTON_A
class-attribute
instance-attribute
#
BUTTON_A = 'e95dda90-251d-470a-a062-fa1922dfa9a8'
State of Button A may be read on demand by a connected client or the client may subscribe to notifications of state change. 3 button states are defined and represented by a simple numeric enumeration:
0 = not pressed
1 = pressed
2 = long press.
Read Mandatory
Notify Mandatory
Fields
- Button_State_Value : uint8
Descriptors
- Client Characteristic Configuration : 2902
BUTTON_B
class-attribute
instance-attribute
#
BUTTON_B = 'e95dda91-251d-470a-a062-fa1922dfa9a8'
State of Button B may be read on demand by a connected client or the client may subscribe to notifications of state change. 3 button states are defined and represented by a simple numeric enumeration:
0 = not pressed
1 = pressed
2 = long press.
Read Mandatory
Notify Mandatory
Fields
- Button_State_Value : uint8
Descriptors
- Client Characteristic Configuration : 2902
PIN_DATA
class-attribute
instance-attribute
#
PIN_DATA = 'e95d8d00-251d-470a-a062-fa1922dfa9a8'
Contains data relating to zero or more pins. Structured as a variable length array of up to 19 Pin Number / Value pairs.
Pin Number and Value are each uint8 fields. Note however that the micro:bit has a 10 bit ADC and so values are compressed to 8 bits with a loss of resolution.
OPERATIONS:
WRITE: Clients may write values to one or more pins in a single GATT write operation. A pin to which a value is to be written must have been configured for output using the Pin IO Configuration characteristic. Any attempt to write to a pin which is configured for input will be ignored.
NOTIFY: Notifications will deliver Pin Number / Value pairs for those pins defined as input pins by the Pin IO Configuration characteristic and whose value when read differs from the last read of the pin.
READ: A client reading this characteristic will receive Pin Number / Value pairs for all those pins defined as input pins by the Pin IO Configuration characteristic.
Read Mandatory
Write Mandatory
Notify Mandatory
Fields
- IO_Pin_Data : uint8[]
Descriptors
- Client Characteristic Configuration : 2902
PIN_AD_CONFIGURATION
class-attribute
instance-attribute
#
PIN_AD_CONFIGURATION = (
"e95d5899-251d-470a-a062-fa1922dfa9a8"
)
A bit mask which allows each pin to be configured for analogue or digital use.
Bit n corresponds to pin n where 0 LESS THAN OR EQUAL TO n LESS THAN 19. A value of 0 means digital and 1 means analogue.
Read Mandatory
Write Mandatory
Fields
- Pin_AD_Config_Value : uint32
PIN_IO_CONFIGURATION
class-attribute
instance-attribute
#
PIN_IO_CONFIGURATION = (
"e95db9fe-251d-470a-a062-fa1922dfa9a8"
)
A bit mask (32 bit) which defines which inputs will be read. If the Pin AD Configuration bit mask is also set the pin will be read as an analogue input, if not it will be read as a digital input.
Note that in practice, setting a pin's mask bit means that it will be read by the micro:bit runtime and, if notifications have been enabled on the Pin Data characteristic, data read will be transmitted to the connected Bluetooth peer device in a Pin Data notification. If the pin's bit is clear, it simply means that it will not be read by the micro:bit runtime.
Bit n corresponds to pin n where 0 LESS THAN OR EQUAL TO n LESS THAN 19. A value of 0 means configured for output and 1 means configured for input.
Read Mandatory
Write Mandatory
Fields
- Pin_IO_Config_Value : uint32
PWM_CONTROL
class-attribute
instance-attribute
#
PWM_CONTROL = 'e95dd822-251d-470a-a062-fa1922dfa9a8'
A variable length array 1 to 2 instances of :
struct PwmControlData {
uint8_t pin;
uint16_t value;
uint32_t period;
}
Period is in microseconds and is an unsigned int but transmitted. Value is in the range 0 – 1024, per the current DAL API (e.g. setAnalogValue). 0 means OFF.
Fields are transmitted over the air in Little Endian format.
Write Mandatory
Fields
- PWM Control Field : uint8[]
LED_MATRIX_STATE
class-attribute
instance-attribute
#
LED_MATRIX_STATE = 'e95d7b77-251d-470a-a062-fa1922dfa9a8'
Allows the state of any|all LEDs in the 5x5 grid to be set to on or off with a single GATT operation.
Consists of an array of 5 x utf8 octets, each representing one row of 5 LEDs.
Octet 0 represents the first row of LEDs i.e. the top row when the micro:bit is viewed with the edge connector at
the bottom and USB connector at the top.
Octet 1 represents the second row and so on.
In each octet, bit 4 corresponds to the first LED in the row, bit 3 the second and so on.
Bit values represent the state of the related LED: off (0) or on (1).
So we have:
Octet 0, LED Row 1: bit4 bit3 bit2 bit1 bit0
Octet 1, LED Row 2: bit4 bit3 bit2 bit1 bit0
Octet 2, LED Row 3: bit4 bit3 bit2 bit1 bit0
Octet 3, LED Row 4: bit4 bit3 bit2 bit1 bit0
Octet 4, LED Row 5: bit4 bit3 bit2 bit1 bit0
Read Mandatory
Write Mandatory
Fields
- LED_Matrix_State : uint8[]
LED_TEXT
class-attribute
instance-attribute
#
LED_TEXT = 'e95d93ee-251d-470a-a062-fa1922dfa9a8'
A short UTF-8 string to be shown on the LED display. Maximum length 20 octets.
Write Mandatory
Fields
- LED_Text_Value : utf8s
SCROLLING_DELAY
class-attribute
instance-attribute
#
SCROLLING_DELAY = 'e95d0d2d-251d-470a-a062-fa1922dfa9a8'
Specifies a millisecond delay to wait for in between showing each character on the display.
Read Mandatory
Write Mandatory
Fields
- Scrolling_Delay_Value : uint16
MICROBIT_REQUIREMENTS
class-attribute
instance-attribute
#
MICROBIT_REQUIREMENTS = (
"e95db84c-251d-470a-a062-fa1922dfa9a8"
)
A variable length list of event data structures which indicates the types of client event, potentially with a specific value which the micro:bit wishes to be informed of when they occur. The client should read this characteristic when it first connects to the micro:bit. It may also subscribe to notifications to that it can be informed if the value of this characteristic is changed by the micro:bit firmware.
struct event {
uint16 event_type;
uint16 event_value;
};
Note that an event_type of zero means ANY event type and an event_value part set to zero means ANY event value.
event_type and event_value are each encoded in little endian format.
Read Mandatory
Notify Mandatory
Fields
- microbit_reqs_value : uint8[]
Descriptors
- Client Characteristic Configuration : 2902
MICROBIT_EVENT
class-attribute
instance-attribute
#
MICROBIT_EVENT = 'e95d9775-251d-470a-a062-fa1922dfa9a8'
Contains one or more event structures which should be notified to the client. It supports notifications and as such the client should subscribe to notifications from this characteristic.
struct event {
uint16 event_type;
uint16 event_value;
};
Read Mandatory
Notify Mandatory
Fields
- Event_Type_And_Value : uint8[]
Descriptors
- Client Characteristic Configuration : 2902
CLIENT_REQUIREMENTS
class-attribute
instance-attribute
#
CLIENT_REQUIREMENTS = "e95d23c4-251d-470a-a062-fa1922dfa9a8"
a variable length list of event data structures which indicates the types of micro:bit event, potentially with a specific value which the client wishes to be informed of when they occur. The client should write to this characteristic when it first connects to the micro:bit.
struct event {
uint16 event_type;
uint16 event_value;
};
Note that an event_type of zero means ANY event type and an event_value part set to zero means ANY event value.
event_type and event_value are each encoded in little endian format.
Write Mandatory
Fields
- Client_Requirements_Value : uint8[]
CLIENT_EVENT
class-attribute
instance-attribute
#
CLIENT_EVENT = 'e95d5404-251d-470a-a062-fa1922dfa9a8'
a writable characteristic which the client may write one or more event structures to, to inform the micro:bit of events which have occurred on the client. These should be of types indicated in the micro:bit Requirements characteristic bit mask.
struct event {
uint16 event_type;
uint16 event_value;
};
Write Mandatory
Write Without Response Mandatory
Fields
- Event_Types_And_Values : uint8[]
DFU_CONTROL
class-attribute
instance-attribute
#
DFU_CONTROL = 'e95d93b1-251d-470a-a062-fa1922dfa9a8'
Writing 0x01 initiates rebooting the micro:bit into the Nordic Semiconductor bootloader if the DFU Flash Code characteristic has been written to with the correct secret key.
Writing 0x02 to this characteristic means "request flash code".
Read Mandatory
Write Mandatory
Fields
- dfu_control : uint8
TEMPERATURE
class-attribute
instance-attribute
#
TEMPERATURE = 'e95d9250-251d-470a-a062-fa1922dfa9a8'
Signed integer 8 bit value in degrees celsius.
Read Mandatory
Notify Mandatory
Fields
- temperature value : sint8
Descriptors
- Client Characteristic Configuration : 2902
TEMPERATURE_PERIOD
class-attribute
instance-attribute
#
TEMPERATURE_PERIOD = 'e95d1b25-251d-470a-a062-fa1922dfa9a8'
Determines the frequency with which temperature data is updated in milliseconds.
Read Mandatory
Write Mandatory
Fields
- temperature period value : uint16
TX_CHARACTERISTIC
class-attribute
instance-attribute
#
TX_CHARACTERISTIC = '6e400002-b5a3-f393-e0a9-e50e24dcca9e'
This characteristic allows the micro:bit to transmit a byte array containing an arbitrary number of arbitrary octet values to a connected device.
The maximum number of bytes which may be transmitted in one PDU is limited to the MTU minus three or 20 octets to be precise.
Indicate Mandatory
Fields
- UART TX Field : uint8[]
RX_CHARACTERISTIC
class-attribute
instance-attribute
#
RX_CHARACTERISTIC = '6e400003-b5a3-f393-e0a9-e50e24dcca9e'
This characteristic allows a connected client to send a byte array containing an arbitrary number of arbitrary octet values to a connected micro:bit.
The maximum number of bytes which may be transmitted in one PDU is limited to the MTU minus three or 20 octets to be precise.
Write Mandatory
Write Without Response Mandatory
Fields
- UART TX Field : uint8[]
lookup
staticmethod
#
lookup(uuid: str)
Looks up the enum corresponding the given uuid
Returns (Characteristic): The enum with the given uuid, None if not found.
Source code in src/kaspersmicrobit/bluetoothprofile/characteristics.py
596 597 598 599 600 601 602 603 604 605 606 607 |
|