0

i'm trying to send data to a bluetooth device , i need to send these datas as packet data of bytes, for example this is packet data of mine : 80 98 F1 01 81 01

80 F1 98 01 C1 33

80 98 F1 02 21 01 01

80 F1 98 0A 61 01 00 00 00 00 00 00 00 00 33

80 98 F1 03 30 01 FF 01

80 F1 98 03 70 01 FF 33

how i can send these packet datas with bluetooth in android studio? note that i'm ok with bluetooth discovering,connectThread,AcceptThread , but i don't know how send these packet datas

1 Answers1

0

Check the framework for sending data here: Android sample bluetooth code to send a simple string via bluetooth

The interesting part is: outputStream.write(s.getBytes());

That should become something like this: outputStream.write(new byte[]{(byte) 0x80, (byte) 0xF1, (byte) 0x98, 0x01, (byte) 0xC1, 0x33});

MartinLoren
  • 61
  • 1
  • 6