Hi all,
We found iOS may return services and characteristics from cache if our application invoke CBPeripheral::discoverServices().
14:59:18.824260 +0800 | bluetoothd | Attempting to find all services on device "<private>" |
14:59:18.824785 +0800 | bluetoothd | Returning primary services from cache |
But our product may change the chracteristics attribute handle number after product firmware updated.
For example, FW Ver1: discovered serivce like below,
14:59:18.826036 +0800 bluetoothd Using local database for discover services by UUID.
14:59:18.826926 +0800 bluetoothd statedump: 0x0001 Primary Service [ serviceUUID: -, endHandle: 0x0006, discoveredCharacteristics: all ]
14:59:18.827124 +0800 bluetoothd statedump: 0x0002 Characteristic [ valueUUID: -, valueHandle: 0x0003, properties: notify, discoveredDescriptors: all ]
14:59:18.827412 +0800 bluetoothd statedump: 0x0003 Characteristic Value [ - ]
14:59:18.827549 +0800 bluetoothd statedump: 0x0004 Client Configuration [ none ]
14:59:18.827713 +0800 bluetoothd statedump: 0x0005 Characteristic [ valueUUID: -, valueHandle: 0x0006, properties: responseless-writes write, discoveredDescriptors: none ]
But after FW updated, FW Ver2: discovered service should like below,
15:00:09.204374 +0800 bluetoothd statedump: 0x0001 Primary Service [ serviceUUID: -, endHandle: 0x0006, discoveredCharacteristics: none ]
15:00:09.204613 +0800 bluetoothd statedump: 0x0007 Primary Service [ serviceUUID: -, endHandle: 0x000C, discoveredCharacteristics: none ]
15:00:09.205718 +0800 bluetoothd Finding all characteristics in range [0x0007, 0x000c] on device "<private>"
15:00:09.265822 +0800 bluetoothd statedump: 0x0001 Primary Service [ serviceUUID: -, endHandle: 0x0006, discoveredCharacteristics: none ]
15:00:09.266798 +0800 bluetoothd statedump: 0x0007 Primary Service [ serviceUUID: -, endHandle: 0x000C, discoveredCharacteristics: all ]
15:00:09.267084 +0800 bluetoothd statedump: 0x0008 Characteristic [ valueUUID: -, valueHandle: 0x0009, properties: notify, discoveredDescriptors: none ]
15:00:09.267562 +0800 bluetoothd statedump: 0x000B Characteristic [ valueUUID: -, valueHandle: 0x000C, properties: responseless-writes write, discoveredDescriptors: none ]
But if we didnot power off/on iPhone's Setting >> Bluetooth switch (reset bluetooth), we cannot setNotifyValue() successfuly.
14:59:18.883104 +0800 bluetoothd Received error response for write value 3 (status=65535)
14:59:18.883522 +0800 bluetoothd Failed to write descriptor at handle 0x0004 on device "<private>" - result was 3
How can app force to discover service and characteristic from BLE device but not just from iOS local cache database?
Thank you