package require DataSourceManager
set singleton [DataSourcemanagerSingleton %AUTO%]
set providers [DataSourceManager::enumerateProviders]
$singelton load provider-name
set params \ [$singleton parameters provider-name]
set caps \ [$singleton capabilities provider-name]
set caps \ [$singleton systemCapabilities]
$singleton addSource provider-name param-dict
set sourceid \ [$singleton removeSource id]
set status [$singleton check]
set source-descriptions [$singleton sources]
$singleton stop id
$singleton begin run-number title
The DataSourceManager is in charge of maintaining
knowledge of the data source providers and active data sources.
The DataSourceManager as used in the ReadoutGUI
Rather than directly instantiating a
your code should instantiate a
Doing so generates a
that wraps the one and only data source manager the ReadoutGUI
uses. The resulting object exports and delegates all
methods to the underlying singleton.
Returns a list of the names of the data source providers known at the time of the call. For more information on data source providers see Introduction and the interaces its related pages describe...
The set of providers is determined by the set of packages that can be located and loaded with names appropriate to that of a data source provider. No attempt is made to determine if these packages contain code that actually meets all the requirements of a data source provider.
The public methods provided by the data source manage are:
Loads a data source provider package. Note that:
provider-name is the
name of the provider not the name of the
provider's package (e.g
SSH not SSH_Provider).
For the load to be successful the provider's
package must be locatable via the normal Tcl
package require command.
For custom providers this may necessitate changes
Until a package is loaded nothing can be done with it.
You must use the
rather than directly doing a package require
as the data source manager maintains a list of registered packages.
Returns a dict that describes the parameterization
required by data sources that
for a description of this dict.
If you are not familiar with Tcl dicts see http://www.tcl.tk/man/tcl8.5/TclCmd/dict.htm for a description of dicts and the command ensemble that acts on them.
Returns a dict that describes the capabilities of
provider-name. The form of
this dict is described in
Returns the minimal set of capabilities the data sources have. This is the intersection of the capabilities of all providers that are represented by data sources that have been added to the manager.
Another way to look at this method is that it returns a dict of capabilities that all sources have. For example, if two data sources have been added to the manager, one of them capable of pausing a run and the other not, the resulting dict will show that the system cannot pause runs. The form of this dict is described in Introduction.
Adds a data source to the manager.
provider-name defines the name
of the data source provider that will manage the
params is a dict
that defines the actual parameterization of this
source. The keys in this dictionary are determined
by the result of
for the provider.
Note that the
source is not yet started. See
Note as well that this method allocates and
defines the source id for the data source. That
implies that if the
has a sourceid key its value
will be overwritten when the parameterization
is stored internally by the manager.
The result of this method is a unique source id which can be used to identify this source when calling methods that work on a single source.
Removes a source (the inverse of
from the manager. If the soure is running, it is
source-id is the source
id returned from the call to
that added the source to the manager.
It is an error to attempt to remove a nonexsitent source.
Checks the liveness of all data sources. This returns a dict whose keys are data source ids and whose values are the results of check on those data sources.
Returns information about all of the sources that have been added to the manager. The result is a list ofr dicts. Each dict contains the parameterization of the data source as well as keys for sourceid which has the source id as a value and provider which is the name of the provider that manages this source when it is running.
Stops the single source identified by
Stops all data sources.
Starts all data sources that have been added.
In addition to the data source manipulation methods described above, the manager also exports run control methods. It is better, however to force run state transitions to happen via the RunStateMachine. In that way other actions associated with run state transitions can occur.
For completeness, the run state control methods are described below. The operate by iterating over the running data sources and delegating the method to their provider.
Starts a run in all of the providers. The
title parameters are
passed without interpretation to the provider's
begin command for each data source.
Iterates over all data sources calling end for them in their data source provider.
Iterates over all data sources pausing them in
the middle of an active run. Before invoking
this method, the caller must ensure all data sources
implement the pause operation by
to get the intersection of all data source capabilites.
Iterates over all data sources resuming the paused run.
Calls the init proc for the provider whose index is id.
Iterates through all of the data sources and calls their respective init procs.