English
Language : 

AN91184 Datasheet, PDF (24/36 Pages) Ramtron International Corporation – Designing BLE Applications
PSoC® 4 BLE – Designing BLE Applications
break;
/* This event is received when device is disconnected or advertising times out*/
case CYBLE_EVT_GAP_DEVICE_DISCONNECTED:
case CYBLE_EVT_TIMEOUT:
/* Sets the ENABLE_HIBERNATE flag to put system in Hibernate mode */
SystemFlag |= ENABLE_HIBERNATE;
break;
/* This event is received when connection is established */
case CYBLE_EVT_GATT_CONNECT_IND:
/* Start watchdog timer with 1s refresh interval */
/* Note: For this application, wakeup should be 1s because htssInterval
* resolution is configured as 1s */
WatchdogTimer_Start(REFRESH_INTERVAL);
/* Retrieve BLE connection handle */
connectionHandle = *(CYBLE_CONN_HANDLE_T *) eventParam;
break;
default:
/* Error handling */
break;
}
}
Code 4. Health Thermometer Service Event Handler
void HtssEventHandler(uint32 event, void* eventParam)
{
CYBLE_HTS_CHAR_VALUE_T *interval;
switch(event)
{
/* This event is received when indication are enabled by the central */
case CYBLE_EVT_HTSS_INDICATION_ENABLED:
/* Set the htssIndication flag */
htssIndication = true;
break;
/* This event is received when indication are disabled by the central */
case CYBLE_EVT_HTSS_INDICATION_DISABLED:
/* Reset the htssIndiciation flag */
htssIndication = false;
break;
/* This event is received when measurement interval is updated by
* the central */
case CYBLE_EVT_HTSS_CHAR_WRITE:
/* Retrive interval value */
interval = ((CYBLE_HTS_CHAR_VALUE_T *)eventParam);
htssInterval = interval->value->val[1];
/* Update htssInterval with the updated value */
htssInterval = (htssInterval << 8) | interval->value->val[0];
break;
default:
/* Error handling */
break;
}
}
www.cypress.com
Document No. 001-91184 Rev. *B
24