/********************************************************************* * @fn glucoseDiscStart() * * @brief Start service discovery. * * @param none * * @return New discovery state. */ uint8_t glucoseDiscStart(void) { // Clear handle cache memset(glucoseHdlCache, 0, sizeof(glucoseHdlCache)); // Start discovery with first service return glucoseDiscGattMsg(DISC_GLUCOSE_START, NULL); }
/********************************************************************* * @fn glucCollCentral_processGATTMsg * * @brief Process GATT messages * * @param pMsg - pointer to Gatt Message Event * * @return none */ static void glucCollCentral_processGATTMsg(gattMsgEvent_t *pMsg) { if (pMsg->method == ATT_HANDLE_VALUE_NOTI || pMsg->method == ATT_HANDLE_VALUE_IND) { glucoseIndGattMsg(pMsg); } else if (pMsg->method == ATT_READ_RSP || pMsg->method == ATT_WRITE_RSP) { if(glucCollCharHdls == true) { glucoseCtlPntGattMsg(pMsg); } else { glucCollConfigState = glucoseConfigGattMsg (glucCollConfigState, pMsg); } } else if(glucCollDiscState != DISC_IDLE) { glucCollDiscState = glucoseDiscGattMsg(glucCollDiscState, pMsg); if (glucCollDiscState == DISC_IDLE) { // Start characteristic configuration glucCollConfigState = glucoseConfigNext(GLUCOSE_CONFIG_START); } } else if (pMsg->method == ATT_ERROR_RSP) { if(glucCollCharHdls == true) { glucoseCtlPntGattMsg(pMsg); } else { glucCollConfigState = glucoseConfigGattMsg (glucCollConfigState, pMsg); } } GATT_bm_free(&pMsg->msg, pMsg->method); }