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
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089 #ifndef _PSERIALCHANNEL
00090 #define _PSERIALCHANNEL
00091
00092 #ifdef P_USE_PRAGMA
00093 #pragma interface
00094 #endif
00095
00096
00097 class PConfig;
00098
00099
00101
00102
00106 class PSerialChannel : public PChannel
00107 {
00108 PCLASSINFO(PSerialChannel, PChannel);
00109
00110 public:
00113
00114 PSerialChannel();
00115
00117 enum Parity {
00119 DefaultParity,
00121 NoParity,
00123 EvenParity,
00125 OddParity,
00127 MarkParity,
00129 SpaceParity
00130 };
00131
00133 enum FlowControl {
00135 DefaultFlowControl,
00137 NoFlowControl,
00139 XonXoff,
00141 RtsCts
00142 };
00143
00148 PSerialChannel(
00153 const PString & port,
00158 DWORD speed = 0,
00162 BYTE data = 0,
00167 Parity parity = DefaultParity,
00171 BYTE stop = 0,
00173 FlowControl inputFlow = DefaultFlowControl,
00175 FlowControl outputFlow = DefaultFlowControl
00176 );
00177
00183 PSerialChannel(
00184 PConfig & cfg
00185 );
00186
00188 ~PSerialChannel();
00190
00191
00198 virtual BOOL Open(
00203 const PString & port,
00208 DWORD speed = 0,
00212 BYTE data = 0,
00217 Parity parity = DefaultParity,
00221 BYTE stop = 0,
00223 FlowControl inputFlow = DefaultFlowControl,
00225 FlowControl outputFlow = DefaultFlowControl
00226 );
00227
00233 virtual BOOL Open(
00234 PConfig & cfg
00235 );
00236
00245 static PStringList GetPortNames();
00247
00248
00256 BOOL SetSpeed(
00257 DWORD speed
00258 );
00259
00265 DWORD GetSpeed() const;
00266
00272 BOOL SetDataBits(
00273 BYTE data
00274 );
00275
00281 BYTE GetDataBits() const;
00282
00288 BOOL SetParity(
00289 Parity parity
00290 );
00291
00297 Parity GetParity() const;
00298
00304 BOOL SetStopBits(
00305 BYTE stop
00306 );
00307
00313 BYTE GetStopBits() const;
00314
00321 BOOL SetInputFlowControl(
00322 FlowControl flowControl
00323 );
00324
00331 FlowControl GetInputFlowControl() const;
00332
00339 BOOL SetOutputFlowControl(
00340 FlowControl flowControl
00341 );
00342
00349 FlowControl GetOutputFlowControl() const;
00350
00354 virtual void SaveSettings(
00355 PConfig & cfg
00356 );
00358
00359
00363 void SetDTR(
00364 BOOL state = TRUE
00365 );
00366
00370 void ClearDTR();
00371
00373 void SetRTS(
00374 BOOL state = TRUE
00375 );
00376
00380 void ClearRTS();
00381
00383 void SetBreak(
00384 BOOL state = TRUE
00385 );
00386
00390 void ClearBreak();
00391
00397 BOOL GetCTS();
00398
00404 BOOL GetDSR();
00405
00411 BOOL GetDCD();
00412
00418 BOOL GetRing();
00420
00421
00422 private:
00423 void Construct();
00424
00425
00426
00427
00428 #ifdef _WIN32
00429 #include "msos/ptlib/serchan.h"
00430 #else
00431 #include "unix/ptlib/serchan.h"
00432 #endif
00433 };
00434
00435 #endif
00436
00437