Communication format for NGINX

Applications, development tools, FPGA, C, WEB
Post Reply
jwarren
Posts: 1
Joined: Tue Aug 11, 2020 10:19 am

Communication format for NGINX

Post by jwarren » Tue Aug 11, 2020 10:38 am

I am building a labview VI to set the parameters and get the signals instead of using a web UI. I managed to open a web socket, handshake, and receive the periodic updates from the RP NGINX server. After ungzipping this data, it looks like a standard json string like:

{parameters:{}}
and
{signals:{}}

So far so good. I assume when I actually hook the update methods to an actual variable, the curley braces won't be empty.

However, wheverever I try to send json data back to the server, the app to crashes or at least does nothing. The javascript for the app (in this case the LED tutorial) only shows a simple call to websocket.send with the data converted to json. I tried sending:

{parameters:{'LED_STATE':true}}

and other variations of this with no luck. The json parser from the ngx_http_rp_module seems to search for two keywords: "datasets" and "params". Including them prevents a total app crash but doesn't toggle the LED.

I know you can interface with RP via scpi but this has its limits because you can't access registers for your own fpga code. The webui interface is nicely put together for exactly this purpose but I'd like to use a labview interface instead of the web browser so I can aggregate the data alongside all the other stuff in my lab.

Any help would be appreciated.

edit:
I managed to intercept an update message from the websocket which gave me the data format:
{"parameters":{"LED_STATE":{"value":false,"min":false,"max":true,"access_mode":0,"fpga_update":0}}}\r\n
Echoing this back as "value":true and it worked. The LED can now be toggled. However, I still haven't managed to find the http sequence to start the app. At the moment I have to start the app in the bazaar via web browser.

editedit:
I got it working by using the HTTP client vi's installed with labview to send a GET with the magic url:
To start app-
http://<rp IP or .local addr>/bazaar?start=<name of app>
and to stop app-
http://<rp IP or .local addr>/bazaar?stop=<name of app>
Also, as a point of clarification for whoever might attempt this, while HTTP client is installed with labview, the websockets is obtained through the VI package manager.

Post Reply
jadalnie klasyczne ekskluzywne meble wypoczynkowe do salonu ekskluzywne meble tapicerowane ekskluzywne meble do sypialni ekskluzywne meble włoskie

Who is online

Users browsing this forum: No registered users and 34 guests