Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the analog command of ncCreateNotification in the NI-XNET API?

Hy,

 

I'm using NI-XNET, with C++ at QT environment, Windows 7.

 

I'm looking for command that notify if a specific frame received from the network, something like the ncCreateNotification.

 

Thanks for advance,

Aviad

0 Kudos
Message 1 of 7
(7,090 Views)

Hey AviadCielo,

 

I'm not sure if there's an exactly comparable command for ncCreateNotification in XNET. However, you may be able to use a variation of nxWait or nxReadState. Similarly, depending on if you're just checking for a frame, you could use nxReadFrame with a switch statement for the value you're looking for and then a default that does nothing. For details, I'd recommend looking through the NI-CAN and NI-XNET manuals linked below:

 

NI-CAN (See page 3-4 for ncCreateNotification)

https://www.ni.com/docs/en-US/bundle/321370c/resource/321370c.pdf

 

NI-XNET (See page 5-40 for C API)

https://www.ni.com/docs/en-US/bundle/ni-xnet/page/user-manual-welcome.html

 

Hope this helps!

 

--Ryan S.

0 Kudos
Message 2 of 7
(7,078 Views)

Hy Ryan,

 

Thanks for the reply!

 

Maybe I need to be more specific - I would like to read data for a frame just if data available,  something like:

 

ncCreateNotification(..... ,NC_ST_READ_AVAIL , ......)

 

All the best,

Aviad

0 Kudos
Message 3 of 7
(7,072 Views)

Hi aviadCielo,

There isn't a directly related call for XNET that equates to the ncCreateNotification(...) for NI-CAN.  What exactly are you trying to achieve?  Are you looking to wait for an item to be available in the read buffer before a read call is made?  Are you trying to do this so other sections of your code can execute, aka using this for multithreading, or for some other use?  I'm just trying to understand what exactly you are trying to do to see if we can come up with an approach for you.

0 Kudos
Message 4 of 7
(7,064 Views)

Thanks allot, I really appreciate.

 

Like what you wrote, I'm looking to wait for an item to be available in the read buffer before a read call is made, in order to:

a. Let my code run, with no need to Implement scheduled polling to get the data.

b. On my network, there is an ECU that transmit a fixed Sync message. I'm looking for a way to check if the sync stopped. I'm use to do it with      notification, using the Timeout feature (if the sync data not available after X sec - sync failed).

 

Thanks again,

Aviad

 


0 Kudos
Message 5 of 7
(7,059 Views)

Hey Aviad,

So my initial impression is that I don't believe there is a notifier for NI-XNET like there is for NI-CAN.  If you conifgure a session to read a single point frame, does this not achieve the behavior you are looking for?  Looking at our documentation for migrating from NI-CAN to NI-XNET, I'm not sure that we have a notifier specifically for the NI-XNET driver like existed for NI-CAN.  I'm going to have to look into this a little more to very definitively, but I think your best bet may be using a polling type call.  Additionally, a single point input session may work for your needs as well.  Let me look into this more and I will follow up with you soon.

0 Kudos
Message 6 of 7
(7,047 Views)

NI-XNET so far does not support notification like NI-CAN. You would need to poll the frame, but I would not suggest the SinglePoint read, as you cannot verify the timestamp of the received data. I would suggest to use a queued Frame or Signal input mode, which allows you to verifiy the timing of the received data. There are several examples included in NIXNET, which you can use as a starting point.

0 Kudos
Message 7 of 7
(7,043 Views)