author | sl |
Tue, 10 Jun 2014 14:32:02 +0200 | |
changeset 1 | 260cb5ec6c19 |
permissions | -rw-r--r-- |
sl@0 | 1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
sl@0 | 2 |
// All rights reserved. |
sl@0 | 3 |
// This component and the accompanying materials are made available |
sl@0 | 4 |
// under the terms of the License "Eclipse Public License v1.0" |
sl@0 | 5 |
// which accompanies this distribution, and is available |
sl@0 | 6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
sl@0 | 7 |
// |
sl@0 | 8 |
// Initial Contributors: |
sl@0 | 9 |
// Nokia Corporation - initial contribution. |
sl@0 | 10 |
// |
sl@0 | 11 |
// Contributors: |
sl@0 | 12 |
// |
sl@0 | 13 |
// Description: |
sl@0 | 14 |
// e32test\device\t_slowir.h |
sl@0 | 15 |
// |
sl@0 | 16 |
// |
sl@0 | 17 |
|
sl@0 | 18 |
//#include <es_sock.h> |
sl@0 | 19 |
#include <e32test.h> |
sl@0 | 20 |
#include <e32cons.h> |
sl@0 | 21 |
#include <d32comm.h> |
sl@0 | 22 |
|
sl@0 | 23 |
#ifndef __T_SLOWIR__ |
sl@0 | 24 |
#define __T_SLOWIR__ |
sl@0 | 25 |
|
sl@0 | 26 |
// Our own comms object with synchronous writes |
sl@0 | 27 |
class RCommDev : public RBusDevComm |
sl@0 | 28 |
{ |
sl@0 | 29 |
public: |
sl@0 | 30 |
TInt WriteS(const TDesC8& aDes); |
sl@0 | 31 |
TInt WriteS(const TDesC8& aDes,TInt aLength); |
sl@0 | 32 |
TInt WriteSE(const TDes8& Entered, TInt aLength); |
sl@0 | 33 |
}; |
sl@0 | 34 |
|
sl@0 | 35 |
enum TXferType |
sl@0 | 36 |
{ |
sl@0 | 37 |
EWriteXfer, |
sl@0 | 38 |
EReadXfer, |
sl@0 | 39 |
EDiagXfer, |
sl@0 | 40 |
EDiscardXfer |
sl@0 | 41 |
}; |
sl@0 | 42 |
|
sl@0 | 43 |
class CActiveRW; |
sl@0 | 44 |
class CActiveConsole : public CActive |
sl@0 | 45 |
//----------------------------------- |
sl@0 | 46 |
{ |
sl@0 | 47 |
public: |
sl@0 | 48 |
// Construction |
sl@0 | 49 |
CActiveConsole(CConsoleBase* aConsole); |
sl@0 | 50 |
static CActiveConsole* NewLC(CConsoleBase* aConsole); |
sl@0 | 51 |
void ConstructL(); |
sl@0 | 52 |
|
sl@0 | 53 |
// Destruction |
sl@0 | 54 |
~CActiveConsole(); |
sl@0 | 55 |
|
sl@0 | 56 |
// Issue request |
sl@0 | 57 |
void RequestCharacter(); |
sl@0 | 58 |
|
sl@0 | 59 |
// Cancel request. |
sl@0 | 60 |
// Defined as pure virtual by CActive; |
sl@0 | 61 |
// implementation provided by this class. |
sl@0 | 62 |
void DoCancel(); |
sl@0 | 63 |
|
sl@0 | 64 |
// Service completed request. |
sl@0 | 65 |
// Defined as pure virtual by CActive; |
sl@0 | 66 |
// implementation provided by this class, |
sl@0 | 67 |
void RunL(); |
sl@0 | 68 |
|
sl@0 | 69 |
void ProcessKeyPressL(TChar aChar); |
sl@0 | 70 |
|
sl@0 | 71 |
// void GetFirRegs(); |
sl@0 | 72 |
// void GetDmaReaderRegs(); |
sl@0 | 73 |
// void GetDmaWriterRegs(); |
sl@0 | 74 |
// void GetReadBufInfo(); |
sl@0 | 75 |
// void GetWriteBufInfo(); |
sl@0 | 76 |
// void GetChunkInfo(); |
sl@0 | 77 |
// void GetMiscInfo(); |
sl@0 | 78 |
void Options1(); |
sl@0 | 79 |
void Options2(); |
sl@0 | 80 |
|
sl@0 | 81 |
public: |
sl@0 | 82 |
// Data members defined by this class |
sl@0 | 83 |
CConsoleBase* iConsole; // A console for reading from |
sl@0 | 84 |
CActiveRW* iRW; |
sl@0 | 85 |
|
sl@0 | 86 |
RCommDev* iPort; |
sl@0 | 87 |
TBool iInit1; |
sl@0 | 88 |
TBool iInit2; |
sl@0 | 89 |
}; |
sl@0 | 90 |
|
sl@0 | 91 |
|
sl@0 | 92 |
class CActiveRW : public CActive |
sl@0 | 93 |
//----------------------------------------------------------- |
sl@0 | 94 |
{ |
sl@0 | 95 |
public: |
sl@0 | 96 |
// Construction |
sl@0 | 97 |
CActiveRW(CConsoleBase* aConsole,RCommDev* aPort); |
sl@0 | 98 |
static CActiveRW* NewL(CConsoleBase* aConsole,RCommDev* aPort); |
sl@0 | 99 |
void ConstructL(); |
sl@0 | 100 |
|
sl@0 | 101 |
~CActiveRW(); |
sl@0 | 102 |
|
sl@0 | 103 |
void Start(TBool StartWriting); |
sl@0 | 104 |
void Stop(); |
sl@0 | 105 |
private: |
sl@0 | 106 |
void RunL (); |
sl@0 | 107 |
void DoCancel (); |
sl@0 | 108 |
TBool CompareBuffers(TInt aLen); |
sl@0 | 109 |
TInt ErrorStats(); |
sl@0 | 110 |
|
sl@0 | 111 |
private: |
sl@0 | 112 |
CConsoleBase* iConsole; |
sl@0 | 113 |
RCommDev* iPort; |
sl@0 | 114 |
TInt iLength; |
sl@0 | 115 |
TInt iNextXfer; |
sl@0 | 116 |
TInt iUnrecovered; |
sl@0 | 117 |
TInt iRxCount; |
sl@0 | 118 |
TInt iRxErrCount; |
sl@0 | 119 |
}; |
sl@0 | 120 |
|
sl@0 | 121 |
#endif // __T_SLOWIR__ |