Tom Bray
New Member
Posts: 4
Raspberry Pi: Yes
Other Device: iPad and Arduino
|
Post by Tom Bray on Oct 22, 2013 3:10:02 GMT -8
This is my first attempt at using a web interface as a way to control a device. I have many questions about implementing the code on the server side but here are two to start with.
First: If the App sends a button command, is it permissible to not only respond to the button but to also send any other status information about other controls at the same time, such as voltage levels, LED indicators, etc.? Or does it the server have to wait until it is asked for the other controls?
If it is the latter (the server needs to wait), is there the ability (or planned ability) to group controls together so that when one button is pushed everything goes out as a group or to force sending an update request for the whole screen upon receiving the confirmation to the initial command?
Second: Events, such as button pushes, all include the UI Type, control code, and display name of the control. When customizing the system, is it intended to use different control codes to identify the individual controls in the App or to use the Display Name as the primary identifier?
|
|
|
Post by SDL on Oct 22, 2013 4:38:52 GMT -8
Hi Tom,
The documentation covers these questions.
"- When a set of control commands are sent to a Raspberry Pi server, all the commands to be sent to the server in a single bundle to minimize http connect/disconnect time. The responses are also read back as a single bundle from the Raspberry Pi. Control commands are sent one at a time to the Arduino and responses are read back individually to minimize buffering space and stack space on the Arduino. This results in slower response from Arduino servers versus Raspberry Pi servers.
- All push button commands and send text commands are sent individually immediately to both kinds of servers. "
Regarding the second part of your first question. We are adding the ability to force a refresh for the whole after a button has received a response from the server.
Second question:
Yes, you use different control codes to select for a control. Typically, you select first on UI Type, then secondarily on control code. The display name can change depending on the control.
Hope that helps!
Best regards,
BP
|
|
Tom Bray
New Member
Posts: 4
Raspberry Pi: Yes
Other Device: iPad and Arduino
|
Post by Tom Bray on Oct 22, 2013 7:07:22 GMT -8
I think the first question may be a bit confusing. What I am asking is related to a response, maybe a push button for example. When the server receives a push button event, is it permissible to respond with additional items, like turning on LEDs on the RasPiConnect UI or setting a voltmeter value in addition to acknowledging the button push?
So the server is bundling extra actions in response to a user event. So the App is getting responses to items that it didn't necessarily ask for.
Will this work? I asked one of my coworkers about generic web services and he thought that I should be able to bundle anything I want in the response packet but that was from the perspective of designing both the web service and the user app to play nicely.
|
|
|
Post by SDL on Oct 22, 2013 7:31:12 GMT -8
Tom,
Understand your question now. The App asks the server for responses. When you push the refresh button, it sends all the controls on the page to the server that want a response (but not, of course, the push buttons). You end up with the situation where you push a button to set an option (feedback button) and then you hit refresh. What we want to add is that when you get a response back from a button, you can optionally refresh the other controls automatically.
That is the normal flow of the program. However, if you wanted to send back responses for controls that the App has NOT asked for with the return of a button response, you can. You just need to make sure they are formatted properly. The App parses the responses, but does NOT check to see if the responses have been requested. Capture one of the responses from the server to a normal refresh, then send it as a response back to the App (after a button request, for example) and you can do what I think you are asking.
BP
|
|
|
Post by faraday on Oct 24, 2013 7:42:29 GMT -8
BP and Tom,
That is a great idea. I'm putting the code in so when I hit a feedback button to display a graph, it also will send out the code to refresh the web view control. Wow!
I really like it.
|
|