getElinkA6Data static method

List<int> getElinkA6Data(
  1. List<int> payload
)

Implementation

static List<int> getElinkA6Data(List<int> payload) {
  /*if (payload.length > 16) {
    throw Exception(
        'GetElinkA6Data error: The maximum length of payload is 16!');
  }*/
  final result = List.filled(4 + payload.length, 0);
  result[0] = elinkDataA6Start;
  final mutablePayload = List<int>.from(payload);
  mutablePayload.insert(0, mutablePayload.length);
  result.setRange(1, mutablePayload.length + 1, mutablePayload);
  result[result.length - 2] = getElinkCmdSum(mutablePayload);
  result[result.length - 1] = elinkData6AEnd;
  return result;
}