Click or drag to resize

SwitchSetSwitch Method

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: 3351c4f3fa64146a7efd5b51ed4591e32a0a5484
Syntax
public void SetSwitch(
	short id,
	bool state
)

Parameters

id
Type: SystemInt16
The number of the device to set
state
Type: SystemBoolean
The required device state

Implements

ISwitchV2SetSwitch(Int16, Boolean)
Exceptions
ExceptionCondition
InvalidValueExceptionIf id is outside the range 0 to MaxSwitch - 1
MethodNotImplementedExceptionIf the device cannot be written to (CanWrite(Int16) is false).
NotConnectedExceptionIf the device is not connected
DriverExceptionAn error occurred that is not described by one of the more specific ASCOM exceptions. The device did not successfully complete the request.
Remarks

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

See Also