31
|
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 |
// TODO: Change to use the define in xqaiwdeclplat.h
|
|
55 |
QLatin1String("wlansniffer.com.nokia.symbian.IWlanSniffer"),
|
|
56 |
parent)
|
|
57 |
{
|
|
58 |
OstTraceFunctionEntry0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_ENTRY);
|
|
59 |
|
|
60 |
publishAll();
|
|
61 |
|
|
62 |
OstTraceFunctionExit0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICE_EXIT);
|
|
63 |
}
|
|
64 |
|
|
65 |
/*!
|
|
66 |
Destructor.
|
|
67 |
*/
|
|
68 |
|
|
69 |
WlanSnifferService::~WlanSnifferService()
|
|
70 |
{
|
|
71 |
OstTraceFunctionEntry0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_ENTRY);
|
|
72 |
OstTraceFunctionExit0(WLANSNIFFERSERVICE_WLANSNIFFERSERVICEDESTR_EXIT);
|
|
73 |
}
|
|
74 |
|
|
75 |
/*!
|
|
76 |
Completes the current service.
|
|
77 |
*/
|
|
78 |
|
|
79 |
void WlanSnifferService::complete()
|
|
80 |
{
|
|
81 |
OstTraceFunctionEntry0(WLANSNIFFERSERVICE_COMPLETE_ENTRY);
|
|
82 |
|
|
83 |
QVariant returnValue(true);
|
|
84 |
bool status = completeRequest(mAsyncRequestIndex, returnValue);
|
|
85 |
Q_ASSERT(status);
|
|
86 |
|
|
87 |
OstTraceFunctionExit0(WLANSNIFFERSERVICE_COMPLETE_EXIT);
|
|
88 |
}
|
|
89 |
|
|
90 |
/*!
|
|
91 |
List view service function. Launches the WLAN Sniffer List View.
|
|
92 |
*/
|
|
93 |
|
|
94 |
void WlanSnifferService::listView()
|
|
95 |
{
|
|
96 |
OstTraceFunctionEntry0(WLANSNIFFERSERVICE_LISTVIEW_ENTRY);
|
|
97 |
|
|
98 |
mAsyncRequestIndex = setCurrentRequestAsync();
|
|
99 |
emit toListView(title());
|
|
100 |
|
|
101 |
OstTraceFunctionExit0(WLANSNIFFERSERVICE_LISTVIEW_EXIT);
|
|
102 |
}
|
|
103 |
|
|
104 |
/*
|
|
105 |
Extracts and returns the client application's title (if available).
|
|
106 |
|
|
107 |
@return Client application's title string or empty if not available.
|
|
108 |
*/
|
|
109 |
|
|
110 |
QString WlanSnifferService::title() const
|
|
111 |
{
|
|
112 |
OstTraceFunctionEntry0(WLANSNIFFERSERVICE_TITLE_ENTRY);
|
|
113 |
|
|
114 |
// Get service request info
|
|
115 |
XQRequestInfo info = requestInfo();
|
|
116 |
|
|
117 |
// There must be a valid request info object
|
|
118 |
Q_ASSERT(info.isValid());
|
|
119 |
|
|
120 |
// Extract the title
|
|
121 |
// TODO: Start using the official define when available
|
|
122 |
QVariant titleInfo = info.info("WindowTitle");
|
|
123 |
QString title = titleInfo.toString();
|
|
124 |
|
|
125 |
OstTraceFunctionExit0(WLANSNIFFERSERVICE_TITLE_EXIT);
|
|
126 |
return title;
|
|
127 |
}
|