取消
显示结果 
搜索替代 
您的意思是: 

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 项奖励
1 条消息(共 9 条)
4,654 次查看

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 项奖励
2 条消息(共 9 条)
4,458 次查看

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 项奖励
3 条消息(共 9 条)
4,434 次查看

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 项奖励
4 条消息(共 9 条)
4,381 次查看

--

0 项奖励
5 条消息(共 9 条)
4,381 次查看

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 项奖励
6 条消息(共 9 条)
4,376 次查看

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 项奖励
7 条消息(共 9 条)
3,562 次查看

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 项奖励
8 条消息(共 9 条)
2,081 次查看

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

0 项奖励
9 条消息(共 9 条)
2,002 次查看