1 Reply Latest reply on Jan 6, 2015 3:35 PM by kris.p

    BLE CUSTOM SERVICE

    yunus.ayhan
              How can i set my characteristic parameters like the function CyBle_IascSetCharacteristicValue, On my own custom service.. thx in advance   
        • 1. Re: BLE CUSTOM SERVICE
          kris.p

          Use CyBle_GattsWriteAttributeValue API.

             

           

             

          Here's an extract from the source code comments:

             

          /******************************************************************************

             

          ##Function Name: CyBle_GattsWriteAttributeValue

             

          *******************************************************************************

             

           

             

          Summary:

             

           This function is used to write to the value field of the specified attribute

             

           in the GATT database of a GATT Server. This is a blocking function. No event

             

           is generated on calling this function.

             

           

             

           If a peer device connected to the GATT Server initiates a write operation, 

             

           this function is executed on the GATT Server. During such a call, the function

             

           checks for the attribute permissions (flags) before executing the write 

             

           operation.

             

           

             

          Parameters:

             

          handleValuePair: Pointer to handle value pair of type 

             

                           CYBLE_GATT_HANDLE_VALUE_PAIR_T.

             

                            * 'handleValuePair.attrHandle' is an input for which value 

             

                               has to be written.

             

                            * 'handleValuePair.value.len' is an input parameter for the 

             

                               length to be written.

             

                            * 'handleValuePair.value.val' is an input parameter for 

             

                               data buffer.

             

                            * 'handleValuePair.actualLen' has to be ignored as it is 

             

                               unused in this function.

             

          offset: Offset at which the data (length in number of bytes) is written.

             

          connHandle: Pointer to the attribute instance handle, of type 

             

                       CYBLE_CONN_HANDLE_T.

             

          falgs: Attribute permissions. Allowed values are,

             

                  * CYBLE_GATT_DB_LOCALLY_INITIATED

             

                  * CYBLE_GATT_DB_PEER_INITIATED

             

           

             

          Return:

             

           CYBLE_GATT_ERR_CODE_T : Return value indicates if the function succeeded or

             

           failed. Following are the possible error codes.

             

           <table>

             

           Errors codes                           Description

             

           ------------                           -----------

             

            CYBLE_GATT_ERR_NONE                   On successful operation

             

            CYBLE_GATT_ERR_INVALID_HANDLE         'handleValuePair.attrHandle' 

             

                                                   is not valid

             

            CYBLE_GATT_ERR_WRITE_NOT_PERMITTED    Write operation is not 

             

                                                   permitted on this attribute

             

            CYBLE_GATT_ERR_INVALID_OFFSET         Offset value is invalid

             

            CYBLE_GATT_ERR_UNLIKELY_ERROR         Some other error occurred

             

           </table>

             

           

             

          ******************************************************************************/

             

          CYBLE_GATT_ERR_CODE_T CyBle_GattsWriteAttributeValue

             

          (

             

                      CYBLE_GATT_HANDLE_VALUE_PAIR_T * handleValuePair,

             

                      uint16                          offset,

             

                      CYBLE_CONN_HANDLE_T       * connHandle,

             

                      uint8                           flags

             

          );