The ErrorPacket is used by the uC to send errors to the API all availible errors are defined in the ErrorHeader.
More...
|
def | __init__ (self, header, original_header, value=0, original_sub_header=0, skip_header_matching=False, print_errors=True) |
| constructor for the ErrorPacket More...
|
|
def | __str__ (self) |
|
def | from_bytearray (self, byte_array) |
| constructs a ErrorPacket from a bytearray More...
|
|
def | original_header (self) |
| getter method for the original header attribute More...
|
|
def | original_sub_header (self) |
| getter method for the original sub header attribute More...
|
|
def | set_header (self, header) |
| setter method for the header attribute More...
|
|
def | set_org_header (self, header, skip_header_matching=False) |
| setter method for the original header attribute More...
|
|
def | set_org_sub_header (self, header, skip_header_matching=False) |
| setter method for the original sub header attribute More...
|
|
def | set_value (self, value) |
| setter method for the value attribute More...
|
|
def | to_bytearray (self) |
| method to convert the packet to a bytearray in the correct format of <header><exec_time><org_header><org_sub_header> More...
|
|
def | value (self) |
| getter method for the value attribute More...
|
|
def | __init__ (self) |
|
def | check_and_log (self) |
| check_and_log logs the packet if the header is in the logging lists More...
|
|
def | from_bytearray (cls, byte_array) |
| method to construct a packet from a bytearray depending on the header the correct packet type is returned More...
|
|
def | header (self) |
| getter method for the header attribute More...
|
|
def | set_exec_time (self, time) |
| setter method for the execution time attribute More...
|
|
def | set_header (self, header) |
| setter method for the header attribute More...
|
|
def | time (self) |
| getter method for the time attribute More...
|
|
def | to_bytearray (self) |
| placeholder for converting the package to a bytearray More...
|
|
The ErrorPacket is used by the uC to send errors to the API all availible errors are defined in the ErrorHeader.
Definition at line 450 of file packet.py.
◆ __init__()
def __init__ |
( |
|
self, |
|
|
|
header, |
|
|
|
original_header, |
|
|
|
value = 0 , |
|
|
|
original_sub_header = 0 , |
|
|
|
skip_header_matching = False , |
|
|
|
print_errors = True |
|
) |
| |
constructor for the ErrorPacket
- Parameters
-
header | (ErrorHeader or uint8) the header indicating the error |
original_header | (uint_8) the original header of the packet causing the error |
value | (uint_32) the value associated (optional, default = 0) |
original_sub_header | (uint_8) the original sub header causeing the error (optional, default = 0) in case of a config |
skip_header_matching | (bool) if the causing headers should be converted into human readable objects (optional, default = False) |
print_errors | (bool) if the error should be logged (optional, default = True) |
Reimplemented from Packet.
Definition at line 454 of file packet.py.
◆ __str__()
◆ from_bytearray()
def from_bytearray |
( |
|
self, |
|
|
|
byte_array |
|
) |
| |
constructs a ErrorPacket from a bytearray
- Parameters
-
byte_array | 9 byte bytearray to construct the Packet from |
- Returns
- : ErrorPacket @raise Exception: if package construction fails
Reimplemented from Packet.
Definition at line 579 of file packet.py.
◆ original_header()
def original_header |
( |
|
self | ) |
|
getter method for the original header attribute
- Returns
- : the original header causing the error
Definition at line 482 of file packet.py.
◆ original_sub_header()
def original_sub_header |
( |
|
self | ) |
|
getter method for the original sub header attribute
- Returns
- : the original sub header causing the error
Definition at line 488 of file packet.py.
◆ set_header()
def set_header |
( |
|
self, |
|
|
|
header |
|
) |
| |
setter method for the header attribute
- Parameters
-
header | (ErrorHeader or uint8) the header indicating the error |
Reimplemented from Packet.
Definition at line 494 of file packet.py.
◆ set_org_header()
def set_org_header |
( |
|
self, |
|
|
|
header, |
|
|
|
skip_header_matching = False |
|
) |
| |
setter method for the original header attribute
- Parameters
-
header | (uint_8) the original header of the packet causing the error |
skip_header_matching | (bool) if the causing headers should be converted into human readable objects (optional, default = False) |
Definition at line 503 of file packet.py.
◆ set_org_sub_header()
def set_org_sub_header |
( |
|
self, |
|
|
|
header, |
|
|
|
skip_header_matching = False |
|
) |
| |
setter method for the original sub header attribute
- Parameters
-
header | (uint_8) the original sub header causeing the error |
skip_header_matching | (bool) if the causing headers should be converted into human readable objects (optional, default = False) |
Definition at line 530 of file packet.py.
◆ set_value()
def set_value |
( |
|
self, |
|
|
|
value |
|
) |
| |
setter method for the value attribute
- Parameters
-
value | (uint_32) the value associated |
Definition at line 561 of file packet.py.
◆ to_bytearray()
method to convert the packet to a bytearray in the correct format of <header><exec_time><org_header><org_sub_header>
- Returns
- : the packet as a bytearray
Reimplemented from Packet.
Definition at line 572 of file packet.py.
◆ value()
getter method for the value attribute
- Returns
- : the value
Definition at line 476 of file packet.py.
The documentation for this class was generated from the following file: