/********************************************************************* * @fn thermometerSendStoredMeas * * @brief Prepare and send a stored Meas Indication * * @return none */ static void thermometerSendStoredMeas(void) { bStatus_t status; //we connected to this peer before so send any stored measurements if(thStoreStartIndex != thStoreIndex ) { //send Measurement status = Thermometer_TempIndicate( gapConnHandle, &thStoreMeas[thStoreStartIndex], thermometerTaskId); if(status == SUCCESS) { thStoreStartIndex = thStoreStartIndex +1; // wrap around buffer if(thStoreStartIndex > TH_STORE_MAX) { thStoreStartIndex = 0; } } } }
/********************************************************************* * @fn Thermometer_sendStoredMeas * * @brief Prepare and send a stored Meas Indication. * * @param none * * @return none */ static void Thermometer_sendStoredMeas(void) { // If previously connected to this peer send any stored measurements. if (thStoreStartIndex != thStoreIndex) { bStatus_t status = FAILURE; attHandleValueInd_t *pStoreInd = &thStoreMeas[thStoreStartIndex]; if (pStoreInd->handle == THERMOMETER_TEMP_VALUE_POS) { // Send Measurement. status = Thermometer_TempIndicate(thermometer_connHandle, pStoreInd, ICall_getEntityId()); } else if (pStoreInd->handle == THERMOMETER_INTERVAL_VALUE_POS) { // Send Interval. status = Thermometer_IntervalIndicate(thermometer_connHandle, pStoreInd, ICall_getEntityId()); } if (status == SUCCESS) { thStoreStartIndex = thStoreStartIndex + 1; // Wrap around buffer. if(thStoreStartIndex > TH_STORE_MAX) { thStoreStartIndex = 0; } // Clear out this Meas indication. memset(pStoreInd, 0, sizeof(attHandleValueInd_t)); } } }