Click or drag to resize

Switch Class

Defines the ISwitchV2 Interface
Inheritance Hierarchy
SystemObject
  ASCOM.DriverAccessAscomDriver
    ASCOM.DriverAccessSwitch

Namespace: ASCOM.DriverAccess
Assembly: ASCOM.DriverAccess (in ASCOM.DriverAccess.dll) Version: 7.0.0-rc.0+0
Syntax
public class Switch : AscomDriver, ISwitchV3

The Switch type exposes the following members.

Constructors
 NameDescription
Public methodSwitch Creates a Switch object with the given Prog ID
Top
Properties
 NameDescription
Public propertyConnected Set True to connect to the device hardware. Set False to disconnect from the device hardware. You can also read the property to check whether it is connected. This reports the current hardware state.
(Inherited from AscomDriver)
Public propertyConnecting Returns True while the device is undertaking an asynchronous connect or disconnect operation.
(Inherited from AscomDriver)
Public propertyDescription Returns a description of the device, such as manufacturer and model number. Any ASCII characters may be used.
(Inherited from AscomDriver)
Public propertyDeviceState Returns the device's operational state in a single call.
(Inherited from AscomDriver)
Public propertyDriverInfo Descriptive and version information about this ASCOM driver.
(Inherited from AscomDriver)
Public propertyDriverVersion A string containing only the major and minor version of the driver.
(Inherited from AscomDriver)
Public propertyHasConnectAndDeviceState Returns if the device has a Platform 7 or later interface that supports Connect / Disconnect and DeviceState
(Inherited from AscomDriver)
Public propertyInterfaceVersion The interface version number that this device supports.
(Inherited from AscomDriver)
Public propertyMaxSwitch The number of switch devices managed by this driver
Public propertyName The short name of the driver, for display purposes
(Inherited from AscomDriver)
Public propertySupportedActionsReturns the list of custom action names supported by this driver.
(Inherited from AscomDriver)
Top
Methods
 NameDescription
Public methodActionInvokes the specified device-specific custom action.
(Inherited from AscomDriver)
Public methodCanAsync Flag indicating whether this switch can operate asynchronously.
Public methodCancelAsync Cancels an in-progress asynchronous state change operation.
Public methodCanWrite Reports if the specified switch device can be written to, default true. This is false if the device cannot be written to, for example a limit switch or a sensor.
Public methodStatic memberChoose Brings up the ASCOM Chooser Dialogue to choose a Switch
Public methodCommandBlind Transmits an arbitrary string to the device and does not wait for a response. Optionally, protocol framing characters may be added to the string before transmission.
(Inherited from AscomDriver)
Public methodCommandBool Transmits an arbitrary string to the device and waits for a boolean response. Optionally, protocol framing characters may be added to the string before transmission.
(Inherited from AscomDriver)
Public methodCommandString Transmits an arbitrary string to the device and waits for a string response. Optionally, protocol framing characters may be added to the string before transmission.
(Inherited from AscomDriver)
Public methodConnect Connect to the device asynchronously
(Inherited from AscomDriver)
Public methodDisconnect Disconnect from the device asynchronously
(Inherited from AscomDriver)
Public methodDispose This method is a "clean-up" method that is primarily of use to drivers that are written in languages such as C# and VB.NET where resource clean-up is initially managed by the language's runtime garbage collection mechanic. Driver authors should take care to ensure that a client or runtime calling Dispose() does not adversely affect other connected clients. Applications should not call this method.
(Inherited from AscomDriver)
Public methodGetSwitch Return the state of switch device id as a boolean
Public methodGetSwitchDescription Gets the description of the specified switch device. This is to allow a fuller description of the device to be returned, for example for a tool tip.
Public methodGetSwitchName Return the name of switch device n.
Public methodGetSwitchValue Returns the value for switch device id as a double
Public methodMaxSwitchValue Returns the maximum value for this switch device, this must be greater than MinSwitchValue(Int16).
Public methodMinSwitchValue Returns the minimum value for this switch device, this must be less than MaxSwitchValue(Int16)
Public methodSetAsync Set a boolean switch's state asynchronously
Public methodSetAsyncValue Set a switch's value asynchronously
Public methodSetSwitch Sets a switch controller device to the specified state, true or false.
Public methodSetSwitchName Set a switch device name to a specified value.
Public methodSetSwitchValue Set the value for this device as a double.
Public methodSetupDialog Launches a configuration dialogue box for the driver. The call will not return until the user clicks OK or cancel manually.
(Inherited from AscomDriver)
Public methodStateChangeComplete Completion variable for asynchronous switch state change operations.
Public methodSwitchStep Returns the step size that this device supports (the difference between successive values of the device).
Top
Remarks

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 writeable 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.

Naming Conventions

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.

See Also