2015-02-11 58 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。

相關問題