adbwp.payload¶
Contains functionality for message data payloads.
-
adbwp.payload.
checksum
(data: Union[bytes, bytearray, str, memoryview]) → int¶ Compute the checksum value of a header that uses the given data payload.
- Parameters
data (
bytes
,bytearray
,str
, ormemoryview
) – Data payload- Returns
Data payload checksum
- Return type
-
adbwp.payload.
null_terminate
(data: Union[bytes, bytearray, str, memoryview]) → bytes¶ Null terminate the given data payload.
- Parameters
data (
bytes
,bytearray
,str
, ormemoryview
) – Data payload- Returns
Data payload ending with a zero byte.
- Return type
-
adbwp.payload.
as_bytes
(data: Union[bytes, bytearray, str, memoryview], encoding: str = 'utf-8', errors: str = 'strict') → bytes¶ Ensure the given data payload is a
bytes
instance.- Parameters
- Returns
Data payload as bytes
- Return type
- Raises
ValueError – When data is not one of the supported types
-
adbwp.payload.
system_identity_string
(system_type: Union[str, adbwp.enums.SystemType], serial: str, banner: str)¶ Compute the system identity string data payload.
- Parameters
system_type (
SystemType
orstr
) – System type creating the messageserial (
str
) – Unique identifierbanner (
str
) – Human readable version/identifier string
- Returns
System identity string payload for connect messages
- Return type