wlanutilities/wlansniffer/wlansnifferapplication/src/wlansnifferservice.cpp
changeset 38 2dc6da6fb431
child 56 de27cc8389dd
equal deleted inserted replaced
29:dbe86d96ce5b 38:2dc6da6fb431
       
     1 /*
       
     2 * Copyright (c) 2009-2010 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 "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:
       
    15 * WLAN Sniffer QtHighway Service.
       
    16 */
       
    17 
       
    18 // System includes
       
    19 
       
    20 // User includes
       
    21 
       
    22 #include "wlansnifferservice.h"
       
    23 
       
    24 #include "OstTraceDefinitions.h"
       
    25 #ifdef OST_TRACE_COMPILER_IN_USE
       
    26 #include "wlansnifferserviceTraces.h"
       
    27 #endif
       
    28 
       
    29 /*!
       
    30     \class WlanSnifferService
       
    31     \brief WLAN Sniffer QtHighway service implementation.
       
    32 
       
    33     This class implements a QtHighway service that can be used to launch
       
    34     a WLAN Sniffer application. 
       
    35 */
       
    36 
       
    37 
       
    38 // External function prototypes
       
    39 
       
    40 // Local constants
       
    41 
       
    42 // ======== LOCAL FUNCTIONS ========
       
    43 
       
    44 // ======== MEMBER FUNCTIONS ========
       
    45 
       
    46 /*!
       
    47     Constructor.
       
    48     
       
    49     @param[in] parent Object parent.
       
    50  */
       
    51 
       
    52 WlanSnifferService::WlanSnifferService(QObject* parent) :
       
    53     XQServiceProvider(
       
    54         QLatin1String("wlansniffer.com.nokia.symbian.IWlanSniffer"),
       
    55         parent)
       
    56 {
       
    57     OstTraceFunctionEntry0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_ENTRY);
       
    58     
       
    59     publishAll();
       
    60 
       
    61     OstTraceFunctionExit0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_EXIT);
       
    62 }
       
    63 
       
    64 /*!
       
    65     Destructor.
       
    66  */
       
    67 
       
    68 WlanSnifferService::~WlanSnifferService()
       
    69 {
       
    70     OstTraceFunctionEntry0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_ENTRY);
       
    71     OstTraceFunctionExit0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_EXIT);
       
    72 }
       
    73 
       
    74 /*!
       
    75     Completes the current service.
       
    76  */
       
    77 
       
    78 void WlanSnifferService::complete()
       
    79 {
       
    80     OstTraceFunctionEntry0(WLANSNIFFERSERVICE_COMPLETE_ENTRY);
       
    81     
       
    82     QVariant returnValue(true);
       
    83     bool status = completeRequest(mAsyncRequestIndex, returnValue);
       
    84     Q_ASSERT(status);
       
    85 
       
    86     OstTraceFunctionExit0(WLANSNIFFERSERVICE_COMPLETE_EXIT);
       
    87 }
       
    88 
       
    89 /*!
       
    90     List view service function. Launches the WLAN Sniffer List View.
       
    91  */
       
    92 
       
    93 void WlanSnifferService::listView()
       
    94 {
       
    95     OstTraceFunctionEntry0(WLANSNIFFERSERVICE_LISTVIEW_ENTRY);
       
    96     
       
    97     mAsyncRequestIndex = setCurrentRequestAsync();
       
    98     emit toListView(title());
       
    99 
       
   100     OstTraceFunctionExit0(WLANSNIFFERSERVICE_LISTVIEW_EXIT);
       
   101 }
       
   102 
       
   103 /*
       
   104     Extracts and returns the client application's title (if available).
       
   105     
       
   106     @return Client application's title string or empty if not available.
       
   107  */
       
   108 
       
   109 QString WlanSnifferService::title() const
       
   110 {
       
   111     OstTraceFunctionEntry0(WLANSNIFFERSERVICE_TITLE_ENTRY);
       
   112     
       
   113     // Get service request info
       
   114     XQRequestInfo info = requestInfo();
       
   115     
       
   116     // There must be a valid request info object
       
   117     Q_ASSERT(info.isValid());
       
   118 
       
   119     // Extract the title
       
   120     // TODO: Start using the official define when available
       
   121     QVariant titleInfo = info.info("WindowTitle");
       
   122     QString title = titleInfo.toString();
       
   123     
       
   124     OstTraceFunctionExit0(WLANSNIFFERSERVICE_TITLE_EXIT);
       
   125     return title;
       
   126 }