De/serialization and Validation¶
The Simple Management Protocol (SMP) Message base class.
T = TypeVar('T', bound='_MessageBase')
module-attribute
¶
_counter = itertools.count()
module-attribute
¶
logger = logging.getLogger(__name__)
module-attribute
¶
_MessageBase
¶
Bases: ABC
, BaseModel
The base class for SMP messages.
Source code in smp/message.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
model_config = ConfigDict(extra='forbid', frozen=True)
class-attribute
instance-attribute
¶
_OP: smpheader.OP
class-attribute
¶
_FLAGS: smpheader.Flag = smpheader.Flag(0)
class-attribute
¶
_GROUP_ID: smpheader.GroupIdField
class-attribute
¶
_COMMAND_ID: smpheader.AnyCommandId | smpheader.CommandId.ImageManagement | smpheader.CommandId.OSManagement | smpheader.CommandId.ShellManagement | smpheader.CommandId.Intercreate | smpheader.CommandId.FileManagement
class-attribute
¶
header: smpheader.Header = None
class-attribute
instance-attribute
¶
version: smpheader.Version = smpheader.Version.V2
class-attribute
instance-attribute
¶
sequence: int = None
class-attribute
instance-attribute
¶
smp_data: bytes = None
class-attribute
instance-attribute
¶
BYTES: bytes
property
¶
__bytes__() -> bytes
¶
loads(data: bytes) -> T
classmethod
¶
Deserialize the SMP message.
Source code in smp/message.py
load(header: smpheader.Header, data: dict) -> T
classmethod
¶
Load an SMP header and CBOR dict.
Source code in smp/message.py
model_post_init(_: None) -> None
¶
Source code in smp/message.py
Request
¶
ResponseType
¶
Bases: IntEnum
An SMP Response
to an SMP Request
must be SUCCESS
, ERROR_V1
, or ERROR_V2
.
Source code in smp/message.py
Response
¶
ReadRequest
¶
ReadResponse
¶
Bases: Response
, ABC
A response from an SMP server to an SMP client read request.