Click or drag to resize

ISwitchV2GetSwitchValue Method

Returns the value for switch device id as a double

Namespace:  ASCOM.DeviceInterface
Assembly:  ASCOM.DeviceInterfaces (in ASCOM.DeviceInterfaces.dll) Version: 3351c4f3fa64146a7efd5b51ed4591e32a0a5484
Syntax
double GetSwitchValue(
	short id
)

Parameters

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

Return Value

Type: Double
The value for this switch, this is expected to be between MinSwitchValue(Int16) and MaxSwitchValue(Int16).
Exceptions
ExceptionCondition
InvalidOperationExceptionIf there is a temporary condition that prevents the device value being returned.
InvalidValueExceptionIf id is outside the range 0 to MaxSwitch - 1
NotConnectedExceptionIf the device is not connected
DriverExceptionAn error occurred that is not described by one of the more specific ASCOM exceptions. Include sufficient detail in the message text to enable the issue to be accurately diagnosed by someone other than yourself.
Remarks

Must be implemented, must not throw a MethodNotImplementedException.

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.

This is a Version 2 method.

See Also