2 Replies Latest reply on Jan 17, 2018 10:52 AM by rich.soennichsen_1592346

    Read Only Characteristic

    rich.soennichsen_1592346

      This is a basic question...  I have a custom service with multiple custom characteristics.  The characteristics have various read/write permissions, some notify some do not.  I am having trouble with one characteristic.  It is read-only and it notifies.  I am using a phone app (LightBlue) as a client.

       

      The idea is to have the BLE peripheral provide a status to the client via this characteristic, the app can read the characteristic and receives updates via notification.

       

      In the GeneralEventHandler I update this characteristic on the "stack on" event.  When I connect the update is not there, I see the default value of the characteristic as entered in the GUI dialog.

       

       

      I does not work when set to read only, but it does work when set to read/write.  What am I missing?

       

      Thanks

       

      Rich

        • 1. Re: Read Only Characteristic
          rich.soennichsen_1592346

          I think I am misunderstand what it means for the characteristic to be "read only"  I interpret this as meaning that my BLE firmware will "set" the characteristic by writing to it but to a client (Phone) it will be read only.

           

          Buuuut, when I try to write to this read-only characteristic using CyBle_GattsWriteAttributeValue I get the error "CYBLE_GATT_ERR_WRITE_NOT_PERMITTED"

           

          So clearly I am misunderstand how this works.

           

          Thanks

           

          Rich

          • 2. Re: Read Only Characteristic
            rich.soennichsen_1592346

            I think I may have answered my own question.

             

            I was updating the GATT with CyBle_GattsWriteAttributeValue, sending the CYBLE_GATT_DB_PEER_INITIATED parameter.  This assumes a connection.

             

            To update the database only, I use the CYBLE_GATT_DB_LOCALLY_INITIATED parameter and I get the results I expect.

             

            I welcome any comments.

             

            Thanks

             

            Rich

            1 of 1 people found this helpful