|
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 #include <xqaiwdecl.h> |
|
24 |
|
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "wlansnifferserviceTraces.h" |
|
28 #endif |
|
29 |
|
30 /*! |
|
31 \class WlanSnifferService |
|
32 \brief WLAN Sniffer QtHighway service implementation. |
|
33 |
|
34 This class implements a QtHighway service that can be used to launch |
|
35 a WLAN Sniffer application. |
|
36 */ |
|
37 |
|
38 |
|
39 // External function prototypes |
|
40 |
|
41 // Local constants |
|
42 |
|
43 // ======== LOCAL FUNCTIONS ======== |
|
44 |
|
45 // ======== MEMBER FUNCTIONS ======== |
|
46 |
|
47 /*! |
|
48 Constructor. |
|
49 |
|
50 @param[in] parent Object parent. |
|
51 */ |
|
52 |
|
53 WlanSnifferService::WlanSnifferService(QObject* parent) : |
|
54 XQServiceProvider( |
|
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 QVariant titleInfo = info.info(XQINFO_KEY_WINDOW_TITLE); |
|
122 QString title = titleInfo.toString(); |
|
123 |
|
124 OstTraceFunctionExit0(WLANSNIFFERSERVICE_TITLE_EXIT); |
|
125 return title; |
|
126 } |