void lib_aci_started_stdby_hook(aci_evt_t *p_rcvd_evt_data) { #if DEBUG_ENABLE aci_evt_params_device_started_t *p_device_started_data; p_device_started_data = &(p_rcvd_evt_data->params.device_started); if (ACI_BOND_STATUS_SUCCESS != p_device_started_data->hw_error) { // LIB_TRACES_LOG_ERROR_1VAR(ERROR_CODE_STDBY_EVT_WITH_HW_ERROR, p_device_started_data->hw_error); } LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_STARTED_STDBY, app_state); #endif /* Start Place holder code - Add code here to process this Event data */ p_rcvd_evt_data = NULL; /* End Place holder code */ switch(app_state) { case APP_SLEEP: //do nothing, the command response event will trig the next state break; case APP_INIT: // LIB_TRACES_LOG_ERROR_1VAR(ERROR_CODE_STDBY_EVT_NOT_EXPECTED, app_state); break; case APP_SETUP_FINISHED: app_state = APP_STANDBY; on_process_app(); break; default : // LIB_TRACES_LOG_ERROR_1VAR(ERROR_CODE_STDBY_EVT_NOT_EXPECTED, app_state); break; } }
void lib_aci_timing_hook(aci_evt_t *p_rcvd_evt_data) { // LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_TIMING_EVT, (uint8_t)(p_rcvd_evt_data->params.timing.conn_rf_interval)); // LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_TIMING_EVT, (uint8_t)(p_rcvd_evt_data->params.timing.conn_rf_interval>>8)); /* Start Place holder code - Edit code here to process this Event data */ p_rcvd_evt_data = NULL; /* End Place holder code */ // Having changed the timing, we can go on to the RUN state app_state = APP_RUN; on_process_app(); }
void lib_aci_disconnect_hook(aci_evt_t *p_rcvd_evt_data) { aci_evt_params_disconnected_t *p_disconnect_data; p_disconnect_data = &(p_rcvd_evt_data->params.disconnected); // LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_DISCONNECTED, p_disconnect_data->aci_status); // LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_DISCONNECTED, p_disconnect_data->btle_status); // is_connected = 0; bleDidDisconnect(); app_state = APP_STANDBY; app_next_state = APP_STANDBY; on_process_app(); }
void lib_aci_bond_status_hook(aci_evt_t *p_rcvd_evt_data) { aci_evt_params_bond_status_t *p_bond_status_data; p_bond_status_data = &(p_rcvd_evt_data->params.bond_status); // LIB_TRACES_LOG_INFO_1VAR(INFO_CODE_BOND, p_bond_status_data->status_code); if (ACI_STATUS_SUCCESS == p_bond_status_data->status_code) { #ifdef BONDING is_bonded = true; #endif app_state = APP_RUN; app_next_state = APP_RUN; on_process_app(); } }
void lib_aci_transaction_finished_hook(void) { app_state = app_next_state; if (APP_SETUP_FINISHED == app_state) { /* State transition occurs on DeviceStartedEvent */ app_next_state = APP_SETUP_FINISHED; // LIB_TRACES_LOG_INFO(INFO_CODE_WAIT_STD_BY); /* Check that the CommandResponseEvent is received with status transaction complete for last setup message */ // ASSERT(ERROR_CODE_SETUP_ERROR, (lib_aci_is_host_setup_complete())); } else { on_process_app(); } }
void ble_begin() { hal_aci_tl_io_config(); is_connected = 0; app_state = APP_INIT; lib_aci_init(); ENABLE_INTERRUPTS(); lib_aci_radio_reset(); app_state = APP_SLEEP; on_process_app(); }
void lib_aci_started_setup_hook(aci_evt_t *p_rcvd_evt_data) { #if DEBUG_ENABLE aci_evt_params_device_started_t *p_device_started_data; p_device_started_data = &(p_rcvd_evt_data->params.device_started); if (ACI_BOND_STATUS_SUCCESS != p_device_started_data->hw_error) { // LIB_TRACES_LOG_ERROR_1VAR(ERROR_CODE_STDBY_EVT_WITH_HW_ERROR, p_device_started_data->hw_error); } // LIB_TRACES_LOG_INFO(INFO_CODE_SETUP); #endif /* Start Place holder code - Add code here to process this Event data */ p_rcvd_evt_data = NULL; /* End Place holder code */ app_state = APP_SETUP; on_process_app(); }
void lib_aci_hw_error_hook(aci_evt_t *p_rcvd_evt_data, uint8_t data_len) { #if DEBUG_ENABLE uint8_t byte_index; aci_evt_params_hw_error_t *p_hw_error_data; p_hw_error_data = &(p_rcvd_evt_data->params.hw_error); // LIB_TRACES_LOG_ERROR(ERROR_CODE_ERR_HANDLING_RADIO_HW_ERROR); // LIB_TRACES_LOG_ERROR_1VAR(ERROR_CODE_ERR_HANDLING_RADIO_HW_ERROR_LINE_NUM_MSB, (uint8_t)(p_hw_error_data->line_num>>8)); // LIB_TRACES_LOG_ERROR_1VAR(ERROR_CODE_ERR_HANDLING_RADIO_HW_ERROR_LINE_NUM_LSB, (uint8_t)(p_hw_error_data->line_num)); for(byte_index = 0; byte_index < data_len-2; byte_index++) { // LIB_TRACES_LOG_ERROR_1VAR(ERROR_CODE_ERR_HANDLING_RADIO_HW_ERROR_CONTENT, p_hw_error_data->file_name[byte_index]); } #endif /* Start Place holder code - Add code here to process this Event data */ p_rcvd_evt_data = NULL; data_len = 0; /* End Place holder code */ app_state = APP_SETUP; app_next_state = APP_SETUP; on_process_app(); }