mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-11 08:22:52 +00:00
Finalize C <=> C++ interface
This commit is contained in:
@@ -25,9 +25,18 @@ public:
|
||||
|
||||
uint16_t address() const { return address_; };
|
||||
uint16_t controller() const { return controller_; };
|
||||
template <DeviceInterface Dev> Dev &device() {
|
||||
return std::get<Dev>(devices_);
|
||||
}
|
||||
|
||||
bool bus_is_active() const { return bus.is_active(); };
|
||||
void mute(bool mute) { bus.mute(mute); };
|
||||
bool is_muted() const { return bus.is_muted(); };
|
||||
|
||||
#ifndef NDEBUG
|
||||
Bus &get_bus() { return bus; }
|
||||
#endif
|
||||
|
||||
Error::Read read(Frame *in, Frame::Print print) {
|
||||
return bus.read(address_, in, print);
|
||||
};
|
||||
@@ -44,7 +53,7 @@ public:
|
||||
using enum Action;
|
||||
out->reaction = 0;
|
||||
|
||||
if (AVCLAN_ismuted() || in->length < 3)
|
||||
if (is_muted() || in->length < 3)
|
||||
return;
|
||||
|
||||
// 0xFF placeholders are variant bytes filled by writing directly to
|
||||
@@ -137,6 +146,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
#undef PACK3
|
||||
|
||||
void react(Frame *out, Error::Send err) {
|
||||
if (((Devs::id == out->owning_device) || ...))
|
||||
((Devs::id == out->owning_device
|
||||
@@ -147,8 +158,6 @@ public:
|
||||
out->reaction = 0;
|
||||
}
|
||||
|
||||
#undef PACK3
|
||||
|
||||
template <class F> void poll_devices(F &&fun) {
|
||||
(poller(std::get<Devs>(devices_), fun), ...);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user