24
|
1 |
/**
|
|
2 |
* Copyright (c) 2003-2009 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:
|
|
15 |
* Script Serial Comms I/O Functions Header.
|
|
16 |
* This should all be 8-bit so we don't need to deal with any conversions at this level.
|
|
17 |
*
|
|
18 |
*
|
|
19 |
*/
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
/**
|
|
24 |
@file Sio.h
|
|
25 |
@internalComponent
|
|
26 |
*/
|
|
27 |
|
|
28 |
#ifndef __SIO_H__
|
|
29 |
#define __SIO_H__
|
|
30 |
|
|
31 |
#include <nifutl.h>
|
|
32 |
#include <etel.h>
|
|
33 |
#include "ND_STD.H"
|
|
34 |
#include "SCHAT.H"
|
|
35 |
#include "SCOMMAND.H"
|
|
36 |
|
|
37 |
// Forward declarations
|
|
38 |
|
|
39 |
class CScriptExecutor;
|
|
40 |
class CPreSendPause;
|
|
41 |
|
|
42 |
class CScriptIO : public CBase, public MCommV2, public MCommChatNotify
|
|
43 |
|
|
44 |
/**
|
|
45 |
One of these per CScriptExecutor object (also uses CScriptExecutor object).
|
|
46 |
Has CPreSendPause and CCommChatter objects.
|
|
47 |
|
|
48 |
@internalComponent
|
|
49 |
*/
|
|
50 |
{
|
|
51 |
public:
|
|
52 |
static CScriptIO* NewL(CScriptExecutor* aScriptExecutor, const TDesC& aCommsChannel);
|
|
53 |
~CScriptIO();
|
|
54 |
//
|
|
55 |
void ConfigurePort(TRequestStatus& aStatus, const TCommConfig& aConfiguration);
|
|
56 |
void CancelConfigurePort();
|
|
57 |
void CreateChannel(TRequestStatus& aStatus);
|
|
58 |
void CancelCreateChannel();
|
|
59 |
void ShutdownChannel(TRequestStatus& aStatus);
|
|
60 |
void Start();
|
|
61 |
void Read(CLabelSearchArray* aSearchArray, const TReal& aTimeOut);
|
|
62 |
void ReadEcho();
|
|
63 |
void Write(const TDesC8& aString);
|
|
64 |
void PreSendPauseCompleted();
|
|
65 |
TBool RWPending();
|
|
66 |
inline TBool WritePending() const;
|
|
67 |
TInt GetExcessData(TDes8& aBuffer);
|
|
68 |
void Disconnect();
|
|
69 |
void ReConfigureAndCancelPort(TRequestStatus& aStatus);
|
|
70 |
void DropSignals(TRequestStatus& aStatus);
|
|
71 |
void Cancel();
|
|
72 |
void ReadEchoCancel();
|
|
73 |
void DropDTR(TRequestStatus* aStatusPtr);
|
|
74 |
void RaiseDTR(TRequestStatus* aStatusPtr);
|
|
75 |
void SetControlLines(TRequestStatus* aStatusPtr, TUint aSetMask, TUint aClearMask);
|
|
76 |
|
|
77 |
// MComm
|
|
78 |
virtual void CommReadComplete(TInt aStatus);
|
|
79 |
virtual void CommWriteComplete(TInt aStatus);
|
|
80 |
virtual const TDesC& BcaStack();
|
|
81 |
virtual void Stop(TInt aError);
|
|
82 |
virtual TInt IapId();
|
|
83 |
virtual void InitializeComplete();
|
|
84 |
virtual void ShutdownComplete(TInt aError);
|
|
85 |
//
|
|
86 |
// MCommChatNotify
|
|
87 |
virtual void ChatStringMatch(TInt aIndex);
|
|
88 |
virtual void ChatTimeout();
|
|
89 |
//
|
|
90 |
private:
|
|
91 |
CScriptIO(CScriptExecutor* aScriptExecutor);
|
|
92 |
void ConstructL(const TDesC& aCommsChannel);
|
|
93 |
private:
|
|
94 |
CScriptExecutor* iScriptExecutor;
|
|
95 |
CCommChatter* iChat;
|
|
96 |
CPreSendPause* iPreSendPause;
|
|
97 |
TInt iRxBufOffset;
|
|
98 |
TBuf8<KRxBufferSize> iRxBuffer;
|
|
99 |
TBuf8<KTxBufferSize> iTxBuffer;
|
|
100 |
CLabelSearchArray* iSearchArray;
|
|
101 |
TPtrC8 iExcessData;
|
|
102 |
TBool iReadPending;
|
|
103 |
TBool iWritePending;
|
|
104 |
TInt iStringFound;
|
|
105 |
TRequestStatus* iCreateAndShutdownStatus;
|
|
106 |
TInt iCreateError;
|
|
107 |
RBuf iCommsChannel;
|
|
108 |
TPckgBuf<TCommConfig> iConfig;
|
|
109 |
TUint iCommClosed : 1;
|
|
110 |
};
|
|
111 |
|
|
112 |
#include "SIO.INL"
|
|
113 |
|
|
114 |
|
|
115 |
class CPreSendPause : public CTimer
|
|
116 |
/**
|
|
117 |
One of these per CScriptIO object. Implements pause before sending.
|
|
118 |
|
|
119 |
@internalComponent
|
|
120 |
*/
|
|
121 |
{
|
|
122 |
public:
|
|
123 |
static CPreSendPause* NewL(CScriptIO* aNotifier);
|
|
124 |
CPreSendPause(CScriptIO* aNotifier);
|
|
125 |
void Start();
|
|
126 |
void RunL();
|
|
127 |
private:
|
|
128 |
CScriptIO* iNotifier;
|
|
129 |
};
|
|
130 |
|
|
131 |
#endif
|