static void handleAccessWrite(GATT_ACCESS_IND_T *p_ind)
{

    /* Check all the services that support attribute 'Write' operation handled
     * by application
     */
    if(GapCheckHandleRange(p_ind->handle))
    {
        GapHandleAccessWrite(p_ind);
    }
#ifdef ENABLE_OTA
    else if(GattCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to Gatt service */
        GattHandleAccessWrite(p_ind);
    }
    else if(OtaCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to OTA service */
        OtaHandleAccessWrite(p_ind);
    }
#endif /* ENABLE_OTA */
    else if(HidCheckHandleRange(p_ind->handle))
    {
        HidHandleAccessWrite(p_ind);
    }

#ifdef __PROPRIETARY_HID_SUPPORT__

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

#endif /* __PROPRIETARY_HID_SUPPORT__ */

    else if(BatteryCheckHandleRange(p_ind->handle))
    {
        BatteryHandleAccessWrite(p_ind);
    }
    else if(ScanParamCheckHandleRange(p_ind->handle))
    {
        ScanParamHandleAccessWrite(p_ind);
    }
    else if(BondMgmtCheckHandleRange(p_ind->handle))
    {
        BondMgmtHandleAccessWrite(p_ind);
    }
    else
    {
        GattAccessRsp(p_ind->cid, p_ind->handle,
                      gatt_status_write_not_permitted,
                      0, NULL);
    }

}
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);
    }

}
示例#3
0
/*----------------------------------------------------------------------------*
 *  NAME
 *      HandleAccessWrite
 *
 *  DESCRIPTION
 *      This function handles Write operation on attributes (as received in 
 *      GATT_ACCESS_IND message) maintained by the application.
 *
 *  RETURNS
 *      Nothing
 *
 *---------------------------------------------------------------------------*/
extern void HandleAccessWrite(GATT_ACCESS_IND_T *p_ind)
{

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

    if(GapCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to GAP service */
        GapHandleAccessWrite(p_ind);
    }
    else if(MeshControlCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to Mesh Control service */
        MeshControlHandleAccessWrite(p_ind);
    }
#ifdef ENABLE_GATT_OTA_SERVICE 
    else if(GattCheckHandleRange(p_ind->handle))
    {
        /* Attribute handle belongs to Gatt service */
        GattHandleAccessWrite(p_ind);
    }
    else if(OtaCheckHandleRange(p_ind->handle))
    {
        OtaHandleAccessWrite(p_ind);
    }
#endif /* ENABLE_GATT_OTA_SERVICE */
    else
    {
        /* Application doesn't support 'Write' operation on received 
         * attribute handle, hence return 'gatt_status_write_not_permitted'
         * status
         */
        GattAccessRsp(p_ind->cid, p_ind->handle, 
                      gatt_status_write_not_permitted,
                      0, NULL);
    }

}