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
#ifndef _PSERIALCHANNEL
00084
#define _PSERIALCHANNEL
00085
00086
#ifdef P_USE_PRAGMA
00087
#pragma interface
00088
#endif
00089
00090
00091
class PConfig;
00092
00093
00095
00096
00100 class PSerialChannel :
public PChannel
00101 {
00102
PCLASSINFO(
PSerialChannel,
PChannel);
00103
00104
public:
00107
00108
PSerialChannel();
00109
00111 enum Parity {
00113
DefaultParity,
00115
NoParity,
00117
EvenParity,
00119
OddParity,
00121
MarkParity,
00123
SpaceParity
00124 };
00125
00127 enum FlowControl {
00129
DefaultFlowControl,
00131
NoFlowControl,
00133
XonXoff,
00135
RtsCts
00136 };
00137
00142
PSerialChannel(
00143
const PString & port,
00148 DWORD speed = 0,
00153 BYTE data = 0,
00157 Parity parity = DefaultParity,
00162 BYTE stop = 0,
00166 FlowControl inputFlow = DefaultFlowControl,
00168 FlowControl outputFlow = DefaultFlowControl
00170 );
00171
00177
PSerialChannel(
00178
PConfig & cfg
00179 );
00180
00182
~PSerialChannel();
00184
00185
00192
virtual BOOL Open(
00193
const PString & port,
00198 DWORD speed = 0,
00203 BYTE data = 0,
00207 Parity parity = DefaultParity,
00212 BYTE stop = 0,
00216 FlowControl inputFlow = DefaultFlowControl,
00218 FlowControl outputFlow = DefaultFlowControl
00220 );
00221
00227
virtual BOOL Open(
00228
PConfig & cfg
00229 );
00230
00239
static PStringList GetPortNames();
00241
00242
00250 BOOL SetSpeed(
00251 DWORD speed
00252 );
00253
00259 DWORD
GetSpeed() const;
00260
00266 BOOL SetDataBits(
00267 BYTE data
00268 );
00269
00275 BYTE GetDataBits() const;
00276
00282 BOOL SetParity(
00283 Parity parity
00284 );
00285
00291 Parity GetParity() const;
00292
00298 BOOL SetStopBits(
00299 BYTE stop
00300 );
00301
00307 BYTE GetStopBits() const;
00308
00315 BOOL SetInputFlowControl(
00316 FlowControl flowControl
00317 );
00318
00325 FlowControl GetInputFlowControl() const;
00326
00333 BOOL SetOutputFlowControl(
00334 FlowControl flowControl
00335 );
00336
00343 FlowControl GetOutputFlowControl() const;
00344
00348 virtual
void SaveSettings(
00349
PConfig & cfg
00350 );
00352
00353
00357
void SetDTR(
00358 BOOL state = TRUE
00359 );
00360
00364
void ClearDTR();
00365
00367
void SetRTS(
00368 BOOL state = TRUE
00369 );
00370
00374
void ClearRTS();
00375
00377
void SetBreak(
00378 BOOL state = TRUE
00379 );
00380
00384
void ClearBreak();
00385
00391 BOOL GetCTS();
00392
00398 BOOL GetDSR();
00399
00405 BOOL GetDCD();
00406
00412 BOOL GetRing();
00414
00415
00416 private:
00417
void Construct();
00418
00419
00420
00421
00422 #ifdef _WIN32
00423 #include "msos/ptlib/serchan.h"
00424 #else
00425 #include "unix/ptlib/serchan.h"
00426 #endif
00427 };
00428
00429 #endif
00430
00431