简体   繁体   English

通过蓝牙将Android连接到健康设备

[英]Connect Android to Health Device via bluetooth

Well im desperately trying to connect my android app to a blood pressure device. 好吧我拼命想把我的Android应用程序连接到血压设备。 I've realized that the amount of examples of this are few . 我已经意识到这个例子的数量很少。 Right now I am stuck at the connection point. 现在我被困在连接点。 It keeps failing with 它一直在失败

 12-21 18:00:38.796: E/Connection Failed(2207): java.io.IOException: Service discovery failed

Im following the steps : 我按照以下步骤:

1 - getting the default adapter 1 - 获取默认适配器

mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

2 - getting the device 2 - 获取设备

mBluetoothDevice = mBluetoothAdapter.getRemoteDevice(DEVICE_MAC_ADD);

3- creating a socket 3-创建一个套接字

mBtSocket = device.createInsecureRfcommSocketToServiceRecord(
                                UUID);

4 - Canceling discovery and connect to device 4 - 取消发现并连接到设备

mBluetoothAdapter.cancelDiscovery();

mBtSocket.connect();

It fails on the connect method with the exception above. 它在连接方法上失败,但上面有例外。 Well im kind of lost trying to know why this happens . 好吧,我想知道为什么会发生这种情况。 Im using the UUID 00001101-0000-1000-8000-00805F9B34FB as referenced in other threads. 我使用其他线程中引用的UUID 00001101-0000-1000-8000-00805F9B34FB。 The bluetooth permissions on the manifest are correct. 清单上的蓝牙权限是正确的。 Can someone give me a little help? 有人能给我一点帮助吗?

Thank you, Pedro Ferreira 谢谢你,Pedro Ferreira

If your blood pressure device is compatible with HDP profile, then you can use the health profile supported in android 4.0 to do this job. 如果您的血压设备与HDP配置文件兼容,那么您可以使用android 4.0中支持的健康配置文件来完成这项工作。

Take a look: BluetoothHDP Demo 看看: BluetoothHDP演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM