mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-23 05:52:53 +00:00
Redesign (simplify) top-level avclan interface to use expected/nullable unique_ptr
- Peripheral::read/send now return `expected<unique_ptr<Frame>, Error>` for a unified success/error interface. - Peripheral::route returns `expected<unique_ptr<Frame>, Error>` to distinguish intent: (intentional) non-response vs unable to respond - Other functions with optional message semantics (handle,poll,react) return a unique_ptr whose ownership-state indicates response intent (i.e. send new message) Bundled necessary changes: - Switch Frame allocation from global to local (enabled via member function new/delete) - Add new header-library tl::expected to shim avr-libstdcpp Unrelated: Defensive `continue` added after `route`, to reduce Bus activity check latency Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
|
||||
#include "avclan.h"
|
||||
#include "device.hpp"
|
||||
@@ -61,11 +62,11 @@ public:
|
||||
void init();
|
||||
|
||||
void handle(const Frame *in, Frame *out);
|
||||
void react(Frame *out, detail::Error::Send err);
|
||||
std::unique_ptr<Frame>
|
||||
react(expected<std::unique_ptr<Frame>, detail::SendError> exp);
|
||||
void enable(Frame *out);
|
||||
void disable(Frame *out);
|
||||
static bool pending();
|
||||
static void resolvepending();
|
||||
void emit(Frame *out);
|
||||
void incrementTime();
|
||||
bool isPlaying() const;
|
||||
|
||||
Reference in New Issue
Block a user