|
1 /** |
|
2 * Copyright (c) 2006-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 "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 * DataMonitoringProvider.h |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 |
|
22 /** |
|
23 @file |
|
24 @internalComponent |
|
25 */ |
|
26 |
|
27 #if !defined(DATAMONITORINGPROVIDER_H_INCLUDED) |
|
28 #define DATAMONITORINGPROVIDER_H_INCLUDED |
|
29 |
|
30 #include <e32const.h> |
|
31 #include <comms-infras/ss_datamon_apiext.h> |
|
32 #include <comms-infras/ss_nodemessages.h> |
|
33 |
|
34 namespace ESock |
|
35 { |
|
36 |
|
37 class TCFDataMonitoringNotification |
|
38 { |
|
39 private: |
|
40 enum |
|
41 { |
|
42 ECFDataMonitoringNotification = 1 |
|
43 }; |
|
44 public: |
|
45 enum { ERealmId = 0x10285A78 }; //UID allocated on 21/11/2007 |
|
46 /*========================================================================== |
|
47 [Name]: TDataMonitoringNotification |
|
48 [Semantics]: [399TODO] RZ: Simon please finish. |
|
49 |
|
50 [Type]: |
|
51 [Fallible]: |
|
52 |
|
53 [Structure]: |
|
54 ===========================================================================*/ |
|
55 typedef Messages::TMessageSigNumberNumber<ECFDataMonitoringNotification, TCFDataMonitoringNotification::ERealmId> TDataMonitoringNotification; |
|
56 }; |
|
57 |
|
58 |
|
59 /* |
|
60 Enumerations for typeids |
|
61 */ |
|
62 enum |
|
63 { |
|
64 EDataMonitoringProvisioningInfoBase, |
|
65 EDataMonitoringConnProvisioningInfo, |
|
66 EDataMonitoringSubConnProvisioningInfo |
|
67 }; |
|
68 |
|
69 /** |
|
70 @internalTechnology |
|
71 */ |
|
72 enum TDataMonitoringDirection |
|
73 { |
|
74 EReceived, |
|
75 ESent |
|
76 }; |
|
77 |
|
78 /** |
|
79 @internalTechnology |
|
80 */ |
|
81 struct TDataVolumes |
|
82 { |
|
83 volatile TUint32 iReceivedBytes; |
|
84 volatile TUint32 iSentBytes; |
|
85 }; |
|
86 |
|
87 /** |
|
88 @internalTechnology |
|
89 */ |
|
90 struct TNotificationThresholds |
|
91 { |
|
92 volatile TUint32 iReceivedThreshold; |
|
93 volatile TUint32 iSentThreshold; |
|
94 }; |
|
95 |
|
96 |
|
97 const TUint32 KDataMonitoringProvisioningUid = 0x10281E0D; |
|
98 |
|
99 /** |
|
100 Base class for flow provisioning data |
|
101 |
|
102 @internalTechnology |
|
103 */ |
|
104 class TDataMonitoringProvisioningInfoBase : public Meta::SMetaData |
|
105 { |
|
106 public: |
|
107 enum |
|
108 { |
|
109 iId = EDataMonitoringProvisioningInfoBase, |
|
110 iUid = KDataMonitoringProvisioningUid |
|
111 }; |
|
112 |
|
113 protected: |
|
114 TDataMonitoringProvisioningInfoBase(TDataVolumes* aDataVolumesPtr, TNotificationThresholds* aThresholdsPtr) : |
|
115 iDataVolumesPtr(aDataVolumesPtr), iThresholdsPtr(aThresholdsPtr) |
|
116 { |
|
117 } |
|
118 |
|
119 private: |
|
120 TDataMonitoringProvisioningInfoBase(); |
|
121 |
|
122 public: |
|
123 TDataVolumes* iDataVolumesPtr; |
|
124 TNotificationThresholds* iThresholdsPtr; |
|
125 |
|
126 EXPORT_DATA_VTABLE_AND_FN |
|
127 }; |
|
128 |
|
129 /** |
|
130 @internalTechnology |
|
131 */ |
|
132 class TDataMonitoringConnProvisioningInfo : public TDataMonitoringProvisioningInfoBase |
|
133 { |
|
134 public: |
|
135 enum |
|
136 { |
|
137 iId = EDataMonitoringConnProvisioningInfo |
|
138 }; |
|
139 |
|
140 IMPORT_C TDataMonitoringConnProvisioningInfo(TDataVolumes* aDataVolumesPtr, TNotificationThresholds* aThresholdsPtr); |
|
141 |
|
142 EXPORT_DATA_VTABLE_AND_FN |
|
143 |
|
144 private: |
|
145 TDataMonitoringConnProvisioningInfo(); |
|
146 }; |
|
147 |
|
148 /** |
|
149 @internalTechnology |
|
150 */ |
|
151 class TDataMonitoringSubConnProvisioningInfo : public TDataMonitoringProvisioningInfoBase |
|
152 { |
|
153 public: |
|
154 enum |
|
155 { |
|
156 iId = EDataMonitoringSubConnProvisioningInfo |
|
157 }; |
|
158 |
|
159 IMPORT_C TDataMonitoringSubConnProvisioningInfo(TDataVolumes* aDataVolumesPtr, TNotificationThresholds* aThresholdsPtr); |
|
160 |
|
161 EXPORT_DATA_VTABLE_AND_FN |
|
162 |
|
163 private: |
|
164 TDataMonitoringSubConnProvisioningInfo(); |
|
165 }; |
|
166 |
|
167 /** |
|
168 @internalTechnology |
|
169 */ |
|
170 class TNotificationRequest |
|
171 { |
|
172 public: |
|
173 TNotificationRequest(CDataMonitoringResponder* aResponder, TSubSessionUniqueId aClientId) |
|
174 : iThreshold(0), iResponder(aResponder), iClientId(aClientId), iCancelled(EFalse), iWrapped(EFalse) |
|
175 { |
|
176 } |
|
177 |
|
178 TUint32 Threshold() const |
|
179 { |
|
180 return iThreshold; |
|
181 } |
|
182 |
|
183 void SetThreshold(TUint32 aThreshold) |
|
184 { |
|
185 iThreshold = aThreshold; |
|
186 } |
|
187 |
|
188 void SetThresholdFromDelta(TUint32 aVolume, TUint32 aDelta); |
|
189 |
|
190 |
|
191 CDataMonitoringResponder*& Responder() |
|
192 { |
|
193 return iResponder; |
|
194 } |
|
195 |
|
196 TSubSessionUniqueId ClientId() const |
|
197 { |
|
198 return iClientId; |
|
199 } |
|
200 |
|
201 TBool Cancelled() const |
|
202 { |
|
203 return iCancelled; |
|
204 } |
|
205 |
|
206 void SetCancelled() |
|
207 { |
|
208 iCancelled = ETrue; |
|
209 } |
|
210 |
|
211 TBool Wrapped() const |
|
212 { |
|
213 return iWrapped; |
|
214 } |
|
215 |
|
216 void SetWrapped(TBool aWrapped) |
|
217 { |
|
218 iWrapped = aWrapped; |
|
219 } |
|
220 |
|
221 static TInt CompareThresholds(const TNotificationRequest& aFirst, const TNotificationRequest& aSecond); |
|
222 static TBool CompareClientIds(const TNotificationRequest& aFirst, const TNotificationRequest& aSecond); |
|
223 |
|
224 private: |
|
225 TUint32 iThreshold; |
|
226 CDataMonitoringResponder* iResponder; |
|
227 TSubSessionUniqueId iClientId; |
|
228 TBool iCancelled; |
|
229 TBool iWrapped; |
|
230 }; |
|
231 |
|
232 typedef RPointerArray<TNotificationRequest> RNotificationRequestArray; |
|
233 |
|
234 /** |
|
235 @internalTechnology |
|
236 */ |
|
237 class ADataMonitoringProvider : public ADataMonitoringProtocolReq |
|
238 { |
|
239 public: |
|
240 IMPORT_C virtual ~ADataMonitoringProvider(); |
|
241 |
|
242 // MExtensionInterfaceBase virtuals |
|
243 IMPORT_C virtual void CancelClientExtItfRequests(TSubSessionUniqueId aClientId); |
|
244 |
|
245 // ADataMonitoringProtocolReq virtuals |
|
246 IMPORT_C virtual void RequestDataTransferred(CDataMonitoringResponder*& aResponder, TSubSessionUniqueId aClientId); |
|
247 IMPORT_C virtual void CancelDataTransferredRequest(TSubSessionUniqueId aClientId); |
|
248 IMPORT_C virtual void RequestDataReceivedNotification(CDataMonitoringResponder*& aResponder, TUint32 aDelta, TUint32 aReceivedBytes, TSubSessionUniqueId aClientId); |
|
249 IMPORT_C virtual void CancelDataReceivedNotificationRequest(TSubSessionUniqueId aClientId); |
|
250 IMPORT_C virtual void RequestDataSentNotification(CDataMonitoringResponder*& aResponder, TUint32 aDelta, TUint32 aSentBytes, TSubSessionUniqueId aClientId); |
|
251 IMPORT_C virtual void CancelDataSentNotificationRequest(TSubSessionUniqueId aClientId); |
|
252 |
|
253 IMPORT_C void DataReceivedNotificationL(TUint32 aNotificationValue); |
|
254 IMPORT_C void DataSentNotificationL(TUint32 aNotificationValue); |
|
255 IMPORT_C void DataNotificationL(const TCFDataMonitoringNotification::TDataMonitoringNotification& aNotification); |
|
256 |
|
257 TDataVolumes* DataVolumesPtr() { return &iDataVolumes; } |
|
258 TNotificationThresholds* NotificationThresholdsPtr() { return &iThresholds; } |
|
259 |
|
260 protected: |
|
261 IMPORT_C ADataMonitoringProvider(); |
|
262 IMPORT_C void ConstructL(); |
|
263 |
|
264 private: |
|
265 RNotificationRequestArray* NotificationRequestArray(TDataMonitoringDirection aDirection); |
|
266 void InsertWrapMarkerL(TDataMonitoringDirection aDirection); |
|
267 TInt InsertNotificationRequest(TNotificationRequest* aRequest, TDataMonitoringDirection aDirection); |
|
268 void SetNextNotificationThreshold(TDataMonitoringDirection aDirection); |
|
269 |
|
270 private: |
|
271 // Notification request arrays |
|
272 RNotificationRequestArray iReceivedNotificationRequests; |
|
273 RNotificationRequestArray iSentNotificationRequests; |
|
274 |
|
275 protected: |
|
276 // Shared memory |
|
277 TDataVolumes iDataVolumes; |
|
278 TNotificationThresholds iThresholds; |
|
279 }; |
|
280 |
|
281 } //namespace ESock |
|
282 |
|
283 #endif |
|
284 |
|
285 |