ClientExtensionsSetAsync Method

Returns an awaitable, running, Task that sets the switch to a given boolean state

Definition

Namespace: ASCOM.Common
Assembly: ASCOM.Common (in ASCOM.Common.dll) Version: 3.0.0-rc.1+86c25ce733aebb4d8b1b8a62e84770ea5e972bea
C#
public static Task SetAsync(
	this ISwitchV3 device,
	short id,
	bool state,
	CancellationToken cancellationToken = default,
	int pollInterval = 1000,
	ILogger logger = null
)

Parameters

device  ISwitchV3
The Switch device
id  Int16
The switch ID number
state  Boolean
The desired boolean state
cancellationToken  CancellationToken  (Optional)
Cancellation token - Default: None
pollInterval  Int32  (Optional)
Interval between polls of the completion variable (milliseconds) - Default: 1000 milliseconds.
logger  ILogger  (Optional)
ILogger instance that will receive operation messages from the method - Default: No logger

Return Value

Task
Awaitable task that ends when the switch has changed to the designated state

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ISwitchV3. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Remarks

Initiator: SetAsync(Int16, Boolean)

Complete when: StateChangeComplete(Int16) is

Only available for ISwitchV3 and later devices.

Version Information

.NET Standard

Supported in: 2.0

See Also