VisionBox Interface Library
Loading...
Searching...
No Matches
Inheritance diagram for VIB::Led:

Detailed Description

This class controls the status LEDs.

The most hardware platforms provide user controllable status LEDs.

For systems with 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

HardwareNumber of user LEDsLED modes (LED_MODE)
LED_OFF, LED_ONLED_GEN0, LED_GEN1LED_SATA, LED_HDDLED_SUNLED_RESET, LED_CF, LED_PCI, LED_RS232, LED_RS422
VisionBox AGE-X5[1] / AGE-X6[1]6yesyesyesyesno
VisionBox AGE-X3[1]2yesyesyesyesno
VisionBox AGE-X2[1]6yesyesyesyesno
VisionBox AGE-X1[1]6yesyesyesyesyes
VisionBox DAYTONA6yesyesnonono
VisionBox LE MANS6yesyesnonono
VisionBox AI6yesyesyes (M.2)nono
VisionBox AI Baisc[2]2yesnononono
VisionCam XM3yesyesnonono
VisionCam XM22yesyesnonono
VisionSensor PV3 + I/O Expansion6yesyesnonono
Machine Vision Manager6yesyesnoyesno

  1. After reset, the VisionBox AGE-X1, AGE-X2, AGE-X3, AGE-X5 and AGE-X6 use the LED_HDD mode for the last green user LED to indicate hard disk activity.
  2. For the VisionBox AI Basic, the signal generators are not available and the user LEDs will be turned off after the device object is closed.

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.
bool GetNumberOfLeds (unsigned int &NumberOfLeds)
 Returns number of user controllable LEDs.
 Led ()
 Default constructor for the device object.
bool Reset ()
 Resets the device to default settings.
bool Set (unsigned int Val, unsigned int BitMask=0xFFFFFFFF)
 Sets the state of the LEDs.
bool SetLED (unsigned int LEDIndex, bool OnOff)
 Sets the state of one LED.
bool SetMode (unsigned int LEDIndex, LED_MODE Mode)
 Sets the mode of one LED.
bool SetMode (unsigned int LEDIndex, LED_MODE Mode, bool Invert)
 Sets the mode of one LED.
Public Member Functions inherited from VIB::iDevice
bool Close ()
 Closes a device.
 iDevice (const iDevice &device)
 The copy constructor makes a copy of the existing device object.
bool isOpen (bool &state)
 Returns the open state of a device object.
bool Open (unsigned int Index=0)
 Opens a device.
iDeviceoperator= (const iDevice &device)
 The assignment operator makes a copy of the existing device object.
virtual ~iDevice ()
 Deletes the device object.

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_HDD 

Hard disk 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 pulses. 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
pLed->SetMode(0, VIB::Led::LED_GEN0);
// connect LED2 to generator 1
pLed->SetMode(2, VIB::Led::LED_GEN1);
// generator 0: signal with 300 ms on and 1500 ms off
pLed->ConfigureGenerator(0, 1, 300, 0, 1500);
// generator 1: two pulses(200 ms on, 100 ms off) and 500 ms off
pLed->ConfigureGenerator(1, 2, 200, 100, 500);
@ LED_GEN0
LED Signal generator 0.
Definition VIB_Interface.h:415
@ LED_GEN1
LED Signal generator 1.
Definition VIB_Interface.h:416

◆ GetNumberOfLeds()

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

Returns number of user controllable LEDs.

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
pLed->Set(0xFF);
// turn LED 0 off and LED 1 on
pLed->Set(0x02, 0x3);

◆ 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
pLed->SetLED(0, true);

◆ SetMode() [1/2]

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

Sets the mode of one LED.

Note
Setting the the LED state with Set() and SetLED() will override the LED mode.
Parameters
LEDIndexIndex of the LED, 0 ... (GetNumberOfLeds() - 1)
ModeLED mode
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description

◆ SetMode() [2/2]

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

Sets the mode of one LED.

Note
Setting the the LED state with Set() and SetLED() will override the LED mode.
Parameters
LEDIndexIndex of the LED, 0 ... (GetNumberOfLeds() - 1)
ModeLED mode
InvertInvert signal polarity
Returns
true for success, use VIBSystem::GetLastErrorString() for an error description