static void send_event_callback(void * item, void * param) { struct cfw_message * msg = (struct cfw_message *) param; indication_list_t * ind = (indication_list_t *) item; struct cfw_message * m = cfw_clone_message(msg); if (m != NULL ) { CFW_MESSAGE_DST(m) = ind->conn_handle->client_port; cfw_send_message(m); } }
/**@brief Function to handle audio requests to play tone and/or sentence. * * @param[in] msg Request message. * @return none */ void ui_handle_audio_req(message_t * msg) { uint32_t audio_data; uint8_t sps_id; uint8_t tone_id; ui_audio_req = cfw_clone_message(msg); if (ui_audio_req == NULL) force_panic(); /* Tone and sequence identifiers are coded as follows: */ /* Byte #3 | Byte #2 | Byte #1 | Byte #0 */ /* future use | Tone id | Domain id 4 bits | Sentence id */ /* | | Request id 4 bits | */ if (msg->id == MSG_ID_UI_LPAL_REQ) { audio_data = ((ui_lpal_evt_rsp_t *) msg)->ui_lpal_event_rsp_id; } else if (MSG_ID_UI_ASR_REQ) { audio_data = ((ui_asr_evt_rsp_t *) msg)->ui_asr_event_rsp_id; } sps_id = audio_data & RESP_ID_MASK_SENTENCE; sps_id_stream_pending = sps_id; audio_data = audio_data >> 16; tone_id = audio_data & RESP_ID_MASK_TONE; if (tone_id) /* Play tone first. */ ui_tone_play_init(tone_id, msg->priv); else if (sps_id) /* Play speech sequence. */ ui_sps_play_init(sps_id, msg->priv); else /* Empty request. */ pr_error(LOG_MODULE_UI_SVC, "No tone or speech sentence in request"); }