Embedded Controller Technology

Micro-Robotics home page

this site web
NEWS

HTTP Protocol Object

Web Server on a VM-1

The HTTP (HyperText Transport Protocol) object enables the VM-1 to run a web server, so that remote systems can be controlled and monitored using any web browser, with a user interface built by the programmer as a set of web pages and forms.

The HTTP object takes advantage of a local file system if one is available, (such as the FAT file system for memory cards enabling it to serve static html and graphics file content automatically.

Capabilities

Dynamically Generated HTML

Responses to page requests can be created with Venom PRINT statements to the http object, enabling dynamically changing HTML code to be generated on the fly. This gives Venom all the power of a server-side scripting language.

VHTML - Embedded Venom Variables

A simple and powerful extension of HTML code allows program variable names to be embedded anywhere in the html source. We use the filename extension ".vhtml" for this, and the http object processes it automatically. Integer, string, buffer and floating point variable names are simply inserted into an HTML file, replaced by their actual values when the page is fetched.

Test Page

A request for the path "/test" on the VM-1 generates an internal test page that shows the Venom version and amount of free heap memory.

Standard HTTP Features

The server recognises and sends correct headers for JPEG, PNG and GIF graphics, HTML and plain text, CSS style sheets and PDF documents as well as the Micro-Robotics VHTML format.

Only the HTML GET method is currently supported. POST may be included in a later version, which would allow the uploading of large and/or binary files to the VM-1.

The object provides a simple interface for obtaining value assignments sent from HTML forms that use the GET method.

The HTTP object provides default response pages for Error 404 (not found) and error 503 (unavailable, generated if the file system media is missing)

Efficiency

A file (e.g. graphics) can be transferred to the http object very quickly by a single Put message.

HTTP/1.1 persistent connections are supported, enabling several entities to be transferred in a single TCP connection.

The HTTP object uses cache controls so that common graphics elements (logos, backgrounds etc.) can be cached by the browser and do not need to be transferred every time they are displayed.

Very little Venom code is requred to serve static and VHTML content. Once the http and physical interfaces are set up (e.g. ethernet) the following single line will serve static and VHTML pages:

  FOREVER [ http.Get http.Flush ]
          

A Programming Time-saver

A customer has written an online utility which converts HTML with embedded delimited variable names into Venom PRINT statements that incorporate the variables. Double quote characters in the HTML are also properly escaped. For programmers creating HTML by PRINT statements, this chould save a lot of coding time.

The conversion utility is here:
http://www.systemlevel.net/tools/h2v/index.php.

N.B. Neither Micro-Robotics nor the author of the H2V utility offer any guarantee; you are responsible for determining its suitability for your application. The site referred to above has links to further explanations about what H2V is and how it works.

Top Top
Top Top
Top Top