Models

This module is used as a base for models submodules.

The main class is models.Connector.

Each model module has a child class named ModelConnector(Connector).

Classes

class models.Connector(port=None, baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=0, rtscts=0, writeTimeout=None, dsrdtr=None)

Bases: serial.serialposix.Serial, threading.Thread

Connect to a total station.

For more information : Pyserial documentation

Parameters
  • port – Device name or None.

  • baudrate (int) – Baud rate such as 9600 or 115200 etc.

  • bytesize – Number of data bits.

  • parity – Enable parity checking.

  • stopbits – Number of stop bits.

  • timeout (float) – Set a read timeout value.

  • xonxoff (bool) – Enable software flow control.

  • rtscts (bool) – Enable hardware (RTS/CTS) flow control.

  • bool dsrdtr (bool) – Enable hardware (DSR/DTR) flow control.

  • writeTimeout (float) – Set a write timeout value.

open()

Open the serial link.

download()

Download method for user interfaces.

First the class must be instantiated, then the port is open and the transfer from the device can start. Once the transfer is finished the user interface should call this method.

fast_download()

Implement a fast download method that requires less user input.

Inside, it calls download() itself, just wrapping it inside another loop that checks whether there’s input coming from the serial port: when data become to appear, download() can start.

run()

Method representing the thread’s activity.

You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.

Constants

  • models.BUILTIN_MODELS

    Dictionnary that holds all models available in Total Open Station.

    Form of the dictionnary :

    {
    ‘model_name’: (‘module_name’, ‘ModelConnector’ or ‘CustomConnector’, ‘Model Name’),
    }