class_dioc Class Reference

This class implements the DIOC communication protocol. More...

#include <class_dioc.h>

List of all members.

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.

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:
pdevice Name 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:
ID id 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:
ret error code
Returns:
void

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.

Parameters:
ID id of the IO
status required status
Returns:
error code

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.

Parameters:
ID id of the IO
ENUM required status
Returns:
error code

Definition at line 110 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:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


atlasmv_base
Author(s): David Gameiro, Jorge Almeida
autogenerated on Wed Jul 23 04:34:43 2014