Assembly: ASCOM.DriverAccess (in ASCOM.DriverAccess.dll) Version: 220.127.116.11 (18.104.22.16819)
The Switch interface is used to define a number of 'switch devices'. A switch device can be used to control something, such as a power switch or may be used to sense the state of something, such as a limit switch.
This SwitchV2 interface is an extension of the original Switch interface. The changes allow devices to have more than two states and to distinguish between devices that are writable and those that are read only.
Compatibility between Switch and SwitchV2 interfaces:
- Switch devices that implemented the original Switch interface and client applications that use the original interface will still work together.
- Client applications that implement the original Switch interface should still work with drivers that implement the new interface.
- Client applications that use the new features in this interface will not work with drivers that do not implement the new interface.
Each device has a CanWrite method, this is true if it can be written to or false if the device can only be read.
The new MinSwitchValue, MaxSwitchValue and SwitchStep methods are used to define the range and values that a device can handle. This also defines the number of different values - states - that a device can have, from two for a traditional on-off switch, through those with a small number of states to those which have many states.
The SetSwitchValue and GetSwitchValue methods are used to set and get the value of a device as a double.
There is no fundamental difference between devices with different numbers of states.
Each device handled by a Switch is known as a device or switch device for general cases, a controller device if it can alter the state of the device and a sensor device if it can only be read.
For convenience devices are referred to as Boolean if the device can only have two states, and multi-state if it can have more than two values. These are treated the same in the interface definition.