getElinkA7Data static method

Future<List<int>> getElinkA7Data(
  1. List<int> cid,
  2. List<int> mac,
  3. List<int> payload
)

Implementation

static Future<List<int>> getElinkA7Data(
  List<int> cid,
  List<int> mac,
  List<int> payload,
) async {
  final encryptPayload = await Ailink().mcuEncrypt(Uint8List.fromList(cid), Uint8List.fromList(mac), Uint8List.fromList(payload));
  final result = List.filled(4 + cid.length + encryptPayload.length, 0);
  result[0] = elinkDataA7Start;
  final mutablePayload = List<int>.from(encryptPayload);
  mutablePayload.insert(0, encryptPayload.length);
  mutablePayload.insertAll(0, cid);
  result.setRange(1, mutablePayload.length + 1, mutablePayload);
  result[result.length - 2] = getElinkCmdSum(mutablePayload);
  result[result.length - 1] = elinkData7AEnd;
  return result;
}