Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
class_dioc Class Reference

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. More...
 
int CommStatus (void)
 Get the comm status. More...
 
int GetStatus (id_enum ID)
 Get the status of a input/output. More...
 
void perr (int ret)
 Print error function. More...
 
int SetStatus (id_enum ID, status_enum ENUM)
 Set the status of a input/output. More...
 
int SetStatus (id_enum ID, int status)
 Set the status of a input/output. More...
 
 ~class_dioc ()
 De-constructor. More...
 

Private Member Functions

void CleanBuffer (void)
 Cleans the buffer. More...
 

Private Attributes

bool active
 This variable indicates that the communication is active. More...
 
char * device
 Communication device to use. More...
 
char err [1024]
 
int port
 Communication port to use. More...
 
int ret
 Auxiliary return code. More...
 

Detailed Description

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.

Member Enumeration Documentation

Enumerator
STATUS 
FRONT 
RIGHT 
LEFT 
REVERSE 
BRAKE 
BLUE 
RED 
GREEN 
CROSS_A 
CROSS_B 

Definition at line 76 of file class_dioc.h.

Enumerator
ON 
OFF 
BLINK1 
BLINK3 

Definition at line 75 of file class_dioc.h.

Constructor & Destructor Documentation

class_dioc::class_dioc ( const char *  pdevice)

Constructor.

This functions sets the default values for internal variables and opens communication with the servos.

Parameters
pdeviceName of the device to use in communications
Returns
void

Definition at line 33 of file class_dioc.cpp.

class_dioc::~class_dioc ( )

De-constructor.

This function closes the communication with the servos.

Returns
void

Definition at line 69 of file class_dioc.cpp.

Member Function Documentation

void class_dioc::CleanBuffer ( void  )
private

Cleans the buffer.

This function clean the communication input buffer.

Returns
void

Definition at line 75 of file class_dioc.cpp.

int class_dioc::CommStatus ( void  )

Get the comm status.

Returns
error code

Definition at line 129 of file class_dioc.cpp.

int class_dioc::GetStatus ( id_enum  ID)

Get the status of a input/output.

Parameters
IDid of the IO
Returns
error code

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.

Parameters
reterror code
Returns
void

Definition at line 228 of file class_dioc.cpp.

int class_dioc::SetStatus ( id_enum  ID,
status_enum  ENUM 
)

Set the status of a input/output.

Parameters
IDid of the IO
ENUMrequired status
Returns
error code

Definition at line 110 of file class_dioc.cpp.

int class_dioc::SetStatus ( id_enum  ID,
int  status 
)

Set the status of a input/output.

Parameters
IDid of the IO
statusrequired status
Returns
error code

Definition at line 91 of file class_dioc.cpp.

Member Data Documentation

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.


The documentation for this class was generated from the following files:


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