Read serial number by activeX

Hello,

I work on Windev software.
I add on the project Cvb activeX (Image control and Display)

On the Image control i can use “serial number”.
I would like use it to check if the camera is online ( i have only 1 camera).
I “initialize” the activeX, i can take a picture and save it, but the serial number command return 0 everytime and i don’t find why.
On Cvb viewver i see the camera and the serial ID.

// initialize
( AX_CVB = image control activeX and AX_Display is display activeX)

AX_CVB>>LoadImage(“C:\Program Files (x86)\STEMMER IMAGING\Common Vision Blox\Drivers\GenICam.vin”)
AX_Display>>Image = AX_CVB>>Image

// code to serial

Can you help me ?

Best regards

Hi @bertrand

is there a reason why you want to go with the ActiveX Control?

If not, you could have a look at the following example:
%cvb%\Tutorial\Image Manager\Cvb.Net

You can also get the SerialNumber directly from the NodeMap.
Here is an example on how to get the NodeMap of a camera and work with it:

// Load driver 
using (Device device = DeviceFactory.Open("GenICam.vin")) 
{ 
  // Load NodeMap for the device 
  var dev_node_map = device.NodeMaps["Device"];   

  using (var camModel = dev_node_map["DeviceModelName"] as StringNode) 
  { 
    Console.WriteLine("Loaded device: " + camModel.Value); 
  }  

  using (var camFirmWare = dev_node_map["DeviceFirmwareVersion"] as StringNode) 
  { 
    Console.WriteLine("Current Firmwareversion : " + camFirmWare.Value); 
  }   

  using (var exposureTime = dev_node_map["ExposureTime"] as FloatNode) 
  { 
    Console.WriteLine("Current exposure time : " + exposureTime.Value); 
    var exposureTimeOld = exposureTime.Value; 
    exposureTime.Value = 32; 
    Console.WriteLine("Small exposure time : " + exposureTime.Value); 
    exposureTime.Value = exposureTimeOld; 
    Console.WriteLine("Resetted to old exposure time : " + exposureTime.Value); 
  } 
}

Also, if you only have one camera on the machine, what is the reason for checking the serialnumber?
Maybe there is a better way to achieve what you want once we fully understand what you are trying to do.

Cheers
Chris

Hello Chris,

Thank you to your message.

I would like to keep activeX to work everytime with the same method, because we use different software and someone can use only ActiveX.

I would like check if the camera is present with the serial number, maybe an other tool is better to do that.

I hope to be clear.

Hi @bertrand ,

if no camera is connected then loading the driver will fail, that would be the easiest way to check as this results in an exception that you could handle.

If a camera was already found and gets disconnected for some reason, the following code will notify you (and also once the device is back up and running):

var device = DeviceFactory.Open("GenICam.vin"); 
device.Notify[NotifyDictionary.DeviceDisconnected].Event += Disconnect; 
device.Notify[NotifyDictionary.DeviceReconnect].Event += Reconnect;  

private static void Disconnect(object sender, NotifyEventArgs e) 
{ 
Console.WriteLine("Device disconnected"); 
// do stuff 
}  

private static void Reconnect(object sender, NotifyEventArgs e) 
{ 
Console.WriteLine("Device reconnected"); 
// do stuff 
}

With this combination you would be independent of the actual camera (model or even specific camera).
If you still want to check for a specific camera you can still go with the NodeMap and the DeviceID (I think should be the serialnumber) node.

Hope this helps

Cheers
Chris

Ok thank you.

But i cannot do that only with property of activeX right ?

I need a little code section to check the connection.

Now i need to find how to do that on Windev.

Thank you to your help @Chris !

Hi @bertrand,

if I look into the %cvb%\Tutorial\Image Manager\CSharp\CSDisplay tutrorial and add the following line in the constructor of the MainForm:

var test = axCVimage1.SerialNumber;

I get ‘999’ as a value. This is the SerialNumber for my developer dongle to license CVB:


So I think be both wrongly assumed this to be the Camera Serial Number where in fact it is not.

So you are left with one of my hints from earlier (Catch exception, Connection Monitoring, NodeMap for SerialNumber of camera).

Cheers
Chris

Ok, good to know …

I find the ping function on Windev to find device.
I continue to search how i can add you example in my project.

Thank you so much for your help @Chris

Hi @bertrand ,

I have never worked with windev, so, unfortunately I cant help you on how to get CVB running in there.
What I found out so far is, that windev has its own programming language.
If there is a possibility to write your own plugins/classes/scripts using C++, C# or Python then I can provide you the code for what you want to do.

How to add these to windev: No idea.

I sorry I cant help you with this but at least I found this:
https://help.windev.com/en-US/?2012008&name=typing_code

Cheers
Chris

No problem,

Thank you @Chris

Hi @bertrand

sorry this confused you, but the SerialNumber property of the CVImage control actually reports - as the two of you found out - the CVB serial number, not the camera’s serial number. It is also somewhat outdated: CVB today supports more than just one serial number, but the property will only ever report the “best” one (i. e. the one that has the best tool coverage).

As a general rule, our ActiveX controls are more or less approaching their end of life and today we add new functionality to the CVB.Net, CVBpy and CVB++ API rather than to the ActiveX controls, so not everything that you find here on the forum can be guaranteed to be feasible with the ActiveX controls (device discovery is one example that comes to mind, another one would be the more advanced acquisition features like MultiPart or FlowSetPools).

Hi,

Yes not a problem to the serial now i know …
To the activeX system it’s old function to a computer but i work on industrial automatism and to include activeX is a new function on automatism side (2 years).