LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the current value of the variable when CNVCreateSubscriber succeds

Solved!
Go to solution

I've been using CNVCreateSubscriber( ) to create a read subscription to a Network Variable: every time the variable value changes, the DataCallback is called and I'm able to get the new value of the variable.

But how can I get the value that the variable has when the subscription is created?

 

I read in the help that CNVCreateBufferedSubscriber( ) returns this information, but I wonder if using CNVGetDataFromBuffer( ) in a polling loop has the same performance as the DataCallback approach of the CNVCreateSubscriber( ).

Moreover, the dataStatus parameter of CNVGetDataFromBuffer( ) is different for different subscribers? (i.e. if I have multiple subscribers, CNVStaleData is related to the specific subscriber or is a global property of the variable?)

Vix
-------------------------------------------
In claris non fit interpretatio

-------------------------------------------
Using LV from 7
Using LW/CVI from 6.0
0 Kudos
Message 1 of 5
(3,142 Views)
Solution
Accepted by topic author vix

CNVData data;

CNVGetConnectionAttribute (subscriber, CNVMostRecentDataAttribute, &data);

Message 2 of 5
(3,130 Views)

Is it possible to wrap the CNVCreateSubscriber as a DLL that would allow a LV vi to call and register a NSV as well as a LV vi callback or maybe even passing back a LV User Event.

 

Thank You

0 Kudos
Message 3 of 5
(2,964 Views)

LabVIEW has its own implementation of Network Variables - they are called Shared Variables in LabVIEW. While you can wrap the CVI Network Variable function calls in a DLL and call them from LabVIEW, it will be easier and better to instead use the shared variables nodes and VIs that are native to LabVIEW. The members of this forum may not know much about the LabVIEW event model - you will get better answers about LabVIEW events and callbacks in the LabVIEW forum.

0 Kudos
Message 4 of 5
(2,941 Views)

The problem with the LV SV API is that they do not expose the callback capability.  It is offered by the DSC but not natively in LV.  Wrapping these CVI functions in LV callable dll's would be a powerful addition to the LV SV API.

0 Kudos
Message 5 of 5
(2,939 Views)