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 is the root of the module. This file contains the
|
|
15 |
// * declarations for the CPortFactory class and is derived from
|
|
16 |
// * C32's CSerial.
|
|
17 |
//
|
|
18 |
|
|
19 |
// PortFactory.h
|
|
20 |
|
|
21 |
/** @file PortFactory.h
|
|
22 |
*
|
|
23 |
*/
|
|
24 |
|
|
25 |
#ifndef _PORTFACTORY_H__
|
|
26 |
#define _PORTFACTORY_H__
|
|
27 |
|
|
28 |
#include <e32std.h>
|
|
29 |
#include <e32hal.h>
|
|
30 |
#include <c32comm.h>
|
|
31 |
#include <d32comm.h>
|
|
32 |
#include <cs_port.h>
|
|
33 |
#include <cdblen.h>
|
|
34 |
#include "CsyGlobals.h"
|
|
35 |
|
|
36 |
class CPortC32Interface;
|
|
37 |
class CPortC32InterfaceBase;
|
|
38 |
class CChannelMgrBase;
|
|
39 |
class CChannelMgrCtrl;
|
|
40 |
class CChannelMgrCmdData;
|
|
41 |
class CMux0710Protocol;
|
|
42 |
class CCommFrameWriterAo;
|
|
43 |
class CCommFrameReaderAo;
|
|
44 |
|
|
45 |
/** @class CPortFactory PortFactory.h "PortFactory.h"
|
|
46 |
* @brief This class provides the factory object which is used to
|
|
47 |
* construct port objects in the CSY. There is only one instance of
|
|
48 |
* this class in the CSY. CPortFactory is derived from C32's CSerial
|
|
49 |
* base class. CPortFactory is also responsible for allocating the
|
|
50 |
* CSY's multiplexer objects and LDD interface objects.
|
|
51 |
*/
|
|
52 |
class CPortFactory : public CSerial
|
|
53 |
{
|
|
54 |
public:
|
|
55 |
enum TC32ClientType
|
|
56 |
{
|
|
57 |
EC32ClientUndefined,
|
|
58 |
EC32ClientTsy,
|
|
59 |
EC32ClientNif,
|
|
60 |
EC32ClientIpNif
|
|
61 |
};
|
|
62 |
|
|
63 |
struct TC32PortInfo
|
|
64 |
{
|
|
65 |
TC32ClientType iClientType;
|
|
66 |
TInt iPortNumber;
|
|
67 |
};
|
|
68 |
|
|
69 |
public:
|
|
70 |
static CPortFactory* NewL();
|
|
71 |
|
|
72 |
~CPortFactory();
|
|
73 |
|
|
74 |
static void CloseObject(TAny* aObject);
|
|
75 |
|
|
76 |
inline TBool IsMultiplexerCreated();
|
|
77 |
|
|
78 |
TC32ClientType GetClientType(TInt aPortNum);
|
|
79 |
|
|
80 |
inline CCommFrameWriterAo* GetCommWriterAo() const;
|
|
81 |
inline CCommFrameReaderAo* GetCommReaderAo() const;
|
|
82 |
|
|
83 |
RBusDevComm* DTEPort(); // LDD
|
|
84 |
|
|
85 |
void ConnectControlChannel();
|
|
86 |
void DisconnectControlChannel();
|
|
87 |
void ChannelCtrlDoCancel();
|
|
88 |
|
|
89 |
CPortC32InterfaceBase* FindPortC32Interface(const TUint8 aDlcNum);
|
|
90 |
CChannelMgrCmdData* FindChannelMgrByDlcNum(const TUint8 aDlcNum);
|
|
91 |
|
|
92 |
inline CMux0710Protocol* GetMux0710Protocol() const;
|
|
93 |
|
|
94 |
inline CChannelMgrCtrl* GetControlChannel() const;
|
|
95 |
|
|
96 |
void RemoveC32Port(CPortC32InterfaceBase* aPort);
|
|
97 |
|
|
98 |
void ConnectIpNifPort(const TUint8 aDlcNum);
|
|
99 |
|
|
100 |
TSecurityPolicy PortPlatSecCapability(TUint aPort) const;
|
|
101 |
|
|
102 |
TBool FindDlcToEnable();
|
|
103 |
void FindActiveDataDlcToStop();
|
|
104 |
void StopAnyDlc();
|
|
105 |
TBool DecrementNumOfOpenPorts();
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
private:
|
|
110 |
CPortFactory();
|
|
111 |
void ConstructL();
|
|
112 |
|
|
113 |
void CreateCsyObjectsL();
|
|
114 |
|
|
115 |
// from CSerial
|
|
116 |
virtual CPort* NewPortL(const TUint aUnit);
|
|
117 |
virtual void Info(TSerialInfo& aSerialInfo);
|
|
118 |
|
|
119 |
// utility methods
|
|
120 |
CChannelMgrCmdData* FindChannelMgr(const TUint aC32PortNum);
|
|
121 |
|
|
122 |
TInt ConfigurePhysicalCommPortL();
|
|
123 |
|
|
124 |
private:
|
|
125 |
// attributes
|
|
126 |
TBool iMuxObjectsCreated;
|
|
127 |
|
|
128 |
// C32 interface ports
|
|
129 |
TSglQue<CPortC32InterfaceBase> iPortC32InterfaceList;
|
|
130 |
TSglQueIter<CPortC32InterfaceBase> iPortC32InterfaceIter;
|
|
131 |
|
|
132 |
// multiplexer framer
|
|
133 |
CMux0710Protocol* iMux0710Protocol;
|
|
134 |
|
|
135 |
// multiplexer Control channel
|
|
136 |
CChannelMgrCtrl* iChannelCtrl;
|
|
137 |
|
|
138 |
// multiplexer Command channels
|
|
139 |
TSglQue<CChannelMgrCmdData> iDataChannelList;
|
|
140 |
TSglQueIter<CChannelMgrCmdData> iDataChannelIter;
|
|
141 |
|
|
142 |
// interface to the serial port logical device driver
|
|
143 |
RBusDevComm iCommPort;
|
|
144 |
CCommFrameWriterAo* iCommWriterAo;
|
|
145 |
CCommFrameReaderAo* iCommReaderAo;
|
|
146 |
|
|
147 |
TBool iDisconnectInProgress;
|
|
148 |
|
|
149 |
TUint iLastDlcNum;
|
|
150 |
TUint iNumOfOpenPorts;
|
|
151 |
|
|
152 |
TBool iOpenPortFailed;
|
|
153 |
};
|
|
154 |
|
|
155 |
|
|
156 |
// Inline Methods
|
|
157 |
inline CCommFrameWriterAo* CPortFactory::GetCommWriterAo() const
|
|
158 |
/**
|
|
159 |
* Return a pointer to the CSY's comm writer object.
|
|
160 |
* @param void
|
|
161 |
* @return Pointer to the CSY's comm writer object
|
|
162 |
*/
|
|
163 |
{
|
|
164 |
return iCommWriterAo;
|
|
165 |
}
|
|
166 |
|
|
167 |
inline CCommFrameReaderAo* CPortFactory::GetCommReaderAo() const
|
|
168 |
/**
|
|
169 |
* Return a pointer to the CSY's comm reader object.
|
|
170 |
* @param void
|
|
171 |
* @return Pointer to the CSY's comm reader object
|
|
172 |
*/
|
|
173 |
{
|
|
174 |
return iCommReaderAo;
|
|
175 |
}
|
|
176 |
|
|
177 |
inline RBusDevComm* CPortFactory::DTEPort()
|
|
178 |
/**
|
|
179 |
* Return a pointer to the CSY's LDD port interface object.
|
|
180 |
* @param void
|
|
181 |
* @return Pointer to the CSY's LDD port interface object
|
|
182 |
*/
|
|
183 |
{
|
|
184 |
return (&iCommPort);
|
|
185 |
}
|
|
186 |
|
|
187 |
inline CMux0710Protocol* CPortFactory::GetMux0710Protocol() const
|
|
188 |
/**
|
|
189 |
* Return a pointer to the CSY's mux protocol object.
|
|
190 |
* @param void
|
|
191 |
* @return Pointer to the CSY's mux protocol object
|
|
192 |
*/
|
|
193 |
{
|
|
194 |
return iMux0710Protocol;
|
|
195 |
}
|
|
196 |
|
|
197 |
inline CChannelMgrCtrl* CPortFactory::GetControlChannel() const
|
|
198 |
/**
|
|
199 |
* Return a pointer to the CSY's control channel object.
|
|
200 |
* @param void
|
|
201 |
* @return Pointer to the CSY's control channel object
|
|
202 |
*/
|
|
203 |
{
|
|
204 |
return iChannelCtrl;
|
|
205 |
}
|
|
206 |
|
|
207 |
#endif // _PORTFACTORY_H__ |