Visual Servoing Platform  version 3.6.1 under development (2024-12-17)
vpParallelPort Class Reference

#include <visp3/io/vpParallelPort.h>

Public Member Functions

 vpParallelPort ()
 
virtual ~vpParallelPort ()
 
void sendData (unsigned char &data)
 
unsigned char getData ()
 

Detailed Description

Parallel port management under unix.

The code below shows how to send a data over the parallel port.

#include <visp3/io/vpParallelPort.h>
#ifdef ENABLE_VISP_NAMESPACE
using namespace VISP_NAMESPACE_NAME;
#endif
int main()
{
#ifdef VISP_HAVE_PARPORT
vpParallelPort parport;
unsigned char data = 5; // 0x00000101 = 5 in decimal
parport.sendData(data); // D0 and D2 are set to logical level 1
#endif
}
Parallel port management under unix.
void sendData(unsigned char &data)
Examples
parallelPort.cpp.

Definition at line 82 of file vpParallelPort.h.

Constructor & Destructor Documentation

◆ vpParallelPort()

vpParallelPort::vpParallelPort ( )

Constructor to access to a parallel port.

Open and initialise the parallel port by sending 0 to the data bus.

Set the default device to "/dev/parport0".

Exceptions
vpParallelPortException::openingIf the device used to access to the parallel port can't be opened. A possible reason is that you don't have write access.

Definition at line 69 of file vpParallelPort.cpp.

References sendData().

◆ ~vpParallelPort()

vpParallelPort::~vpParallelPort ( )
virtual

Destructor to close the parallel port.

Exceptions
vpParallelPortException::closingIf the device used to access to the parallel port can't be closed.

Definition at line 85 of file vpParallelPort.cpp.

Member Function Documentation

◆ getData()

unsigned char vpParallelPort::getData ( )

Get the last data sent to the parallel port.

Definition at line 142 of file vpParallelPort.cpp.

◆ sendData()

void vpParallelPort::sendData ( unsigned char &  data)

Send a data to the parallel port.

Parameters
data: Value [D7, D6, ... D0] to send to the data bus.

The code bellow shows how to set D0 and D2 to logical level 1:

unsigned char data = 5; // 0x00000101 = 5 in decimal
parport.sendData(data); // D0 and D2 are set to logical level 1
Examples
parallelPort.cpp.

Definition at line 129 of file vpParallelPort.cpp.

Referenced by vpParallelPort().