/// Connected State handler definition. const struct ke_msg_handler sample128_connected[] = { {GATTC_WRITE_CMD_IND, (ke_msg_func_t) gattc_write_cmd_ind_handler}, {SAMPLE128_UPD_CHAR2_REQ, (ke_msg_func_t) sample128_upd_char2_req_handler}, }; /// Default State handlers definition const struct ke_msg_handler sample128_default_state[] = { {GAPC_DISCONNECT_IND, (ke_msg_func_t) gap_disconnnect_ind_handler}, }; /// Specifies the message handler structure for every input state. const struct ke_state_handler sample128_state_handler[SAMPLE128_STATE_MAX] = { [SAMPLE128_DISABLED] = KE_STATE_HANDLER(sample128_disabled), [SAMPLE128_IDLE] = KE_STATE_HANDLER(sample128_idle), [SAMPLE128_CONNECTED] = KE_STATE_HANDLER(sample128_connected), }; /// Specifies the message handlers that are common to all states. const struct ke_state_handler sample128_default_handler = KE_STATE_HANDLER(sample128_default_state); /// Defines the place holder for the states of all the task instances. ke_state_t sample128_state[SAMPLE128_IDX_MAX] __attribute__((section("exchange_mem_case1"))); #endif //BLE_SAMPLE128
{ {GATTC_DISC_SVC_IND, (ke_msg_func_t)gattc_disc_svc_ind_handler}, {GATTC_DISC_CHAR_IND, (ke_msg_func_t)gattc_disc_char_ind_handler}, {GATTC_DISC_CHAR_DESC_IND, (ke_msg_func_t)gattc_disc_char_desc_ind_handler}, }; /// Default State handlers definition const struct ke_msg_handler scppc_default_state[] = { {SCPPC_ENABLE_REQ, (ke_msg_func_t)scppc_enable_req_handler}, {GAPC_DISCONNECT_IND, (ke_msg_func_t)gapc_disconnect_ind_handler}, {GATTC_CMP_EVT, (ke_msg_func_t)gattc_cmp_evt_handler}, }; // Specifies the message handler structure for every input state. const struct ke_state_handler scppc_state_handler[SCPPC_STATE_MAX] = { [SCPPC_IDLE] = KE_STATE_HANDLER_NONE, [SCPPC_CONNECTED] = KE_STATE_HANDLER(scppc_connected), [SCPPC_DISCOVERING] = KE_STATE_HANDLER(scppc_discovering), }; // Specifies the message handlers that are common to all states. const struct ke_state_handler scppc_default_handler = KE_STATE_HANDLER(scppc_default_state); // Defines the place holder for the states of all the task instances. ke_state_t scppc_state[SCPPC_IDX_MAX] __attribute__((section("exchange_mem_case1"))); //@WIKRETENTION MEMORY #endif /* (BLE_SP_CLIENT) */ /// @} SCPPCTASK
const struct ke_msg_handler hogpbh_default_state[] = { {HOGPBH_ENABLE_REQ, (ke_msg_func_t)hogpbh_enable_req_handler}, {GAP_DISCON_CMP_EVT, (ke_msg_func_t)gap_discon_cmp_evt_handler}, }; // Specifies the message handler structure for every input state. const struct ke_state_handler hogpbh_state_handler[HOGPBH_STATE_MAX] = { [HOGPBH_IDLE] = KE_STATE_HANDLER_NONE, [HOGPBH_CONNECTED] = KE_STATE_HANDLER(hogpbh_connected), [HOGPBH_DISCOVERING] = KE_STATE_HANDLER(hogpbh_discovering), }; // Specifies the message handlers that are common to all states. const struct ke_state_handler hogpbh_default_handler = KE_STATE_HANDLER(hogpbh_default_state); // Defines the place holder for the states of all the task instances. ke_state_t hogpbh_state[HOGPBH_IDX_MAX]; // Register HOGPBH task into kernel void task_hogpbh_desc_register(void) { struct ke_task_desc task_hogpbh_desc; task_hogpbh_desc.state_handler = hogpbh_state_handler; task_hogpbh_desc.default_handler = &hogpbh_default_handler; task_hogpbh_desc.state = hogpbh_state; task_hogpbh_desc.state_max = HOGPBH_STATE_MAX; task_hogpbh_desc.idx_max = HOGPBH_IDX_MAX;
const struct ke_msg_handler pasps_default_state[] = { {PASPS_CREATE_DB_REQ, (ke_msg_func_t)pasps_create_db_req_handler}, {PASPS_ENABLE_REQ, (ke_msg_func_t)pasps_enable_req_handler}, {PASPS_UPDATE_CHAR_VAL_CMD, (ke_msg_func_t)pasps_update_char_val_cmd_handler}, {GATTC_WRITE_CMD_IND, (ke_msg_func_t)gattc_write_cmd_ind_handler}, {GATTC_CMP_EVT, (ke_msg_func_t)gattc_cmp_evt_handler}, {GAPC_DISCONNECT_IND, (ke_msg_func_t)gapc_disconnect_ind_handler}, }; /// Specifies the message handler structure for every input state. const struct ke_state_handler pasps_state_handler[PASPS_STATE_MAX] = { [PASPS_DISABLED] = KE_STATE_HANDLER_NONE, [PASPS_IDLE] = KE_STATE_HANDLER_NONE, [PASPS_CONNECTED] = KE_STATE_HANDLER_NONE, [PASPS_BUSY] = KE_STATE_HANDLER_NONE, }; /// Specifies the message handlers that are common to all states. const struct ke_state_handler pasps_default_handler = KE_STATE_HANDLER(pasps_default_state); /// Defines the place holder for the states of all the task instances. ke_state_t pasps_state[PASPS_IDX_MAX] __attribute__((section("retention_mem_area0"),zero_init)); //@RETENTION MEMORY #endif //(BLE_PASS_SERVER) /// @} PASPSTASK
{ if(!memcmp(¶m->report.data[3], APP_DFLT_ADV_DATA, APP_DFLT_ADV_DATA_LEN)) { //Save found bd_addr to global variable memcpy(&connect_bdaddr, param->report.adv_addr.addr, sizeof(struct bd_addr)); app_cancel_scanning(); } return (KE_MSG_CONSUMED); } /* * GLOBAL VARIABLES DEFINITION **************************************************************************************** */ /* Specifies the message handlers that are common to all states. */ const struct ke_state_handler app_default_handler = KE_STATE_HANDLER(app_default_state); /* Defines the place holder for the states of all the task instances. */ ke_state_t app_state[APP_IDX_MAX] __attribute__((section("retention_mem_area0"), zero_init)); //RETENTION MEMORY /*Specifies the bd address that device will connect to*/ struct bd_addr connect_bdaddr __attribute__((section("retention_mem_area0"), zero_init)); //RETENTION MEMORY #endif //(BLE_APP_PRESENT) /// @} APPTASK
/// Connected State handler definition. const struct ke_msg_handler adc_notify_connected[] = { {GATTC_WRITE_CMD_IND, (ke_msg_func_t) gattc_write_cmd_ind_handler}, {ADC_NOTIFY_UPD_CHAR_REQ, (ke_msg_func_t) adc_notify_upd_char_req_handler}, }; /// Default State handlers definition const struct ke_msg_handler adc_notify_default_state[] = { {GAPC_DISCONNECT_IND, (ke_msg_func_t) gap_disconnnect_ind_handler}, }; /// Specifies the message handler structure for every input state. const struct ke_state_handler adc_notify_state_handler[ADC_NOTIFY_STATE_MAX] = { [ADC_NOTIFY_DISABLED] = KE_STATE_HANDLER(adc_notify_disabled), [ADC_NOTIFY_IDLE] = KE_STATE_HANDLER(adc_notify_idle), [ADC_NOTIFY_CONNECTED] = KE_STATE_HANDLER(adc_notify_connected), }; /// Specifies the message handlers that are common to all states. const struct ke_state_handler adc_notify_default_handler = KE_STATE_HANDLER(adc_notify_default_state); /// Defines the place holder for the states of all the task instances. ke_state_t adc_notify_state[ADC_NOTIFY_IDX_MAX] __attribute__((section("retention_mem_area0"),zero_init)); #endif //BLE_ADC_NOTIFY
///Connected State handler definition. const struct ke_msg_handler udss_connected[] = { {UDSS_UCP_RSP_REQ, (ke_msg_func_t) udss_ucp_rsp_req_handler}, {GATTC_WRITE_CMD_IND, (ke_msg_func_t) gattc_write_cmd_ind_handler}, }; /// Default State handlers definition const struct ke_msg_handler udss_default_state[] = { {GAPC_DISCONNECT_IND, (ke_msg_func_t) gapc_disconnect_ind_handler}, }; ///Specifies the message handler structure for every input state. const struct ke_state_handler udss_state_handler[UDSS_STATE_MAX] = { [UDSS_DISABLED] = KE_STATE_HANDLER(udss_disabled), [UDSS_IDLE] = KE_STATE_HANDLER(udss_idle), [UDSS_CONNECTED] = KE_STATE_HANDLER(udss_connected), }; ///Specifies the message handlers that are common to all states. const struct ke_state_handler udss_default_handler = KE_STATE_HANDLER(udss_default_state); ///Defines the place holder for the states of all the task instances. ke_state_t udss_state[UDSS_IDX_MAX] __attribute__((section("retention_mem_area0"),zero_init)); //@RETENTION MEMORY #endif //BLE_UDS_SERVER /// @} UDSSTASK
{ {GATT_DISC_SVC_BY_UUID_CMP_EVT, (ke_msg_func_t)gatt_disc_svc_by_uuid_evt_handler}, {GATT_DISC_CHAR_ALL_CMP_EVT, (ke_msg_func_t)gatt_disc_char_all_evt_handler}, {GATT_CMP_EVT, (ke_msg_func_t)gatt_cmp_evt_handler}, }; /// Default State handlers definition const struct ke_msg_handler streamdatah_default_state[] = { {STREAMDATAH_ENABLE_REQ, (ke_msg_func_t)streamdatah_enable_req_handler}, {GAP_DISCON_CMP_EVT, (ke_msg_func_t)gap_discon_cmp_evt_handler}, }; // Specifies the message handler structure for every input state. const struct ke_state_handler streamdatah_state_handler[STREAMDATAH_STATE_MAX] = { [STREAMDATAH_IDLE] = KE_STATE_HANDLER_NONE, [STREAMDATAH_CONNECTED] = KE_STATE_HANDLER(streamdatah_connected), [STREAMDATAH_DISCOVERING] = KE_STATE_HANDLER(streamdatah_discovering), }; // Specifies the message handlers that are common to all states. const struct ke_state_handler streamdatah_default_handler = KE_STATE_HANDLER(streamdatah_default_state); // Defines the place holder for the states of all the task instances. ke_state_t streamdatah_state[STREAMDATAH_IDX_MAX] __attribute__((section("exchange_mem_case1"))); #endif //BLE_STREAMDATA_HOST /// @} STREAMDATAHTASK
return KE_MSG_NO_FREE; } const struct ke_msg_handler my_gtl_default_state[] = { /** Default handler for GTL TX message, this entry has to be put first as table is parsed from end to start by Kernel */ {KE_MSG_DEFAULT_HANDLER, (ke_msg_func_t)my_gtl_msg_send_handler}, #if (DEEP_SLEEP) {GTL_SLEEP_TO, (ke_msg_func_t)gtl_sleep_to_handler}, {GTL_POLLING_TO, (ke_msg_func_t)gtl_polling_to_handler}, #endif // DEEP_SLEEP }; struct ke_state_handler my_gtl_default_handler = KE_STATE_HANDLER(my_gtl_default_state); struct ke_task_desc TASK_DESC_GTL = {NULL, &my_gtl_default_handler, gtl_state, GTL_STATE_MAX, GTL_IDX_MAX}; void patch_gtl_task() { uint8_t hdl; //struct ke_task_desc * p_task_desc = NULL; volatile struct ke_task_elem * curr_list = ke_task_env.task_list; uint8_t curr_nb = ke_task_env.task_cnt; // Search task handle for(hdl=0 ; hdl < curr_nb; hdl++) { if(curr_list[hdl].type == TASK_GTL) { ke_task_env.task_list[hdl].p_desc = &TASK_DESC_GTL;
/// Connected State handler definition. const struct ke_msg_handler findt_connected[] = { {GATTC_WRITE_CMD_IND, (ke_msg_func_t)gattc_write_cmd_ind_handler}, }; /// Default State handlers definition const struct ke_msg_handler findt_default_state[] = { {GAPC_DISCONNECT_IND, (ke_msg_func_t)gapc_disconnect_ind_handler}, }; // Specifies the message handler structure for every input state. const struct ke_state_handler findt_state_handler[FINDT_STATE_MAX] = { [FINDT_DISABLED] = KE_STATE_HANDLER(findt_disabled), [FINDT_IDLE] = KE_STATE_HANDLER(findt_idle), [FINDT_CONNECTED] = KE_STATE_HANDLER(findt_connected), }; // Specifies the message handlers that are common to all states. const struct ke_state_handler findt_default_handler = KE_STATE_HANDLER(findt_default_state); // Defines the place holder for the states of all the task instances. ke_state_t findt_state[FINDT_IDX_MAX] __attribute__((section("retention_mem_area0"),zero_init)); //@RETENTION MEMORY #endif //BLE_FINDME_TARGET /// @} FINDTTASK
const struct ke_msg_handler basc_default_state[] = { {BASC_ENABLE_REQ, (ke_msg_func_t)basc_enable_req_handler}, {GAP_DISCON_CMP_EVT, (ke_msg_func_t)gap_discon_cmp_evt_handler}, }; // Specifies the message handler structure for every input state. const struct ke_state_handler basc_state_handler[BASC_STATE_MAX] = { [BASC_IDLE] = KE_STATE_HANDLER_NONE, [BASC_CONNECTED] = KE_STATE_HANDLER(basc_connected), [BASC_DISCOVERING] = KE_STATE_HANDLER(basc_discovering), }; // Specifies the message handlers that are common to all states. const struct ke_state_handler basc_default_handler = KE_STATE_HANDLER(basc_default_state); // Defines the place holder for the states of all the task instances. ke_state_t basc_state[BASC_IDX_MAX]; // Registet BASC task into kernel void task_basc_desc_register(void) { struct ke_task_desc task_basc_desc; task_basc_desc.state_handler = basc_state_handler; task_basc_desc.default_handler = &basc_default_handler; task_basc_desc.state = basc_state; task_basc_desc.state_max = BASC_STATE_MAX; task_basc_desc.idx_max = BASC_IDX_MAX;
{GATTC_DISC_CHAR_IND, (ke_msg_func_t)gattc_disc_char_ind_handler}, {GATTC_DISC_SVC_IND, (ke_msg_func_t)gattc_disc_svc_ind_handler}, }; /// Default State handlers definition const struct ke_msg_handler sps_client_default_state[] = { {SPS_CLIENT_ENABLE_REQ, (ke_msg_func_t)sps_client_enable_req_handler}, {GAPC_DISCONNECT_IND, (ke_msg_func_t)gapc_disconnect_ind_handler}, {GATTC_CMP_EVT, (ke_msg_func_t)gattc_cmp_evt_handler}, }; // Specifies the message handler structure for every input state. const struct ke_state_handler sps_client_state_handler[SPS_CLIENT_STATE_MAX] = { [SPS_CLIENT_IDLE] = KE_STATE_HANDLER_NONE, [SPS_CLIENT_CONNECTED] = KE_STATE_HANDLER(sps_client_connected), [SPS_CLIENT_DISCOVERING] = KE_STATE_HANDLER(sps_client_discovering), }; // Specifies the message handlers that are common to all states. const struct ke_state_handler sps_client_default_handler = KE_STATE_HANDLER(sps_client_default_state); // Defines the place holder for the states of all the task instances. ke_state_t sps_client_state[SPS_CLIENT_IDX_MAX] __attribute__((section("exchange_mem_case1"))); #endif //BLE_SPS_CLIENT /// @} SPS_CLIENTTASK