/** *@brief Read Req *@param None *@retval None */ static void Read_Request_CB(uint16_t handle) { if(handle == BLueNrgServHandle + 1) { //Acc_Update((AxesRaw_t*)&axes_data); } if(connection_handle != 0) { aci_gatt_allow_read(connection_handle); } }
ble_error_t BlueNRGGattServer::Read_Request_CB(uint16_t handle) { //signed short refvalue; uint16_t gapConnectionHandle = BlueNRGGap::getInstance().getConnectionHandle(); GattReadCallbackParams readParams; readParams.handle = handle; //PRINTF("readParams.charHandle = %d\n\r", readParams.charHandle); HCIDataReadEvent(&readParams); //EXIT: if(gapConnectionHandle != 0){ //PRINTF("Calling aci_gatt_allow_read\n\r"); aci_gatt_allow_read(gapConnectionHandle); } return BLE_ERROR_NONE; }
void HCI_Event_CB(void *pckt) { hci_uart_pckt *hci_pckt = pckt; hci_event_pckt *event_pckt = (hci_event_pckt*)hci_pckt->data; if(hci_pckt->type != HCI_EVENT_PKT) return; switch(event_pckt->evt){ case EVT_DISCONN_COMPLETE: { GAP_DisconnectionComplete_CB(); } break; case EVT_LE_META_EVENT: { evt_le_meta_event *evt = (void *)event_pckt->data; switch(evt->subevent){ case EVT_LE_CONN_COMPLETE: { evt_le_connection_complete *cc = (void *)evt->data; GAP_ConnectionComplete_CB(cc->peer_bdaddr,cc->handle); } break; } } break; case EVT_VENDOR: { evt_blue_aci *blue_evt = (void*)event_pckt->data; switch(blue_evt->ecode){ #ifdef ST_OTA_BTL /* We need to indicate to the stack that the response can be sent to the client */ case EVT_BLUE_GATT_READ_PERMIT_REQ: { //evt_gatt_read_permit_req *pr = (void*)blue_evt->data; if(connection_handle !=0) aci_gatt_allow_read(connection_handle); } break; #endif case EVT_BLUE_GATT_ATTRIBUTE_MODIFIED: { #ifdef ST_OTA_BTL evt_gatt_attr_modified *am = (void*)blue_evt->data; OTA_Write_Request_CB(am); #endif } break; } } break; } }