2015-02-11 60 views
0

我可以在我想要将数据发送到该扫描设备后,从我的android应用程序扫描ble设备。怎么做?请与我分享示例代码,如果有的话。如何在android中将数据写入BLE设备

我提到回答有人在这里问同样的问题[Working with BLE Android 4.3 how to write characteristics?

,但我没有得到下面的代码我喜欢上面的代码

BluetoothGattService Service = mBluetoothGatt.getService(your Services); 

Here what is `your seervice` 

BluetoothGattCharacteristic charac = Service 
      .getCharacteristic(your characteristic); 

    Here what is `your characteristic` 

请解释

感谢

+0

你试过github的例子吗?如果还没有,请通过gihub,这会给你广泛的例子! – 2015-02-11 12:27:04

+0

感谢您的rply,你能分享我链接@ JiteshUpadhyay – Prasad 2015-02-11 12:34:07

回答

0

要了解关于服务和特点,ddl和运行官方BLE项目:https://android.googlesource.com/platform/development/+/cefd49aae65dc85161d08419494071d74ffb982f/samples/BluetoothLeGatt

您的设备包含许多描述它可以为您提供的服务。随着官方projet,你可以访问他们。请注意,每个服务是这样的: 0000XXXX-0000-1000-8000-00805f9b34f 你可以在这里找到XXXX:https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx 如果你想找到的名称是为特征

比如同设备 服务UUID代码为00001800-0000-1000-8000-00805f9b34f,特征为设备名称。 UUID 00002A00-0000-1000-8000-00805f9b34f。

要回答你,你的服务是一个UUID。

相关问题