LabVIEW Web Development Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

web dev tools

So, just adding to the knowledge base here (but maybe getting ahead of everything) - when you get far enough along and want to consider concatenating, uglifying and minimizing, here is a tutorial on using gulp that seems esspecially helpful.  gulp is rapidly catching up to grunt as far as build systems go and I am just now piling into it.  I will let you know how my own travails with this system go.

Matt

0 Kudos
Message 21 of 32
(3,040 Views)

Sooo...my vote for IDE will now definitely be aptana (unless I can figure out how some of the command line tools work with atom, then maybe....).  Took about an hour of learning to get gulp rolling so that I can lint, concatenate, uglify and minimize files using gulp and it is rolling!  The watch functionality automatically rolls changes in the code into the minified file and lints the changes for errors.  And all of this can be done from the Aptana terminal!

Matt

0 Kudos
Message 22 of 32
(3,040 Views)

Matt,

The problem with latching buttons in on the LabVIEW end.

If you press a button on the webpage, that action needs to feed back to the front panel since we're not modifying the code. The vi that receives the click event from the website keeps a reference to the front panel and can use VI server to manipulate controls. Unfortunately, you cannot use the value signalling property on latching buttons, which means that there is no (to me) obvious way to programmatially press a button on the front panel that would fire an event within LabVIEW to trigger the event structure that listens to that button.

So far I only way I managed to solve this problem is by making calls to the windows API to move the mouse cursor around and actually press the button by sending mouse button down events.

0 Kudos
Message 23 of 32
(3,040 Views)

teegee,

I am not really following this.  Are you using web services or just the http VIs?  In either case, this shouldn't be an issue.  Why not just use a switch when pressed button and then toggle the switch back to false when the the button is pressed (since it is latching, you wouldn't have to do anything when an http request comes in, you simply or the values to execute the code you want to fire when one or the other is pressed)?

Maybe you should put up an example so that we can offer more concrete suggestions.  I totally missed that you are trying to tie a web UI event to a VI FP.

Cheers, Matt

0 Kudos
Message 24 of 32
(3,040 Views)

Matt,

I appreciate your (and the others') feedback but like I said, I haven't got anything to show at the moment. It's all in bits.

My plan is to provide a tool, that can be an add-on to a working project to publish one or more front-panels via LabVIEW webservice by either dropping a vi on the existing BD of the FPs to be published or have the user select the VIs from a list at first run. No more modification to the code should be required.

The web pages should not only display the content from the FP but also be able to control it.

If you take a working project, it shouldn't be required to change all latching buttons into switching buttons just because an add-on can't handle it.

Anyway. I'll keep you updated on progress and try to get code out as soon as possible.

Message 25 of 32
(3,040 Views)

Hi teegee,  Is that possible to control a F.P from the Browser by using Labview Webserver without  using any other external webservers?  Regards, Krish.

Venugopal
0 Kudos
Message 26 of 32
(3,039 Views)

teegee wrote:

If you take a working project, it shouldn't be required to change all latching buttons into switching buttons just because an add-on can't handle it.

I have to completely disagree with this statement.  If you develop an application and then as after thought attempt to do provide some new means of interacting with that application, then why should you have any expectation of immutable code?  This premise is flawed for at least one very obvious reason - you have to have some way of injecting the required dependencies into the existing code.  And this will not happen without fore thought, so you will never be able to just add another layer without some refactoring.   

Krish, you can indeed provide interaction using the LV webserver; but, as teegee has pointed out, you can not manipulate a latched boolean due to race conditions.

I guess you could do a little meta-programming with the LV scripting tool and have it walk the controls and replace the latching booleans with some other manipulatable control with a similar output when you inject your layer...that would be pretty cool!

0 Kudos
Message 27 of 32
(3,039 Views)

Alright, here we go.

I have attached a proof-of-principle project.

When you load it, you will find Simple.vi in "To Publish". This vi's front panel is published to the webservice which is also included in the project by adding FPPublisher.vi to its front panel. As discussed before, any latching controls aren't compatible and cause an error.

When Simple.vi is run, FPPublisher goes through all controls and indicators and generates a bunch of objects, which know how to generate their own HTML and javascript code. All that gets written to file and is ready to be served. Objects also handle their own get/set data. Currently, I'm only supporting boolean, numeric, xygraph and their labels and captions.

There is also an option to use the picture of the control instead of HTML code by setting the Documentation to "UsePicture". The plan is to have a nice GUI to deal with the configuation of this and other things - later.

To run the thing, just start the webservice (as debug) and run Simple.vi. You should then be able to browse to the published front panel and interact with it.

What do you think?

Message 28 of 32
(3,039 Views)

More reading makes me realise this won't work in an executable because all "static" content is actually static and can't be changed easily once the websever is running. That means I have three options for cases when anything that isn't the value of a control or an indicator changes:

1) Ignore it. You can't rename an axis of a graph ever or change a caption

2) I have to serve HTML and js "files" via resource files rather than putting them on disk. This could be tricky. I'll have to add a flag to the data returned to GetData() to notify the website to reload its static content somehow.

3) Instead of just handing out the value of a control or an indicator, include other properties that may get changed and update them via js.

Has anyone looked at the project I included above? I'd like some feedback

0 Kudos
Message 29 of 32
(3,039 Views)

Hey teege,

I will take a look at it and give you some feedback.  Just been kinda busy trying to get paid ....

Matt

0 Kudos
Message 30 of 32
(3,039 Views)