toPacket method

String toPacket()

toPacket converts the BleServiceData to a raw message following this structure: SERVICE_UUID:DATA

Implementation

String toPacket() {
  String message = '${uuid.toRadixString(16).padLeft(4, '0').toUpperCase()}:';
  message += data.map((e) => e.toRadixString(16).padLeft(2, '0')).join('').toUpperCase();
  return message;
}