Method ConnectAsync
Namespace: Belay.Core
Assembly: Belay.Core.dll
ConnectAsync(CancellationToken)
Connect to the MicroPython device and perform capability detection.
csharp
public Task ConnectAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationToken
Cancellation token.
Returns
A task representing the asynchronous operation.
Examples
using var device = Device.FromConnectionString("subprocess:micropython");
await device.ConnectAsync();
// Capabilities are now available
Console.WriteLine($"Platform: {device.State.Capabilities?.Platform}");
Console.WriteLine($"Memory: {device.State.Capabilities?.AvailableMemory} bytes");
Remarks
This method connects to the device and immediately performs capability detection using the optimized batched approach, completing in <100ms compared to the previous ~2000ms sequential detection.