Skip to content

Class SimpleDevice

Namespace: Belay.Core.Examples
Assembly: Belay.Core.dll

Simple example device demonstrating [Task] attribute method interception. This shows how users can inherit from Device and use attributes for method execution.

csharp
public class SimpleDevice : Device, IDisposable

Inheritance

objectDeviceSimpleDevice

Implements

IDisposable

Inherited Members

Device.OutputReceived, Device.StateChanged, Device.ConnectionState, Device.State, Device.Executor, Device.ConnectAsync(CancellationToken), Device.DisconnectAsync(CancellationToken), Device.ExecuteAsync(string, CancellationToken), Device.ExecuteAsync<T>(string, CancellationToken), Device.PutFileAsync(string, string, CancellationToken), Device.GetFileAsync(string, CancellationToken), Device.FromConnectionString(string, ILoggerFactory?), Device.DiscoverDevicesAsync(CancellationToken), Device.DiscoverFirstAsync(ILoggerFactory?, CancellationToken), Device.ExecuteMethodAsync<T>(MethodInfo, object?, object?[]?, CancellationToken), Device.ExecuteMethodAsync(MethodInfo, object?, object?[]?, CancellationToken), Device.Dispose(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods

DeviceExtensions.FileSystem(Device), DeviceExtensions.GetFileSystem(Device, ILogger<DeviceFileSystem>?)

Constructors

SimpleDevice(DeviceConnection, ILogger<Device>?)

Initializes a new instance of the class.

Methods

CleanupAsync()

Teardown method that cleans up the device. Demonstrates [Teardown] attribute for cleanup code.

GetGreetingAsync()

Simple task method that returns a greeting from the device. This demonstrates basic [Task] attribute usage with method interception.

InitializeAsync()

Setup method that initializes the device. Demonstrates [Setup] attribute for initialization code.

ReadTemperatureAsync()

Task method that reads the device temperature. Demonstrates [Task] with more complex Python code execution.

Released under the Apache License 2.0.