Arrange code structure. Introduce dynamic scheduler and multi leader.

This commit is contained in:
Youmu Liu
2025-10-22 14:00:13 +08:00
parent 91a0add1d1
commit 3788db4cd0
6 changed files with 163 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
namespace EM.LowLevel
{
/// <summary>
/// Builds device/peripheral commands from C#-friendly types (enums, records, structs, etc.).
/// </summary>
public interface ICommandBuilder
{
/// <summary>
/// Build a command payload (already framed or raw depending on implementation contract) from a
/// strongly-typed command description.
/// </summary>
/// <typeparam name="TCommand">
/// Command type (e.g., an enum or a record/struct)
/// </typeparam>
/// <param name="command">
/// Command value to build
/// </param>
/// <returns>
/// Command bytes
/// </returns>
ReadOnlyMemory<byte> Build<TCommand>(TCommand command) where TCommand: notnull;
/// <summary>
/// Try-build variant to avoid throwing and allow buffer reuse strategies.
/// </summary>
bool TryBuild<TCommand>(TCommand command, out ReadOnlyMemory<byte> bytes) where TCommand: notnull;
}
}