Packet class abstract

Packet as interface for immutable view of varying view length.

Cannot extend Struct directly. ffi.Struct current does not allow length < full struct length, or mixin alternatively, use extension type on TypedData

Components/Header/Payload may extend Struct for convenience of defining sized fields.

Available extensions

Constructors

Packet(TypedData typedData)

Properties

asHeader PacketHeader
no setter
asSync PacketSyncHeader
no setter
bytes Uint8List
no setter
checksumAlgorithm int Function(Uint8List data)
no setter
checksumFieldOrNull int?
no setter
checksumIndex int
no setter
checksumSize int
no setter
checksumTest int
no setter
format PacketFormat<Packet>
Class variables per subtype class, or should this be mixin
no setter
hashCode int
The hash code for this object.
no setterinherited
no setter
headerAvailable Uint8List
no setter
headerWords ByteData
no setter
idFieldOrNull int?
no setter
idHeader Uint8List
Header/Payload Pointers using defined boundaries
no setter
isChecksumFieldValid bool?
no setter
isIdFieldValid bool?
no setter
isLengthFieldValid bool?
no setter
isPacketComplete bool
no setter
isStartFieldValid bool?
no setter
length int
immutable, of varying length, by default mutable with mixin, or PacketBuffer immutable, always lengthMax, in case of mixin on struct
no setter
lengthFieldOrNull int?
no setter
packetData ByteData
final
packetId PacketId?
no setter
packetIdOrNull PacketId?
derived values using field offset + size
no setter
packetLengthOrNull int?
no setter
parsePayloadLength int
no setter
payload Uint8List
no setter
payloadAsList16 Uint16List
no setter
payloadAsList32 Uint32List
no setter
payloadAsList8 Uint8List
for building/parsing payload 'as' packet, not needed when payload is a struct with named fields, temporarily work around returning Lists payload as TypedIntList, for list operations truncated views, end set by packet.length. uses packet element size
no setter
payloadIndex int
derive from either header or packetInterface alternatively, define as SizeField key
no setter
payloadLength int
no setter
payloadLengthMax int
no setter
payloadWords ByteData
payload as "words" of select length, for individual entry operations payload.buffer == packet.buffer, starts at 0 of back buffer
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startFieldOrNull int?
On partial header, truncated view, header status during parsing using cast length
no setter

Methods

buildHeader(PacketId packetId, int payloadLength) → void
buildHeaderAsRequest(PacketId requestId, int payloadLength) → void
buildHeaderAsSync(PacketId packetId) → void
buildPayloadAs<V>(PayloadCaster<V> caster, V values) PayloadMeta
Payload build with Id, pass Header reference typed with user input values, directly accepting struct would miss deriving meta
buildRequest<V>(PacketIdRequest<V, dynamic> packetId, V requestArgs) PayloadMeta
checksum([int? length]) int
all bytes excluding checksumField using length contained in bytes view, or length param length
fillStartField() → void
isValidChecksum(int value) bool
isValidId(int value) bool
isValidLength(int value) bool
isValidStart(int value) bool
for valueOrNull from header status
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parsePayloadAs<V>(PayloadCaster<V> caster, [PayloadMeta? stateMeta]) → V
parseResponse<V>(PacketIdRequest<dynamic, V> packetId, [PayloadMeta? reqStateMeta]) → V
parseSyncId() PacketSyncId?
payloadAt<R extends TypedDataList<int>>([int byteOffset = 0, int? length]) → R
using ffi NativeType for signature types only with range check under length packet will be reject at parser
payloadAtOrNull<R extends TypedDataList<int>>([int byteOffset = 0, int? length]) → R?
payloadWordAt<R extends NativeType>(int byteOffset) int
payloadWordAtOrNull<R extends NativeType>(int byteOffset) int?
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

sum(Uint8List data) int
Checksum overridable for alternate field offsets and algorithms