pyrcareworld.side_channel package#

Submodules#

pyrcareworld.side_channel.incoming_message module#

class pyrcareworld.side_channel.incoming_message.IncomingMessage(buffer: bytes, offset: int = 0)[source]#

Bases: object

Utility class for reading the message written to a SideChannel. Values must be read in the order they were written.

read_bool(default_value: bool = False) bool[source]#

Read a boolean value from the message buffer. :param default_value: Default value to use if the end of the message is reached. :return: The value read from the message, or the default value if the end was reached.

read_float32(default_value: float = 0.0) float[source]#

Read a float value from the message buffer. :param default_value: Default value to use if the end of the message is reached. :return: The value read from the message, or the default value if the end was reached.

read_float32_list(default_value: List[float] = None) List[float][source]#

Read a list of float values from the message buffer. :param default_value: Default value to use if the end of the message is reached. :return: The value read from the message, or the default value if the end was reached.

read_int32(default_value: int = 0) int[source]#

Read an integer value from the message buffer. :param default_value: Default value to use if the end of the message is reached. :return: The value read from the message, or the default value if the end was reached.

read_string(default_value: str = '') str[source]#

Read a string value from the message buffer. :param default_value: Default value to use if the end of the message is reached. :return: The value read from the message, or the default value if the end was reached.

pyrcareworld.side_channel.outgoing_message module#

class pyrcareworld.side_channel.outgoing_message.OutgoingMessage[source]#

Bases: object

Utility class for forming the message that is written to a SideChannel. All data is written in little-endian format using the struct module.

write_bool(b: bool) None[source]#

Append a boolean value.

write_float32(f: float) None[source]#

Append a float value. It will be truncated to 32-bit precision.

write_float32_list(float_list: List[float]) None[source]#

Append a list of float values. They will be truncated to 32-bit precision.

write_int32(i: int) None[source]#

Append an integer value.

write_string(s: str) None[source]#

Append a string value. Internally, it will be encoded to ascii, and the encoded length will also be written to the message.

Module contents#