statemanager

Name

statemanager -- Tcl interface to state manager

Synopsis

package require statemanager

::statemanager::statemonitor start requestURI publishURI

::statemanager::statemonitor register state scriptHead

::statemanager::statemonitor unregister state

::statemanager::statemonitor transition transition-name

DESCRIPTION

The statemanager package provides an API for the State manager server to Tcl scripts. The API is provided as a command ensemble with the command head ::statemanager::statemonitor.

SUBCOMMANDS

::statemanager::statemonitor start requestURI publishURI

Starts the state monitor thread. In order to interface with the Tcl event loop, the state monitor runs a thread that accepts messages from the state manager and turns them into events in the interpreter's thread.

requestURI is the URI of the endpoint on which the state manager is listening for state change requests while the publishURI is the URI for the endpointo n which the state manager publishes state and state transitions.

The form of a URI is tcp://hostname:port The port for each of the URI's can be determined using the port manager API to look up the services StateRequest and StatePublish respectively.

::statemanager::statemonitor register state scriptHead

Registers interest in a state mnager state. When the state is entered, or when the initial state is discovered to be state scriptHead has the prior and current state appended to it and is executed. If the prior state is not known, and empty string is passed for it instead.

::statemanager::statemonitor unregister state

Unregisters interest in state. Any callback registered for that state will no longer be invoked when that state is reached.

::statemanager::statemonitor transition transition-name

Requests the transition-name state transition. For legal transition names see Experiment (State manager) State Diagram. The transition names are on the arcs between the bubbles (which are the states).

This command returns the text of the state manager's reply. This can be OK or FAIL followed by a human readable error message.