extern void HandleAccessRead(GATT_ACCESS_IND_T *p_ind)
{

    /* For the received attribute handle, check all the services that support
     * attribute 'Read' operation handled by application.
     */

    if(GapCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to GAP service */
        GapHandleAccessRead(p_ind);
    }
#ifdef ENABLE_OTA
    else if(GattCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to Gatt service */
        GattHandleAccessRead(p_ind);
    }
    else if(OtaCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to OTA service */
        OtaHandleAccessRead(p_ind);
    }
#endif /* ENABLE_OTA */
    else if(HeartRateCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to Heart Rate service */
        HeartRateHandleAccessRead(p_ind);
    }
    else if(BatteryCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to Battery service */
        BatteryHandleAccessRead(p_ind);
    }
    else if(DeviceInfoCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to Device Information Service. */
        DeviceInfoHandleAccessRead(p_ind);
    }
    else
    {
        /* Application doesn't support 'Read' operation on received
         * attribute handle, hence return 'gatt_status_read_not_permitted'
         * status
         */
        GattAccessRsp(p_ind->cid, p_ind->handle,
                      gatt_status_read_not_permitted,
                      0, NULL);
    }

}
Exemple #2
0
/*----------------------------------------------------------------------------*
 *  NAME
 *      HandleAccessRead
 *
 *  DESCRIPTION
 *      This function handles read operations on attributes (as received in 
 *      GATT_ACCESS_IND message) maintained by the application and responds
 *      with the GATT_ACCESS_RSP message.
 *
 *  PARAMETERS
 *      p_ind [in]              Data received in GATT_ACCESS_IND message.
 *
 *  RETURNS
 *      Nothing
 *----------------------------------------------------------------------------*/
extern void HandleAccessRead(GATT_ACCESS_IND_T *p_ind)
{
    /* For the received attribute handle, check all the services that support 
     * attribute 'Read' operation handled by application.
     */
    /* More services may be added here to support their read operations */
    if(GapCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to the GAP service */
        GapHandleAccessRead(p_ind);
    }
    else if(DeviceInfoCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to the DEVICE INFORMATION service */
        DeviceInfoHandleAccessRead(p_ind);
    }
    else if(BatteryCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to BATTERY service */
        BatteryHandleAccessRead(p_ind);
    }
    else if(EsurlBeaconCheckHandleRange (p_ind->handle))
    {
        /* Attribute handle belongs to Beacon service */
        EsurlBeaconHandleAccessRead(p_ind);
    }    
    else
    {
        /* Application doesn't support 'Read' operation on received attribute
         * handle, so return 'gatt_status_read_not_permitted' status.
         */
        GattAccessRsp(p_ind->cid, p_ind->handle, 
                      gatt_status_read_not_permitted,
                      0, NULL);
    }

}
static void handleAccessRead(GATT_ACCESS_IND_T *p_ind)
{

    /* Check all the services that support attribute 'Read' operation handled
     * by application
     */

    if(GapCheckHandleRange(p_ind->handle))
    {
        GapHandleAccessRead(p_ind);
    }
#ifdef ENABLE_OTA
    else if(GattCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to Gatt service */
        GattHandleAccessRead(p_ind);
    }
    else if(OtaCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to OTA service */
        OtaHandleAccessRead(p_ind);
    }
#endif /* ENABLE_OTA */
    else if(HidCheckHandleRange(p_ind->handle))
    {
        HidHandleAccessRead(p_ind);
    }

#ifdef __PROPRIETARY_HID_SUPPORT__

    else if(HidBootCheckHandleRange(p_ind->handle))
    {
        HidBootHandleAccessRead(p_ind);
    }

#endif /* __PROPRIETARY_HID_SUPPORT__ */

    else if(BatteryCheckHandleRange(p_ind->handle))
    {
        BatteryHandleAccessRead(p_ind);
    }
    else if(ScanParamCheckHandleRange(p_ind->handle))
    {
        ScanParamHandleAccessRead(p_ind);
    }
    else if(DeviceInfoCheckHandleRange(p_ind->handle))
    {
        DeviceInfoHandleAccessRead(p_ind);
    }
    else if(BondMgmtCheckHandleRange(p_ind->handle))
    {
        BondMgmtHandleAccessRead(p_ind);
    }
    else
    {
        GattAccessRsp(p_ind->cid, p_ind->handle,
                      gatt_status_read_not_permitted,
                      0, NULL);
    }

}