telephonyserverplugins/multimodetsy/hayes/SCOMM.H
changeset 0 3553901f7fa8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/telephonyserverplugins/multimodetsy/hayes/SCOMM.H	Tue Feb 02 01:41:59 2010 +0200
@@ -0,0 +1,96 @@
+// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Comms IO Mixin
+// 
+//
+
+/**
+ @file
+ @internalAll 
+*/
+
+#ifndef __SCOMM_H__
+#define __SCOMM_H__
+
+#include <c32comm.h>
+
+class CCommWriter;
+class CCommReader;
+class MComm
+/**
+@internalComponent
+*/
+	{
+protected:
+	MComm();
+	virtual ~MComm();
+	void CommConstructL(TInt aReadPriority, TInt aWritePriority);
+	 TInt CommOpen(const TDesC& aName, TCommAccess aAccess);
+	 TInt CommOpen(const TDesC& aDll, const TDesC& aName, TCommAccess aAccess);
+	 void CommClose();
+	 void CommCancel();
+	 void CommWrite(const TDesC8& aDes);
+	 void CommWriteReady();
+	 void CommWriteCancel();
+	 void CommRead(TDes8& aDes);
+	 void CommReadOneOrMore(TDes8& aDes);
+	 void CommReadReady();
+	 void CommReadCancel();
+	virtual void CommReadComplete(TInt aStatus)=0;
+	virtual void CommWriteComplete(TInt aStatus)=0;
+protected:
+	friend class CCommWriter;
+	friend class CCommReader;
+	RCommServ iCommServer;
+	RComm iCommPort;
+	CCommReader* iCommReader;
+	CCommWriter* iCommWriter;
+	TBuf8<1> iBuf;
+	};
+
+class CCommReader : public CActive
+/**
+@internalComponent
+*/
+	{
+public:
+	CCommReader(MComm* aComm, TInt aPriority);
+	virtual ~CCommReader();
+	inline void Activate() { SetActive(); }
+	inline TRequestStatus& StatusRef() { return iStatus; }
+protected:
+	virtual void RunL();
+	virtual void DoCancel();
+private:
+	MComm *iComm;
+	};
+
+class CCommWriter : public CActive
+/**
+@internalComponent
+*/
+	{
+public:
+	CCommWriter(MComm* aComm, TInt aPriority);
+	virtual ~CCommWriter();
+	inline void Activate() { SetActive(); }
+	inline TRequestStatus& StatusRef() { return iStatus; }
+protected:
+	virtual void RunL();
+	virtual void DoCancel();
+private:
+	MComm *iComm;
+	};
+
+#endif