Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

serchan.h

Go to the documentation of this file.
00001 /* 00002 * serchan.h 00003 * 00004 * Asynchronous Serial I/O channel class. 00005 * 00006 * Portable Windows Library 00007 * 00008 * Copyright (c) 1993-1998 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Portions are Copyright (C) 1993 Free Software Foundation, Inc. 00025 * All Rights Reserved. 00026 * 00027 * Contributor(s): ______________________________________. 00028 * 00029 * $Log: serchan.h,v $ 00030 * Revision 1.16 2003/09/17 05:41:59 csoutheren 00031 * Removed recursive includes 00032 * 00033 * Revision 1.15 2003/09/17 01:18:02 csoutheren 00034 * Removed recursive include file system and removed all references 00035 * to deprecated coooperative threading support 00036 * 00037 * Revision 1.14 2002/09/16 01:08:59 robertj 00038 * Added #define so can select if #pragma interface/implementation is used on 00039 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00040 * 00041 * Revision 1.13 2001/05/22 12:49:32 robertj 00042 * Did some seriously wierd rewrite of platform headers to eliminate the 00043 * stupid GNU compiler warning about braces not matching. 00044 * 00045 * Revision 1.12 1999/03/09 02:59:50 robertj 00046 * Changed comments to doc++ compatible documentation. 00047 * 00048 * Revision 1.11 1999/02/16 08:11:10 robertj 00049 * MSVC 6.0 compatibility changes. 00050 * 00051 * Revision 1.10 1998/09/23 06:21:21 robertj 00052 * Added open source copyright license. 00053 * 00054 * Revision 1.9 1995/07/31 12:15:46 robertj 00055 * Removed PContainer from PChannel ancestor. 00056 * 00057 * Revision 1.8 1995/06/17 11:13:18 robertj 00058 * Documentation update. 00059 * 00060 * Revision 1.7 1995/03/14 12:42:33 robertj 00061 * Updated documentation to use HTML codes. 00062 * 00063 * Revision 1.6 1995/01/14 06:19:37 robertj 00064 * Documentation 00065 * 00066 * Revision 1.5 1994/08/23 11:32:52 robertj 00067 * Oops 00068 * 00069 * Revision 1.4 1994/08/22 00:46:48 robertj 00070 * Added pragma fro GNU C++ compiler. 00071 * 00072 * Revision 1.3 1994/07/17 10:46:06 robertj 00073 * Moved data to PChannel class. 00074 * 00075 * Revision 1.2 1994/06/25 11:55:15 robertj 00076 * Unix version synchronisation. 00077 * 00078 * Revision 1.1 1994/04/20 12:17:44 robertj 00079 * Initial revision 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 // Serial Channel 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 // Platform dependent construct of the serial channel. 00419 00420 00421 // Include platform dependent part of class 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 // End Of File ///////////////////////////////////////////////////////////////

Generated on Sat Jul 24 15:35:56 2004 for PWLib by doxygen 1.3.7