fromModbusAscii static method

Uint8List fromModbusAscii(
  1. Iterable<int> ascii
)

Implementation

static Uint8List fromModbusAscii(Iterable<int> ascii) {
  String str = String.fromCharCodes(ascii);
  List<int> bytes = [];
  for (int i = 0; i < str.length - 1; i += 2) {
    bytes.add(int.parse(str.substring(i, i + 2), radix: 16));
  }
  return Uint8List.fromList(bytes);
}