testexecfw/statsrv/device/source/statapi/light/statlightserial/src/serialdriver.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/statsrv/device/source/statapi/light/statlightserial/src/serialdriver.h Mon Mar 08 15:03:44 2010 +0800
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005-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:
+*
+*/
+
+
+
+/**
+@file
+@internalComponent
+*/
+
+#ifndef __SERIAL_DRIVER_H
+#define __SERIAL_DRIVER_H
+
+#define MAX_PORTS 10 // randomly high value...
+
+#include <e32std.h>
+#include <e32cmn.h>
+
+class RSerialPort; // actually defined within the implementation
+
+
+class CSerialServer
+{
+
+friend class CSerialPort; // declare CSerialPort our friemd
+
+public:
+ CSerialServer();
+ virtual ~CSerialServer();
+
+ TBool Open(void);
+ TBool Close(void);
+
+private:
+
+ // These next methods are for friends and not intended
+ // as part of the truely public interface.
+ RSerialPort * GetPort(TUint aPortNum);
+ RSerialPort * InitialisePort(TUint aPortNum);
+ TBool ClosePort(TUint aPortNum);
+
+ // member variables
+
+ TInt m_errPhysicalLoad;
+ TInt m_errLogicalLoad;
+
+ RSerialPort * portsInUse[MAX_PORTS]; // array for holding set of port info
+};
+
+
+class CSerialPort
+{
+public:
+ CSerialPort();
+ virtual ~CSerialPort();
+
+ TBool Open(CSerialServer & aServer, TUint aPort);
+ TBool Close(void);
+
+ TBool Read(TRequestStatus & aStatus,
+ TTimeIntervalMicroSeconds32 aTimeout,
+ TDes8 &aDes,
+ TInt aLength);
+
+ TBool Write(TRequestStatus & aStatus,
+ TTimeIntervalMicroSeconds32 aTimeout,
+ const TDesC8 &aDes,
+ TInt aLength);
+
+ TInt SetConfig(const TCommConfig & aRequiredConfig);
+
+ TBool GetPortConfig(TCommConfig & aPortSettings);
+
+ TBool ReadCancel(void);
+
+ TBool WriteCancel(void);
+
+ TBool SetReceiveBufferLength(TInt aSize);
+
+ TBool ReceiveBufferLength(TInt & aSize);
+
+ public:
+
+ //functions
+ RSerialPort * GivePortDetails(void);
+
+ // Member variables
+ CSerialServer * m_pOurServer;
+
+ TUint m_portId;
+
+};
+
+#endif