Binary Switch – step 0031 – February 2010

1 Purpose of SrrSwitchA

It’s the purpose of SrrSwitchA to simulate a switch, whose scheduled state is synchronized among several scene instances. Each scene instance can animate the switch (“soft state”).

SrrSwitchA is an SRR-object that is instantiated and given a name unique within the module.

SrrSwitchA uses a network sensor with streamName/networkSensorId=”Srr-<moduleName>-<objId>” for the communication among scene instances.

2 User Interface of SrrSwitchA (uiObj)

SrrSwitchA is an external prototype that is available at the directory srr/

<ProtoDeclare name='SrrSwitchA'>

<ProtoInterface>

<field accessType='inputOutput' name='objType' type='SFString' value='SrrSwitchA'/>

<field accessType='inputOutput' name='version' type='SFFloat' value='0.0022'/>

<field accessType='inputOutput' name='quasiModule' type='SFString'/>

<field accessType='inputOutput' name='objId' type='SFString'/>

<field accessType='inputOutput' name='duration' type='SFFloat' value='1'/>

<field accessType='inputOutput' name='lock' type='SFNode'/>

<field accessType='inputOutput' name='modParam' type='SFNode'/>

<field accessType='inputOutput' name='enabled' type='SFBool' value='true'/>

<field accessType='outputOnly' name='initialized' type='SFNode'/>

<field accessType='inputOnly' name='toggle' type='SFBool'/>

<field accessType='inputOutput' name='actualState' type='SFBool' value='false'/>

<field accessType='outputOnly' name='isActive' type='SFBool'/>

<field accessType='outputOnly' name='softState' type='SFFloat'/>

</ProtoInterface>

objId, quasiModule

The user sets the objId and the quasiModule before initialization of the switch object. The objId is unique within the module. The quaiModule needs only be set in global (vehicle) models.

enabled

can be used to disable all active elements of the SRR objects, when the model is unloaded.

duration

is set by the user. It’s the duration of the switching process from one end to the other in seconds. This value is used as a basis for the animation (softState).

modParam

is needed for the initialization. This value was delivered by the module coordinator SrrModCoord after the registration and initialization of the module. The user routes this event from SrrModCoord to SrrSwitchA.

initialized

fires an SFNode event, after the switch has been initialized. This is needed by other SRR objects that contain a switch to coordinate the initialisation procedure.

toggle

Each scene instance can trigger the inversion of the scheduled state and its distribution to all scene instances. Independent whether the switch is active or not (whether an animation is ongoing or not), the scheduled value will be set and the direction and scheduled end time of the animation will be updated.

actualState

as soon as the animation has finished, this field will fire an event with the end state (true or false).

The user can set an initial value in this field.

isActive

fires true at the begin of the switching process and false at the end (when actualState is being set).

softState

is a floating point value within the interval from 0.0 to 1.0 and interpolates the switching process linearly. 0.0 denotes the state false, 1.0 denotes true. You can use this event as input to an interpolator node for the desired animation of the switch.

lock

The user can attach an SrrLock object to the SrrSwitchA. If a lock is attached, the switch may be locked due to the locked state of the lock (depending on carried keys and contained keys). The lock has to be created by the user, but it will be initialized by the SrrSwitchA and get the object ID <objId>.Lock.