viatom-develop / LepuBle

BLE demo for Lepu devices
10 stars 11 forks source link

Hello Jiang - we need your help to connect viatom Bluetooth BP monitor to my Java Application #2

Open rrepaka opened 3 years ago

rrepaka commented 3 years ago

Hi Jiang,

We need your help for connecting Blue tooth Blood pressure monitor from Java Application

OS: Windows 10 Language : Java 11

We were able to complete below things

  1. We have paired Blood pressure monitor with windows Tablet

  2. The BP Monitor's Address : c15a8bb412d0 and Service Name : 14839ac4...

we have tried below code , but we were not able to connect to device. please suggest how to connect ?


LocalDevice local = LocalDevice.getLocalDevice();
String serviceUUID="14839ac47d7e415c9a42167340cf2339";
//String address="c15a8bb412d0";
String deviceURL = "btspp://"+serviceUUID+";name=BP2 3513;authenticate=false;encrypt=false;master=false";
javax.microedition.io.Connection notifier = Connector.open(deviceURL);
StreamConnectionNotifier streamNotifier = (StreamConnectionNotifier) notifier;
StreamConnection connection = streamNotifier.acceptAndOpen();
System.out.println(" Connection accepted.");

OutputStream output = connection.openOutputStream();
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(isr);

The control is stuck before "Connection accepted" line.
viatom-dev commented 3 years ago

Hi, on PC software, we use Qt, and we use Java on Android platform. Sorry for that we can't help with connecting BLE using jvm. Have you ever connected to other BLE devices? And, it looks like you are using classic Bluetooth to connect but I'm not sure. Classic Bluetooth use the socket/stream to communicate.