/usr/include/ptlib/serchan.h is in libpt-1.10.10-dev 1.10.10-3.1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | /*
* serchan.h
*
* Asynchronous Serial I/O channel class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Log: serchan.h,v $
* Revision 1.18 2005/11/25 03:43:47 csoutheren
* Fixed function argument comments to be compatible with Doxygen
*
* Revision 1.17 2005/02/20 21:18:30 dereksmithies
* Fix documentation typos.
*
* Revision 1.16 2003/09/17 05:41:59 csoutheren
* Removed recursive includes
*
* Revision 1.15 2003/09/17 01:18:02 csoutheren
* Removed recursive include file system and removed all references
* to deprecated coooperative threading support
*
* Revision 1.14 2002/09/16 01:08:59 robertj
* Added #define so can select if #pragma interface/implementation is used on
* platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
*
* Revision 1.13 2001/05/22 12:49:32 robertj
* Did some seriously wierd rewrite of platform headers to eliminate the
* stupid GNU compiler warning about braces not matching.
*
* Revision 1.12 1999/03/09 02:59:50 robertj
* Changed comments to doc++ compatible documentation.
*
* Revision 1.11 1999/02/16 08:11:10 robertj
* MSVC 6.0 compatibility changes.
*
* Revision 1.10 1998/09/23 06:21:21 robertj
* Added open source copyright license.
*
* Revision 1.9 1995/07/31 12:15:46 robertj
* Removed PContainer from PChannel ancestor.
*
* Revision 1.8 1995/06/17 11:13:18 robertj
* Documentation update.
*
* Revision 1.7 1995/03/14 12:42:33 robertj
* Updated documentation to use HTML codes.
*
* Revision 1.6 1995/01/14 06:19:37 robertj
* Documentation
*
* Revision 1.5 1994/08/23 11:32:52 robertj
* Oops
*
* Revision 1.4 1994/08/22 00:46:48 robertj
* Added pragma fro GNU C++ compiler.
*
* Revision 1.3 1994/07/17 10:46:06 robertj
* Moved data to PChannel class.
*
* Revision 1.2 1994/06/25 11:55:15 robertj
* Unix version synchronisation.
*
* Revision 1.1 1994/04/20 12:17:44 robertj
* Initial revision
*
*/
#ifndef _PSERIALCHANNEL
#define _PSERIALCHANNEL
#ifdef P_USE_PRAGMA
#pragma interface
#endif
class PConfig;
///////////////////////////////////////////////////////////////////////////////
// Serial Channel
/**This class defines an I/O channel that communicates via a serial port. This
is usually an RS-232 port.
*/
class PSerialChannel : public PChannel
{
PCLASSINFO(PSerialChannel, PChannel);
public:
/**@name Construction */
//@{
/// Create a new serial channel object, but do not open it.
PSerialChannel();
/// Configuration of serial port parity options.
enum Parity {
/// Use the default parity, ie do not change it.
DefaultParity,
/// Set the port for no parity bit.
NoParity,
/// Set the port to generate parity and make it even.
EvenParity,
/// Set the port to generate parity and make it odd.
OddParity,
/// Set the port parity bit to mark only.
MarkParity,
/// Set the port parity bit to space only.
SpaceParity
};
/// Configuration of serial port flow control options.
enum FlowControl {
/// Use the default flow control, ie do not change it.
DefaultFlowControl,
/// Set the port for no flow control.
NoFlowControl,
/// Set the port for software or XON/XOFF flow control.
XonXoff,
/// Set the port for hardware or RTS/CTS flow control.
RtsCts
};
/**Create a serial channal.
The channel is opened it on the specified port and with the specified
attributes.
*/
PSerialChannel(
/**The name of the serial port to connect to. This is a platform
dependent string and woiuld rarely be a literal. The static function
#GetPortNames()# can be used to find the platforms serial ports.
*/
const PString & port,
/**Serial port speed or baud rate. The actual values possible here are
platform dependent, but the standard value of 300, 1200, 2400, 4800,
9600, 19200, 38400 always be legal.
*/
DWORD speed = 0,
/**Number of data bits for serial port. The actual values possible here
are platform dependent, but 7 and 8 should always be legal.
*/
BYTE data = 0,
/**Parity for serial port. The actual values possible here are platform
dependent, but #NoParity#, #OddParity# and
#EvenParity# should always be legal.
*/
Parity parity = DefaultParity,
/**Number of stop bits for serial port. The actual values possible here
are platform dependent, but 1 and 2 should always be legal.
*/
BYTE stop = 0,
/**Flow control for data from the remote system into this conputer.*/
FlowControl inputFlow = DefaultFlowControl,
/**Flow control for data from this conputer out to remote system. */
FlowControl outputFlow = DefaultFlowControl
);
/**Create a serial channal.
The channel is opened using attributes obtained from standard variables
in the configuration file. Note that it assumed that the correct
configuration file section is already set.
*/
PSerialChannel(
PConfig & cfg ///< Configuration file to read serial port attributes from.
);
/// Close the serial channel on destruction.
~PSerialChannel();
//@}
/**@name Open functions */
//@{
/**Open a serial channal.
The channel is opened it on the specified port and with the specified
attributes.
*/
virtual BOOL Open(
/**The name of the serial port to connect to. This is a platform
dependent string and woiuld rarely be a literal. The static function
#GetPortNames()# can be used to find the platforms serial ports.
*/
const PString & port,
/**Serial port speed or baud rate. The actual values possible here are
platform dependent, but the standard value of 300, 1200, 2400, 4800,
9600, 19200, 38400 always be legal.
*/
DWORD speed = 0,
/**Number of data bits for serial port. The actual values possible here
are platform dependent, but 7 and 8 should always be legal.
*/
BYTE data = 0,
/**Parity for serial port. The actual values possible here are platform
dependent, but #NoParity#, #OddParity# and
#EvenParity# should always be legal.
*/
Parity parity = DefaultParity,
/**Number of stop bits for serial port. The actual values possible here
are platform dependent, but 1 and 2 should always be legal.
*/
BYTE stop = 0,
/**Flow control for data from the remote system into this conputer.*/
FlowControl inputFlow = DefaultFlowControl,
/**Flow control for data from this conputer out to remote system. */
FlowControl outputFlow = DefaultFlowControl
);
/**Open a serial channal.
The channel is opened using attributes obtained from standard variables
in the configuration file. Note that it assumed that the correct
configuration file section is already set.
*/
virtual BOOL Open(
PConfig & cfg ///< Configuration file to read serial port attributes from.
);
/**Get a list of the available serial ports. This returns a set of
platform dependent strings which describe the serial ports of the
computer. For example under unix it may be "ttyS0", under MS-DOS or
NT it would be "COM1" and for the Macintosh it could be "Modem".
@return
list of strings for possible serial ports.
*/
static PStringList GetPortNames();
//@}
/**@name Configuration functions */
//@{
/**Set the speed (baud rate) of the serial channel.
@return
TRUE if the change was successfully made.
*/
BOOL SetSpeed(
DWORD speed ///< New speed for serial channel.
);
/**Get the speed (baud rate) of the serial channel.
@return
current setting.
*/
DWORD GetSpeed() const;
/**Set the data bits (5, 6, 7 or 8) of the serial port.
@return
TRUE if the change was successfully made.
*/
BOOL SetDataBits(
BYTE data ///< New number of data bits for serial channel.
);
/**Get the data bits (5, 6, 7 or 8) of the serial port.
@return
current setting.
*/
BYTE GetDataBits() const;
/**Set the parity of the serial port.
@return
TRUE if the change was successfully made.
*/
BOOL SetParity(
Parity parity ///< New parity option for serial channel.
);
/**Get the parity of the serial port.
@return
current setting.
*/
Parity GetParity() const;
/**Set the stop bits (1 or 2) of the serial port.
@return
TRUE if the change was successfully made.
*/
BOOL SetStopBits(
BYTE stop ///< New number of stop bits for serial channel.
);
/**Get the stop bits (1 or 2) of the serial port.
@return
current setting.
*/
BYTE GetStopBits() const;
/**Set the flow control (handshaking) protocol of the input to the serial
port.
@return
TRUE if the change was successfully made.
*/
BOOL SetInputFlowControl(
FlowControl flowControl ///< New flow control for serial channel input.
);
/**Get the flow control (handshaking) protocol of the input to the serial
port.
@return
current setting.
*/
FlowControl GetInputFlowControl() const;
/**Set the flow control (handshaking) protocol of the output to the serial
port.
@return
TRUE if the change was successfully made.
*/
BOOL SetOutputFlowControl(
FlowControl flowControl ///< New flow control for serial channel output.
);
/**Get the flow control (handshaking) protocol of the output from the
serial port.
@return
current setting.
*/
FlowControl GetOutputFlowControl() const;
/**Save the current port settings into the configuration file. Note that
it assumed that the correct configuration file section is already set.
*/
virtual void SaveSettings(
PConfig & cfg ///< Configuration file to save setting into.
);
//@}
/**@name Status functions */
//@{
/** Set the Data Terminal Ready signal of the serial port. */
void SetDTR(
BOOL state = TRUE ///< New state of the DTR signal.
);
/**Clear the Data Terminal Ready signal of the serial port. This is
equivalent to #SetDTR(FALSE)#.
*/
void ClearDTR();
/**Set the Request To Send signal of the serial port. */
void SetRTS(
BOOL state = TRUE ///< New state of the RTS signal.
);
/**Clear the Request To Send signal of the serial port. This is equivalent
to #SetRTS(FALSE)#.
*/
void ClearRTS();
/** Set the break condition of the serial port. */
void SetBreak(
BOOL state = TRUE ///< New state of the serial port break condition.
);
/**Clear the break condition of the serial port. This is equivalent to
#SetBreak(FALSE)#.
*/
void ClearBreak();
/**Get the Clear To Send signal of the serial port.
@return
TRUE if the CTS signal is asserted.
*/
BOOL GetCTS();
/**Get the Data Set Ready signal of the serial port.
@return
TRUE if the DSR signal is asserted.
*/
BOOL GetDSR();
/**Get the Data Carrier Detect signal of the serial port.
@return
TRUE if the DCD signal is asserted.
*/
BOOL GetDCD();
/**Get the Ring Indicator signal of the serial port.
@return
TRUE if the RI signal is asserted.
*/
BOOL GetRing();
//@}
private:
void Construct();
// Platform dependent construct of the serial channel.
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/serchan.h"
#else
#include "unix/ptlib/serchan.h"
#endif
};
#endif
// End Of File ///////////////////////////////////////////////////////////////
|