wlan_bearer/wlanengine/wlan_common/wlanengine_common_3.1/src/core_operation_get_statistics.cpp
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Statemachine for getting the packet statistics.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "core_operation_get_statistics.h"
       
    20 #include "core_roam_metrics.h"
       
    21 #include "core_server.h"
       
    22 #include "am_debug.h"
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 core_operation_get_statistics_c::core_operation_get_statistics_c(
       
    30     u32_t request_id,
       
    31     core_server_c* server,
       
    32     abs_core_driverif_c* drivers,
       
    33     abs_core_server_callback_c* adaptation,
       
    34     core_packet_statistics_s& statistics ) :
       
    35     core_operation_base_c( core_operation_get_statistics, request_id, server, drivers, adaptation,
       
    36         core_base_flag_none ),
       
    37     client_statistics_m( statistics )
       
    38     {
       
    39     DEBUG( "core_operation_get_statistics_c::core_operation_get_statistics_c()" );
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 core_operation_get_statistics_c::~core_operation_get_statistics_c()
       
    46     {
       
    47     DEBUG( "core_operation_get_statistics_c::~core_operation_get_statistics_c()" );
       
    48     }
       
    49     
       
    50 // ---------------------------------------------------------------------------
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 core_error_e core_operation_get_statistics_c::next_state()
       
    54     {
       
    55     DEBUG( "core_operation_get_statistics_c::next_state()" );    
       
    56 
       
    57     switch ( operation_state_m )
       
    58         {
       
    59         case core_state_init:
       
    60             {
       
    61             server_m->get_core_settings().roam_metrics().trace_current_roam_metrics();
       
    62 
       
    63             if ( !server_m->get_core_settings().is_connected() )
       
    64                 {
       
    65                 DEBUG( "core_operation_connect_c::next_state() - not connected, returning cached packet statistics" );
       
    66 
       
    67                 client_statistics_m = server_m->get_core_settings().connection_statistics();
       
    68 
       
    69                 return core_error_ok;
       
    70                 }
       
    71 
       
    72             operation_state_m = core_state_req_packet_statistics;
       
    73 
       
    74             DEBUG( "core_operation_get_statistics_c::next_state() - requesting packet statistics from drivers" );
       
    75 
       
    76             drivers_m->get_packet_statistics(
       
    77                 request_id_m,
       
    78                 current_statistics_m );        
       
    79 
       
    80             break;
       
    81             }
       
    82         case core_state_req_packet_statistics:
       
    83             {
       
    84             core_packet_statistics_s statistics =
       
    85                 server_m->get_core_settings().connection_statistics();
       
    86 
       
    87             DEBUG( "core_operation_get_statistics_c::next_state() - previous packet statistics:" );
       
    88             DEBUG1( "core_operation_get_statistics_c::next_state() - tx_frames:           %u",
       
    89                 statistics.tx_frames );
       
    90             DEBUG1( "core_operation_get_statistics_c::next_state() - rx_frames:           %u",
       
    91                 statistics.rx_frames );
       
    92             DEBUG1( "core_operation_get_statistics_c::next_state() - tx_multicast_frames: %u",
       
    93                 statistics.tx_multicast_frames );
       
    94             DEBUG1( "core_operation_get_statistics_c::next_state() - rx_multicast_frames: %u",
       
    95                 statistics.rx_multicast_frames );
       
    96             DEBUG1( "core_operation_get_statistics_c::next_state() - fcs_errors:          %u",
       
    97                 statistics.fcs_errors );
       
    98             DEBUG1( "core_operation_get_statistics_c::next_state() - tx_retries:          %u",
       
    99                 statistics.tx_retries );
       
   100             DEBUG1( "core_operation_get_statistics_c::next_state() - tx_errors:           %u",
       
   101                 statistics.tx_errors );
       
   102 
       
   103             server_m->get_core_settings().update_connection_statistics(
       
   104                 current_statistics_m );
       
   105 
       
   106             client_statistics_m = server_m->get_core_settings().connection_statistics();
       
   107 
       
   108             DEBUG( "core_operation_get_statistics_c::next_state() - current packet statistics:" );
       
   109             DEBUG1( "core_operation_get_statistics_c::next_state() - tx_frames:           %u",
       
   110                 client_statistics_m.tx_frames );
       
   111             DEBUG1( "core_operation_get_statistics_c::next_state() - rx_frames:           %u",
       
   112                 client_statistics_m.rx_frames );
       
   113             DEBUG1( "core_operation_get_statistics_c::next_state() - tx_multicast_frames: %u",
       
   114                 client_statistics_m.tx_multicast_frames );
       
   115             DEBUG1( "core_operation_get_statistics_c::next_state() - rx_multicast_frames: %u",
       
   116                 client_statistics_m.rx_multicast_frames );
       
   117             DEBUG1( "core_operation_get_statistics_c::next_state() - fcs_errors:          %u",
       
   118                 client_statistics_m.fcs_errors );
       
   119             DEBUG1( "core_operation_get_statistics_c::next_state() - tx_retries:          %u",
       
   120                 client_statistics_m.tx_retries );
       
   121             DEBUG1( "core_operation_get_statistics_c::next_state() - tx_errors:           %u",
       
   122                 client_statistics_m.tx_errors );
       
   123 
       
   124             return core_error_ok;
       
   125             }
       
   126         default:
       
   127             {
       
   128             ASSERT( false_t );
       
   129             }
       
   130         }
       
   131 
       
   132     return core_error_request_pending;
       
   133     }