📄 idle enter execs
字号:
/** The purpose of this state is to wait until the packet has **/
/** arrived from the higher or lower layer. **/
/** In this state following intrpts can occur: **/
/** 1. Data arrival from application layer **/
/** 2. Frame (DATA,ACK,RTS,CTS) rcvd from PHY layer **/
/** 3. Busy intrpt stating that frame is being rcvd **/
/** 4. Coll intrpt indicating that more than one frame is rcvd **/
/* */
/* When Data arrives from the application layer, insert it in */
/* the queue. If rcvr is not busy then set Deference to DIFS */
/* and Change state to "DEFER" state. Set Backoff flag if the */
/* station needs to backoff. */
/* */
/* Rcvd RTS,CTS,DATA,or ACK (frame rcvd intrpt): */
/* If the frame is destined for this station then send */
/* appropriate response and set deference to SIFS clear the */
/* rcvr busy flag and clamp any data transmission. */
// IMMEDIATELY RESET adaptive timeout
//if (op_ev_pending (wsn_ta_evh)) op_ev_cancel (wsn_ta_evh);
//wsn_ta_evh = op_intrpt_schedule_self (op_sim_time() + wsn_ta_time, WlanC_Sleep_Schedule);
//printf("set wsn_ta_evh node <%d> at time <%e> for <%f> secs\n", my_address, op_sim_time(), wsn_ta_time);
//WSN
// assigns the unique state number and writes the sleep status to the sleep statistic handeler for graphing purposes
state = WSN_IDLE;
// mib took the sleep stat update out off every state to reduce events
//op_stat_write_t (sleep_stathandle, sleep_temp, op_sim_time());
#ifndef OPD_NO_DEBUG
// for diagnostic purposes, programmers can indicate the address of up to 2 stations that they want to follow
// and can indicate what time the printf statement should be outputtted
// NOTICE: Opnet's ODB has to be used to see the printed statements
if ((op_sim_time() >= wsn_test_time) && (my_address == wsn_test_address || my_address == wsn_test_address_2) )
printf("Node <%d> in IDLE at time %f\n", my_address, op_sim_time(),energy_consum_total_local);
#endif
// Set the adaptive timeout TA interrupt if not already set
if( !op_ev_valid(wsn_ta_evh) )
{
wsn_ta_evh = op_intrpt_schedule_self (op_sim_time() + wsn_ta_time, WlanC_Sleep_Schedule_Cyclic);
#ifndef OPD_NO_DEBUG
if ((op_sim_time() > wsn_test_time) && (my_address == wsn_test_address || my_address == wsn_test_address_2) )
{
printf("STA %d in IDLE -> WSN TA Timeout reset to wake up in %e secs at %e\n", my_address, wsn_ta_time,op_sim_time() + wsn_ta_time);
}
#endif
}
if (wlan_trace_active)
{
/* Determine the current state name. */
strcpy (current_state_name, "idle");
}
/* If roaming is enabled on this node, then ensure that */
/* connectivity is checked every few beacon intervals. If the */
/* scan type is "virtual" (where the distance or pathloss to */
/* all AP's are evaluated directly) then AP evaluation is done */
/* if needed whenever any new interrupt is processed. Moreover, */
/* the time at which connectivity to the AP should be next */
/* evaluated is also updated each time this evaluation is */
/* performed. Therefore, we need not update the next evaluation */
/* time. On the other hand, if the scan type is based on */
/* actual beacon or signal strength evaluation, the next */
/* evaluation time is not updated when new interrupts are */
/* processed. Therefore the next evaluation time must be */
/* updated. See wlan_interrupts_process() for clarification. */
if (roam_state_ptr->enable_roaming)
{
if (roam_state_ptr->scan_type != WlanC_Scan_Type_Distance)
{
ap_connectivity_check_time = op_sim_time () + beacon_int * WLANC_CONN_CHK_BEACON_MULT;
}
ap_connectivity_check_evhndl = op_intrpt_schedule_self (ap_connectivity_check_time, WlanC_AP_Check_Timeout);
}
/* Reset the forced backoff end flag that may have been set in */
/* the BACKOFF state under rare, special cases. */
wlan_flags->forced_bk_end = OPC_FALSE;
/* Unlock the mutex that serializes accessing the roaming */
/* related information of this MAC. */
op_prg_mt_mutex_unlock (roam_state_ptr->roam_info_mutex);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -