Method ConnectAsync
- Namespace
- Yeelight
- Assembly
- YeelightClient.dll
ConnectAsync(CancellationToken)
Makes sure that there is a connection to the device, and waits until there is. The client does this by itself for every device that it finds (see AutoConnect), and a command makes the connection when there is none.
public Task ConnectAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenTo stop waiting.
Returns
- Task
A task that ends when the connection is there.
Exceptions
- YeelightException
There was no connection within ConnectTimeout: the connection is still tried (and the exception has the kind NotConnected), or the device was forgotten by the client.
- OperationCanceledException
The wait was cancelled.