SRR Controller–Base – step 0032 – March 2010
SrrControl controls the SRR Framework in an SrrTrains model railroad layout.
SrrControl is instantiated and initialized exactly once in each scene instance by the frame, e.g. in the main file.
SrrControl contains client software and server software, where the server software runs in only one of the scene instances. The client software runs in all scene instances.
SrrControl uses a network sensor (streamName/networkSensorId= “SrrControl”).
SrrControl provides the user interface for the frame to perform the overall control of the simulation (interface uiControl, described in this document).
SrrControl is an external prototype, available at the directory srr/.
<ProtoInterface>
<field accessType='inputOutput' name='objType' type='SFString' value='SrrControl'/>
<field accessType='inputOutput' name='version' type='SFFloat' value='0.0032'/>
<field accessType='inputOutput' name='multiuserRequest' type='SFBool' value='false'/>
<field accessType='outputOnly' name='multiuser' type='SFBool' value='false'/>
<field accessType='inputOutput' name='useConnection' type='SFString'/>
<field accessType='inputOutput' name='connection' type='SFNode'/>
<field accessType='inputOnly' name='sessionId' type='SFInt32' value='-1'/>
<field accessType='inputOnly' name='init' type='SFBool'/>
<field accessType='outputOnly' name='commParam' type='SFNode'/>
<field accessType='inputOnly' name='sessionIdLeft' type='SFInt32'/>
<field accessType='inputOutput' name='controllerRequest' type='SFBool' value='false'/>
<field accessType='outputOnly' name='controller' type='SFBool' value='false'/>
<field accessType='inputOutput' name='activatedModulesRequest' type='MFString'/>
<field accessType='inputOutput' name='mocRequest' type='MFString'/>
<field accessType='outputOnly' name='activatedModules' type='MFString'/>
<field accessType='outputOnly' name='mocRoles' type='MFString'/>
<field accessType='inputOnly' name='activatedModulesIxsRequest' type='MFInt32'/>
<field accessType='inputOnly' name='mocIxsRequest' type='MFInt32'/>
<field accessType='outputOnly' name='activatedModulesBoolArr' type='MFInt32'/>
<field accessType='outputOnly' name='registeredModules' type='MFString'/>
<field accessType='inputOutput' name='selectedRolesRequest' type='SFString'/>
<field accessType='outputOnly' name='selectedRoles' type='SFString'/>
<field accessType='inputOnly' name='traceLevelRequest' type='SFInt32'/>
<field accessType='inputOnly' name='traceLevelSrrControlRequest' type='MFInt32'/>
<field accessType='inputOnly' name='traceLevelCommControlRequest' type='MFInt32'/>
<field accessType='inputOnly' name='traceLevelTrainControlRequest' type='MFInt32'/>
<field accessType='inputOnly' name='traceLevelModulesRequest' type='SFString'/>
<field accessType='inputOnly' name='traceLevelObjectsRequest' type='SFString'/>
<field accessType='inputOutput' name='traceLevel' type='SFInt32' value='1'/>
<field accessType='inputOutput' name='traceLevelSrrControl' type='MFInt32' value='1,1'/>
<field accessType='inputOutput' name='traceLevelCommControl' type='MFInt32' value='1,1'/>
<field accessType='inputOutput' name='traceLevelTrainControl' type='MFInt32' value='1'/>
<field accessType='inputOutput' name='traceLevelModules' type='SFString' value='*=1,1'/>
<field accessType='inputOutput' name='traceLevelObjects' type='SFString' value='*=1,1'/>
<field accessType='outputOnly' name='carriedKeys' type='MFString'/>
<field accessType='inputOnly' name='keysToPut' type='MFString'/>
<field accessType='inputOnly' name='consoleCommand' type='SFString'/>
<field accessType='outputOnly' name='consoleResponse' type='MFString'/>
<field accessType='inputOutput' name='srrControlModules' type='MFNode'/>
</ProtoInterface>
The fields of the user interface can be arranged according to the following categories:
x) Initialization, Session Handling
Before you can use the SRR Framework, you have to initialize it. During initialization, initial values of parameters will be set, initial states will be synchronized among scene instances, network sensors will be created and so on.
To start initialization, send an SFBool event of value true to the init field
The SRR Controller will answer with a reference to the Common Parameters, i.e. commParam. The SRR Controller will even answer, if a failure has happened.
The frame has to forward the commParam event to all modules (and hence to their module coordinators) to start their initialization. This is essential to be able to use the SRR Framework.
Furthermore the frame can use the commParam to initialize its own instances of the SrrTracer prototype and of SrrMasterAvatarContainer and SrrAvatarContainer SRR objects.
For initialization in single-user-mode, that's it. For initialization in multi-user-mode, you have to consider the following additional rules:
set multiuserRequest to true before initialization
set sessionId to a unique integer, that identifies the scene instance, before initialization
always inform the SRR Controller with sessionIdLeft, when a remote sessionId has left the game
when using the BS Contact (Blaxxun), set useConnection to the DEF# name of the <NetConnection> node, that has to be used for the network sensors.
When using the Octaga Player, set connection to a reference to the <Connection> node, that has to be used for the network sensors.
If commParam.initialized is true, this indicates, that the initialization of the SRR Controller was successful and then multiuser indicates, whether multi-user-mode is active or not (if the SRR Controller – Base Module cannot initialize its network sensor, it will fall back to single-user-mode, but finish initialization successfully).
x) Tracer
traceLevelRequest / traceLevel
This pair of fields sets/indicates the “classic” trace level.
The SRR Controller contains a “classic” (old) tracer that is reachable via the commParam. The classic tracer is controlled by one global trace level, that can take one of the following values.
traceLevel = 0: tracing OFF (only non-switchable trace points are output to the console)
traceLevel = 1: error tracing (only trace points with level <= 1 are output)
traceLevel = 2: info tracing (only trace points with level <= 2 are output)
traceLevel = 3: debug tracing (all trace points are output)
traceLevelSrrControlRequest, traceLevelSrrControl
This pair of MFInt32 values sets/indicates the trace levels for the SrrControl tracer instance.
traceLevelSrrControl[0] indicates the trace level after the initialization of the SRR Controller, traceLevelSrrControl[1] indicates the trace level during the initialization of the SRR Controller.
traceLevelCommControlRequest, traceLevelCommControl
This pair of MFInt32 values sets/indicates the trace levels for the CommControl tracer instance.
traceLevelCommControl[0] indicates the trace level after the initialization of the SRR Controller, traceLevelSrrControl[1] indicates the trace level during the initialization of the SRR Controller.
traceLevelTrainControlRequest, traceLevelTrainControl
This pair of MFInt32 values sets/indicates the trace level for the TrainControl tracer instance.
traceLevelTrainControl[0] indicates the trace level during and after the initialization (overall trace level).
traceLevelModulesRequest, traceLevelModules
This pair of SFString values sets/indicates the trace levels of the modules (see the description of SrrTracer for an explanation).
traceLevelObjectsRequest, traceLevelObjects
This pair of SFString values sets/indicates the trace levels of the SRR objects and all models that use the SrrTracer prototype (see the description of SrrTracer for an explanation).
x) Communication State (Central Controller, Roles, Module Activation)
controllerRequest, controller:
During normal play with the layout, it's not relevant for the user, whether his scene instance hosts the central controller. However, in case of tracing/debugging the SRR framework and in case of performance optimizations, it's possible for the frame of a scene instance to request the controller role with controllerRequest=true, controller will always indicate, whether the scene instance has got the controller role or not.
activatedModulesRequest, activatedModules, mocRequest, mocRoles, activatedModulesIxsRequest, mocIxsRequest, activatedModulesBoolArr:
Each module can request the own activation or deactivation from the module controller (see SrrModCoord.x3d).
In addition, it's possible for the frame to request a set of activated modules for its scene instance. Set activatedModulesRequest or activatedModulesIxsRequest, if you want to set the list of active modules for your scene instance. All registered modules not in the list will be deactivated. The activatedModulesIxsRequest has to contain the modules' indexes relative to the registeredModules array. The result will be reported in activatedModules.
The central controller will assign so-called MOC roles for each module. Each module, which is active in at least one scene instance, will have one dedicated scene instance, which has the MOC role for this module. The own MOC roles (module names) are reported in mocRoles.
In addition, it's possible for the frame to request a set of MOC roles for its scene instance. Set mocRequest or mocIxsRequest, if you want to set the list of MOC roles for your scene instance. All registered modules not in the list will loose their MOC roles (the central controller will assign another scene instance the MOC role; in some cases it will assign the MOC role to the same instance again, so it will NOT loose the MOC role). The mocIxsRequest has to contain the modules' indexes relative to the registeredModules array. The result will be reported in mocRoles.
selectedRolesRequest, selectedRoles:
The frame can request a set of roles that have to be assumed by this scene instance. The central controller will assign the roles and they will be reported back to the frame.
x) Module Management (Announcement/Initialization, Module Registration)
registeredModules:
This field reports the list of all registered modules (module names). This list is identical in all scene instances.
x) Console Interface
The SRR Controller provides the so-called console interface. The frame can send a command line to the consoleCommand field. The command will be forwarded to the addressed SRR objects and their addressed parameters will be set/read. The result will be output as a set of character strings in the consoleResponse field.
x) Keys, Key Container and Locks
The SRR framework supports the concept of keys, key containers and locks. Keys can be contained in key containers and locks.
Avatars can take keys from key containers and locks (move the keys to the carriedKeys field, as requested by the key container/lock) or put keys into the bound key container/lock (as requested by the frame with the keysToPut field).
x) Avatars and Moving Objects
No fields at uiControl regarding this category.
x) Modularity of the SRR Framework
The SRR Controller – Base Module can be extended with extension modules (see e.g. SrrControlTm).
The frame has to set references to all those modules in the MFNode field srrControlModules.
SrrControl will organize the initialization of those extension modules, hence the references have to be set before initialization of the SRR Controller.