KatanaNativeInterface
$VERSION$
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
include
KNI
cdlCOM.h
Go to the documentation of this file.
1
/*
2
* Katana Native Interface - A C++ interface to the robot arm Katana.
3
* Copyright (C) 2005 Neuronics AG
4
* Check out the AUTHORS file for detailed contact information.
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*/
20
21
22
23
#ifndef _CDLCOM_H_
24
#define _CDLCOM_H_
25
26
#include "
common/dllexport.h
"
27
28
#include "
KNI/cdlBase.h
"
29
#include "
KNI/cdlCOMExceptions.h
"
30
31
#include <string>
32
33
34
//-------------------------------------------------------//
35
#ifdef WIN32
36
//-------------------------------------------------------//
37
#include <windows.h>
38
//-------------------------------------------------------//
39
#else //LINUX
40
//-------------------------------------------------------//
41
#include <termios.h>
42
#include <fcntl.h>
43
#include <cerrno>
44
//-------------------------------------------------------//
45
#endif //WIN32 else LINUX
46
//-------------------------------------------------------//
47
48
53
struct
TCdlCOMDesc
{
54
int
port
;
55
int
baud
;
56
int
data
;
57
int
parity
;
58
int
stop
;
59
int
rttc
;
60
int
wttc
;
61
};
62
63
//--------------------------------------------------------------------------//
64
65
73
class
DLLDIR
CCdlCOM
:
public
CCdlBase
{
74
private
:
75
std::string
_deviceName
;
76
77
protected
:
78
79
TCdlCOMDesc
_ccd
;
80
81
//-------------------------------------------------------//
82
#ifdef WIN32
83
//-------------------------------------------------------//
84
HANDLE _prtHdl;
85
COMMTIMEOUTS _oto;
86
//-------------------------------------------------------//
87
#else //LINUX
88
//-------------------------------------------------------//
89
int
_prtHdl
;
90
struct
termios _oto;
91
//-------------------------------------------------------//
92
#endif //WIN32 else LINUX
93
//-------------------------------------------------------//
94
95
protected
:
96
99
static
char
digit
(
const
int
_val) {
100
return
(
char
)((int)
'0'
+ _val);
101
}
102
103
public
:
110
CCdlCOM
(
TCdlCOMDesc
ccd,
const
char
*dev_name = 0);
111
virtual
~
CCdlCOM
();
114
virtual
int
send
(
const
void
* buf,
int
size);
117
virtual
int
recv
(
void
* buf,
int
size);
120
};
121
122
123
#endif //_CDLCOM_H_
124
Generated by
1.8.3.1