37
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
//
|
|
15 |
|
|
16 |
/**
|
|
17 |
@file
|
|
18 |
@internalComponent
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
#if !defined(__SHIMNIFMANSCONN_H__)
|
|
23 |
#define __SHIMNIFMANSCONN_H__
|
|
24 |
|
|
25 |
#include <comms-infras/ss_log.h>
|
|
26 |
#include "shimdatatransfer.h"
|
|
27 |
#include "shimclient.h"
|
|
28 |
#include "shimcpr.h" //access to the CConnectionProviderShim::Provider() fn
|
|
29 |
|
|
30 |
//const TInt KSubConnectionProviderShimImplementationUid = 0x10207106;
|
|
31 |
|
|
32 |
#define KShimScprTag KESockSubConnectionTag
|
|
33 |
_LIT8(KShimScprSubTag, "shimscpr");
|
|
34 |
_LIT8(KShimScprDataTag, "shimscprData");
|
|
35 |
_LIT8(KShimScprClientTag, "shimscprClient");
|
|
36 |
|
|
37 |
//Former CInterface CSubConnection related up-calls so that CConnectionProviderShim
|
|
38 |
//doesn't have to link against the sub-connection shim
|
|
39 |
class CConnection;
|
|
40 |
class MSubInterfaceShim : public MConnDataTransferNotify
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
virtual TInt ProgressNotification(TInt aStage, TInt aError, const TDesC8& aInfo) = 0;
|
|
44 |
virtual TSubConnectionUniqueId Id() = 0;
|
|
45 |
virtual void SetSubConnectionUniqueId( TSubConnectionUniqueId aSubConnectionUniqueId ) = 0;
|
|
46 |
virtual void ConnectionJoiningL(const CConnection& aConnection) = 0;
|
|
47 |
virtual void ConnectionLeaving(const CConnection& aConnection) = 0;
|
|
48 |
};
|
|
49 |
|
|
50 |
//class CSubConnectionProviderFactoryShim;
|
|
51 |
class CSubConnectionLinkShimClient;
|
|
52 |
|
|
53 |
NONSHARABLE_CLASS(CNifManSubConnectionShim) : public CBase, public MConnectionDataClient, public MSubInterfaceShim
|
|
54 |
/**
|
|
55 |
@internalComponent
|
|
56 |
*/
|
|
57 |
{
|
|
58 |
|
|
59 |
public:
|
|
60 |
CNifManSubConnectionShim(CConnectionProviderShim& aProviderShim);
|
|
61 |
~CNifManSubConnectionShim();
|
|
62 |
|
|
63 |
// MSubInterfaceShim impl
|
|
64 |
virtual TInt ProgressNotification(TInt aStage, TInt aError, const TDesC8& aInfo);
|
|
65 |
virtual TInt NotifyDataTransferred(TUint aUplinkVolume, TUint aDownlinkVolume);
|
|
66 |
virtual TInt NotifyDataSent(TUint aUplinkVolume, TUint aCurrentGranularity);
|
|
67 |
virtual TInt NotifyDataReceived(TUint aDownlinkVolume, TUint aCurrentGranularity);
|
|
68 |
virtual TSubConnectionUniqueId Id();
|
|
69 |
virtual void SetSubConnectionUniqueId( TSubConnectionUniqueId aSubConnectionUniqueId );
|
|
70 |
virtual void ConnectionJoiningL(const CConnection& aConnection);
|
|
71 |
virtual void ConnectionLeaving(const CConnection& aConnection);
|
|
72 |
|
|
73 |
CConnectionProvdBase& Provider()
|
|
74 |
{
|
|
75 |
return static_cast<CConnectionProviderShim*>(iConnectionProvider)->Provider();
|
|
76 |
}
|
|
77 |
CConnDataTransferShim* DataTransferShim()
|
|
78 |
{
|
|
79 |
return iConnDataTransferShim;
|
|
80 |
}
|
|
81 |
CSubConnectionLinkShimClient* ShimClient( TInt aIndex )
|
|
82 |
{
|
|
83 |
return aIndex < iShimClients.Count() ? iShimClients[aIndex] : NULL;
|
|
84 |
}
|
|
85 |
void DeleteAsync();
|
|
86 |
protected:
|
|
87 |
//MConnectionDataClient
|
|
88 |
virtual void ConnectionGoingDown(CConnectionProviderBase& aConnProvider);
|
|
89 |
virtual void ConnectionError(TInt aStage, TInt aError);
|
|
90 |
virtual void Notify(TNotify aNotifyType, CConnectionProviderBase* aConnProvider, TInt aError, const CConNotificationEvent* aConNotificationEvent);
|
|
91 |
virtual void AttachToNext(CSubConnectionProviderBase* aSubConnProvider);
|
|
92 |
|
|
93 |
|
|
94 |
TInt FindClient(const CConnection& aConnection);
|
|
95 |
CConnDataTransfer& CreateDataTransferL();
|
|
96 |
|
|
97 |
protected:
|
|
98 |
RPointerArray<CSubConnectionLinkShimClient> iShimClients;
|
|
99 |
TSubConnectionUniqueId iSubConnectionsUniqueId;
|
|
100 |
CConnDataTransferShim* iConnDataTransferShim;
|
|
101 |
CConnectionProviderBase* iConnectionProvider;
|
|
102 |
CAsyncCallBack iAsyncDestructor;
|
|
103 |
private:
|
|
104 |
static TInt AsyncDestructorCb(TAny* aInstance);
|
|
105 |
};
|
|
106 |
|
|
107 |
NONSHARABLE_CLASS(CSubConnectionLinkShimClient) : public CBase, public MConnDataTransferNotify, public MShimControlClient
|
|
108 |
/**
|
|
109 |
Handle subconnection-related asynchronous client requests that may not complete immediately, it effectively
|
|
110 |
represents the old CSubConnection
|
|
111 |
@internalComponent
|
|
112 |
*/
|
|
113 |
{
|
|
114 |
public:
|
|
115 |
CSubConnectionLinkShimClient(const CConnection& aConnection, CNifManSubConnectionShim& aSubConnectionShim);
|
|
116 |
~CSubConnectionLinkShimClient();
|
|
117 |
|
|
118 |
//MConnDataTransferNotify interface towards CConnDataTransfer
|
|
119 |
virtual TInt NotifyDataTransferred(const TUint aUplinkVolume, const TUint aDownlinkVolume);
|
|
120 |
virtual TInt NotifyDataSent(TUint aUplinkVolume, TUint aCurrentGranularity);
|
|
121 |
virtual TInt NotifyDataReceived(TUint aDownlinkVolume, TUint aCurrentGranularity);
|
|
122 |
|
|
123 |
void ProgressNotification(TInt aStage, TInt aError, const TDesC8& aInfo);
|
|
124 |
|
|
125 |
//MShimControlClient interface towards ESOCK
|
|
126 |
//former CConnection::StopSubConnectionL(const RMessage2& aMessage);
|
|
127 |
virtual TBool StopL(const RMessage2& aMessage);
|
|
128 |
// Former calls from CConnection::GetSubConnectionInfo
|
|
129 |
virtual TInt GetSubConnectionInfo(const RMessage2& aMessage);
|
|
130 |
// Former Calls from RConnection via CSubConnection
|
|
131 |
virtual TInt GetCurrentProgress(TNifProgress& aProgress);
|
|
132 |
virtual TBool DataTransferredL(const RMessage2& aMessage);
|
|
133 |
virtual TBool DataTransferredCancel(const RMessage2& aMessage);
|
|
134 |
virtual TBool RequestSubConnectionProgressNotificationL(const RMessage2& aMessage);
|
|
135 |
virtual TBool CancelSubConnectionProgressNotification(const RMessage2& aMessage);
|
|
136 |
virtual TBool DataSentNotificationRequestL(const RMessage2& aMessage);
|
|
137 |
virtual TBool DataSentNotificationCancel(const RMessage2& aMessage);
|
|
138 |
virtual TBool DataReceivedNotificationRequestL(const RMessage2& aMessage);
|
|
139 |
virtual TBool DataReceivedNotificationCancel(const RMessage2& aMessage);
|
|
140 |
virtual TBool IsSubConnectionActiveRequestL(const RMessage2& aMessage);
|
|
141 |
virtual TBool IsSubConnectionActiveCancel(const RMessage2& aMessage);
|
|
142 |
TBool Match(const CConnection& aConnection) const;
|
|
143 |
TSubConnectionUniqueId Id();
|
|
144 |
virtual TInt ReturnCode() const;
|
|
145 |
|
|
146 |
void SetReturnCode(TInt aErr)
|
|
147 |
{
|
|
148 |
iReturnCode = aErr;
|
|
149 |
}
|
|
150 |
|
|
151 |
/**
|
|
152 |
Callback from activity timer
|
|
153 |
*/
|
|
154 |
void CheckSubConnectionActivity();
|
|
155 |
|
|
156 |
NONSHARABLE_CLASS(CActivityTimer) : public CTimer
|
|
157 |
/**
|
|
158 |
@internalComponent
|
|
159 |
*/
|
|
160 |
{
|
|
161 |
public:
|
|
162 |
static CActivityTimer* NewL(CSubConnectionLinkShimClient* aOwner, TInt aPriority);
|
|
163 |
virtual inline ~CActivityTimer() {};
|
|
164 |
void RunL();
|
|
165 |
private:
|
|
166 |
inline CActivityTimer(CSubConnectionLinkShimClient* aOwner, TInt aPriority);
|
|
167 |
private:
|
|
168 |
CSubConnectionLinkShimClient* iOwner;
|
|
169 |
};
|
|
170 |
|
|
171 |
|
|
172 |
private:
|
|
173 |
const CConnection& iConnection;
|
|
174 |
CNifManSubConnectionShim& iSubConnectionShim;
|
|
175 |
|
|
176 |
TUint iUplinkDataVolume;
|
|
177 |
TUint iDownlinkDataVolume;
|
|
178 |
TUint iUplinkDataNotificationVolume;
|
|
179 |
TUint iDownlinkDataNotificationVolume;
|
|
180 |
TInt iRemainingUplinkGranularity;
|
|
181 |
TInt iRemainingDownlinkGranularity;
|
|
182 |
|
|
183 |
TBool iDataSentNotificationsInAbsoluteMode;
|
|
184 |
TBool iDataReceivedNotificationsInAbsoluteMode;
|
|
185 |
|
|
186 |
TNifProgress iCurrentProgress;
|
|
187 |
TInt iLastProgressToClient;
|
|
188 |
TInt iClientRequestedProgress;
|
|
189 |
CActivityTimer* iActivityTimer;
|
|
190 |
TInt iRequestedClientTimerPeriod;
|
|
191 |
TBool iClientBelievesSubConnectionActive;
|
|
192 |
TUint iPreviousUplinkDataVolume;
|
|
193 |
TUint iPreviousDownlinkDataVolume;
|
|
194 |
|
|
195 |
TBool iOutstandingProgressNotification:1;
|
|
196 |
TBool iOutstandingDataSentNotification:1;
|
|
197 |
TBool iOutstandingDataReceivedNotification:1;
|
|
198 |
TBool iOutstandingSubConnectionActivity:1;
|
|
199 |
|
|
200 |
RMessage2 iOutstandingProgressNotificationMessage;
|
|
201 |
RMessage2 iOutstandingDataSentNotificationMessage;
|
|
202 |
RMessage2 iOutstandingDataReceivedNotificationMessage;
|
|
203 |
RMessage2 iOutstandingSubConnectionActivityMessage;
|
|
204 |
|
|
205 |
TInt iReturnCode;
|
|
206 |
};
|
|
207 |
|
|
208 |
inline CSubConnectionLinkShimClient::CActivityTimer::CActivityTimer(CSubConnectionLinkShimClient* aOwner, TInt aPriority)
|
|
209 |
: CTimer(aPriority), iOwner(aOwner)
|
|
210 |
/**
|
|
211 |
Set up the activity timer for subconnection activity
|
|
212 |
|
|
213 |
@param aOwner, The owing subconnection
|
|
214 |
@param aPriority, The priority of the active object
|
|
215 |
*/
|
|
216 |
{ CActiveScheduler::Add(this); };
|
|
217 |
|
|
218 |
#endif
|
|
219 |
// __SHIMNIFMANSCONN_H__
|