Ejemplo n.º 1
0
/******************************************************************************
##Function Name: CyBle_GattcDiscoverCharacteristicsEventHandler
*******************************************************************************

Summary:
 This function is called on receiving a "CYBLE_EVT_GATTC_READ_BY_TYPE_RSP"
 event. Based on the service UUID, an appropriate data structure is populated
 using the data received as part of the callback.

Parameters:
 *discCharInfo: The pointer to a characteristic information structure.

Return:
 None

******************************************************************************/
void CyBle_GattcDiscoverCharacteristicsEventHandler(CYBLE_DISC_CHAR_INFO_T *discCharInfo)
{
    if(discCharInfo->uuid.uuid16 == CYBLE_UUID_CHAR_SERVICE_CHANGED)
    {
        CyBle_CheckStoreCharHandle(cyBle_gattc.serviceChanged);
    }
}
Ejemplo n.º 2
0
/******************************************************************************
##Function Name: CyBle_BascDiscoverCharacteristicsEventHandler
*******************************************************************************

Summary:
 This function is called on receiving a CYBLE_EVT_GATTC_READ_BY_TYPE_RSP
 event. Based on the service UUID, an appropriate data structure is populated
 using the data received as part of the callback.

Parameters:
 *discCharInfo: The pointer to a characteristic information structure.
 discoveryService: The index of the service instance

Return:
 None

******************************************************************************/
void CyBle_BascDiscoverCharacteristicsEventHandler(uint16 discoveryService, CYBLE_DISC_CHAR_INFO_T *discCharInfo)
{
    if(discCharInfo->uuid.uuid16 == CYBLE_UUID_CHAR_BATTERY_LEVEL)
    {
        CyBle_CheckStoreCharHandle(cyBle_basc[discoveryService].batteryLevel);
    }
}
Ejemplo n.º 3
0
/****************************************************************************** 
##Function Name: CyBle_LlscDiscoverCharacteristicsEventHandler
*******************************************************************************

Summary:
 This function is called on receiving a CYBLE_EVT_GATTC_READ_BY_TYPE_RSP
 event. Based on the service UUID, an appropriate data structure is populated
 using the data received as part of the callback.

Parameters: 
 CYBLE_DISC_CHAR_INFO_T * discCharInfo: The pointer to a characteristic 
                                         information structure.

Return: 
 None

******************************************************************************/
void CyBle_LlscDiscoverCharacteristicsEventHandler(CYBLE_DISC_CHAR_INFO_T *discCharInfo)
{
    if(discCharInfo->uuid.uuid16 == CYBLE_UUID_CHAR_ALERT_LEVEL)
    {
        /* Check for invalid char handle */
        if(cyBle_llsc.alertLevelChar.valueHandle == CYBLE_GATT_INVALID_ATTR_HANDLE_VALUE)
        {
            /* Save Alert Level Characteristic handle */
            CyBle_CheckStoreCharHandle(cyBle_llsc.alertLevelChar);
        }
    }
}
Ejemplo n.º 4
0
/******************************************************************************
##Function Name: CyBle_HtscDiscoverCharacteristicsEventHandler
*******************************************************************************

Summary:
 This function is called on receiving a CYBLE_EVT_GATTC_READ_BY_TYPE_RSP
 event. Based on the service UUID, an appropriate data structure is populated
 using the data received as part of the callback.

Parameters:
 *discCharInfo: The pointer to a characteristic information structure.

Return:
 None

******************************************************************************/
void CyBle_HtscDiscoverCharacteristicsEventHandler(CYBLE_DISC_CHAR_INFO_T *discCharInfo)
{
    /* HTS characteristics UUIDs */
    static const CYBLE_UUID16 cyBle_htscCharUuid[CYBLE_HTS_CHAR_COUNT] =
    {
        CYBLE_UUID_CHAR_TEMPERATURE_MSMNT,
        CYBLE_UUID_CHAR_TEMPERATURE_TYPE,
        CYBLE_UUID_CHAR_INTERMEDIATE_TEMP,
        CYBLE_UUID_CHAR_MSMNT_INTERVAL    
    };
    uint8 i;
    static CYBLE_GATT_DB_ATTR_HANDLE_T *htsLastEndHandle = NULL;

    /* Update last characteristic endHandle to declaration handle of this characteristic */ 
    if(htsLastEndHandle != NULL)
    {
        *htsLastEndHandle = discCharInfo->charDeclHandle - 1u;
        htsLastEndHandle = NULL;
    }

    for(i = (uint8) CYBLE_HTS_TEMP_MEASURE; i < (uint8) CYBLE_HTS_CHAR_COUNT; i++)
    {
        if(cyBle_htscCharUuid[i] == discCharInfo->uuid.uuid16)
        {
            CyBle_CheckStoreCharHandle(cyBle_htsc.charInfo[i]);
            htsLastEndHandle = &cyBle_htsc.charInfo[i].endHandle;
            break;
        }
    }
    
    /* Init characteristic endHandle to the Service endHandle.
       Characteristic endHandle will be updated to declaration
       handler of the following characteristic,
       in the following characteristic discovery procedure. */
    if(htsLastEndHandle != NULL)
    {
        *htsLastEndHandle = cyBle_serverInfo[cyBle_disCount].range.endHandle;
    }    
    
}