I am developping NUS server(Peripheral) on Android. Central is ble_app_uart_c on nRF52832. In this case, service discovery cannot be completed. According to the console log, the log "APP:INFO:Discovery complete." in ble_nus_c_evt_handler() is not printed. On the other hand, when I use ble_app_uart as peripheral, it is printed.
NUS server implementation on Android is as follows.
BluetoothGattService service =new BluetoothGattService(SERVICE_NUS_UUID,
BluetoothGattService.SERVICE_TYPE_PRIMARY);
BluetoothGattCharacteristic nusTxCharacteristic =
new BluetoothGattCharacteristic(CHARACTERISTIC_NUS_TX_UUID,
//Read-only characteristic, supports notifications
BluetoothGattCharacteristic.PROPERTY_NOTIFY,
BluetoothGattCharacteristic.PERMISSION_WRITE);
BluetoothGattCharacteristic nusRxCharacteristic =
new BluetoothGattCharacteristic(CHARACTERISTIC_NUS_RX_UUID,
//Write permissions
BluetoothGattCharacteristic.PROPERTY_WRITE | BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE,
BluetoothGattCharacteristic.PERMISSION_WRITE);
service.addCharacteristic(nusTxCharacteristic);
service.addCharacteristic(nusRxCharacteristic);
mGattServer.addService(service);
When I use HRS server as peripheral on Android and ble_app_hrs_c as central on nRF52832, service discovery can be completed as correctly. In this case, the log "Heart rate service discovered." in hrs_c_evt_handler() is printed on the console.
HRS server implementation on Android is as follows.
mHeartRateMeasurementCharacteristic =
new BluetoothGattCharacteristic(HEART_RATE_MEASUREMENT_UUID,
BluetoothGattCharacteristic.PROPERTY_NOTIFY,
/* No permissions */ 0);
mHeartRateMeasurementCharacteristic.addDescriptor(
Peripheral.getClientCharacteristicConfigurationDescriptor());
mHeartRateMeasurementCharacteristic.addDescriptor(
Peripheral.getCharacteristicUserDescriptionDescriptor(HEART_RATE_MEASUREMENT_DESCRIPTION));
mBodySensorLocationCharacteristic =
new BluetoothGattCharacteristic(BODY_SENSOR_LOCATION_UUID,
BluetoothGattCharacteristic.PROPERTY_READ,
BluetoothGattCharacteristic.PERMISSION_READ);
mHeartRateControlPoint =
new BluetoothGattCharacteristic(HEART_RATE_CONTROL_POINT_UUID,
BluetoothGattCharacteristic.PROPERTY_WRITE,
BluetoothGattCharacteristic.PERMISSION_WRITE);
mHeartRateService = new BluetoothGattService(HEART_RATE_SERVICE_UUID,
BluetoothGattService.SERVICE_TYPE_PRIMARY);
mHeartRateService.addCharacteristic(mHeartRateMeasurementCharacteristic);
mHeartRateService.addCharacteristic(mBodySensorLocationCharacteristic);
mHeartRateService.addCharacteristic(mHeartRateControlPoint);
mGattServer.addService(mHeartRateService);
I guess that NUS server implementation on Android is something wrong. But I cannot figure out the root cause. Could you help me please?
[environment]
- Peripheral : Android 6.0
- Central : nRF52832, S132, nRF5 SDK ver13
June 29, 2017
The "Find By Type Value Response" is as follows. What I can see is only that the handle 0x0028 is found.
I have attached the sniffer log files.
-
NUS_vsAndroid.pcap Central : ble_app_uart_c (nRF52832) / Peripheral : Android
-
BLE_NUS.pcap Central : ble_app_uart_c (nRF52832) / Peripheral : ble_app_uart (nRF52832)
June 29, 2017
I don't have the .pcapng files. I used TI's SmartRF packet sniffer as a sniffer tool. I only have the .psd files.