Software Overview  |  Sitemap  |  Downloads  |  Developers  |  Forums
Small_clear_logo_llc

Controlling the System from the Console

The Console provides full control over a running system. All the operations available on all the other screens in the system are available on the console. In addition, the Console provides capabilities which are not available on any other screen.

The Console is a text interface which gives it its strengths and also its weakness. The strength of a text based interface is the flexibility it provides. The weakness is that one has to type everything in by hand. Some commands are pretty easy to type. Others can easily be executed by editing and resubmitting commands that have already been executed on the Console. Still, there are many remaining commands.

The Scripts and Wires pages are generally much quicker and easier to use when it comes to running Scripts and adding and deleting Wires from the system.

The methods Command

The methods command is a generally useful command. The methods command asks devices, any device, what commands it knows. As we saw in the Console Learning section, one can ask the system (device) what commands it knows:

methods
["add_device", "devices", "get_script", "get_scripts", "info", "load_scripts", "methods", "peek", "poke", "put_script", "restart", "run_script", "unwire", "update", "wire", "wires"]

We saw in the Learning section what the devices, info, peek, and wires, commands did. We covered the restart, run_script, unwire, wire commands in the Console History section.

We'll cover the remaining commands here.

The poke Command

The poke command is the counterpart to the peek command. The peek command shows terminal values. The poke command sets terminal values.

poke "inverter1:1", "off"
["1"]

The command above sets "inverter1" terminal "1" to off. It returns a non-error value. Had we tried to poke a non-existent terminal:

poke "inverter1:nonexistent", "off"
[null,"Error running user script, , line 1: #Error: method \"poke\" failed.  Error, unknown terminal or connector\n"]

We get a familiar looking error message.

The poke command can poke more than terminals. Like the peek command, we can poke a device. When we peeked a device, we saw all its terminals. When we poke a device, we have to say how we want to poke it.

poke "inverter1", "methods"
[true,["set", "load_module", "run_script", "add_terminals", "device_terminals", "add_script", "behave_as", "define_inputs", "define_outputs", "define_true", "define_false"]]

We poked the Inverter for its methods, and we got a list of all the methods that "inverter1" understands. These methods are also all the ways we can poke "inverter1".

poke "inverter1", "device_terminals"
["1","1S"]

Many of the Device Scripts use these Device methods. When you are working with a Device and want to fine tune its behavior, you can look at the Device's Script for hints on how its Device methods operate. Then you can execute them from the Console.

The add_device Command

The add_device command adds a device of a particular Device Type. We saw examples of Device Types when we ran the devices command. As an example, if one wanted to add an Arduino to the system, one could run the Arduino Script, or one could type from the Console:

add_device(type_file:"arduino_systems", port_locations:"/dev/ttyACM0", analog_sample_period_ms:100, id:"Arduino")

There are many examples of the add_device command in the Device Scripts. Go to the Scripts page, use the device "View Filter", and click on the "Show" action for any of the Scripts to see how add_device is used.

The get_script and get_scripts Commands

These two commands retrieve Scripts from the system. They are used to generate the Scripts page view and by the system when it runs Scripts. They are not of great use from the Console command line.

The load_scripts and put_script Commands

The load_scripts command is used by the system to load Scripts from the web. The put_script command updates the contents of a Script in the system cache, and it updates the source location of the Script. They are not of real use from the Console.

The update Command

The update command updates the system software. It only works in systems which are configured to receive updates.

Catalina Computing, LLC.

Copyright © Catalina Computing, LLC. (2013-2017)




Page last updated: Tue Feb 10 17:25:51 2015 (UTC)