6 Replies Latest reply on May 25, 2018 8:04 AM by epr_1639216

    How to disable write property on Device Name Characteristic

      Hi everyone,

             for my application (on cyble022001 module) I have the necessity to change the device name. So I had do it, but now I want to disable or enable the write property.

      I tryed enable/disable the Generic Access Service with CyBle_GattsDisableAttribute but seem that it works only with custom service, not with Generic Access Service.

      Is there a way to disable or enable the Device name characteristic (or write property) via software?

      Thanks for help.

        • 1. Re: How to disable write property on Device Name Characteristic

          The CyBle_GattsDisableAttribute() should work for any attribute; You just need to pass the handle to the attribute to disable (The Generic Access Service should have a handle associated with it that will allow you to disable it as well). The handle is merely an integer representing which "index" to enable/disable and is not dependent on what type of attribute it is (AFAIK).

          1 of 1 people found this helpful
          • 2. Re: How to disable write property on Device Name Characteristic

            Thanks for the reply.

            What you say is true, but I tried to write CyBle_GattsDisableAttribute(0x0001) where 0x0001 is the handle index for Generic Access Service and I didn't get any results.

            So I tried to write CyBle_GattsDisableAttribute(0x0009) where 0x0009 is the handle index for my custom Service and in this case I disabled the service. Where am I wrong? Is it maybe wrong the handle index? How can I know which is the right handle index for Generic Access Service?

            • 3. Re: How to disable write property on Device Name Characteristic

              It could be you are using the wrong handle. The "handle" value will be associated with the peripheral device's specific BT profile, and should be constant as long as the software image doesn't change.

              One way to be sure is to use the characteristic or service discovery to figure out what handle each service/attribute/characteristic is actually using. The function CyBle_GattcDiscoverCharacteristicByUuid(CYBLE_CONN_HANDLE_T connHandle, CYBLE_GATTC_READ_BY_TYPE_REQ_T * readByTypeReqParam) will discover a specific handle based on a single UUID and will fire the CYBLE_EVT_GATTC_READ_BY_TYPE_RSP event in the callback handler with the correct handle to use.

              If you want to discover all handles on the remote device, then you can use the CyBle_GattcDicoverAllCharacteristicDescriptors() function to get all possible handles. This will confirm whether the Generic Access Service has a handle

              I don't think you can disable the service itself, but you can disable the Characteristics and the Attributes underneath the service. (Descriptor, Characteristic, "Device Name", "Appearance", etc.)

              Some of the BLE component profile parts are required for the BLE to operate correctly, like the Server, Generic Access services. Thus, I would expect them to be unchangeable due to their required nature for the chip to work.

              2 of 2 people found this helpful
              • 4. Re: How to disable write property on Device Name Characteristic

                The CyBle_GattcDiscoverCharacteristicByUUID() API is for GATT Client only. How is the attribute handle of a service identified for a GATT Server device? I also intend to use the CyBle_GattsDisableAttribute API.

                • 5. Re: How to disable write property on Device Name Characteristic

                  I was already able to identify the attribute handle of a Service. For example, I have 2 HID Services named HID and HID2. To disable HID2 service, the API to use is CyBle_GattsDisableAttribute(cyBle_hidss[HIDS2_service_index].serviceHandle). The attribute handles can be obtained in the generated source files; so in this case, I was able to locate them in BLE_hids.c/.h.

                  • 6. Re: How to disable write property on Device Name Characteristic

                    The handles declared in your profiles/services are hard-coded into the hex image/code that you build the device with. In order to get the handle values, there are 2 different ways I know of: Open the BLE component and select the service/characteristic that you want to access, and the handle value will be listed at the top of the related information associated with it (It is editable, so you can custom configurations if you desire. It should be a 128-bit value iirc).

                    Otherwise, looking at the generated BLE source/header files, one of them (BLE_hids.c/h as you found) has all of the handle constants declared by the server listed in a nicely formatted section.