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); } else if(HidCheckHandleRange(p_ind->handle)) { HidHandleAccessWrite(p_ind); } else if(BatteryCheckHandleRange(p_ind->handle)) { BatteryHandleAccessWrite(p_ind); } else if(ScanParamCheckHandleRange(p_ind->handle)) { ScanParamHandleAccessWrite(p_ind); } else { GattAccessRsp(p_ind->cid, p_ind->handle, gatt_status_write_not_permitted, 0, NULL); } }
/*----------------------------------------------------------------------------* * NAME * HandleAccessWrite * * DESCRIPTION * This function handles write 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 HandleAccessWrite(GATT_ACCESS_IND_T *p_ind) { /* For the received attribute handle, check all the services that support * attribute 'Write' operation handled by application. */ /* More services may be added here to support their write operations */ if(GapCheckHandleRange(p_ind->handle)) { /* Attribute handle belongs to GAP service */ GapHandleAccessWrite(p_ind); } else if(BatteryCheckHandleRange(p_ind->handle)) { /* Attribute handle belongs to BATTERY service */ BatteryHandleAccessWrite(p_ind); } else if(EsurlBeaconCheckHandleRange(p_ind->handle)) { /* Attribute handle belongs to Beacon service */ EsurlBeaconHandleAccessWrite(p_ind); } else { /* Application doesn't support 'Write' operation on received attribute * handle, so return 'gatt_status_write_not_permitted' status */ GattAccessRsp(p_ind->cid, p_ind->handle, gatt_status_write_not_permitted, 0, NULL); } }
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); } }