payload property

  1. @override
Uint8List get payload
override

Implementation

@override
Uint8List get payload {
  var payload = <int>[];
  payload.add(carrierPowerStateIndex);

  // latin1 String and its corresponding Uint8List have the same length
  payload.add(carrierDataReference.length);
  payload.addAll(carrierDataReference);

  assert(auxDataReferenceList.length < 255,
      "Number of auxDataReference must be in [0,256)");

  payload.add(auxDataReferenceList.length);
  for (int i = 0; i < auxDataReferenceList.length; i++) {
    payload.add(auxDataReferenceList[i].length);
    payload.addAll(auxDataReferenceList[i]);
  }

  return Uint8List.fromList(payload);
}
  1. @override
set payload (Uint8List? payload)
override

Implementation

@override
set payload(Uint8List? payload) {
  var stream = ByteStream(payload!);

  carrierPowerStateIndex = stream.readByte() & 3;
  int carrierDataReferenceLength = stream.readByte();
  carrierDataReference = stream.readBytes(carrierDataReferenceLength);

  int auxDataReferenceCount = stream.readByte();
  for (int i = 0; i < auxDataReferenceCount; i++) {
    int auxDataReferenceLength = stream.readByte();
    auxDataReferenceList.add(stream.readBytes(auxDataReferenceLength));
  }

  assert(stream.isEnd() == true,
      "payload has ${stream.unreadLength} bytes after decode");
}