printProtocol function
dynamic
printProtocol(})
Implementation
printProtocol(List<int> data, int length, {String prefix = "SEND", int protocolStart = 2, int characteristic = 0}) {
if (kDebugMode) {
StringBuffer sb = StringBuffer();
String charId = '0xFF${characteristic.toRadixString(16).toUpperCase()}';
if (protocolStart == 2) {
charId = '0x${data[0].toRadixString(16).toUpperCase()}${data[1].toRadixString(16).toUpperCase()}';
}
sb.write('[$prefix] PROTOCOL: $charId, ');
if (protocolStart == 2) {
characteristic = data[1];
}
if (characteristic == 0xe2 || characteristic == 0xe6) {
sb.write('msg num: 0x${data[protocolStart + 0].toRadixString(16)},');
sb.write(' pid(${data[protocolStart + 4]}):');
sb.write(' ${_utf8Ptr2String(
clingNative.cwsGetProtocolName(data[protocolStart + 4]))},');
sb.write(' length: ${data[protocolStart + 1] * 65536 +
data[protocolStart + 2] * 256 + data[protocolStart + 3]}');
slog(sb.toString());
} else if (characteristic == 0xe1 || characteristic == 0xe5) {
sb.write('msg num: ---,');
sb.write(' pid(${data[protocolStart + 0]}):');
sb.write(' ${_utf8Ptr2String(
clingNative.cwsGetProtocolName(data[protocolStart + 0]))},');
sb.write(' syscmd(0x${data[protocolStart + 1].toRadixString(16)}):');
sb.write(' ${_utf8Ptr2String(
clingNative.cwsGetSystemCmdName(data[protocolStart + 1] & 0xff))}');
slog(sb.toString());
} else {
// slog("msg num: 0x${data[protocolStart + 0].toRadixString(16)}",);
}
}
}