08-09-2023 11:18 AM
Hey y'all, I've been thinking about this for a while but haven't come up with anything, so I thought I might get some ideas here. I know that LabVIEW's SVE uses TCP/IP as it's transport layer for network published variables, so I was wondering if there were any way to highjack into this connection to be able to receive, or at least just read, the data outside of LabVIEW (in python or something, for example). It seems like it could be somewhat plausible, seeing as it uses TCP/IP, but I haven't found any mention of it anywhere else on the internet. Thanks!
08-09-2023 12:15 PM - edited 08-09-2023 12:18 PM
It's actually not just TCP/IP but more correctly REST HTTP.
See this post about some ideas that might help.
The Getting Variable Updates documentation mentioned in that post has moved here.
So using your favorite RESTful request library in Python, C# or whatever should actually allow you to do this quite easily.
08-09-2023 12:30 PM
This is AWESOME! I do have a few questions about the answer that you may be able to help with. Firstly, the article uses this as the request:
GET http://my_server:3580/nivariable/VariableValueGroups('1587dcd4a87d118ae3ddd0fce09246f6')/VariableValues?$format=json
1. I'm assuming I replace the my_server with the IP address of the machine it's deployed on (in this case a cRIO)
2. Is the port for the SVE always the same (3580)? I'm not sure where I'd find the port that the SVE is listening on otherwise.
3. The article uses, what I can only assume is a key, of 1587dcd4a87d118ae3ddd0fce09246f6. Is this just a generic key to request the values, or does each server have it's own, etc... And where would I find it if it is different for each.
Thanks again, this is a huge stride towards getting this to work.
08-09-2023 12:59 PM
1) yes (or localhost if it is the same computer)
2) it's the default value and I think standard, but there may be a specific registration in the NI Service locater service that is another HTTP request to the port number 3580 on the target server. Possible requests are GET http:/address:3580/dumpinfo?
3) If you look in the left hand side of the Getting Variable Update link, you see other topics. For instance the simple psp variable read would be actually using this: Reading the Value of a Variable
The UID in the example is a Variable Group identifier. You can create that with Creating a Variable Group
08-09-2023 01:34 PM
Oh shoot, forgot to look to the left. I think I've got almost everything ,except that when trying to do any kind of request, I keep getting an "Remote end closed connection without response" error. I checked the dump request you suggested and none of the entries had a mapping of 3580. I went through and tried some of the ports listened and sometimes I would get a "Could not find File", but most were just closing or refusing connections. I also tried using an auth tag with the login for the cRIO but to no avail. Any ideas what could be causing it to close like this?
08-09-2023 01:45 PM
You should be able to actually use the GET uri's simply in a browser. Does that work?
08-09-2023 01:50 PM
When trying to search in web browser http://192.168.0.2:3580/nivariable/VariableValues('ni.var.psp://192.168.0.2/ControlVariables/Filter%... with a variable located at Location: \\192.168.0.2\ControlVariables\Filter Extend I get The specified URL does not exist.
08-09-2023 01:54 PM
Does a LabVIEW Variable access from the same computer to "ni.var.psp://192.168.0.2/ControlVariables/Filter Extend" work?
08-09-2023 01:57 PM
Yep, and using DSM I'm able to change the value and have it reflected in LabVIEW. I do have to enter the Variable connection as a string, as I can't find it when browsing PSP variables.
08-10-2023 11:35 AM - edited 08-10-2023 12:17 PM
I'm still trying to get this to work, here's some updates I've found:
1. I realized I never showed the 3580 info dump, so here it is. Not entirely sure what it's supposed to look like so can't really say whether or not it's wrong or not
2. I was thinking maybe it had something to do with the Web Configurations, but after trying to open it, I remembered why I'd never used it before, because I didn't have silverlight. Do you think there's something in there that enables the server?
3. Are there any startup settings I need to have enabled/disabled? I tried enabling all of them (other than force safe mode) and still nothing, but maybe one of them is blocking it?
4. When looking at DSM, the variables I'm trying to read are under My Systems. Should I be trying to get them from the Network Items?
5. I tried to take a step back and deploy the variable on my local machine, and after confirming that it works in LabVIEW, I tried to use the URI in the browser again. Using the URI http://localhost:3580/nivariable/VariableValues('ni.var.psp://localhost/Variables/TestVariable')?$fo...
I got a different response than last time, this time stating 404, Cannot open document for:
/nivariable/VariableValues('ni.var.psp://localhost/Variables/TestVariable')