telephonyserverplugins/multimodetsy/hayes/SCOMM.H
changeset 0 3553901f7fa8
child 24 6638e7f4bd8f
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 1997-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 // Comms IO Mixin
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalAll 
       
    21 */
       
    22 
       
    23 #ifndef __SCOMM_H__
       
    24 #define __SCOMM_H__
       
    25 
       
    26 #include <c32comm.h>
       
    27 
       
    28 class CCommWriter;
       
    29 class CCommReader;
       
    30 class MComm
       
    31 /**
       
    32 @internalComponent
       
    33 */
       
    34 	{
       
    35 protected:
       
    36 	MComm();
       
    37 	virtual ~MComm();
       
    38 	void CommConstructL(TInt aReadPriority, TInt aWritePriority);
       
    39 	 TInt CommOpen(const TDesC& aName, TCommAccess aAccess);
       
    40 	 TInt CommOpen(const TDesC& aDll, const TDesC& aName, TCommAccess aAccess);
       
    41 	 void CommClose();
       
    42 	 void CommCancel();
       
    43 	 void CommWrite(const TDesC8& aDes);
       
    44 	 void CommWriteReady();
       
    45 	 void CommWriteCancel();
       
    46 	 void CommRead(TDes8& aDes);
       
    47 	 void CommReadOneOrMore(TDes8& aDes);
       
    48 	 void CommReadReady();
       
    49 	 void CommReadCancel();
       
    50 	virtual void CommReadComplete(TInt aStatus)=0;
       
    51 	virtual void CommWriteComplete(TInt aStatus)=0;
       
    52 protected:
       
    53 	friend class CCommWriter;
       
    54 	friend class CCommReader;
       
    55 	RCommServ iCommServer;
       
    56 	RComm iCommPort;
       
    57 	CCommReader* iCommReader;
       
    58 	CCommWriter* iCommWriter;
       
    59 	TBuf8<1> iBuf;
       
    60 	};
       
    61 
       
    62 class CCommReader : public CActive
       
    63 /**
       
    64 @internalComponent
       
    65 */
       
    66 	{
       
    67 public:
       
    68 	CCommReader(MComm* aComm, TInt aPriority);
       
    69 	virtual ~CCommReader();
       
    70 	inline void Activate() { SetActive(); }
       
    71 	inline TRequestStatus& StatusRef() { return iStatus; }
       
    72 protected:
       
    73 	virtual void RunL();
       
    74 	virtual void DoCancel();
       
    75 private:
       
    76 	MComm *iComm;
       
    77 	};
       
    78 
       
    79 class CCommWriter : public CActive
       
    80 /**
       
    81 @internalComponent
       
    82 */
       
    83 	{
       
    84 public:
       
    85 	CCommWriter(MComm* aComm, TInt aPriority);
       
    86 	virtual ~CCommWriter();
       
    87 	inline void Activate() { SetActive(); }
       
    88 	inline TRequestStatus& StatusRef() { return iStatus; }
       
    89 protected:
       
    90 	virtual void RunL();
       
    91 	virtual void DoCancel();
       
    92 private:
       
    93 	MComm *iComm;
       
    94 	};
       
    95 
       
    96 #endif