Click or drag to resize

ISwitchV2GetSwitch Method

Return the state of switch device id as a boolean

Namespace:  ASCOM.DeviceInterface
Assembly:  ASCOM.DeviceInterfaces (in ASCOM.DeviceInterfaces.dll) Version: 3c9121baba46811fe6e53a58a05935662261416d
bool GetSwitch(
	short id


Type: SystemInt16
The device number (0 to MaxSwitch - 1)

Return Value

Type: Boolean
True or false
InvalidValueExceptionIf id is outside the range 0 to MaxSwitch - 1
InvalidOperationExceptionIf there is a temporary condition that prevents the device value being returned.

Must be implemented, must not throw a 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.

Some devices do not support reading their state although they do allow state to be set. In these cases, on startup, the driver can not know the hardware state and it is recommended that the driver either:

  • Sets the device to a known state on connection
  • Throws an InvalidOperationException until the client software has set the device state for the first time

In both cases the driver should save a local copy of the state which it last set and return this through GetSwitch(Int16) and GetSwitchValue(Int16)

Devices are numbered from 0 to MaxSwitch - 1

See Also