|
1 // Copyright (c) 2004-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 SS_DATATRANSFER.CPP |
|
18 */ |
|
19 |
|
20 #include "ss_datatransfer.h" |
|
21 |
|
22 |
|
23 #ifdef _DEBUG |
|
24 // Panic category for "absolutely impossible!" vanilla ASSERT()-type panics from this module |
|
25 // (if it could happen through user error then you should give it an explicit, documented, category + code) |
|
26 _LIT(KSpecAssert_ESockSSocksdtrns, "ESockSSocksdtrns"); |
|
27 #endif |
|
28 |
|
29 /** |
|
30 Constructor |
|
31 */ |
|
32 EXPORT_C CConnDataTransfer::CConnDataTransfer() |
|
33 { |
|
34 } |
|
35 |
|
36 /** |
|
37 Calculate out how much data has been sent and received on the sub-connection |
|
38 |
|
39 @param aUplinkVolume On return, contains the amount of data sent on this subconnection |
|
40 @param aDownlinkVolume On return, contains the amount of data received on this subconnection |
|
41 @return KErrNone if successful, otherwise one of the system-wide error codes |
|
42 */ |
|
43 EXPORT_C TInt CConnDataTransfer::DataTransferred(TUint& aUplinkVolume, TUint& aDownlinkVolume) |
|
44 { |
|
45 return DoDataTransferred( aUplinkVolume, aDownlinkVolume); |
|
46 } |
|
47 |
|
48 /** |
|
49 Cancel a request for data transfer information |
|
50 |
|
51 @return ETrue to indicate that the operation is completed here |
|
52 */ |
|
53 EXPORT_C TInt CConnDataTransfer::DataTransferredCancel() |
|
54 { |
|
55 return DoDataTransferredCancel(); |
|
56 } |
|
57 |
|
58 /** |
|
59 Receive a request for a notification after a given volume of data has been sent on the sub-connection |
|
60 |
|
61 @param aRequestedGranularity The amount of data to be sent after which the notification will occur (but see notes); |
|
62 this is relative to the current volume of data sent |
|
63 @param aRequestedNotificationVolume The absolute amount of data that should be sent before we send a notification; only used if aRequestedGranularity is zero |
|
64 @return KErrNone, or one of the system-wide error codes |
|
65 */ |
|
66 EXPORT_C TInt CConnDataTransfer::DataSentNotificationRequest(TUint aRequestedGranularity, TUint aRequestedNotificationVolume) |
|
67 { |
|
68 return DoDataSentNotificationRequest(aRequestedGranularity, aRequestedNotificationVolume); |
|
69 } |
|
70 |
|
71 /** |
|
72 Remove the additional notification that this request would have generated |
|
73 |
|
74 @return KErrNone, or one of the system-wide error codes |
|
75 */ |
|
76 EXPORT_C TInt CConnDataTransfer::DataSentNotificationCancel() |
|
77 { |
|
78 return DoDataSentNotificationCancel(); |
|
79 } |
|
80 |
|
81 /** |
|
82 Receive a request for a notification after a given volume of data has been received on the sub-connection |
|
83 |
|
84 @param aRequestedGranularity The amount of data to be received after which the notification will occur (but see notes); this is relative to the current volume of data received |
|
85 @param aRequestedNotificationVolume The absolute amount of data that should be received before we send a notification; only used if aRequestedGranularity is zero |
|
86 @return KErrNone, or one of the system-wide error codes |
|
87 */ |
|
88 EXPORT_C TInt CConnDataTransfer::DataReceivedNotificationRequest(TUint aRequestedGranularity, TUint aRequestedNotificationVolume) |
|
89 { |
|
90 return DoDataReceivedNotificationRequest(aRequestedGranularity, aRequestedNotificationVolume); |
|
91 } |
|
92 |
|
93 /** |
|
94 Remove the additional notification that this request would have generated |
|
95 |
|
96 @return KErrNone, or one of the system-wide error codes |
|
97 */ |
|
98 EXPORT_C TInt CConnDataTransfer::DataReceivedNotificationCancel() |
|
99 { |
|
100 return DoDataReceivedNotificationCancel(); |
|
101 } |
|
102 |
|
103 /** |
|
104 Register a client |
|
105 @param aClient Reference to the MConnDataTransferNotify derived class as the client |
|
106 */ |
|
107 EXPORT_C void CConnDataTransfer::RegisterClientL( MConnDataTransferNotify& aClient ) |
|
108 { |
|
109 __ASSERT_DEBUG(iClients.Find(&aClient) == KErrNotFound, User::Panic(KSpecAssert_ESockSSocksdtrns, 1)); |
|
110 iClients.AppendL(&aClient); |
|
111 } |
|
112 |
|
113 /** |
|
114 De-register a client |
|
115 @param aClient Reference to the MConnDataTransferNotify derived class as the client |
|
116 */ |
|
117 EXPORT_C void CConnDataTransfer::DeRegisterClient( MConnDataTransferNotify& aClient ) |
|
118 { |
|
119 TInt index = iClients.Find(&aClient); |
|
120 if ( index >= 0 ) |
|
121 { |
|
122 iClients.Remove(index); |
|
123 } |
|
124 } |
|
125 |