VisionBox Interface Library  1.7.5.0 (2021-12-10)
VIB::Led Class Reference
+ Inheritance diagram for VIB::Led:

Detailed Description

This class controls the status LEDs.

The most hardware platforms provide user controllable status LEDs.

The LEDs are dual color LEDs. The API uses even LED index numbers to control the green LEDs and odd LED index numbers to control the red LEDs (green: 0, 2, 4; red: 1, 3, 5).

The LEDs can be controlled by the following means:

Hardware dependencies

After reset, the VisionBox AGE-X, AGE-X2, AGE-X3 and AGE-X5 use the SATA / CF mode for the last green user LED to indicate disk activity. SetMode() can be used to change the mode for this LED.

+ Click to show the available LED source signals for each hardware platform.
Hardware Number of user LEDs LED modes (LED_MODE)
LED_OFF, LED_ON, LED_GEN0, LED_GEN1 LED_SATA, LED_SATA_CF LED_SUN LED_RESET, LED_CF, LED_PCI, LED_RS232, LED_RS422
VisionBox AGE-X5 6 yes yes yes no
VisionBox AGE-X3 2 yes yes yes no
VisionBox AGE-X2 6 yes yes yes no
VisionBox AGE-X1 6 yes yes yes yes
VisionBox DAYTONA 6 yes no no no
VisionBox LE MANS 6 yes no no no
VisionCam XM 3 yes no yes no
Machine Vision Manager 6 yes no yes no

Public Types

enum  LED_MODE
 LED mode definitions More...
 

Public Member Functions

bool ConfigureGenerator (unsigned int GeneratorIndex, unsigned int BlinkCount, unsigned int ms_ton, unsigned int ms_toff, unsigned int ms_tpause)
 Configures the LED signal generator. More...
 
bool GetNumberOfLeds (unsigned int &NumberOfLeds)
 Returns number of LEDs. More...
 
 Led ()
 Default constructor for the device object More...
 
bool Reset ()
 Resets the device to default settings. More...
 
bool Set (unsigned int Val, unsigned int BitMask=0xFFFFFFFF)
 Sets the state of the LEDs. More...
 
bool SetLED (unsigned int LEDIndex, bool OnOff)
 Sets the state of one LED. More...
 
bool SetMode (unsigned int LEDIndex, LED_MODE Mode)
 Sets the mode of one LED. More...
 
- Public Member Functions inherited from VIB::iDevice
bool Close ()
 Closes a device More...
 
 iDevice (const iDevice &device)
 The copy constructor makes a copy of the existing device object More...
 
bool isOpen (bool &state)
 Returns the open state of a device object More...
 
bool Open (unsigned int Index=0)
 Opens a device More...
 
iDeviceoperator= (const iDevice &device)
 The assignment operator makes a copy of the existing device object More...
 
virtual ~iDevice ()
 Deletes the device object More...
 

Member Enumeration Documentation

◆ LED_MODE

LED mode definitions

The mode is used with SetMode() to specify the source signal for the LED.

Enumerator
LED_OFF 

LED off.

LED_ON 

LED on.

LED_GEN0 

LED Signal generator 0.

LED_GEN1 

LED Signal generator 1.

LED_RESET 

Reset.

LED_SATA 

SATA activity.

LED_CF 

CF (IDE) activity.

LED_SATA_CF 

SATA or CF activity.

LED_PCI 

PCI bus activity.

LED_SUN 

Internal RTCC bus activity.

LED_RS232 

RS-232 activity.

LED_RS422 

RS-422 activity.

Constructor & Destructor Documentation

◆ Led()

VIB::Led::Led ( )

Default constructor for the device object

The device must be opened with Open() before it can be used.

Member Function Documentation

◆ ConfigureGenerator()

bool VIB::Led::ConfigureGenerator ( unsigned int  GeneratorIndex,
unsigned int  BlinkCount,
unsigned int  ms_ton,
unsigned int  ms_toff,
unsigned int  ms_tpause 
)

Configures the LED signal generator.

Two signal generators can be used to create a periodic sequence of pulsed. The LED on time, off time and the pause time between each sequence can be adjusted. The resolution is a multiple of 100 ms.

In order to use a generator, SetMode() has to be called with LED_GEN0 / LED_GEN1.

Parameters
GeneratorIndexGenerator index, 0 or 1
BlinkCountNumber of pulses for each sequence, 1 ... 16
ms_tonLED on time in milliseconds, 100 ... 6400
ms_toffLED off time in milliseconds, 100 ... 6400
ms_tpausePause time in milliseconds, 0 ... 6400
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description
Example:
//Connect LED0 to generator 0
if ( !pLed->SetMode(0, VIB::Led::LED_GEN0) )
goto error;
//Connect LED2 to generator 1
if ( !pLed->SetMode(2, VIB::Led::LED_GEN1) )
goto error;
//signal with 300 ms on and 1500 ms off
if ( !pLed->ConfigureGenerator(0, 1, 300, 0, 1500) )
goto error;
//two pulses(200 ms on, 100 ms off) 500 ms break time(LED off), two pulses ...
if( !pLed->ConfigureGenerator(1, 2, 200, 100, 500) )
goto error;

◆ GetNumberOfLeds()

bool VIB::Led::GetNumberOfLeds ( unsigned int &  NumberOfLeds)

Returns number of LEDs.

Mostly the LEDs are physical implemented as dual color LED.
A function result of two indicates one LED with green and red light.

Parameters
NumberOfLedsNumber of LEDs
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ Reset()

bool VIB::Led::Reset ( )

Resets the device to default settings.

Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ Set()

bool VIB::Led::Set ( unsigned int  Val,
unsigned int  BitMask = 0xFFFFFFFF 
)

Sets the state of the LEDs.

Parameters
ValBinary representation of the LEDs
BitMaskMask bits can be used to change only certain outputs, LSB is LED0
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description
Example:
// turn all LEDs on
if (!pLed->Set(0xFF))
goto error;
// turn LED 0 off
if (!pLed->Set(0x00,0x1))
goto error;

◆ SetLED()

bool VIB::Led::SetLED ( unsigned int  LEDIndex,
bool  OnOff 
)

Sets the state of one LED.

Parameters
LEDIndexIndex of the LED, 0 ... (GetNumberOfLeds() - 1)
OnOffEnable/disable LED
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description
Example:
// turn LED 0 on
if (!pLed->SetLED(0, true))
goto error;

◆ SetMode()

bool VIB::Led::SetMode ( unsigned int  LEDIndex,
LED_MODE  Mode 
)

Sets the mode of one LED.

Parameters
LEDIndexIndex of the LED, 0 ... (GetNumberOfLeds() - 1)
ModeLED mode
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description
VIB::Led::LED_GEN1
@ LED_GEN1
LED Signal generator 1.
Definition: VIB_Interface.h:405
VIB::Led::LED_GEN0
@ LED_GEN0
LED Signal generator 0.
Definition: VIB_Interface.h:404