command & value are concatenated with '=' characters transformed to '?)' (question marks are special characters to WebIOPi, so can't be in the request).Returns: 1 (true) as the AV app has no need for response from UDP.msgNum & data are concatenated with a comma (commas are special character to WebIOPi, so can't be in the request).Accepts: IP address, port, msgNum, data.Returns: TCP response from the third party device to JS on the smartphone.Returns: HTTP response from the third party device to JS on the smartphone.Communicates with the third party device as requested.Accepts: HTTP verb (GET/PUT/POST), protocol (HTTP/HTTPS), host, path, headers & data.I have intentionally kept the message forwarding on the Pi fairly 'dumb' with all the 'smarts' residing in JS on the smartphones/tablets. JS on a smartphone cannot communicate over UDP or cabled RS232. JS on a smartphone is restricted by the Same Origin Policy (ie: JS can only talk to the same protocol/host/port that it was served up from).The main reasons for using message forwarding are: The JS sends HTML requests to the Python functions which then forwards/proxies the messages to relevant devices/services and returns responses where appliable. The main point of this blog post is to document what was done! Overview of architectureįrom a previous post the Raspberry Pi uses WebIOPi which has a built-in Python server that serves up the HTML/CSS/JS to smartphones/tablets. I will be migrating to a Phonegap app + Node.JS architecture in the coming weeks, so these notes will soon become irrelevant to my setup. NOTE: This code is a first attempt at Python 3 message-forwarder/proxy for the HTML/CSS/JS frontend on smartphones/tablets.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |