5
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-2006 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: describes system information notifiers.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __SYSCONNECTIONREQUEST_H__
|
|
20 |
#define __SYSCONNECTIONREQUEST_H__
|
|
21 |
|
|
22 |
//INCLUDES
|
|
23 |
#include<rconnmon.h>
|
|
24 |
|
|
25 |
#include "sysinfo.h"
|
|
26 |
#include "activerequests.h"
|
|
27 |
|
|
28 |
// CONSTANT DECLARATIONS
|
|
29 |
const TInt KMaxConnName = 256;
|
|
30 |
|
|
31 |
// FORWARD DECLARATIONS
|
|
32 |
|
|
33 |
/**
|
|
34 |
* @ref MConnectInfoCallback
|
|
35 |
* Observer class to handle to async response.
|
|
36 |
*
|
|
37 |
*/
|
|
38 |
class MConnectInfoCallback
|
|
39 |
{
|
|
40 |
public:
|
|
41 |
//Gets called when complete connection attributes are read.
|
|
42 |
virtual void HandleConnectionInfoL(CConnectionInfo*& aInfo,TInt error=0)=0;
|
|
43 |
virtual ~MConnectInfoCallback() { };
|
|
44 |
};
|
|
45 |
|
|
46 |
/**
|
|
47 |
* @ref CReadConnectionInfo
|
|
48 |
* active object class to read all connection attributes of an ConnectionID.
|
|
49 |
*
|
|
50 |
*/
|
|
51 |
NONSHARABLE_CLASS(CReadConnectionInfo):public CActive
|
|
52 |
{
|
|
53 |
public:
|
|
54 |
/**
|
|
55 |
* Two-phased constructor.
|
|
56 |
*
|
|
57 |
* @return A new instance of this class.
|
|
58 |
*/
|
|
59 |
static CReadConnectionInfo* NewL(RConnectionMonitor& aConnMon,TUint aConnId,
|
|
60 |
MConnectInfoCallback* aCallBack,
|
|
61 |
CConnectionInfo::TConnectionState aState,
|
|
62 |
TSysRequest::TRequestType aReqType);
|
|
63 |
|
|
64 |
/**
|
|
65 |
* Destructor.
|
|
66 |
*/
|
|
67 |
~CReadConnectionInfo();
|
|
68 |
|
|
69 |
private:
|
|
70 |
/**
|
|
71 |
* C++ default constructor.
|
|
72 |
*/
|
|
73 |
CReadConnectionInfo(RConnectionMonitor& aConnMon,TUint aConnId,
|
|
74 |
MConnectInfoCallback* aCallBack,
|
|
75 |
CConnectionInfo::TConnectionState aState,
|
|
76 |
TSysRequest::TRequestType aReqType);
|
|
77 |
|
|
78 |
public:
|
|
79 |
/**
|
|
80 |
* Issues asynchronous request.
|
|
81 |
*/
|
|
82 |
TInt Request();
|
|
83 |
|
|
84 |
protected: // From CActive
|
|
85 |
void RunL();
|
|
86 |
void DoCancel();
|
|
87 |
|
|
88 |
private:
|
|
89 |
//Enumeration of states involved in getting connection information.
|
|
90 |
typedef enum{
|
|
91 |
EInitial,
|
|
92 |
EIAPId,
|
|
93 |
EBearerType,
|
|
94 |
EIAPName,
|
|
95 |
ENetworkName,
|
|
96 |
EIAPConnectionName,
|
|
97 |
EComplete
|
|
98 |
}TConnstate;
|
|
99 |
|
|
100 |
//ConnectionID whose attributes to be read.
|
|
101 |
TUint iConnectionID;
|
|
102 |
//Observer to handle response.
|
|
103 |
MConnectInfoCallback* iCallBack;
|
|
104 |
//Connection to Connection Server.
|
|
105 |
RConnectionMonitor iConnMon;
|
|
106 |
|
|
107 |
//Access point ID.
|
|
108 |
TUint iIAPId;
|
|
109 |
//Connection Type.
|
|
110 |
TInt iBearerType;
|
|
111 |
//Access point name.
|
|
112 |
HBufC* iIAPName;
|
|
113 |
//Network name.
|
|
114 |
HBufC* iNetworkName;
|
|
115 |
//Connection Name.
|
|
116 |
HBufC* iConnectionName;
|
|
117 |
//State variable for reading attributes.
|
|
118 |
TConnstate iState;
|
|
119 |
//Connection State.
|
|
120 |
CConnectionInfo::TConnectionState iConnState;
|
|
121 |
|
|
122 |
TBuf<KMaxConnName> iNameBuf;
|
|
123 |
|
|
124 |
TSysRequest::TRequestType iReqType ;
|
|
125 |
};
|
|
126 |
|
|
127 |
/**
|
|
128 |
* @ref CReadConnectionInfo
|
|
129 |
* active object class to read all connection attributes of an ConnectionID.
|
|
130 |
*
|
|
131 |
*/
|
|
132 |
NONSHARABLE_CLASS(CConnection): public CActiveRequest,
|
|
133 |
private MConnectionMonitorObserver,
|
|
134 |
private MConnectInfoCallback
|
|
135 |
{
|
|
136 |
public: // Constructors and destructor
|
|
137 |
/**
|
|
138 |
* Two-phased constructor.
|
|
139 |
*
|
|
140 |
* @return A new instance of this class.
|
|
141 |
*/
|
|
142 |
static CConnection* NewL(const TSysRequest& aRequest);
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Destructor.
|
|
146 |
*/
|
|
147 |
~CConnection();
|
|
148 |
|
|
149 |
private:
|
|
150 |
/**
|
|
151 |
* C++ default constructor.
|
|
152 |
*/
|
|
153 |
CConnection(TSysRequest::TRequestType aReqType,TInt32 aTransID,
|
|
154 |
ISystemObserver* aObsrvr);
|
|
155 |
|
|
156 |
/**
|
|
157 |
* By default Symbian 2nd phase constructor is private.
|
|
158 |
*/
|
|
159 |
void ConstructL(const TSysRequest& aRequest);
|
|
160 |
|
|
161 |
private:
|
|
162 |
void ReadNextConnectionL();
|
|
163 |
|
|
164 |
private:
|
|
165 |
/**
|
|
166 |
* MConnectionMonitorObserver call back funtion.
|
|
167 |
*/
|
|
168 |
void EventL(const CConnMonEventBase& aEvent);
|
|
169 |
|
|
170 |
void HandleConnectionInfoL(CConnectionInfo*& aInfo,TInt error);
|
|
171 |
|
|
172 |
public:
|
|
173 |
/**
|
|
174 |
* Issues asynchronous request.
|
|
175 |
*/
|
|
176 |
TInt Request();
|
|
177 |
|
|
178 |
protected: // from CActive
|
|
179 |
void RunL();
|
|
180 |
void DoCancel();
|
|
181 |
|
|
182 |
private: // DATA
|
|
183 |
enum {
|
|
184 |
EMAXCONNECTIONS=10,
|
|
185 |
};
|
|
186 |
|
|
187 |
// Local copy of Entity.
|
|
188 |
HBufC* iEntity;
|
|
189 |
|
|
190 |
// Local copy of Key.
|
|
191 |
HBufC* iKey;
|
|
192 |
|
|
193 |
RConnectionMonitor iConnMonitor;
|
|
194 |
|
|
195 |
TUint iConnectionIds[EMAXCONNECTIONS];
|
|
196 |
|
|
197 |
TUint iConnectionCount;
|
|
198 |
|
|
199 |
TInt iConnectionIndex;
|
|
200 |
|
|
201 |
RPointerArray<CConnectionInfo> iConnectionInfoArray;
|
|
202 |
|
|
203 |
CReadConnectionInfo* iReadConnectionInfo;
|
|
204 |
|
|
205 |
TBool iConnectionInit;
|
|
206 |
};
|
|
207 |
|
|
208 |
#endif __SYSCONNECTIONREQUEST_H__ |