Class DeviceState
Namespace: Belay.Core
Assembly: Belay.Core.dll
Simple state tracking for MicroPython device operations. Replaces complex session management with lightweight state tracking aligned with single-threaded MicroPython device constraints.
public sealed class DeviceState
Inheritance
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Examples
Basic Usage
using var device = Device.FromConnectionString("subprocess:micropython");
await device.ConnectAsync();
// Check device state
Console.WriteLine($"Platform: {device.State.Capabilities?.Platform}");
Console.WriteLine($"Features: {device.State.Capabilities?.SupportedFeatures}");
Console.WriteLine($"Connection: {device.State.ConnectionState}");
Remarks
This class provides minimal state tracking for MicroPython devices without the complexity of session management. It tracks basic device capabilities, current operations for debugging, and timing information for monitoring.
Unlike the previous session management system, this approach:
- Eliminates race conditions from concurrent session creation
- Reduces memory overhead from session tracking
- Provides direct device operations without session indirection
- Aligns with single-threaded MicroPython device reality
Properties
Gets or sets the detected device capabilities.
Gets the current connection state of the device.
Gets the name of the current operation being executed.
Gets the timestamp of the last completed operation.
Methods
Clears all execution history and operation tracking.
Marks an operation as completed and updates timing information.
Sets the current operation and updates internal tracking.
Gets a summary of the current device state.