circuitmatter.tlv
Attributes
Exceptions
Common base class for all non-exit exceptions. |
Classes
Enum where members are also (and must be) ints |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Helper class that provides a standard way to create an ABC using |
|
Stores a TLV encoded value. |
Functions
|
|
|
Module Contents
- circuitmatter.tlv.TAG_LENGTH = b'\x00\x01\x02\x04\x02\x04\x06\x08'
- circuitmatter.tlv.INT_SIZE = 'BHIQ'
- class circuitmatter.tlv.ElementType
Bases:
enum.IntEnumEnum where members are also (and must be) ints
- SIGNED_INT = 0
- UNSIGNED_INT = 4
- BOOL = 8
- FLOAT = 10
- UTF8_STRING = 12
- OCTET_STRING = 16
- NULL = 20
- STRUCTURE = 21
- ARRAY = 22
- LIST = 23
- END_OF_CONTAINER = 24
- circuitmatter.tlv.decode_tag(control_octet, buffer, offset=0)
- circuitmatter.tlv.decode_element(control_octet, buffer, offset, depth)
- class circuitmatter.tlv.Container
- values
- classmethod max_length()
- set_value(tag, value)
- delete_value(tag)
- class circuitmatter.tlv.Structure
Bases:
Container- __str__()
- encode() memoryview
- classmethod decode(buffer: memoryview, offset=0) Structure
- construct_containers()
- classmethod from_value(value)
- values
- classmethod max_length()
- set_value(tag, value)
- delete_value(tag)
- class circuitmatter.tlv.Member(tag, *, optional: _OPT = False, nullable: _NULLABLE = False, default=None)
Bases:
abc.ABC,Generic[_T,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- abstract decode_member(control_octet: int, buffer: memoryview, offset: int = 0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- abstract encode_element_type(value: _T) int
Return Element Type Field as defined in Appendix A in the spec
- abstract encode_value_into(value: _T | None, buffer: bytearray, offset: int) int
- abstract encode_value_into(value: _T, buffer: bytearray, offset: int) int
Encode
valueintobufferand return the new offset
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.NumberMember(tag, _format: str, optional: _OPT = False, nullable: _NULLABLE = False, minimum: int | None = None, maximum: int | None = None, **kwargs)
Bases:
Member[_NT,_OPT,_NULLABLE],Generic[_NT,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- format
- integer
- signed
- max_value_length
- __set__(obj, value)
- static decode_member(control_octet, buffer, offset=0, depth=0) tuple[_NT, int]
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- print(value)
Return string representation of
value
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.IntMember(tag, *, signed: bool = True, octets: Literal[1, 2, 4, 8] = 1, optional: _OPT = False, nullable: _NULLABLE = False, **kwargs)
Bases:
NumberMember[int,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- uformat
- format
- integer
- signed
- max_value_length
- __set__(obj, value)
- static decode_member(control_octet, buffer, offset=0, depth=0) tuple[_NT, int]
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- print(value)
Return string representation of
value
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.EnumMember(tag, enum_class, **kwargs)
Bases:
IntMemberHelper class that provides a standard way to create an ABC using inheritance.
- enum_class
- __set__(obj, value)
- print(value)
Return string representation of
value
- uformat
- format
- integer
- signed
- max_value_length
- static decode_member(control_octet, buffer, offset=0, depth=0) tuple[_NT, int]
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.BitmapMember(tag, enum_class, **kwargs)
Bases:
EnumMemberHelper class that provides a standard way to create an ABC using inheritance.
- print(value)
Return string representation of
value
- enum_class
- __set__(obj, value)
- uformat
- format
- integer
- signed
- max_value_length
- static decode_member(control_octet, buffer, offset=0, depth=0) tuple[_NT, int]
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.FloatMember(tag, *, octets: Literal[4, 8] = 4, optional: _OPT = False, nullable: _NULLABLE = False, **kwargs)
Bases:
NumberMember[float,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- format
- integer
- signed
- max_value_length
- __set__(obj, value)
- static decode_member(control_octet, buffer, offset=0, depth=0) tuple[_NT, int]
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- print(value)
Return string representation of
value
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.BoolMember(tag, *, optional: _OPT = False, nullable: _NULLABLE = False, default=None)
Bases:
Member[bool,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- max_value_length = 0
- static decode_member(control_octet, buffer, offset=0, depth=0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- print(value)
Return string representation of
value
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.StringMember(tag, max_length: int, *, optional: _OPT = False, nullable: _NULLABLE = False, min_length: int = 0, **kwargs)
Bases:
Member[AnyStr,_OPT,_NULLABLE],Generic[AnyStr,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- max_length_encoding
- max_length_format
- length_length
- min_length
- max_value_length
- print(value)
Return string representation of
value
- __set__(obj, value)
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- encode_value_into(value, buffer: bytearray, offset: int) int
Encode
valueintobufferand return the new offset
- static parse_length(control_octet, buffer, offset=0)
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- abstract decode_member(control_octet: int, buffer: memoryview, offset: int = 0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.OctetStringMember(tag, max_length: int, *, optional: _OPT = False, nullable: _NULLABLE = False, min_length: int = 0, **kwargs)
Bases:
StringMember[bytes,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- static decode_member(control_octet, buffer, offset=0, depth=0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- max_length_encoding
- max_length_format
- length_length
- min_length
- max_value_length
- print(value)
Return string representation of
value
- __set__(obj, value)
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- encode_value_into(value, buffer: bytearray, offset: int) int
Encode
valueintobufferand return the new offset
- static parse_length(control_octet, buffer, offset=0)
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.UTF8StringMember(tag, max_length: int, *, optional: _OPT = False, nullable: _NULLABLE = False, min_length: int = 0, **kwargs)
Bases:
StringMember[str,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- static decode_member(control_octet, buffer, offset=0, depth=0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- encode_value_into(value: str, buffer, offset) int
Encode
valueintobufferand return the new offset
- print(value)
Return string representation of
value
- max_length_encoding
- max_length_format
- length_length
- min_length
- max_value_length
- __set__(obj, value)
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- static parse_length(control_octet, buffer, offset=0)
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.StructMember(tag, substruct_class: type[_TLVStruct], *, optional: _OPT = False, nullable: _NULLABLE = False, **kwargs)
Bases:
Member[_TLVStruct,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- substruct_class
- max_value_length
- static decode_member(control_octet, buffer, offset=0, depth=0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- print(value)
Return string representation of
value
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- encode_value_into(value, buffer: bytearray, offset: int) int
Encode
valueintobufferand return the new offset
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- exception circuitmatter.tlv.ArrayEncodingError(index, offset)
Bases:
ExceptionCommon base class for all non-exit exceptions.
- index
First index not encoded
- offset
- class circuitmatter.tlv.ArrayMember(tag, substruct_class: type[_TLVStruct, Member], *, max_length: int | None = None, optional: _OPT = False, nullable: _NULLABLE = False, **kwargs)
Bases:
Member[_TLVStruct,_OPT,_NULLABLE]Helper class that provides a standard way to create an ABC using inheritance.
- substruct_class
- max_value_length = 1280
- max_items
- static decode_member(control_octet, buffer, offset=0, depth=0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- print(value)
Return string representation of
value
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- encode_value_into(value, buffer: memoryview, offset: int) int
Encode
valueintobufferand return the new offset
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.List
Bases:
Container- items = []
- values
- __iter__()
- __str__()
- encode() memoryview
- classmethod from_value(value)
- set_value(tag, value)
- delete_value(tag)
- copy()
- classmethod max_length()
- class circuitmatter.tlv.ListMember(tag, substruct_class: type[_TLVList], *, optional: _OPT = False, nullable: _NULLABLE = False, **kwargs)
Bases:
MemberHelper class that provides a standard way to create an ABC using inheritance.
- substruct_class
- max_value_length
- static decode_member(control_octet, buffer, offset=0, depth=0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- print(value)
Return string representation of
value
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- encode_value_into(value, buffer: bytearray, offset: int) int
Encode
valueintobufferand return the new offset
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()
- class circuitmatter.tlv.AnythingMember(tag, *, optional: _OPT = False, nullable: _NULLABLE = False, default=None)
Bases:
MemberStores a TLV encoded value.
- decode_member(control_octet, buffer, offset=0)
Return the decoded value at
offsetinbuffer.offsetis after the tag (but before any length)
- print(value)
Return string representation of
value
- encode_element_type(value)
Return Element Type Field as defined in Appendix A in the spec
- encode_value_into(value, buffer: bytearray, offset: int) int
Encode
valueintobufferand return the new offset
- tag
- optional
- nullable
- tag_length = 0
- __set_name__(owner, name)
- property max_length
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T | None
- __get__(obj: Structure, objtype: type[Structure] | None = None) _T
- __delete__(obj)
- encode(value)
- decode(buffer: memoryview, offset: int = 0) _T
Return the decoded value at
offsetinbuffer
- from_value(value)
- __slots__ = ()