Hi, I'm a ble developer using nrf51822. It is a wierd question, Is this any possible to write value to one characteristic's CCCD value from itself(device)?
This is my situation: I'm implement an higher layer protocol between mobile and ble device. For "data compatibility" and protocol transform flexibility. (Our protocol to BLE command transform) I want the mobile to write an characteristic named "Operate state" When the "Operate state" is set to 1, it will trigger the other (target) characteristic's CCCD (The target characteristic and Operate state characteristic may not in the same service.) Thus the target characteristic will start notify data through hvx function.
Below is the simplified system flow
(Our protocol command)---(software transformer)-->(ble write to Operate handle) /Tx from mobile/ (Write Operate handle)-->(Trigger target CCCD)-->(Start notification) /Rx from ble device/
To be brief, I want my protocol's command only need write "only one" characteristic but there are two characteristic will be modified (Not included the changed Target characteristic value) Thus the "Software transformer " can be designed more simple and general for similar ble devices using our protocol.
There is a workaround method: (Our protocol command)---(software transform: The operate characteristic's descriptor will give target's CCCD handle)-->(ble write to target CCCD handle) /Tx from mobile/ (Write CCCD handle)-->(sd_ble_gatts_set(Operate handle...) & Start notification) /Rx from ble device/
You may ask why not CCCD = Operate Characteristic and the problem is solved. This is because our protocol is implement from some ISO specification, This specification is defined some objects to present the whole system... Each objects has to contain some information (Using GATT attribute-characteristic-service to bring these service) And we also hope the software transformer can more general for other device and simple implement.
Any suggestions? Thanks.