Timers Driver

Modified on 2010/12/15 12:06 by Administrator — Categorized as: Driver

Allows countdown timers to be created from scripts for a specified # of milliseconds.

This driver is really only for special uses since the Sleep() function and DateTime Driver should take care of most timing needs.



Manufacturer: N/A


Configuration Settings

Events

Ready State Changed

The device's running and ready state changed.

Whenever Filter:

none

EventArgs:


Elapsed

Occurs at a specific date and time.

Whenever Filter:


EventArgs:

none

Instance Properties

DeviceDisplayName

The display name for this device.

Accessibility : Read Only

Type: String

DeviceStartTime

The date and time when this device was started.

Accessibility : Read Only

Type: DateTime

DeviceLifecycleStage

The current lifecycle stage of the device. The stages in order are: Pending Start, Starting, Running, Stopping

Accessibility : Read Only

Type: Number

DeviceIsRunningAndReady

Indicates if the device is ready for use, ie it is in the Running lifecycle stage and all properties are valid and all methods are ready to be used.

Accessibility : Read Only

Type: Boolean

Instance Methods

StartTimer ( String, TimeSpan )

Starts a new timer (or resets an existing timer) by the specified name for the specified amount of time.

Syntax

void StartTimer( String name, unknown duration )

Parameters

name : The name of the timer to start.
duration : The amount of time to set the timer to countdown from.

Example:

mytimers.StartTimer( "LightsOffDelay", 10000 );

StopTimer ( String )

Stops the timer with the specified name.

Syntax

void StopTimer( String name )

Parameters

name : The name of the timer to stop.

Example:

mytimers.StopTimer( "LightsOffDelay" );

IsTimerRunning ( String )

Indicates if the specified timer is currently counting down.

Syntax

Boolean IsTimerRunning( String name )

Parameters

name : The name of the timer.

Example:

isRunning = mytimers.IsTimerRunning( "LightsOffDelay");

SetPropertyForDuration ( String, TimeSpan, Object, Object )

Sets a property for a duration of time and then sets the property to a subequent value asynchronously. This action returns after setting the first value and the timer and subsequent property set run in the background. Subsequent sets of the same property will reset the timer if the subsequent value has not yet been set. This is an advanced feature, be sure to set the property name correctly.

Syntax

void SetPropertyForDuration( String propertyName, unknown duration, Object initialValue, Object finalValue )

Parameters

propertyName : The name of the property to set.
duration : The amount of time to wait after setting the initial value to set the subsequent value.
initialValue : The value to set the property to initially.
finalValue : The value to set the property to after the duration of time has passed.

SetPropertyForDuration ( String, Number, TimeSpan, Object, Object )

Sets a property for a duration of time and then sets the property to a subequent value asynchronously. This action returns after setting the first value and the timer and subsequent property set run in the background. Subsequent sets of the same property will reset the timer if the subsequent value has not yet been set. This is an advanced feature, be sure to set the property name correctly.

Syntax

void SetPropertyForDuration( String propertyName, Number arrayIndex, unknown duration, Object initialValue, Object finalValue )

Parameters

propertyName : The name of the property to set.
arrayIndex : The property's array index to set.
duration : The amount of time to wait after setting the initial value to set the subsequent value.
initialValue : The value to set the property to initially.
finalValue : The value to set the property to after the duration of time has passed.