03-07-2016 04:00 PM - edited 03-07-2016 04:06 PM
Hey,
I would like to ask for some suggestions on my problem:
I have a system in which I use USB-6211's on multiple computers and it might happen that more than one of them is connected to a single computer, yet simultaneously only one is used on a machine. I have found a way to read serial number and I can attribute this number to a name. However at design time I do not know the serial numbers, so what would be the best to store them?
I am thinking of a way to store these values somewhere, read it, check devices, if there is no entry, then ask for a name to store, if found, return the name and get the dev identifier of the selected device. The actual data format does not really matter, it can be a simple array, a variant attribute list or whatever, since a computer won't have more than ~10 devices listed. The actual problem is where to store them safe.
Some of the users might have administrator rights, while most of them definitely won't and have Windows XP, 7, 8 and 10 installed (something I can't really control).
Thanks
Solved! Go to Solution.
03-07-2016 04:12 PM
I'm going to assume you're using DAQmx to access these?
If so, try using the DAQmx System node to get all available devices, then scan through them to find the types and serial numbers available.
03-07-2016 04:19 PM
my problem is not how to obtain these values (actually I do use the same daqmx property node), but where to store that the device with a serial number of let's say "0x2102102" should be called "work card 1", and "0x34532432" should be called "fancy box"
as I do not know these at design time, I cannot store them inside the program, that's why I am looking for some way to store it permanently
03-07-2016 04:24 PM - edited 03-07-2016 04:25 PM
In an Init File? It is where I store this kind of informations.
03-07-2016 04:26 PM
I tend to use configuration files (ini) to setup my hardware. They are simple to use and make things easy to setup.
03-07-2016 04:29 PM
Okay, it seems that an ini file is the most common for these.
Now another sub-question: where (at which point of a Windows filesystem) should I store this file to have it safe?
03-07-2016 04:34 PM
In general, I store the init file in the directory ProgramData (C:\ProgramData\DirectoryOfMySoftware\Init.ini). I don't know if it is the best place...
03-07-2016 04:35 PM - edited 03-07-2016 04:37 PM
I was going to recommend an INI file too.
When you say "safe" do you mean that there won't be any permission issues to worry about? Or that users can't alter it?
I prefer to use the "Get system directory" functionality.
If you look at the "Help" entry for Get System Directory, it tells you what permissions and accessibity you can expect for any given directory.
"C:\ProgramData\" is a hidden directory by default and I found that trying to tell other users how to find a hidden directory to be more trouble than it was worth.
03-07-2016 04:41 PM - edited 03-07-2016 04:42 PM
Could be interesting:
03-07-2016 04:51 PM
Thanks, it seems that ProgramData should be fine