LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reg Event Callback Functionality doesn't work with .NET Sapera SDK

Hi Group,

I'm working on CameraLink device with DALSA Framegrabber, and I'm trying to grab camera frames to LabVIEW for further processing. I tried to use "Reg Event Callback Functionality" with acquisition events like EndOfFrame.

Based on Sapera SDK [1] Examples all acquisition events works fine with .NET application and WindowsForms. However when I extract common functionality into DLL and run it from LabVIEW, I don't see any events handled, even inside DLL.

I've prepared basic test that works in C# (see sample) but it doesn't receive any event in LabVIEW. It should handle error event as I don't have a server no. 4. In Sapera logs I see that the error is logged in case of triggering error event, but all other logs are the same as when running in .NET.

Do you know what I can try to make it running, as Sapera support replied that they don't see any issues with my code from their side?

What can be different between running .NET application vs. LabVIEW that might impact this behaviour?

Kind regards

RP

generate_error_vi.PNG

Static VI (when running it is never called):

handle_error_vi.PNG

[1] https://www.teledynedalsa.com/en/products/imaging/vision-software/sapera-lt/

 

C# source:

static private void ErrorHandler(object sender, SapErrorEventArgs e) { 
  SapManager.DisplayMessage(e.Message);  // throws stack overflow, but is triggered! 
}
static void Main(){
  SapManager.Error += ErrorHandler;
  SapManager.DisplayStatusMode = SapManager.StatusMode.Event;
  SapManager.GetServerName(4);
}

 

0 Kudos
Message 1 of 9
(2,815 Views)

Hi rpietruc, I've got the exact same problem (Win 10, LV18 SP1 64-bit) using the Sapera SDK (.NET assembly DALSA.SaperaLT.SapClassBasic 8.41.0.1955). No error when registering SapAcqDeviceToBuf.XferNotify, after setting EventType to EndOfFrame for SapAcqDeviceToBuf.Pairs(0), but the callback VI never gets called when calling Snap() which does produce an image.

 

There is also no way, afaik, to implement SapProcessing, which you need for further live processing, since the base class does not have a constructor and a daughter needs to be derived. It would work no problem in C# but not in LabVIEW.

 

At least for live image rendering (SapView), I ended up launching an asynchronous VI which monitors the SapBufferWithTash's index and displays the n-1 image (invoke node SapView.Show()) every time it increments. That works.

 

For further processing, my plan is to do it post-processing after saving the images in the buffer. Not ideal for "live" processing/rendering.

 

Async callAsync call

 

Index monitorIndex monitor

 

0 Kudos
Message 2 of 9
(2,619 Views)

You're registering an event to a .NET constant.

 

You'll have to create the class using a .NET constructor.

 

If you put a probe on the .NET wire, you'll notice it is 0x00000000.

 

The flat sequence structure is redundant and distracting...

0 Kudos
Message 3 of 9
(2,595 Views)

Thanks @wiebe@CARYA for reply, unfortunately I can't call SapManager constructor because the library doesn't implement any public constructor. There are classes that derives from SapManager, however the SapManager events (e.g. SapManager.Error) are not visible from derived classes, like SapAcquisition.

0 Kudos
Message 4 of 9
(2,542 Views)

--

0 Kudos
Message 5 of 9
(2,542 Views)

Thank you Frenmerican for code snippets, I've ended up with C wrapper library using PostLVUserEvent function, however your code is worth checking as it doesn't require extra coding in C.

0 Kudos
Message 6 of 9
(2,537 Views)

Hello Frenmerican,
even though your answer is a few years old now, did you find a way to process the data on Labview or copy it into an array with the Sapera SDK?
Best regards

0 Kudos
Message 7 of 9
(1,723 Views)

Hi,

i'm facing a similar problem : I want to acquire the data from an axcis camera with the grabber. Has anyone develop something that might help me?

Any support would be appreciated!

Have a nice day.

0 Kudos
Message 8 of 9
(242 Views)

Anyone evolved in this? I am also having this problem and don´t have any good solution so far...

0 Kudos
Message 9 of 9
(163 Views)