In Bluetooth Class Service & Charateristic Parameter of write method in CN1bluetooth.cn1lib

26 views
Skip to first unread message

ldina...@gmail.com

unread,
May 4, 2019, 10:34:47 AM5/4/19
to CodenameOne Discussions
import com.codename1.bluetoothle.Bluetooth;

By using the above class, I can able to do the followings 
but I am facing problem while printing data to the bluetooth printer by using write method.

able to do in bluetooth between mobile and portable bluetooth printer
1. enable
2. permission
3. getting bluetooth id [address]
3. connection

not able to to

String service = "12ab";
String characteristic = "34cd";
String address = "34:81:F4:1A:45:1C";

bt.write(this, address, service, characteristic, "DINAKARAN", false);

after processing the above line, showing error as java.io.IOException. Device is not connected.
By using bt.wasConnected(address2) method showing as true and 
to make sure msg getting displayed in dialog window. It is fine.

Pl.required guidance, struggling over a period of 10days.


Shai Almog

unread,
May 5, 2019, 12:18:11 AM5/5/19
to CodenameOne Discussions
Is the device a bluetooth or BluetoothLE device?
Notice that the library only supports BluetoothLE.

What was returned from the device connection?
Are you sure of the values you passed to the write operation?
Reply all
Reply to author
Forward
0 new messages