multimediacommsengine/tsrc/testdriver/testclient/net/src/CTcSerialManager.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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:  See class definition below.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CTCSERIALMANAGER_H__
       
    19 #define __CTCSERIALMANAGER_H__
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <c32comm.h>
       
    24 #include "MTcBearerManager.h"
       
    25 #include "MTcBearerObserver.h"
       
    26 #include "CTcSerialConnection.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class TTcSerialFactory;
       
    30 
       
    31 // CLASS DEFINITION
       
    32 /**
       
    33  * CTcSerialManager implements Serial port connection management.
       
    34  * It also owns and controls the CTcSerialConnection instance
       
    35  */
       
    36 class CTcSerialManager
       
    37 	: public CBase,
       
    38 	  public MTcBearerManager,
       
    39 	  public MTcBearerObserver
       
    40 	{
       
    41 	public:	// Constructors and destructor
       
    42 
       
    43 		/**
       
    44 		 * Static constructor.
       
    45 		 *
       
    46 		 * @param aFactory Specifies the used bearer type
       
    47 		 * @return An initialized instance of this class
       
    48 		 */
       
    49 		static CTcSerialManager* NewL( const TTcSerialFactory& aFactory );
       
    50 
       
    51 		/// Destructor
       
    52 		~CTcSerialManager();
       
    53 
       
    54 	private: // Constructors
       
    55 
       
    56 		/**
       
    57 		 * Constructor
       
    58 		 *
       
    59 		 * @param aFactory Specifies the used bearer type
       
    60 		 */
       
    61 		CTcSerialManager( const TTcSerialFactory& aFactory );
       
    62 
       
    63 		/// Default constructor. Not implemented.
       
    64 		CTcSerialManager();
       
    65 
       
    66 		/// 2nd phase constructor.
       
    67 		void ConstructL();
       
    68 
       
    69 	public: // From MTcBearerManager
       
    70 
       
    71 		void ConnectL( TInetAddr* aRemoteAddr );
       
    72 		void Close();
       
    73 		void Send( const TDesC8& aDes );
       
    74 		void Receive( TDes8& aDes );
       
    75 		void ReceiveOneOrMore( TDes8& aDes );
       
    76 		void SetObserver( MTcBearerObserver* aObserver );
       
    77 		void GetLocalAddressL( TDes& aDes );
       
    78 
       
    79 	public: // From MTcBearerObserver
       
    80 
       
    81 		void BearerCompletion( MTcBearerObserver::TOperation aOp,
       
    82 							   TInt aStatus );
       
    83 
       
    84 	private: // New methods
       
    85 
       
    86         void LoadDriversAndCommModuleL();
       
    87         
       
    88 	private: // Data
       
    89 
       
    90         /// Factory. Not owned.
       
    91         const TTcSerialFactory& iFactory;
       
    92         
       
    93         RCommServ iCommServ;
       
    94        
       
    95 		/// Connection implementation. Owned.
       
    96 		CTcSerialConnection* iConn;
       
    97 
       
    98 		/// Connection observer. Not owned.
       
    99 		MTcBearerObserver* iObserver;
       
   100 
       
   101 	};
       
   102 
       
   103 #endif // __CTCSERIALMANAGER_H__