44
|
1 |
//
|
|
2 |
// * Copyright 2004 Neusoft America Inc.
|
|
3 |
// * All rights reserved.
|
|
4 |
// * This component and the accompanying materials are made available
|
|
5 |
// * under the terms of the 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 |
// * Contributors:
|
|
10 |
// * Keith Collins (Neusoft America Inc.) original software development and additional code and modifications.
|
|
11 |
// * Thomas Gahagen (Neusoft America Inc.) additional code and modifications.
|
|
12 |
// * Zhen Yuan (Neusoft America Inc.) additional code and modifications.
|
|
13 |
// *
|
|
14 |
// * Description: This file defines the CPortC32Interface class. This class
|
|
15 |
// * is equivalent to client RComm subsessions. This is derived
|
|
16 |
// * from the C32 base class for ports CPort.
|
|
17 |
//
|
|
18 |
|
|
19 |
// CPortC32InterfaceBase.h
|
|
20 |
/** @file
|
|
21 |
*
|
|
22 |
* PortC32InterfaceBase:
|
|
23 |
* - Equivalent to client RComm subsessions. This is base class
|
|
24 |
* derived from the C32 base class for ports CPort.
|
|
25 |
*/
|
|
26 |
|
|
27 |
#ifndef _PORTC32INTERFACEBASE_H__
|
|
28 |
#define _PORTC32INTERFACEBASE_H__
|
|
29 |
|
|
30 |
#include <cs_port.h>
|
|
31 |
#include "CsyGlobals.h"
|
|
32 |
#include "Portfactory.h"
|
|
33 |
|
|
34 |
class CChannelMgrCmdData;
|
|
35 |
class CCsyMsgBufBpFrame;
|
|
36 |
|
|
37 |
class CPortC32InterfaceBase : public CPort
|
|
38 |
{
|
|
39 |
public:
|
|
40 |
virtual ~CPortC32InterfaceBase();
|
|
41 |
|
|
42 |
// from CPort
|
|
43 |
virtual void Destruct();
|
|
44 |
virtual void StartRead(const TAny* aClientBuffer, TInt aLength);
|
|
45 |
virtual void ReadCancel();
|
|
46 |
virtual void NotifySignalChange(TUint aSignalMask);
|
|
47 |
virtual void NotifySignalChangeCancel();
|
|
48 |
virtual void StartWrite(const TAny* aClientBuffer, TInt aLength);
|
|
49 |
virtual TInt SetConfig(const TDesC8& aPackage);
|
|
50 |
|
|
51 |
// message passing
|
|
52 |
void CompleteWriteRequest(TInt aStatus);
|
|
53 |
virtual void SendFrameToClient(CCsyMsgBufBpFrame* aFrame) = 0;
|
|
54 |
|
|
55 |
|
|
56 |
// utility methods
|
|
57 |
void SetMuxChannel(CChannelMgrCmdData* aMuxChannel);
|
|
58 |
CChannelMgrCmdData* GetMuxChannel() const;
|
|
59 |
TInt GetPortNumber() const;
|
|
60 |
CPortFactory::TC32ClientType GetClientType() const;
|
|
61 |
|
|
62 |
void ModemAndCsyToClientFlowCtrl(const TFlowControl aFlowControl);
|
|
63 |
void ReceivedV24Signals(const TUint8 aV24Signals);
|
|
64 |
TInt SetV24Signals(const TUint aRs232Signals);
|
|
65 |
|
|
66 |
void IncRefCount();
|
|
67 |
void CompleteOutstandingRequest();
|
|
68 |
|
|
69 |
// link for parent CPortFactory
|
|
70 |
TSglQueLink iLink;
|
|
71 |
|
|
72 |
protected:
|
|
73 |
CPortC32InterfaceBase(CPortFactory& aPortFactory,
|
|
74 |
CPortFactory::TC32PortInfo& aPortInfo);
|
|
75 |
void ConstructL();
|
|
76 |
void SetDataAvailable();
|
|
77 |
|
|
78 |
void CompleteReadRequest(TInt aStatus);
|
|
79 |
virtual TBool ReadFromBufOrQueue() = 0;
|
|
80 |
|
|
81 |
// utility
|
|
82 |
void RemoveWaitingAllFrames(TBool aAddToFreeList = ETrue);
|
|
83 |
void Shutdown();
|
|
84 |
|
|
85 |
|
|
86 |
// from CPort, but not all are supported by the CSY
|
|
87 |
virtual TInt QueryReceiveBuffer(TInt& aLength) const = 0;
|
|
88 |
virtual void ResetBuffers(TUint aFlags) = 0;
|
|
89 |
virtual void Break(TInt aTime);
|
|
90 |
virtual void BreakCancel();
|
|
91 |
virtual void WriteCancel();
|
|
92 |
virtual TInt GetConfig(TDes8& aPackage) const;
|
|
93 |
virtual TInt SetServerConfig(const TDesC8& aPackage);
|
|
94 |
virtual TInt GetServerConfig(TDes8& aPackage);
|
|
95 |
virtual TInt GetCaps(TDes8& aPackage);
|
|
96 |
virtual TInt GetSignals(TUint& aSignals);
|
|
97 |
virtual TInt SetSignalsToMark(TUint aSignals);
|
|
98 |
virtual TInt SetSignalsToSpace(TUint aSignals);
|
|
99 |
virtual TInt GetReceiveBufferLength(TInt& aLength) const;
|
|
100 |
virtual TInt SetReceiveBufferLength(TInt aLength);
|
|
101 |
virtual void FreeMemory();
|
|
102 |
virtual void NotifyDataAvailable();
|
|
103 |
virtual void NotifyDataAvailableCancel();
|
|
104 |
virtual void NotifyConfigChange();
|
|
105 |
virtual void NotifyConfigChangeCancel();
|
|
106 |
virtual void NotifyFlowControlChange();
|
|
107 |
virtual void NotifyFlowControlChangeCancel();
|
|
108 |
virtual void NotifyBreak();
|
|
109 |
virtual void NotifyBreakCancel();
|
|
110 |
virtual void NotifyOutputEmpty();
|
|
111 |
virtual void NotifyOutputEmptyCancel();
|
|
112 |
virtual TInt GetFlowControlStatus(TFlowControl& aFlowControl);
|
|
113 |
virtual TInt GetRole(TCommRole& aRole);
|
|
114 |
virtual TInt SetRole(TCommRole aRole);
|
|
115 |
|
|
116 |
protected:
|
|
117 |
|
|
118 |
// List of frames waiting to be read by the client
|
|
119 |
TSglQue<CCsyMsgBufBpFrame> iFramesWaitingToBeReadList;
|
|
120 |
TSglQueIter<CCsyMsgBufBpFrame> iFramesWaitingToBeReadIter;
|
|
121 |
|
|
122 |
// attributes
|
|
123 |
TCommRole iRole;
|
|
124 |
TCommConfigV01 iConfig;
|
|
125 |
CPortFactory& iPortFactory;
|
|
126 |
|
|
127 |
CPortFactory::TC32PortInfo iPortInfo;
|
|
128 |
CChannelMgrCmdData* iMuxChannel;
|
|
129 |
|
|
130 |
// Pointer to client's read buffer when there is a read outstanding.
|
|
131 |
// (This is the way C32 transfers messages from clients to CSYs.)
|
|
132 |
TAny* iClientBuffer;
|
|
133 |
TInt iClientLength;
|
|
134 |
TInt iPos;
|
|
135 |
TBool iOneOrMore;
|
|
136 |
|
|
137 |
TFlowControl iCsyAllowedToSendFrames;
|
|
138 |
TBool iFlowControlNotifyPending;
|
|
139 |
|
|
140 |
TUint iSignals;
|
|
141 |
TUint iSentSignals;
|
|
142 |
TUint iSignalMask;
|
|
143 |
TBool iSignalChangeNotifyPending;
|
|
144 |
|
|
145 |
TBool iDataAvailableNotifyPending;
|
|
146 |
|
|
147 |
TBool iIsWriteInProgress;
|
|
148 |
TBool iIsReadInProgress;
|
|
149 |
};
|
|
150 |
|
|
151 |
|
|
152 |
// Inline methods
|
|
153 |
inline CChannelMgrCmdData* CPortC32InterfaceBase::GetMuxChannel() const
|
|
154 |
/**
|
|
155 |
* Return a pointer to the mux channel associated with this C32 port.
|
|
156 |
*
|
|
157 |
* @return Pointer to the mux channel associated with this C32 port
|
|
158 |
*/
|
|
159 |
{
|
|
160 |
return iMuxChannel;
|
|
161 |
}
|
|
162 |
|
|
163 |
inline CPortFactory::TC32ClientType CPortC32InterfaceBase::GetClientType() const
|
|
164 |
/**
|
|
165 |
* Return the client type (command or data) for this C32 port.
|
|
166 |
*
|
|
167 |
* @return Client type command or data
|
|
168 |
*/
|
|
169 |
{
|
|
170 |
return iPortInfo.iClientType;
|
|
171 |
}
|
|
172 |
|
|
173 |
inline TInt CPortC32InterfaceBase::GetPortNumber() const
|
|
174 |
/**
|
|
175 |
* Return the port number for this C32 port.
|
|
176 |
*
|
|
177 |
* @return Port number
|
|
178 |
*/
|
|
179 |
{
|
|
180 |
return iPortInfo.iPortNumber;
|
|
181 |
}
|
|
182 |
|
|
183 |
inline void CPortC32InterfaceBase::IncRefCount()
|
|
184 |
/**
|
|
185 |
* Increment the reference count for this object.
|
|
186 |
*/
|
|
187 |
{
|
|
188 |
Inc();
|
|
189 |
};
|
|
190 |
|
|
191 |
#endif // _PORTC32INTERFACEBASE_H__
|