payload property
Implementation
@override
Uint8List get payload {
List<int?> data = <int?>[];
for (var e in attributes.entries) {
data.add(e.value.length + 1);
data.add(EIR.typeNumMap[e.key]);
data.addAll(e.value);
}
List<int>? payload = ByteUtils.intToBytes(
data.length + address!.bytes.length + 2, 2,
endianness: Endianness.Little) +
address!.bytes +
data.cast();
return Uint8List.fromList(payload);
}
Implementation
@override
set payload(Uint8List? payload) {
var stream = ByteStream(payload!);
var oobLength = stream.readInt(2, endianness: Endianness.Little);
address = EPAddress.fromBytes(stream.readBytes(6));
while (stream.readLength < oobLength) {
var length = stream.readByte();
var data = stream.readBytes(length);
attributes[EIR.numTypeMap[data[0]]] = data.sublist(1);
}
}