This class implements the DIOC communication protocol. More...
#include <class_dioc.h>
Public Types | |
| enum | id_enum {  STATUS = 0, FRONT, RIGHT, LEFT, REVERSE, BRAKE, BLUE, RED, GREEN, CROSS_A, CROSS_B }  | 
| enum | status_enum { ON, OFF, BLINK1, BLINK3 } | 
Public Member Functions | |
| class_dioc (const char *pdevice) | |
| Constructor.   | |
| int | CommStatus (void) | 
| Get the comm status.   | |
| int | GetStatus (id_enum ID) | 
| Get the status of a input/output.   | |
| void | perr (int ret) | 
| Print error function.   | |
| int | SetStatus (id_enum ID, int status) | 
| Set the status of a input/output.   | |
| int | SetStatus (id_enum ID, status_enum ENUM) | 
| Set the status of a input/output.   | |
| ~class_dioc () | |
| De-constructor.   | |
Private Member Functions | |
| void | CleanBuffer (void) | 
| Cleans the buffer.   | |
Private Attributes | |
| bool | active | 
| This variable indicates that the communication is active.   | |
| char * | device | 
| Communication device to use.   | |
| char | err [1024] | 
| int | port | 
| Communication port to use.   | |
| int | ret | 
| Auxiliary return code.   | |
This class implements the DIOC communication protocol.
This class allows to control the discreet input/output PCB.
Definition at line 55 of file class_dioc.h.
| enum class_dioc::id_enum | 
Definition at line 76 of file class_dioc.h.
Definition at line 75 of file class_dioc.h.
| class_dioc::class_dioc | ( | const char * | pdevice | ) | 
Constructor.
This functions sets the default values for internal variables and opens communication with the servos.
| pdevice | Name of the device to use in communications | 
Definition at line 33 of file class_dioc.cpp.
| class_dioc::~class_dioc | ( | ) | 
De-constructor.
This function closes the communication with the servos.
Definition at line 69 of file class_dioc.cpp.
| void class_dioc::CleanBuffer | ( | void | ) |  [private] | 
        
Cleans the buffer.
This function clean the communication input buffer.
Definition at line 75 of file class_dioc.cpp.
| int class_dioc::CommStatus | ( | void | ) | 
| int class_dioc::GetStatus | ( | id_enum | ID | ) | 
Get the status of a input/output.
| ID | id of the IO | 
Definition at line 173 of file class_dioc.cpp.
| void class_dioc::perr | ( | int | ret | ) | 
Print error function.
This function prints the error present in the err variable (this is a private variable of the gamepad class). The ret number specifies what kind of error is this, -1 is a error that raises a SIGINT signal, -2 is an warning that allows the program to continue and -3 is a error that prints perror and raises SIGINT.
| ret | error code | 
Definition at line 228 of file class_dioc.cpp.
| int class_dioc::SetStatus | ( | id_enum | ID, | |
| int | status | |||
| ) | 
Set the status of a input/output.
| ID | id of the IO | |
| status | required status | 
Definition at line 91 of file class_dioc.cpp.
| int class_dioc::SetStatus | ( | id_enum | ID, | |
| status_enum | ENUM | |||
| ) | 
Set the status of a input/output.
| ID | id of the IO | |
| ENUM | required status | 
Definition at line 110 of file class_dioc.cpp.
bool class_dioc::active [private] | 
        
This variable indicates that the communication is active.
Definition at line 132 of file class_dioc.h.
char* class_dioc::device [private] | 
        
Communication device to use.
Definition at line 141 of file class_dioc.h.
char class_dioc::err[1024] [private] | 
        
Definition at line 143 of file class_dioc.h.
int class_dioc::port [private] | 
        
Communication port to use.
Definition at line 135 of file class_dioc.h.
int class_dioc::ret [private] | 
        
Auxiliary return code.
Definition at line 138 of file class_dioc.h.