|
1 /* |
|
2 * Copyright (c) 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 * |
|
16 */ |
|
17 |
|
18 /** @file |
|
19 @internalComponent |
|
20 */ |
|
21 |
|
22 #ifndef NCMCONNECTIONMANAGER_H |
|
23 #define NCMCONNECTIONMANAGER_H |
|
24 |
|
25 #ifdef OVERDUMMY_NCMCC |
|
26 #include <usb/testncmcc/dummy_essock.h> |
|
27 #include <usb/testncmcc/dummy_insock.h> |
|
28 #include <usb/testncmcc/dummy_nifman.h> |
|
29 #else |
|
30 #include <es_sock.h> |
|
31 #include <in_sock.h> |
|
32 #include <nifman.h> |
|
33 #include <commdbconnpref.h> |
|
34 #endif // OVERDUMMY_NCMCC |
|
35 |
|
36 #include <e32property.h> |
|
37 #include "ncmcommon.h" |
|
38 #include "ncmiapprogressstateobserver.h" |
|
39 #include "ncmiapconnectionobserver.h" |
|
40 #include "ncmdhcpnotifobserver.h" |
|
41 #include "ncmiapreaderobserver.h" |
|
42 |
|
43 |
|
44 class MNcmConnectionManagerObserver; |
|
45 class CNcmIapProgressWatcher; |
|
46 class CNcmConnectionManHelper; |
|
47 class CNcmDhcpNotifWatcher; |
|
48 class CNcmIapReader; |
|
49 class RNcmInternalSrv; |
|
50 |
|
51 /** |
|
52 * CNcmConnectionManager to control ncm networking interface |
|
53 * It handles: |
|
54 * 1 Searching NCM IAP |
|
55 * 2 Start NCM connection |
|
56 * 3 IAP progress notification |
|
57 * 4 DHCP provisioning request from NCM internal server |
|
58 */ |
|
59 NONSHARABLE_CLASS(CNcmConnectionManager) : public CBase, |
|
60 public MNcmIapProgressStateObserver, |
|
61 public MNcmConnectionObserver, |
|
62 public MNcmDhcpNotificationObserver, |
|
63 public MNcmIAPReaderObserver |
|
64 { |
|
65 public: |
|
66 /** |
|
67 * Constructs a CNcmConnectionManager object. |
|
68 * @param[in] aOwner, NCM connection observer |
|
69 * @param[in] aHostMacAddress, the NCM interface MAC address |
|
70 * @param[in] aDataBufferSize, the EndPoint buffer size |
|
71 * @param[in] aNcmInternalSvr, the NCM internal server |
|
72 * @return Ownership of a new CNcmConnectionManager object |
|
73 */ |
|
74 static CNcmConnectionManager* NewL(MNcmConnectionManagerObserver& aOwner, |
|
75 const TNcmMacAddress& aMacAddress, TUint aDataBufferSize, |
|
76 RNcmInternalSrv& aNcmInternalSvr); |
|
77 ~CNcmConnectionManager(); |
|
78 |
|
79 /** |
|
80 * Start NCM connection |
|
81 * @param aStatus complete status for this request. |
|
82 */ |
|
83 void Start(TRequestStatus& aStatus); |
|
84 |
|
85 /** |
|
86 * Cancel starting of NCM connection |
|
87 */ |
|
88 void StartCancel(); |
|
89 |
|
90 /** |
|
91 * Stop NCM connection |
|
92 */ |
|
93 void Stop(); |
|
94 |
|
95 // From MIapPorgressStateObserver |
|
96 virtual void MipsoHandleClassFatalError(TInt aError); |
|
97 |
|
98 // From MNcmConnectionObserver |
|
99 virtual void MicoHandleConnectionComplete(TInt aError); |
|
100 |
|
101 // From MNcmDhcpNotificationObserver |
|
102 virtual void MdnoHandleDhcpNotification(TInt aError); |
|
103 |
|
104 // From MNcmIAPReaderObserver |
|
105 virtual void MicoHandleIAPReadingComplete(TInt aError); |
|
106 |
|
107 private: |
|
108 /** |
|
109 * Two-phase construction: phase 1 |
|
110 * @param[in] aObserver, NCM connection observer |
|
111 * @param[in] aHostMacAddress, the NCM interface MAC address |
|
112 * @param[in] aDataBufferSize, the EndPoint buffer size |
|
113 * @param[in] aNcmInternalSvr, the NCM internal server |
|
114 */ |
|
115 CNcmConnectionManager(MNcmConnectionManagerObserver& aObserver, |
|
116 const TNcmMacAddress& aHostMacAddress, TUint aDataBufferSize, |
|
117 RNcmInternalSrv& aNcmInternalSvr); |
|
118 /** |
|
119 * Two-phase construction: phase 2 |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 /** |
|
124 * Reset NCM connection manager |
|
125 */ |
|
126 void Reset(); |
|
127 |
|
128 /* |
|
129 * Change default MTU size on NCM connection |
|
130 */ |
|
131 void SetCustomMtuL(); |
|
132 |
|
133 /* |
|
134 * Handle NCM connection building completion |
|
135 */ |
|
136 void HandleConnectionCompleteL(); |
|
137 |
|
138 private: |
|
139 // Owned. |
|
140 CNcmIapProgressWatcher* iIapPrgrsWatcher; |
|
141 CNcmConnectionManHelper* iConnManHelper; |
|
142 CNcmDhcpNotifWatcher* iDhcpNotifWatcher; |
|
143 CNcmIapReader* iIapReader; |
|
144 |
|
145 // Not own. |
|
146 TRequestStatus* iReportStatus; |
|
147 |
|
148 MNcmConnectionManagerObserver& iConnMgrObserver; |
|
149 |
|
150 // RSocketServ used for starting NCM IAP and configuring DHCP and NAPT, owned |
|
151 RSocketServ iSocketServ; |
|
152 |
|
153 // RConnection used for starting NCM IAP and configuring DHCP server, owned |
|
154 RConnection iConnection; |
|
155 |
|
156 TCommDbConnPref iConnPref; |
|
157 |
|
158 RProperty iProperty; |
|
159 TBool iConnComplete; |
|
160 |
|
161 const TNcmMacAddress& iHostMacAddress; |
|
162 const TUint iDataBufferSize; |
|
163 RNcmInternalSrv& iNcmInternalSvr; |
|
164 }; |
|
165 |
|
166 #endif // NCMCONNECTIONMANAGER_H |