- class rfnode.sender.sender.Sender(ser: Serial, hold: float = 0.1)
Bases:
object- MAX_PAYLOAD = 32
- NEW_LINE = b'\n'
- build_packets(payload: str) list[bytes]
Constructs a list of byte packets from a given string payload. :param payload: The string payload to be converted into packets. :type payload: str
- Returns:
returns the list of packets.
- Return type:
list[bytes]
- checksum_calculator(data: bytes) int
Responsible for calculating the CRC32 checksum of the given data. :param data: for which the checksum is to be calculated. :type data: bytes
- Returns:
checksum of givin data.
- Return type:
int
- generate_header(data: bytes) bytes
Responsible for generating the checksum. :param data: for which the checksum is to be generated. :type data: bytes
- send(payload: str) None
Responsible for sending a payload over a serial connection. :param payload: string that will be sent over the serial connection. :type payload: str
- rfnode.sender.sender.main() None
Demonstrating how to use the Sender class to send data over a serial connection.
It establishes a serial connection, creates a Sender instance, and enters an infinite loop, repeatedly sending a predefined payload string.