wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_sub_operation_create_ts.cpp
branchRCL_3
changeset 6 e0f767079796
parent 0 c40eb8fe8501
equal deleted inserted replaced
5:51a71243e562 6:e0f767079796
    14 * Description:  Statemachine for creating a traffic stream.
    14 * Description:  Statemachine for creating a traffic stream.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 /*
    18 /*
    19 * %version: 12 %
    19 * %version: 13 %
    20 */
    20 */
    21 
    21 
    22 #include "core_sub_operation_create_ts.h"
    22 #include "core_sub_operation_create_ts.h"
    23 #include "core_server.h"
    23 #include "core_server.h"
    24 #include "core_frame_wmm_ie.h"
    24 #include "core_frame_wmm_ie.h"
    26 #include "core_frame_action_wmm.h"
    26 #include "core_frame_action_wmm.h"
    27 #include "core_tools.h"
    27 #include "core_tools.h"
    28 #include "core_tools_parser.h"
    28 #include "core_tools_parser.h"
    29 #include "am_debug.h"
    29 #include "am_debug.h"
    30 
    30 
       
    31 /** The amount of microseconds to wait for a response to our request. */
    31 const u32_t CORE_AP_RESP_WAITING_TIME = 1000000;
    32 const u32_t CORE_AP_RESP_WAITING_TIME = 1000000;
       
    33 
       
    34 /** The maximum amount of times AP can reject our request due to invalid parameters. */
       
    35 const u8_t CORE_MAX_INVALID_PARAMETERS_COUNT = 3;
    32 
    36 
    33 // ======== MEMBER FUNCTIONS ========
    37 // ======== MEMBER FUNCTIONS ========
    34 
    38 
    35 // ---------------------------------------------------------------------------
    39 // ---------------------------------------------------------------------------
    36 // ---------------------------------------------------------------------------
    40 // ---------------------------------------------------------------------------
    49         core_base_flag_none ),
    53         core_base_flag_none ),
    50     current_ap_m( ap_data ),
    54     current_ap_m( ap_data ),
    51     tid_m( tid ),
    55     tid_m( tid ),
    52     user_priority_m( user_priority ),
    56     user_priority_m( user_priority ),
    53     tspec_m( tspec ),
    57     tspec_m( tspec ),
    54     stream_status_m( stream_status )
    58     stream_status_m( stream_status ),
       
    59     invalid_parameters_count_m( 0 )
    55     {
    60     {
    56     DEBUG( "core_sub_operation_create_ts_c::core_sub_operation_create_ts_c()" );
    61     DEBUG( "core_sub_operation_create_ts_c::core_sub_operation_create_ts_c()" );
    57 
    62 
    58     stream_status_m = core_traffic_stream_status_inactive_other;
    63     stream_status_m = core_traffic_stream_status_inactive_other;
    59     }
    64     }
   184 
   189 
   185             return core_error_general;
   190             return core_error_general;
   186             }
   191             }
   187         case core_state_invalid_parameters:
   192         case core_state_invalid_parameters:
   188             {
   193             {
       
   194             ++invalid_parameters_count_m;
       
   195 
       
   196             if( invalid_parameters_count_m >= CORE_MAX_INVALID_PARAMETERS_COUNT )
       
   197                 {
       
   198                 server_m->unregister_frame_handler( this );
       
   199 
       
   200                 DEBUG( "core_sub_operation_create_ts_c::next_state() - invalid parameters counter exceeded, giving up" );
       
   201 
       
   202                 return core_error_general;
       
   203                 }
       
   204 
   189             DEBUG( "core_sub_operation_create_ts_c::next_state() - AP has downgraded our parameters, retrying" );
   205             DEBUG( "core_sub_operation_create_ts_c::next_state() - AP has downgraded our parameters, retrying" );
   190 
   206 
   191             return goto_state( core_state_init );
   207             return goto_state( core_state_init );
   192             }
   208             }
   193         case core_state_failure:
   209         case core_state_failure:
   294 
   310 
   295                     asynch_goto( core_state_success, CORE_TIMER_IMMEDIATELY );
   311                     asynch_goto( core_state_success, CORE_TIMER_IMMEDIATELY );
   296                     }
   312                     }
   297                 else if ( wmm_action->status() == core_frame_action_wmm_c::core_dot11_action_wmm_status_invalid_parameters )
   313                 else if ( wmm_action->status() == core_frame_action_wmm_c::core_dot11_action_wmm_status_invalid_parameters )
   298                     {
   314                     {
       
   315                     stream_status_m = core_traffic_stream_status_inactive_invalid_parameters;
       
   316 
   299                     asynch_goto( core_state_invalid_parameters, CORE_TIMER_IMMEDIATELY );
   317                     asynch_goto( core_state_invalid_parameters, CORE_TIMER_IMMEDIATELY );
   300                     }
   318                     }
   301                 else
   319                 else
   302                     {
   320                     {
   303                     stream_status_m = server_m->get_wpx_adaptation_instance().get_wpx_traffic_stream_status(
   321                     stream_status_m = server_m->get_wpx_adaptation_instance().get_wpx_traffic_stream_status(