/** * @brief Processes a data response to an MLME-POLL.request * * This function processes a data response to an MLME-POLL.request. * Our coordinator has responded with a data frame. It is checked * whether any data has been received, and the appropriate * MLME-POLL.confirm message is constructed. */ void mac_process_data_response(void) { uint8_t status; if (FCF_FRAMETYPE_BEACON == mac_parse_data.frame_type) { /* * Node is currently in polling state, so only command or data * frames * are of interest. * This is an unexpected frame type, do nothing. * Note. Ack frames are not uploaded to this point. * All subsequent actions are not to be done now. * Instead the timer will expire and initiate the proper stuff. */ return; } else { /* Stop the MaxFrameResponseTime timer */ pal_timer_stop(T_Poll_Wait_Time); #if (_DEBUG_ > 0) if (pal_is_timer_running(T_Poll_Wait_Time)) { Assert("Frame resp tmr running" == 0); } #endif /* * For received command frames (Association response or * disassociation notification) and for data frames with zero * payload length the potential status for the poll.confirm * message * is supposed to be "No data". */ status = MAC_NO_DATA; if ((FCF_FRAMETYPE_DATA == mac_parse_data.frame_type) && (mac_parse_data.mac_payload_length > 0) ) { /* * For received data frames with non-zero payload length * the potential status for the poll.confirm message is * supposed to be "Success". */ status = MAC_SUCCESS; } } if (MAC_POLL_EXPLICIT == mac_poll_state) { /* * Data is received on explicit poll request, hence generate the * poll confirm using * the buffer which was stored in mac_conf_buf_ptr. */ gen_mlme_poll_conf((buffer_t *)mac_conf_buf_ptr, status); } /* MAC was busy during poll. */ MAKE_MAC_NOT_BUSY(); mac_poll_state = MAC_POLL_IDLE; } /* mac_process_data_response() */
/** * @brief ED scan callback function. * * This function is a callback function from the TAL after ED scan * is performed on a specified channel. * * @param energy_level Maximum energy on the channel */ void tal_ed_end_cb(uint8_t energy_level) { MAKE_MAC_NOT_BUSY(); mlme_scan_conf_t *msc; /* * Scan request buffer is used to generate a scan confirm for the ED * scan * which is stored in mac_conf_buf_ptr. */ msc = (mlme_scan_conf_t *)BMM_BUFFER_POINTER( (buffer_t *)mac_conf_buf_ptr); uint8_t n_eds; n_eds = msc->ResultListSize; msc->scan_result_list[0].ed_value[n_eds] = energy_level; msc->ResultListSize++; msc->scan_result_list[0].ed_value[n_eds + 1] = 0; msc->UnscannedChannels &= ~(1UL << scan_curr_channel); /* Continue with next channel */ scan_proceed(MLME_SCAN_TYPE_ED, (buffer_t *)mac_conf_buf_ptr); }
/** * @brief T_Poll_Wait_Time timer callback * * This function implements the T_Poll_Wait_Time timer callback. * If a poll request is pending, a mlme-poll-confirm is generated. * * @param callback_parameter Callback parameter */ void mac_t_poll_wait_time_cb(void *callback_parameter) { if (MAC_POLL_EXPLICIT == mac_poll_state) { /* * Data is not received on time for the poll request, hence * generate * the poll confirm using the poll request buffer which was * stored in * mac_conf_buf_ptr. */ gen_mlme_poll_conf((buffer_t *)mac_conf_buf_ptr, MAC_NO_DATA); } mac_poll_state = MAC_POLL_IDLE; /* MAC was busy during poll. */ MAKE_MAC_NOT_BUSY(); callback_parameter = callback_parameter; /* Keep compiler happy. */ }