KAME: C++ program for laboratory measurement
Main Page
Related Pages
Classes
Files
File List
modules
charinterface
serial.h
1
/***************************************************************************
2
Copyright (C) 2002-2015 Kentaro Kitagawa
3
kitagawa@phys.s.u-tokyo.ac.jp
4
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU Library General Public
7
License as published by the Free Software Foundation; either
8
version 2 of the License, or (at your option) any later version.
9
10
You should have received a copy of the GNU Library General
11
Public License and a list of authors along with this program;
12
see the files COPYING and AUTHORS.
13
***************************************************************************/
14
#ifndef SERIAL_H_
15
#define SERIAL_H_
16
17
#include "charinterface.h"
18
19
#if defined __linux__ || defined __APPLE__
20
#define SERIAL_POSIX
21
#endif //__linux__ || LINUX
22
23
#if defined WINDOWS || defined __WIN32__ || defined _WIN32
24
#define SERIAL_WIN32
25
#endif // WINDOWS || __WIN32__ || defined _WIN32
26
27
#if defined SERIAL_WIN32 || defined SERIAL_POSIX
28
#define USE_SERIAL
29
#endif
30
31
class
XSerialPort
:
public
XPort
{
32
public
:
33
XSerialPort
(
XCharInterface
*interface);
34
virtual
~
XSerialPort
();
35
36
virtual
void
open(
const
XCharInterface
*pInterface)
throw
(
XInterface::XCommError
&);
37
virtual
void
send(
const
char
*str)
throw
(
XInterface::XCommError
&);
38
virtual
void
write(
const
char
*sendbuf,
int
size)
throw
(
XInterface::XCommError
&);
39
virtual
void
receive()
throw
(
XInterface::XCommError
&);
40
virtual
void
receive(
unsigned
int
length)
throw
(
XInterface::XCommError
&);
41
private
:
42
#ifdef SERIAL_POSIX
43
void
flush();
44
int
m_scifd;
45
#endif
/*SERIAL_POSIX*/
46
#ifdef SERIAL_WIN32
47
void
*m_handle;
48
#endif
/*SERIAL_WIN32*/
49
bool
m_serialFlushBeforeWrite;
50
bool
m_serialHasEchoBack;
51
};
52
53
#endif
/*SERIAL_H_*/
Generated for
KAME4
by
1.8.3