|
1 /* |
|
2 * Copyright (c) 2009 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: This class implements command queue for BgScan. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 2 % |
|
20 */ |
|
21 |
|
22 |
|
23 #ifndef WLANBGSCANCOMMAND_H |
|
24 #define WLANBGSCANCOMMAND_H |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <e32std.h> |
|
28 #include <e32property.h> |
|
29 #include <e32msgqueue.h> |
|
30 |
|
31 // forward declarations |
|
32 class MWlanBgScanCommandListener; |
|
33 |
|
34 /** |
|
35 * CWlanBgScanCommand class |
|
36 * |
|
37 * @since S60 v5.2 |
|
38 */ |
|
39 |
|
40 NONSHARABLE_CLASS( CWlanBgScanCommand ) : |
|
41 public CActive |
|
42 { |
|
43 |
|
44 public: |
|
45 |
|
46 /** |
|
47 * WLAN BgScan Commands. |
|
48 */ |
|
49 enum TWlanBgScanCommand |
|
50 { |
|
51 ESetInterval = 0, |
|
52 ECommandMax // Last command, not used |
|
53 }; |
|
54 |
|
55 /** |
|
56 * Static constructor. |
|
57 * @param aObserver Object that is commanded based on received commands. |
|
58 */ |
|
59 static CWlanBgScanCommand* NewL( MWlanBgScanCommandListener& aListener ); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 ~CWlanBgScanCommand(); |
|
65 |
|
66 /** |
|
67 * Command Queue. |
|
68 * Queues command for waiting to be executed. The method completes |
|
69 * AWS's AO, which RunL method will then be called in AWS thread |
|
70 * context. |
|
71 * @param aCommand Command to be queued. |
|
72 * @param aParameter Parameter for the command to be queued. |
|
73 * @param aStatus Status of the calling active object. On successful |
|
74 * completion contains KErrNone, otherwise one of the |
|
75 * system-wide error codes. |
|
76 */ |
|
77 void CommandQueue( TWlanBgScanCommand aCommand, TUint32 aParameter, TRequestStatus& aStatus ); |
|
78 |
|
79 private: // CWlanBgScanCommand private definitions |
|
80 |
|
81 /** |
|
82 * WLAN BgScan Message. |
|
83 * Message format used in BgScan message queue. |
|
84 */ |
|
85 struct TWlanBgScanMsg |
|
86 { |
|
87 TWlanBgScanCommand iCommand; |
|
88 TUint32 iParameter; |
|
89 TRequestStatus* iReportStatusPtr; |
|
90 RThread iClientThread; |
|
91 }; |
|
92 |
|
93 private: // CWlanBgScanCommand private methods |
|
94 |
|
95 /** |
|
96 * C++ constructor. |
|
97 * @param aListener Object that is commanded based on received commands. |
|
98 */ |
|
99 CWlanBgScanCommand( MWlanBgScanCommandListener& aListener ); |
|
100 |
|
101 /** |
|
102 * Symbian 2nd phase constructor. |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 /** |
|
107 * Process Commands. |
|
108 * Processes all the commands from BgScan message queue. This method is |
|
109 * called when BgScan is indicated that there are messages in the queue. |
|
110 * The method is called from RunL. |
|
111 */ |
|
112 void ProcessCommands(); |
|
113 |
|
114 private: // From CActive |
|
115 |
|
116 /** |
|
117 * Handles an active object's request completion event. |
|
118 */ |
|
119 void RunL(); |
|
120 |
|
121 /** |
|
122 * Cancels asynchronous request. |
|
123 */ |
|
124 void DoCancel(); |
|
125 |
|
126 /** |
|
127 * Handles a leave occurring in RunL(). |
|
128 * @param aError Error that caused RunL to leave. |
|
129 */ |
|
130 TInt RunError( TInt aError ); |
|
131 |
|
132 private: // CAwsWlanScanMonitor private data |
|
133 |
|
134 /** |
|
135 * BgScan Command Listener. |
|
136 * Component to which commands are passed for processing. |
|
137 */ |
|
138 MWlanBgScanCommandListener& iListener; |
|
139 |
|
140 /** |
|
141 * Message Queue. |
|
142 * Message queue for commands coming from WLAN Engine. |
|
143 */ |
|
144 RMsgQueue<TWlanBgScanMsg> iMsgQueue; |
|
145 |
|
146 }; |
|
147 |
|
148 #endif // WLANBGSCANCOMMAND_H |