Class DeviceConnection
Namespace: Belay.Core
Assembly: Belay.Core.dll
Unified device connection that handles both serial and subprocess communication. Uses sophisticated adaptive Raw REPL protocol with graceful degradation to basic mode. Implements simplified architecture principles while maintaining advanced protocol capabilities.
public sealed class DeviceConnection : IDisposableInheritance
Implements
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
DeviceConnection(ConnectionType, string, ILogger<DeviceConnection>)
Initializes a new instance of the class.
Fields
Properties
Methods
ConnectAsync(CancellationToken)
Connects to the device.
DisconnectAsync(CancellationToken)
Disconnects from the device.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
ExecuteAsync(string, CancellationToken)
Executes Python code on the device using sophisticated adaptive Raw REPL protocol. Includes comprehensive input validation and security checks to prevent code injection.
ExecuteAsync<T>(string, CancellationToken)
Executes code and returns typed result (simplified generic version).
GetFileAsync(string, CancellationToken)
Reads a file from the device using adaptive chunked transfer. Automatically optimizes chunk size based on device communication performance. Based on official mpremote fs_readfile implementation with base64 encoding.
PutFileAsync(string, string, CancellationToken)
Writes a file to the device using efficient adaptive chunked transfer. Automatically optimizes chunk size based on device communication performance. Based on official mpremote fs_writefile implementation with base64 encoding.
WriteFileAsync(string, byte[], CancellationToken)
Writes data to a file on the device using adaptive chunked transfer. Automatically optimizes chunk size based on device communication performance. Based on official mpremote fs_writefile implementation with base64 encoding.