using SickBlazorApp.Models;

namespace SickBlazorApp.Services;

public interface ICanBusService : IDisposable
{
    event EventHandler<PositionPdo>? PositionReceived;

    event EventHandler<CanNodeState>? NodeStateChanged;
    
    event EventHandler<CanFrame>? FrameReceived;

    event EventHandler<byte>? NodeIdChanged;

    Task InitAsync();
    void Start();
    void Stop();
    void SendNmtStart(byte nodeId);
    void SendNmtReset(byte nodeId);
    void SendNmtStop(byte nodeId);
    void ChangeBitrate(int bitrate);
    Task ApplyBitrateAsync(byte nodeId, int bitrate);
    int CurrentBitrate { get; }
    Task ApplyNodeIdAsync(byte oldNodeId, byte newNodeId);
    byte CurrentNodeId { get; }

}
