在机器人的bluez实施 [英] Bluez implementation in android

查看:138
本文介绍了在机器人的bluez实施的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人能请向我们提供任何来源$ C ​​$ C在Android的bluez的实施。实际上,我们正在试图与GATT配置文件的应用程序。这款Android应用程序应该与蓝牙连接其他设备连接。请建议我什么都要发送数据到非Android设备的最佳方式。

Can anyone please provide us any source code for bluez implementation in android. Actually we are trying to make an application with GATT profile. This android application should connect with other device by Bluetooth connection. Please suggest me what should be the best way to send data to a non android device.

推荐答案

看着蓝牙聊天例如通过谷歌,你也可以用同样的方法来连接到非Android设备。 具体来说,你将需要这个API

Look at Bluetooth chat example by Google, you also can use the same method to connect to a non android device. Specifically you will need this api

device.createRfcommSocketToServiceRecord(SerialPortServiceClass_UUID);

device.createRfcommSocketToServiceRecord(SerialPortServiceClass_UUID);

编辑: 您也可以尝试使用反射来访问这样的另一种方法

You can also try using reflection to access another method like this

Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
mmSocket = (BluetoothSocket) m.invoke(mmDevice, Integer.valueOf(1));

这篇关于在机器人的bluez实施的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆