class_dioc.h
Go to the documentation of this file.
1 /**************************************************************************************************
2  Software License Agreement (BSD License)
3 
4  Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt
5  All rights reserved.
6 
7  Redistribution and use in source and binary forms, with or without modification, are permitted
8  provided that the following conditions are met:
9 
10  *Redistributions of source code must retain the above copyright notice, this list of
11  conditions and the following disclaimer.
12  *Redistributions in binary form must reproduce the above copyright notice, this list of
13  conditions and the following disclaimer in the documentation and/or other materials provided
14  with the distribution.
15  *Neither the name of the University of Aveiro nor the names of its contributors may be used to
16  endorse or promote products derived from this software without specific prior written permission.
17 
18  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
19  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
21  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
24  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 ***************************************************************************************************/
31 #ifndef _DIOC_H_
32 #define _DIOC_H_
33 
34 //System Includes
35 //all system includes go here
36 #include <string.h>
37 #include <termios.h>
38 #include <sys/ioctl.h>
39 #include <stdlib.h>
40 #include <stdio.h>
41 #include <sys/types.h>
42 #include <sys/stat.h>
43 #include <fcntl.h>
44 #include <unistd.h>
45 #include <ros/ros.h>
46 #include <termios.h>
47 #include <sys/ioctl.h>
48 #include <signal.h>
49 
56 {
57  public:
65  class_dioc(const char*pdevice);
66 
73  ~class_dioc();
74 
75  typedef enum {ON,OFF,BLINK1,BLINK3} status_enum;
77 
85  int SetStatus(id_enum ID,status_enum ENUM);
86 
94  int SetStatus(id_enum ID, int status);
95 
101  int GetStatus(id_enum ID);
102 
107  int CommStatus(void);
108 
119  void perr(int ret);
120 
121  private:
122 
129  void CleanBuffer(void);
130 
132  bool active;
133 
135  int port;
136 
138  int ret;
139 
141  char*device;
142 
143  char err[1024];
144 };
145 #endif
This class implements the DIOC communication protocol.
Definition: class_dioc.h:55
char * device
Communication device to use.
Definition: class_dioc.h:141
int ret
Auxiliary return code.
Definition: class_dioc.h:138
class_dioc(const char *pdevice)
Constructor.
Definition: class_dioc.cpp:33
int SetStatus(id_enum ID, status_enum ENUM)
Set the status of a input/output.
Definition: class_dioc.cpp:110
bool active
This variable indicates that the communication is active.
Definition: class_dioc.h:132
int GetStatus(id_enum ID)
Get the status of a input/output.
Definition: class_dioc.cpp:173
int port
Communication port to use.
Definition: class_dioc.h:135
int CommStatus(void)
Get the comm status.
Definition: class_dioc.cpp:129
~class_dioc()
De-constructor.
Definition: class_dioc.cpp:69
void CleanBuffer(void)
Cleans the buffer.
Definition: class_dioc.cpp:75
char err[1024]
Definition: class_dioc.h:143
void perr(int ret)
Print error function.
Definition: class_dioc.cpp:228


atlasmv_base
Author(s): David Gameiro, Jorge Almeida
autogenerated on Mon Mar 2 2015 01:31:28