examples/ForumNokia/Symbian_OS_End-to-End_Sockets_API_Example/SocketTaskManager_S60/src/TaskManagerConnInfo.cpp

00001 /*
00002 * ============================================================================
00003 *  Name     : TTaskManagerConnInfo from TaskManagerConnInfo.cpp
00004 *  Part of  : TaskManager
00005 *  Created  : 15/03/2006 by Forum Nokia
00006 *  Version  : 1.2
00007 *  Copyright: Nokia Corporation
00008 * ============================================================================
00009 */
00010 
00011 // INCLUDE FILES
00012 #include "TaskManagerConnInfo.h"
00013 #include "TaskManager.pan"
00014 
00015 // CONSTANTS
00016 const TInt TTaskManagerConnInfo::KDefaultPort = 3000;
00017 
00018 // ================= MEMBER FUNCTIONS =======================
00019 
00020 // constructor
00021 TTaskManagerConnInfo::TTaskManagerConnInfo(): iPort( KDefaultPort ), iIap(0)
00022         {
00023         // No implementation
00024         }
00025 
00026 // ----------------------------------------------------------
00027 // TTaskManagerConnInfo::SetServerAddress()
00028 // Sets the server address.
00029 // ----------------------------------------------------------
00030 //
00031 void TTaskManagerConnInfo::SetServerAddress( const TDesC& aAddress )
00032         {
00033         if( aAddress.Length() > KMaxServerNameLength )
00034                 {
00035                 Panic(ETaskManagerServerAddressTooLong);
00036                 }
00037         iServerAddress.Copy( aAddress );
00038         }
00039 
00040 // ----------------------------------------------------------
00041 // TTaskManagerConnInfo::ServerAddress()
00042 // Gets the server address.
00043 // ----------------------------------------------------------
00044 //
00045 TBufC< KMaxServerNameLength > TTaskManagerConnInfo::ServerAddress() const
00046         {
00047         return iServerAddress;
00048         }
00049 
00050 // ----------------------------------------------------------
00051 // TTaskManagerConnInfo::SetPort()
00052 // Sets the port number.
00053 // ----------------------------------------------------------
00054 //      
00055 void TTaskManagerConnInfo::SetPort( const TInt aPort )
00056         {
00057         iPort = aPort;
00058         }
00059 
00060 // ----------------------------------------------------------
00061 // TTaskManagerConnInfo::Port()
00062 // Gets the port number.
00063 // ----------------------------------------------------------
00064 //      
00065 const TInt TTaskManagerConnInfo::Port() const
00066         {
00067         return iPort;
00068         }
00069         
00070 // ----------------------------------------------------------
00071 // TTaskManagerConnInfo::SetUsername()
00072 // Sets the username.
00073 // ----------------------------------------------------------
00074 //              
00075 void TTaskManagerConnInfo::SetUsername( const TDesC& aUsername )
00076         {
00077         if( aUsername.Length() > KMaxUsernameLength )
00078                 {
00079                 Panic(ETaskManagerUsernameTooLong); 
00080                 }
00081         iUsername.Copy( aUsername );
00082         }
00083 
00084 // ----------------------------------------------------------
00085 // TTaskManagerConnInfo::Username()
00086 // Gets the username.
00087 // ----------------------------------------------------------
00088 //              
00089 TBufC< KMaxUsernameLength > TTaskManagerConnInfo::Username() const
00090         {
00091         return iUsername;       
00092         }
00093         
00094 // ----------------------------------------------------------
00095 // TTaskManagerConnInfo::SetPassword()
00096 // Sets the password.
00097 // ----------------------------------------------------------
00098 //                      
00099 void TTaskManagerConnInfo::SetPassword( const TDesC& aPassword )
00100         {
00101         if( aPassword.Length() > KMaxPasswordLength )
00102                 {
00103                 Panic(ETaskManagerPasswordTooLong);
00104                 }
00105         iPassword.Copy( aPassword );
00106         }
00107 
00108 // ----------------------------------------------------------
00109 // TTaskManagerConnInfo::Password()
00110 // Gets the password.
00111 // ----------------------------------------------------------
00112 //              
00113 TBufC< KMaxPasswordLength > TTaskManagerConnInfo::Password() const
00114         {
00115         return iPassword;       
00116         }
00117 
00118 // ----------------------------------------------------------
00119 // TTaskManagerConnInfo::SetIap()
00120 // Sets the IAP.
00121 // ----------------------------------------------------------
00122 //                      
00123 void TTaskManagerConnInfo::SetIap( const TUint32& aId)
00124         {
00125         iIap = aId;
00126         }
00127 
00128 // ----------------------------------------------------------
00129 // TTaskManagerConnInfo::Iap()
00130 // Gets the IAP.
00131 // ----------------------------------------------------------
00132 //                      
00133 TUint32 TTaskManagerConnInfo::Iap() const
00134         {
00135         return iIap;
00136         }
00137 
00138 // ----------------------------------------------------------
00139 // TTaskManagerConnInfo::ExternalizeL()
00140 // Saves the connection data to the given stream.
00141 // ----------------------------------------------------------
00142 //              
00143 void TTaskManagerConnInfo::ExternalizeL(RWriteStream& aStream) const
00144         {
00145         aStream << iServerAddress;
00146         aStream.WriteInt32L(iPort);
00147         aStream << iUsername;
00148         aStream << iIap;
00149         }
00150 
00151 // ----------------------------------------------------------
00152 // TTaskManagerConnInfo::InternalizeL()
00153 // Reads the connections data from the given stream.
00154 // ----------------------------------------------------------
00155 //                      
00156 void TTaskManagerConnInfo::InternalizeL(RReadStream& aStream)
00157         {
00158         aStream >> iServerAddress;
00159         iPort  = aStream.ReadInt32L();
00160         aStream >> iUsername;
00161         aStream >> iIap;
00162         }
00163         
00164 // End of file

Generated by  doxygen 1.6.2