我用手机扫描到服务~~~这些服务是通过什么函数获取的??这些服务干啥用的??最后一个服务知道点···
还有就是TI给的安卓APP怎么扫描不到从机???google的BLE例程可以扫描到~~~
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
yueliang0123,
TI 给的 app 是针对sensortag的, 底层能扫到所有设备,但是在应用层是做了过滤的,只在界面上显示sensortag设备。
至于这些服务获取的地方,如果你看 google提供的Android sample code 的话,那么就在BluetoothLeService.java 中,BluetoothLeService 类中的 connect() 成员函数,其中 mBluetoothGatt.connect() 发起连接,一旦连接建立,blueDroid协议栈 会自动 发起服务搜索请求。
搜索到服务之后,同样在BluetoothLeService.java 中, 重写的成员函数 onServicesDiscovered() 会把信息 broadcast 给 接受方 DeviceCtontrolActivity.java中的 BroacsterReceiver ,然后显示在界面上。你查找一下ACTION_GATT_SERVICES_DISCOVERED 就知道了。