LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the MAC address of a PXI in a dll

Solved!
Go to solution
Solution
Accepted by topic author ChristianEC

Christian,

 

unsupported hint: Search on the RT target for files which might contain the MAC.

 

Norbert

 

EDIT: Maybe, this KB (bottom line "Using Command Line") helps you as well.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 11 of 22
(2,045 Views)

I think what you REALLY want to do is use the NI System Config API - it has a standardized library that can be accessed from within a C/C++ DLL that can query system information.  All of the VIs you traditionally use call into the "guts" of the Real-Time OS, which may or may not have published APIs and may or may not exist on all systems/controllers.  The NI System Config API is guaranteed to provide access to APIs that always "work."  

 

https://decibel.ni.com/content/docs/DOC-13216

 

-Danny

0 Kudos
Message 12 of 22
(2,027 Views)

@Norbert_B:

As far as I understand, using the command line works if I ping the RT target from a host machine that runs Windows.

But I need to retrieve the MAC address on the RT target itself, without any other systems involved.

 

@Texas_Diaz

This NI System Config API looks interesting. I will search the examples and documentation and try to find the functionality I need.

 

Christian

0 Kudos
Message 13 of 22
(2,020 Views)

Hello,

 

I just want to let you know that there is a file on RT targets that seem to contain the mac address. This is what Norbert_B suggested.

At least on my PXI running LabVIEW RT, there is the file netconf.ini in /ni-rt/system/ethernet which provides information about the network interface.

Unfortunately, I have only one RT system, but want to make sure that this file is available in the same folder and format on other systems as well.

 

To be on the save side: Is it possible that whoever has as RT system, checks if there is this file and if yes, send it to me so that I can check the internal format and adapt my parser if needed?

 

Thank you in advance,

 

Christian

0 Kudos
Message 14 of 22
(1,998 Views)

Christian,

 

The reason I didn't recommend looking in the netconf.ini file, and instead to use the System Config API, is because not all systems will have a netconf.ini file.  Also, systems with multiple NICs will have multiple entries in the netconf.ini file, and you're not guaranteed to always have a "primary NIC" listed in that file.  A year ago I would have told you to just use the netconf.ini file, but with recent <cough> "changes" </cough> this is not something I would recommend any more.

 

-Danny

Message 15 of 22
(1,993 Views)

Danny,

 

I have checked the System Configuration API, but as far as I understood, it can be used to get the MAC address of a target system, but the application that gets the MAC address needs to run on a host (Windows) system.

Do you know if the System Configuration API is intended to run on the target directly?

If you have any experience with this API, could you please let me know how to use it on the target itself (which functions to call, which libraries to link etc.)?

 

Thank you,

 

Christian

0 Kudos
Message 16 of 22
(1,990 Views)

Yes, the System Config API can be run on the target itself - it's fairly host/target agnostic, customers have used this API on the targets to reconfigure network settings "automagically" without access to a host machine.

 

I myself have not used the System Config API, unfortunately.  But I do know this was one of the expected/standard use cases for it.  Maybe an NI Applications Engineer can guide you in using this API.

 

-Danny

0 Kudos
Message 17 of 22
(1,982 Views)

Ok, I did some more investigation on the System Config API and you're right, it can run on the target itself.

But unfortunately, I found the VIs only, but no interface that can be used from C++.

The documentation also gives no information if there is such an API.

 

Christian

0 Kudos
Message 18 of 22
(1,973 Views)

Christian,

 

i have not done that before, so i am not sure if this works out correctly..... BUT: You are running a LV RT system. Correct?

 

So, it is possible to wrap the System Config API (LV code) as a DLL which you call within your "primary DLL". This is of course some hack (require to deploy two DLLs in addition), but might come close to your needs.

 

Norbert

 

EDIT: This construct must not be called within your time critical section of code of course. It could break determinism.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 19 of 22
(1,965 Views)

Norbert,

 

deploying additional Dlls is ok. And yes, I am running LV RT.

But how can I wrap the LV code for calls of System Config API into a DLL, i.e. creating a DLL from a VI?

I have no idea how this can be done?

Can you please let me know how I can do this.

 

Thanks,

 

Christian

0 Kudos
Message 20 of 22
(1,962 Views)