NI Home > Community > NI Discussion Forums

Data Acquisition Idea Exchange

Showing results for 
Search instead for 
Do you mean 
Announcements
The NI Idea Exchange is a product feedback forum where NI R&D and users work together to submit ideas, collaborate on their development, and vote for the ones they like best. View all of the NI Idea Exchanges to post an idea or add your opinion on an existing one today!
TCPlomp

Add LabVIEW events based on hardware

Status: New
by Trusted Enthusiast on ‎08-26-2010 12:47 AM

Based on this question, I would like to add a new category of events to LabVIEW: Max-events.

 

This category could contain the following events:

-Hardware Added

-Hardware removed

-Configuration changed

    -Scales

    -Channels

    -Tasks

 

If you know other events, please post them.

Comments
by Active Participant JoshuaP on ‎08-30-2010 01:48 PM

MAX 4.7 supports a new LabVIEW programmatic API called NI System Configuration that provides the ability to Find Hardware and get properties like the devices status to tell whether or not it is currently connected to the system.  Look in the LV Example Finder under Hardware Input and Output/System Configuration. 

 

However, it doesn't currently provide support for events.  If we were to support events how would you anticipate it being exposed?  What would you want it to look like?

by Trusted Enthusiast ‎08-30-2010 02:24 PM - edited ‎08-30-2010 02:25 PM

It does seem like this feature would best fit in as part of the System Configuration API.  I can't speak for the Original Poster, but to me the following would make the most sense:

 

 

22727i17F57657E3F008C0

by Trusted Enthusiast on ‎08-31-2010 01:15 AM

Yes that is good enough for me! I really like dynamic events.

by Active Participant Brad_K ‎08-31-2010 09:15 PM - edited ‎08-31-2010 09:20 PM

TCPlomp, this is a very interesting idea. Thanks for posting it.

 

There is already a Windows-specific way to get notifications about hardware added/removed (WM_DEVICECHANGE) but accessing it from LabVIEW pretty much requires writing a DLL in another programming language, it's not supported on LabVIEW RT, and it doesn't report devices that Windows doesn't know about (such as SCXI and SCCs). This idea would be easier to use and more portable (in some ways) than WM_DEVICECHANGE.

 

How would you use these events? Would a program using these events be concerned only about the current state of the system, or would it be important to identify what has changed?

 

If these were DAQmx events, passing the event structure a "DAQmx Device", "DAQmx Global Channel", "DAQmx Scale Name", or "DAQmx Task Name" type seems like an obvious way to identify the newly added/removed object. Since these types are convertible to strings, they should still be useful for identification purposes after the object has been removed. I'm sure there are other approaches I haven't thought of.

 

If these were NI System Configuration events, there are many ways the newly added/removed object could be identified, and here are just a few that come to mind. Passing a resource refnum to the event structure would probably be pretty convenient to use, assuming that you could still query properties from a resource that has been removed. I would expect the G code in the event structure to be responsible for closing the refnum. Passing the Expert/Resource/Alias properties to the event structure could work too. Or maybe a list of properties to pass to the event structure could be specified at event registration time?

 

Reporting a newly added device to the event structure as a DAQmx Device or a nisyscfg "User Alias" introduces the possibility for a race condition: what if someone else (especially another "Hardware Added" observer) renames the device as soon as it is added? Besides that, it might also be useful to have a "Hardware Renamed" event.

 

Brad

by Trusted Enthusiast on ‎06-13-2011 12:09 PM

Another downside to WM_DEVICECHANGE which has come up recently is that the event fires before the hardware is necessarily available in DAQmx (see here).

About Data Acquisition Idea Exchange

Have an idea for new DAQ hardware or DAQ software features?

  1. Browse by label or search in the Data Acquisition Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see implemented!
Idea Statuses
Top Kudoed Authors
User Kudos Count
3
1
1
1