epoc32/include/comms-infras/ss_datatransfer.h
branchSymbian3
changeset 4 837f303aceeb
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
       
     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  @internalTechnology 
       
    19 */
       
    20 
       
    21 #if !defined(__SS_DATATRANSFER_H__)
       
    22 #define __SS_DATATRANSFER_H__
       
    23 
       
    24 #include <e32def.h>
       
    25 #include <e32base.h>
       
    26 
       
    27 /**
       
    28  Interface that any sub-connection client wishing to get data notification must implement
       
    29  @released Since 9.1
       
    30  @internalTechnology
       
    31  */
       
    32 class MConnDataTransferNotify
       
    33 	{
       
    34 public:
       
    35 	/**
       
    36 	 Override this to receive notification for data transfered, to allow any absolute volume 
       
    37 	 notifications that may be outstanding to be completed if the required amount of data has been 
       
    38 	 sent/received
       
    39 
       
    40 	 @param aUplinkVolume The total volume of data sent on this subconnection
       
    41 	 @param aDownlinkVolume The total volume of data received on this subconnection
       
    42 	 @return KErrNone, or one of the system-wide error codes
       
    43 	 @see CConnDataTransfer::DataTransferred
       
    44 	 */
       
    45 	virtual TInt NotifyDataTransferred(const TUint aUplinkVolume, const TUint aDownlinkVolume) = 0;
       
    46 	
       
    47 	/**	 	 
       
    48 	 Override this to update the sent bytes count, and if necessary complete any outstanding RMessages
       
    49 	 
       
    50 	 @param aUplinkVolume The total number of bytes sent on this subconnection
       
    51 	 @param aCurrentGranularity Requested granularity
       
    52 	 @return KErrNone, or one of the system-wide error codes
       
    53 	 */	 	
       
    54 	virtual TInt NotifyDataSent(TUint aUplinkVolume, TUint aCurrentGranularity) = 0;
       
    55 	
       
    56 	/**
       
    57 	 Override this to update the received bytes count, and if necessary complete any outstanding RMessages
       
    58 
       
    59 	 @param aDownlinkVolume The total number of bytes sent on the sub-connection
       
    60 	 @param aCurrentGranularity The currently set granularity of notifications
       
    61 	 */
       
    62 	virtual TInt NotifyDataReceived(TUint aDownlinkVolume, TUint aCurrentGranularity) = 0;
       
    63 	};
       
    64 	
       
    65 /**
       
    66  Base class that any sub-connection client wishing to get sub-connection related data statitics must implement
       
    67  @released Since 9.1
       
    68  @internalTechnology
       
    69  */
       
    70 class CConnDataTransfer : public CBase
       
    71 	{
       
    72 protected:
       
    73 	IMPORT_C CConnDataTransfer();
       
    74 	
       
    75 public:
       
    76 	IMPORT_C TInt DataTransferred(TUint& aUplinkVolume, TUint& aDownlinkVolume);
       
    77 	IMPORT_C TInt DataTransferredCancel();
       
    78 	IMPORT_C TInt DataSentNotificationRequest(TUint aRequestedGranularity, TUint aRequestedNotificationVolume);
       
    79 	IMPORT_C TInt DataSentNotificationCancel();
       
    80 	IMPORT_C TInt DataReceivedNotificationRequest(TUint aRequestedGranularity, TUint aRequestedNotificationVolume);
       
    81 	IMPORT_C TInt DataReceivedNotificationCancel();
       
    82 
       
    83 	IMPORT_C void RegisterClientL( MConnDataTransferNotify& aClient );
       
    84 	IMPORT_C void DeRegisterClient( MConnDataTransferNotify& aClient );
       
    85 	
       
    86 protected:
       
    87 	/**
       
    88 	 Override this to register for data transfer notification on the sub-connection
       
    89 	 
       
    90 	 @param aUplinkVolume On return, contains the amount of data sent on this subconnection
       
    91 	 @param aDownlinkVolume On return, contains the amount of data received on this subconnection
       
    92 	 @return KErrNone if successful, otherwise one of the system-wide error codes
       
    93 	 */
       
    94 	virtual TInt DoDataTransferred(TUint& aUplinkVolume, TUint& aDownlinkVolume) = 0;
       
    95 	
       
    96 	/**
       
    97 	 Override this to cancel a request for data transfer information
       
    98 	 
       
    99 	 @return ETrue to indicate that the operation is completed here
       
   100 	 */
       
   101 	virtual TInt DoDataTransferredCancel() = 0;
       
   102 	
       
   103 	/**
       
   104 	 Override this to receive a request for a notification after a given volume of data has been sent on the sub-connection
       
   105 	 
       
   106 	 @param aRequestedGranularity The amount of data to be sent after which the notification will occur (but see notes); 
       
   107 	 this is relative to the current volume of data sent
       
   108 	 @param aRequestedNotificationVolume The absolute amount of data that should be sent before we send a notification; only used if aRequestedGranularity is zero
       
   109 	 @return KErrNone, or one of the system-wide error codes
       
   110 	 */
       
   111 	virtual TInt DoDataSentNotificationRequest(TUint aRequestedGranularity, TUint aRequestedNotificationVolume) = 0;
       
   112 	
       
   113 	/**
       
   114 	 Override this to remove the additional notification that this request would have generated
       
   115 	 
       
   116 	 @return KErrNone, or one of the system-wide error codes
       
   117 	 */
       
   118 	virtual TInt DoDataSentNotificationCancel() = 0;
       
   119 	
       
   120 	/**
       
   121 	 Override this to receive a request for a notification after a given volume of data has been received on the sub-connection
       
   122 	 
       
   123 	 @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
       
   124 	 @param aRequestedNotificationVolume The absolute amount of data that should be received before we send a notification; only used if aRequestedGranularity is zero
       
   125 	 @return KErrNone, or one of the system-wide error codes
       
   126 	 */	
       
   127 	virtual TInt DoDataReceivedNotificationRequest(TUint aRequestedGranularity, TUint aRequestedNotificationVolume) = 0;
       
   128 	
       
   129 	/**
       
   130 	 Override this to remove the additional notification that this request would have generated
       
   131 	 
       
   132 	 @return KErrNone, or one of the system-wide error codes
       
   133 	 */
       
   134 	virtual TInt DoDataReceivedNotificationCancel() = 0;
       
   135 
       
   136 protected:
       
   137 	RPointerArray<MConnDataTransferNotify> iClients;
       
   138 	};
       
   139 	
       
   140 #endif	// __SS_DATATRANSFER_H__
       
   141