You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.8 KiB
39 lines
1.8 KiB
using Peak.Can.Basic; |
|
using IOModuleTestBlazor.Models; |
|
|
|
namespace IOModuleTestBlazor.Services; |
|
|
|
public interface ICanService |
|
{ |
|
bool IsConnected { get; } |
|
string ChannelName { get; } |
|
|
|
/// <summary> |
|
/// Raised on the worker thread each time a CAN message passes all filters. |
|
/// Subscribers must marshal UI updates with InvokeAsync(StateHasChanged). |
|
/// </summary> |
|
event Action<CanMessageDto> MessageReceived; |
|
|
|
// ── Filters ─────────────────────────────────────────────────────────────── |
|
IReadOnlyList<CanFilter> Filters { get; } |
|
CanFilter AddFilter(CanFilter filter); |
|
bool RemoveFilter(Guid id); |
|
void ClearFilters(); |
|
|
|
// ── Bitmasks ────────────────────────────────────────────────────────────── |
|
IReadOnlyList<CanBitmask> Bitmasks { get; } |
|
CanBitmask AddBitmask(CanBitmask bitmask); |
|
bool RemoveBitmask(Guid id); |
|
void ClearBitmasks(); |
|
|
|
// ── Helpers used by the worker ──────────────────────────────────────────── |
|
bool PassesFilter(uint messageId); |
|
IReadOnlyDictionary<string, double> ExtractSignals(uint messageId, byte[] data); |
|
void PublishMessage(CanMessageDto dto); |
|
|
|
// ── PCAN passthrough ────────────────────────────────────────────────────── |
|
void Initialize(PcanChannel channel, Bitrate bitrate); |
|
void Uninitialize(); |
|
PcanStatus Read(out PcanMessage msg, out ulong timestamp); |
|
PcanStatus Write(PcanMessage msg); |
|
}
|
|
|