app

Rovercode app.

Functions

MotorManager(\*args, \*\*kwargs)
connect() Connect to the rovercode-web websocket.
create_app() Creator of rovercode flask app.
download_block_diagram(id) API: /download/<id> [GET].
emit(event, \*args, \*\*kwargs) Emit a SocketIO event.
find_dotenv([filename, ...]) Search in increasingly higher folders for the given file
get_block_diagram(id) API: /blockdiagrams/<id> [GET].
get_block_diagrams() API: /blockdiagrams [GET].
get_local_ip() Get the local area network IP address of the rover.
init_rover_service() Initialize hardware pins and motor speeds.
isfile(path) Test whether a path is a regular file
join(a, \*p) Join two or more pathname components, inserting ‘/’ as needed.
jsonify(\*args, \*\*kwargs) This function wraps dumps() to add a few enhancements that make life easier.
listdir((path) -> list_of_strings) Return a list containing the names of the entries in the directory.
load_dotenv(dotenv_path) Read a .env file and load into os.environ.
run_command(decoded) Run the command specified by decoded.
save_block_diagram() API: /blockdiagrams [POST].
send_command() API: /sendcommand [POST].
send_from_directory(directory, filename, ...) Send a file from a given directory with send_file().
sensors_thread() Scan each binary sensor and sends events based on changes.
singleton(class_) Helper class for creating a singleton.
test_message(message) Send a debug test message when status is received from rovercode-web.
upload_block_diagram() API: /upload [POST].

Classes

BinarySensor(name, pin, rising_event, ...) The binary sensor object contains information for each binary sensor.
CORS([app]) Initializes Cross Origin Resource sharing for the application.
Flask(import_name[, static_path, ...]) The flask object implements a WSGI application and acts as the central object.
HeartBeatManager(payload[, id]) A manager to register the rover with rovercode-web and periodically check in.
Response([response, status, headers, ...]) The response object that is used by default in Flask.
SocketIO([app]) Create a Flask-SocketIO server.
class app.BinarySensor(name, pin, rising_event, falling_event)

The binary sensor object contains information for each binary sensor.

Parameters:
  • name – The human readable name of the sensor
  • pin – The hardware pin connected to the sensor
  • rising_event – The event name associated with a signal changing from low to high
  • falling_event – The event name associated with a signal changing from high to low

Constructor for BinarySensor object.

class app.HeartBeatManager(payload, id=None)

A manager to register the rover with rovercode-web and periodically check in.

Parameters:
  • run – A flag for the state of the thread. Set to false to gracefully stop the thread.
  • thread – The Thread object that performs the periodic check-in.
  • web_id – The rovercode-web id of this rover.
  • payload – The json-formatted information about the rover to send to rovercode-web.

Constructor for the HeartBeatManager.

register()

Regiser the rover with rovercode-web.

stopThread()

Gracefully stop the periodic check-in thread.

thread_func(run_once=False)

Thread function that periodically checks in with rovercode-web.

app.connect()

Connect to the rovercode-web websocket.

app.create_app()

Creator of rovercode flask app.

app.download_block_diagram(id)

API: /download/<id> [GET].

Starts a download of the block diagram specified by id

app.get_block_diagram(id)

API: /blockdiagrams/<id> [GET].

Replies with an XML formatted description of the block diagram specified by id

app.get_block_diagrams()

API: /blockdiagrams [GET].

Replies with a JSON formatted list of the block diagrams

app.get_local_ip()

Get the local area network IP address of the rover.

app.init_rover_service()

Initialize hardware pins and motor speeds.

app.run_command(decoded)

Run the command specified by decoded.

Parameters:decoded – The command to run
app.save_block_diagram()

API: /blockdiagrams [POST].

Saves the posted block diagram

app.send_command()

API: /sendcommand [POST].

Executes the posted command

Available Commands:::
START_MOTOR STOP_MOTOR
app.sensors_thread()

Scan each binary sensor and sends events based on changes.

app.singleton(class_)

Helper class for creating a singleton.

app.test_message(message)

Send a debug test message when status is received from rovercode-web.

app.upload_block_diagram()

API: /upload [POST].

Adds the posted block diagram