Sets a switch controller device to the specified state If the device cannot be set then throws a MethodNotImplementedException.

Namespace: ASCOM.DriverAccess
Assembly: ASCOM.DriverAccess (in ASCOM.DriverAccess.dll) Version: 6.0.0.0 (6.1.1.2619)

Syntax

C#
public void SetSwitch(
	short id,
	bool state
)
Visual Basic
Public Sub SetSwitch ( _
	id As Short, _
	state As Boolean _
)
Visual C++
public:
virtual void SetSwitch(
	short id, 
	bool state
) sealed

Parameters

id
Type: System..::..Int16
The number of the device to set
state
Type: System..::..Boolean
The required device state

Implements

ISwitchV2..::..SetSwitch(Int16, Boolean)

Remarks

The GetSwitchValue(Int16) will be set to MaxSwitchValue(Int16) if state is true and to MinSwitchValue(Int16) if the state is False.

Exceptions

ExceptionCondition
ASCOM..::..InvalidValueExceptionIf id is outside the range 0 to MaxSwitch - 1
ASCOM..::..MethodNotImplementedExceptionIf the device cannot be written to (CanWrite(Int16) is false).

See Also