flutter_bluetooth_serial icon indicating copy to clipboard operation
flutter_bluetooth_serial copied to clipboard

Need Send Hex String and WriteBytes Not Supported

Open jhonny1977 opened this issue 4 years ago • 1 comments

i try to send hex string and change to hex byte to embedded system. but seems the library only support for send by string.

jhonny1977 avatar Jan 23 '21 15:01 jhonny1977

The library actually only supports directly sending bytes, so if you convert your data into a Uint8List (flutter data type for holding multiple bytes), you could easily send raw bytes, without converting to a string.

import 'dart:typed_data';
import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart';

BluetoothConnection connection;
...
Uint8List dataInBytes;
connection.output.add(dataInBytes);

ramuno4 avatar Feb 12 '21 11:02 ramuno4