src.bluetooth_sig.gatt.characteristics.templates.string¶
String templates for UTF-8 and UTF-16LE variable-length parsing.
Covers Utf8StringTemplate and Utf16StringTemplate.
Classes¶
Name | Description |
|---|---|
Template for UTF-16LE string parsing with variable length. |
|
Template for UTF-8 string parsing with variable length. |
Module Contents¶
- class src.bluetooth_sig.gatt.characteristics.templates.string.Utf16StringTemplate(max_length: int = 256)¶
Bases:
src.bluetooth_sig.gatt.characteristics.templates.base.CodingTemplate[str]Template for UTF-16LE string parsing with variable length.
- decode_value(data: bytearray, offset: int = 0, ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None = None, *, validate: bool = True) str¶
Parse UTF-16LE string from remaining data.
- UNICODE_BOM = '\ufeff'¶
- UNICODE_SURROGATE_END = 57343¶
- UNICODE_SURROGATE_START = 55296¶
- max_length = 256¶
- class src.bluetooth_sig.gatt.characteristics.templates.string.Utf8StringTemplate(max_length: int = 256)¶
Bases:
src.bluetooth_sig.gatt.characteristics.templates.base.CodingTemplate[str]Template for UTF-8 string parsing with variable length.
- decode_value(data: bytearray, offset: int = 0, ctx: src.bluetooth_sig.gatt.context.CharacteristicContext | None = None, *, validate: bool = True) str¶
Parse UTF-8 string from remaining data.
- max_length = 256¶