Hi, I am trying to enabling a notification of an attribute(once the attribute changed, the server will push the new value to the client) and I learned I have to first configure the CCCD correctly to do this. In the bluetooth spec it says the CCCD has to be 1 to support notification, and I have successfully added the CCCD of my attribute by setting the char_props.notify to be 1, but the default value of CCCD is 0. I am just wondering if I can make this default value to be 1 or it is up to the client to configure it?
There isn't any way to set the default value to 1, but for bonded devices, the spec requires CCCD values to be stored. This means that once the Central device bonds with your Peripheral, the Peripheral will store the CCCD values used and restore them when this particular device reconnects. The CCCD values are what is called system attributes in S110 terms.
If you mean setting the default for newly connected (not bonded) devices, this is not possible.
I'd be happy if you could mark my answer as accepted if you found that it answered your question. :-)