00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef _PSERIALCHANNEL
00035 #define _PSERIALCHANNEL
00036
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040
00041
00042 class PConfig;
00043
00044
00046
00047
00051 class PSerialChannel : public PChannel
00052 {
00053 PCLASSINFO(PSerialChannel, PChannel);
00054
00055 public:
00058
00059 PSerialChannel();
00060
00062 enum Parity {
00064 DefaultParity,
00066 NoParity,
00068 EvenParity,
00070 OddParity,
00072 MarkParity,
00074 SpaceParity
00075 };
00076
00078 enum FlowControl {
00080 DefaultFlowControl,
00082 NoFlowControl,
00084 XonXoff,
00086 RtsCts
00087 };
00088
00093 PSerialChannel(
00098 const PString & port,
00103 DWORD speed = 0,
00107 BYTE data = 0,
00112 Parity parity = DefaultParity,
00116 BYTE stop = 0,
00118 FlowControl inputFlow = DefaultFlowControl,
00120 FlowControl outputFlow = DefaultFlowControl
00121 );
00122
00128 PSerialChannel(
00129 PConfig & cfg
00130 );
00131
00133 ~PSerialChannel();
00135
00136
00143 virtual PBoolean Open(
00148 const PString & port,
00153 DWORD speed = 0,
00157 BYTE data = 0,
00162 Parity parity = DefaultParity,
00166 BYTE stop = 0,
00168 FlowControl inputFlow = DefaultFlowControl,
00170 FlowControl outputFlow = DefaultFlowControl
00171 );
00172
00178 virtual PBoolean Open(
00179 PConfig & cfg
00180 );
00181
00190 static PStringList GetPortNames();
00192
00193
00201 PBoolean SetSpeed(
00202 DWORD speed
00203 );
00204
00210 DWORD GetSpeed() const;
00211
00217 PBoolean SetDataBits(
00218 BYTE data
00219 );
00220
00226 BYTE GetDataBits() const;
00227
00233 PBoolean SetParity(
00234 Parity parity
00235 );
00236
00242 Parity GetParity() const;
00243
00249 PBoolean SetStopBits(
00250 BYTE stop
00251 );
00252
00258 BYTE GetStopBits() const;
00259
00266 PBoolean SetInputFlowControl(
00267 FlowControl flowControl
00268 );
00269
00276 FlowControl GetInputFlowControl() const;
00277
00284 PBoolean SetOutputFlowControl(
00285 FlowControl flowControl
00286 );
00287
00294 FlowControl GetOutputFlowControl() const;
00295
00299 virtual void SaveSettings(
00300 PConfig & cfg
00301 );
00303
00304
00308 void SetDTR(
00309 PBoolean state = PTrue
00310 );
00311
00315 void ClearDTR();
00316
00318 void SetRTS(
00319 PBoolean state = PTrue
00320 );
00321
00325 void ClearRTS();
00326
00328 void SetBreak(
00329 PBoolean state = PTrue
00330 );
00331
00335 void ClearBreak();
00336
00342 PBoolean GetCTS();
00343
00349 PBoolean GetDSR();
00350
00356 PBoolean GetDCD();
00357
00363 PBoolean GetRing();
00365
00366
00367 private:
00368 void Construct();
00369
00370
00371
00372
00373 #ifdef _WIN32
00374 #include "msos/ptlib/serchan.h"
00375 #else
00376 #include "unix/ptlib/serchan.h"
00377 #endif
00378 };
00379
00380 #endif
00381
00382