Return the state of switch device id as a boolean.

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

Syntax

C#
public bool GetSwitch(
	short id
)
Visual Basic
Public Function GetSwitch ( _
	id As Short _
) As Boolean
Visual C++
public:
virtual bool GetSwitch(
	short id
) sealed

Parameters

id
Type: System..::..Int16
The switch number to return

Return Value

True or false

Implements

ISwitchV2..::..GetSwitch(Int16)

Remarks

Must be implemented, must not throw an ASCOM.MethodNotImplementedException

All devices must implement this. A multi-state device will return true if the device is at the maximum value, false if the value is at the minumum and either true or false as specified by the driver developer for intermediate values.

Exceptions

ExceptionCondition
ASCOM..::..InvalidValueExceptionIf id is outside the range 0 to MaxSwitch - 1
ASCOM..::..InvalidOperationExceptionIf the state cannot be read. This is not recommended but it is not always possible to read the state from some hardware. Once the state has been set the last state set should be returned.

See Also