Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

serialc.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 1999  Carsten Winkelholz
00003 
00004 Address:  FGAN Forschungsgesellschaft fr Angewandte Naturwissenschaften e. V.
00005       Neuenahrer Str. 20
00006       D - 53343 Wachtberg
00007       
00008 Email:    winkelholz@fgan.de
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 */
00024 
00025 
00026 #ifndef SERIALC_H
00027 #define SERIALC_H
00028 
00029 #ifdef _WIN32
00030 #ifdef _AFXDLL
00031 #include <afx.h>
00032 #else
00033 #include <windows.h>
00034 #endif
00035 #endif
00036 
00037 #define COM1 1
00038 #define COM2 2
00039 
00040 #include "../oawconfig.h"
00041 
00042 OAW_BEGIN_NAMESPACE
00043 
00044 class SerialC;
00045 
00046 class OAW_DLLMAPPING ComStateC{
00047   friend class SerialC;
00048 public:
00049   ComStateC();
00050 public:
00051   DWORD m_baudRate;
00052   BYTE m_byteSize;
00053   BYTE m_parity;
00054   BYTE m_stopBits;
00055 };
00056 
00057 
00058 class OAW_DLLMAPPING SerialC{
00059 public:
00060   SerialC(short com = COM2);
00061   virtual ~SerialC();
00062   long Read(char*, long);
00063   long Write(const char*, long);
00064   void Get(char*);
00065   void Put(char);
00066   short SetState(ComStateC);
00067   short SetPort(short);
00068   short Open();
00069   short Close();
00070 protected:
00071 
00072   char m_com[10];
00073   
00074   HANDLE m_fd;
00075 
00076   ComStateC m_comState;
00077   DCB m_dcb;
00078   DCB m_oldDcb;
00079   COMMTIMEOUTS m_timeout;
00080   COMMTIMEOUTS m_oldTimeout;
00081   short m_isOpen;
00082 };
00083 
00084 OAW_END_NAMESPACE
00085 
00086 #endif
00087 
00088 
00089 
00090 
00091 

Generated on Tue Jul 29 14:24:15 2003 for Open ActiveWrl by doxygen1.3-rc2