Skip to main content
.NETFramework4.8.NETFramework4.8.1net8.0net9.0net10.0.NETStandard2.0

This package contains the client library to talk to devices on a RS-485 EssyBus network.

Published
Dec 6, 2025
10mo ago
Total Downloads
7.4K
7,419

Install

dotnet add package Essy.EssyBus --version 2.2.0
ProductVersions
.NET
net10.0net8.0net9.0
.NET Standard
netstandard2.0netstandard2.1
Other
.NETFramework4.8.NETFramework4.8.1

README

EssyBus .NET Library

EssyBus is a lightweight and robust communication library for interacting with devices over the EssyBus protocol.
It provides a clean abstraction between the underlying physical transport (UART, RS-485, USB, etc.) and your high-level device logic.

This package includes:

  • EssyBus — Manages communication, framing, retries, and device orchestration.
  • EssyBusClient — Base class for building device-specific drivers.
  • IPhysicalLayer — Interface you implement to link EssyBus to your hardware or simulation layer.
  • A structured exception hierarchy.

✨ Features

🔌 Pluggable Physical Layer

Implement IPhysicalLayer to make EssyBus work with:

  • Serial ports
  • USB bridges
  • RS-485 interfaces
  • Hardware simulators
  • Unit-test stubs

🧱 High-Level Client Framework

Derive your device classes from EssyBusClient to automatically get:

  • Typed request/response handling
  • EncodeFunction / EncodeMethod helpers
  • Async and sync APIs
  • Built-in Ping & FirmwareVersion access
  • Automatic casting to numeric, float, string types

🔁 Robust Error Handling

EssyBus includes:

  • Automatic retry logic
  • Bus reset on communication failures
  • Checksum verification
  • Timeout/error propagation
  • Fatal-error protection

⚡ Interrupt Handling Support

Devices can signal interrupts using the physical layer interrupt line.
Implement:

  • IEssyBusClientInterrupt
  • IEssyBusClientResetable

EssyBus will automatically dispatch interrupts when detected.

🔧 Automatic Device Reset

If enabled, devices implementing IEssyBusClientResetable are automatically reset when added.


📦 Installation

dotnet add package EssyBus

🚀 Getting Started

1. Implement the Physical Layer

public class SerialPhysicalLayer : IPhysicalLayer
{
    // Implement WriteBytes, ReadBytes, interrupts, etc.
}

2. Create and Configure EssyBus

var bus = new EssyBus(new SerialPhysicalLayer());

3. Build Your Device Client

public class MyDevice : EssyBusClient
{
    public MyDevice(byte address) : base(address, "My Device") {}

    public int GetTemperature()
    {
        EncodeFunction(10, out int temp);
        return temp;
    }
}

4. Add Client and Communicate

var device = new MyDevice(1);
bus.AddClient(device);

Console.WriteLine(device.GetTemperature());

🧩 Architecture Overview

EssyBus

Handles communication, framing, retries, checksum, STX/ETX formatting, interrupt dispatch, and optional async operations.

EssyBusClient

Provides strongly typed access to device methods:

  • EncodeFunction(...)
  • EncodeMethod(...)
  • Async equivalents
  • Auto firmware retrieval
  • Ping(), RebootDevice(), DisconnectedFromBus()

Exception Types

  • EssyBusException
  • PhysicalLayerException
  • EssyBusClientException
  • FatalEssyBusException

IPhysicalLayer

Your implementation provides:

  • WriteBytes
  • ReadBytes / ReadBytesAsync
  • ResetInterface
  • Interrupt events
  • EEPROM read/write support

📘 Example: Read Firmware Version

var version = device.FirmwareVersion;
Console.WriteLine(version);

Firmware is fetched using method token 254.


🛠 Protocol Details

EssyBus uses a framed HEX-encoded protocol:

STX | Address | Leader | Length | HEX(Data...) | Checksum | ETX
  • Each byte is encoded as two HEX nibbles
  • Max payload: 250 bytes
  • Transmission ends with EOT

📄 License

MIT License


🧯 Logging / Debugging

var loggerFactory = LoggerFactory.Create(b => b.AddConsole());
var bus = new EssyBus(myPhysicalLayer, loggerFactory);

Changes from Previous Version

No structural changes between v2.1.2 and v2.2.0.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

Compatibility metadata lists 7 target frameworks; confirm the exact target used by your application.The published metadata declares 14 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.