Python Smart Terminal Technical Details

From OpenCircuits
Revision as of 08:15, 17 February 2017 by Russ hensel (talk | contribs)
Jump to navigation Jump to search

This page is for some fairly fine scale detail on how things are implemented in the Smart Terminal, they may be useful as techniques in other applications. See also: Russ Python Tips and Techniques

Comm Port Details

In the parameter file there is a setting for the comm port, this is typical of all communications programs. Other parameters hold other comm port values. Again typical. There are however, some less typical additions.

Comm Port Validation

  • So you open a comm port, the first level of validation is that the port opens.
  • The second level of validation is that the port can send and receive, this is checked by sending a text string and looking for a response.
  • The third level is to look at the received string. If it contains the correct substring then the port is valid.

For example the terminal may send "v<cr>", recieve "GreenHouse Monitor v3 2017 01 24.01<cr>", and look for "GreenHouse" in the recieved string. This would validate the port.

So what does the terminal send and what does it look for -- see the parameter file"

        # next used in a port probe routine to help identify the port with an arduino
        # the arduino is supposed to respond to a version request with a string
        # containing this, they are part of the name of an Arduino application
        self.get_arduino_version    = "v"

        self.arduino_version        = "GreenHouse"