VisionBox .NET Library  1.7.10.0 (2024-04-16)
VIBSystem_Example.cs

C# example for using the VIBSystem factory

1 
2 using System;
3 using System.Collections;
4 using VIB_NET;
5 
6 namespace CSharp
7 {
8  class VIBSystem_Example
9  {
10  public static void VIBSystem()
11  {
12  Console.Clear();
13  //acquire a new factory
14  VIB_NET.VIBSystem pVIBSystem = new VIB_NET.VIBSystem();
15  try
16  {
17  //get API version
18  VIB_NET.VIBSystem.Version4Parts version = pVIBSystem.API_Version;
19  System.Console.WriteLine("API version: " + version.ToString());
20 
21  //get VIB_NET version
22  System.Console.WriteLine("VIB_NET version: " + pVIBSystem.VIB_NET_Version.ToString());
23 
24  //get version string
25  System.Console.WriteLine("Version string:\n" + pVIBSystem.VersionString);
26 
27  //get system string
28  System.Console.WriteLine("System string:\n" + pVIBSystem.SystemString);
29 
30  //get number of device types
31  Int32 NumberOfDeviceTypes = pVIBSystem.NumberOfDeviceTypes;
32  System.Console.WriteLine("Number of device types: " + NumberOfDeviceTypes.ToString());
33 
34  //get list of hardware devices
35  ArrayList DeviceList = pVIBSystem.DeviceInfoList;
36 
37  //search for the led(s)
38  foreach (DeviceInfo DevInfo in DeviceList)
39  {
40  if (DevInfo != null)
41  {
42  if (DevInfo.Type == VIB_NET.eDEVICE_TYPE.LED)
43  System.Console.WriteLine("\nNumber of LED devices: " + DevInfo.NumberOfEntities.ToString());
44  }
45  }
46 
47  //get device informations of led devices
48  VIB_NET.DeviceInfo LedInfo = pVIBSystem.GetDeviceInfo(VIB_NET.eDEVICE_TYPE.LED);
49  if(LedInfo != null)
50  {
51  System.Console.WriteLine(LedInfo.Type + " has " + LedInfo.NumberOfEntities + " Entitie(s).");
52 
53  //open device: Led number 0
54  VIB_NET.Led pLed = (VIB_NET.Led)pVIBSystem.OpenDevice(VIB_NET.eDEVICE_TYPE.LED, 0);
55  //close device
56  if (pLed != null)
57  {
58  //Set Led 1 ON and all other OFF
59  pLed.Set(2, 255);
60  System.Threading.Thread.Sleep(1000);
61  //Set all Leds OFF
62  pLed.Set(0, 255);
63 
64  // close Led device
65  pVIBSystem.CloseDevice(pLed);
66  }
67  }
68  }
69  catch (System.Exception e)
70  {
71  Console.WriteLine(e.Message);
72  }
73  finally
74  {
75  //release factory
76  pVIBSystem = null;
77  }
78  Console.WriteLine("\nPress enter to proceed...");
79  System.Console.ReadLine();
80  }
81  }
82 }
VIB_NET
All relevant classes and functions are residing in this namespace.
Definition: CameraLinkIn.cpp:6
VIB_NET::Led::Set
void Set(UInt32 Val, UInt32 BitMask)
Sets the state of the LEDs.
Definition: Led.cpp:70
VIB_NET::DeviceInfo
Collection of information about a device type
Definition: VIB_NET.h:547
VIB_NET::VIBSystem::Version4Parts
Version information
Definition: VIB_NET.h:1739
VIB_NET::Led
This class controls the status LEDs.
Definition: VIB_NET.h:607
VIB_NET::VIBSystem
Factory for devices
Definition: VIB_NET.h:1734