resSendPacket function

void resSendPacket(
  1. Pointer<Void> data,
  2. int length
)

Implementation

void resSendPacket(Pointer<Void> data, int length) {
  // slog('resSendPacket: $length');
  Pointer<UnsignedChar> buffer = data as Pointer<UnsignedChar>;

  StringBuffer sb = StringBuffer();
  final List<int> ls = [];

  for (int i = 0; i < length; i++) {
    // if (i % 8 == 0) {
    //   sb.write('\n');
    // }
    sb.write('${buffer[i].toRadixString(16)} ');
    ls.add(buffer[i]);
  }
  // slog('resSendPacket($length), Hex: ${sb.toString()}');
  printProtocol(ls, ls.length);
  ClingBleEvent.onMessageSend(ls.toCmd());
}