67 std::string_view resource,
68 std::string_view header_json,
69 const std::vector<uint8_t>& payload)>;
185 const std::vector<ProfileState>&
profiles()
const {
return profiles_; }
201 std::optional<std::string>
get_property(std::string_view resource)
const;
216 function_blocks_.push_back(block);
220 return function_blocks_;
225 for (
auto& fb : function_blocks_) {
226 if (fb.id ==
id)
return &fb;
262 const std::vector<uint8_t>& data);
270 uint8_t target)
const;
275 return discovered_details_;
289 std::size_t size)
const;
293 const std::vector<uint8_t>& data)
const {
301 const std::vector<uint8_t>& data)>
334 std::size_t
notify(std::string_view resource,
335 std::string_view header_json,
336 const std::vector<uint8_t>& payload);
340 std::vector<CiDeviceInfo> discovered_;
341 std::vector<ProfileState> profiles_;
342 std::vector<FunctionBlockInfo> function_blocks_;
345 std::vector<ProfileDetails> local_details_;
346 std::vector<ProfileDetails> discovered_details_;
347 std::map<std::string, std::string, std::less<>> properties_;
348 mutable std::unique_ptr<PeSubscriptionManager> sub_mgr_;
350 std::vector<uint8_t> handle_discovery(
const uint8_t* data,
size_t size);
351 std::vector<uint8_t> handle_profile_inquiry(
const uint8_t* data,
size_t size);
352 std::vector<uint8_t> handle_profile_added(
const uint8_t* data,
size_t size);
353 std::vector<uint8_t> handle_profile_removed(
const uint8_t* data,
size_t size);
354 std::vector<uint8_t> handle_profile_details_inquiry(
const uint8_t* data,
size_t size);
355 void handle_profile_details_reply(
const uint8_t* data,
size_t size);
356 void handle_profile_specific_data(
const uint8_t* data,
size_t size);
357 std::vector<uint8_t> handle_subscribe(
const uint8_t* data,
size_t size);
358 void handle_notify(
const uint8_t* data,
size_t size);
void add_profile(const ProfileState &profile)
NOT RT-safe — std::vector::push_back may reallocate.
Definition midi_ci.hpp:183
const std::vector< CiDeviceInfo > & discovered_devices() const
RT-safe.
Definition midi_ci.hpp:180
CiDiscovery()
RT-safe (constructs an MUID via std::mt19937; the random_device seed is one-shot at construction).
std::vector< uint8_t > create_discovery_inquiry() const
NOT RT-safe — allocates and returns a SysEx wire buffer.
std::vector< uint8_t > create_profile_specific_data(MUID destination, const ProfileId &id, const uint8_t *data, std::size_t size) const
NOT RT-safe — allocates the wire bytes.
std::function< void(const CiDeviceInfo &)> on_device_discovered
Callbacks.
Definition midi_ci.hpp:305
std::function< void(MUID source, const ProfileId &)> on_profile_removed
Definition midi_ci.hpp:308
std::vector< uint8_t > create_profile_inquiry(MUID destination) const
NOT RT-safe — allocates and returns a SysEx wire buffer.
std::vector< uint8_t > process_message(const uint8_t *data, size_t size)
NOT RT-safe — allocates a response vector and dispatches into handle_* methods that allocate.
const std::vector< ProfileState > & profiles() const
RT-safe. Returns a reference; no allocation.
Definition midi_ci.hpp:185
const std::vector< FunctionBlockInfo > & function_blocks() const
RT-safe. Returns a reference; no allocation.
Definition midi_ci.hpp:219
std::vector< uint8_t > create_profile_removed_report(MUID destination, const ProfileId &id)
NOT RT-safe — allocates the wire bytes.
const std::vector< ProfileDetails > & discovered_profile_details() const
RT-safe.
Definition midi_ci.hpp:274
std::function< void(MUID source, const ProfileId &id, const std::vector< uint8_t > &data)> on_profile_specific_data
Fires when a Profile-Specific Data message arrives.
Definition midi_ci.hpp:302
bool disable_profile(const ProfileId &id)
NOT RT-safe — see enable_profile.
std::vector< uint8_t > create_profile_added_report(MUID destination, const ProfileId &id)
NOT RT-safe — allocates the wire bytes.
std::vector< ProfileDetails > profile_details_for(const ProfileId &id) const
NOT RT-safe — allocates a result vector and copies stored data.
std::optional< std::string > get_property(std::string_view resource) const
RT-safe with caveats: the lookup uses heterogeneous std::less<> so no string allocation occurs for th...
std::function< void(const ProfileId &, bool enabled)> on_profile_changed
Definition midi_ci.hpp:306
bool enable_profile(const ProfileId &id)
NOT RT-safe — invokes the on_profile_changed callback which may allocate.
void set_profile_details(const ProfileId &id, uint8_t target, const std::vector< uint8_t > &data)
NOT RT-safe — copies into a std::map; the value's std::vector<uint8_t> is also copied.
void set_property(std::string_view resource, std::string_view value)
NOT RT-safe — std::map::insert and string construction both allocate.
const CiDeviceInfo & device_info() const
RT-safe. Returns a reference; no allocation.
Definition midi_ci.hpp:160
std::vector< uint8_t > create_profile_details_inquiry(MUID destination, const ProfileId &id, uint8_t target) const
NOT RT-safe — allocates the wire bytes.
std::function< void(MUID source, const ProfileId &)> on_profile_added
Definition midi_ci.hpp:307
std::size_t notify(std::string_view resource, std::string_view header_json, const std::vector< uint8_t > &payload)
NOT RT-safe — invokes subscription_manager() (potentially lazy allocation) and subscribers_of() (allo...
const PeSubscriptionManager & subscription_manager() const
NOT RT-safe — see non-const overload.
std::function< void(MUID source, const ProfileDetails &)> on_profile_details
Definition midi_ci.hpp:309
PeNotifyCallback on_pe_notify
Fires when a Subscribe peer should receive a Notify.
Definition midi_ci.hpp:318
void set_device_info(const CiDeviceInfo &info)
RT-safe. Trivial copy of the small CiDeviceInfo struct.
Definition midi_ci.hpp:158
const FunctionBlockInfo * find_function_block(FunctionBlockId id) const
RT-safe.
Definition midi_ci.hpp:224
MUID local_muid() const
RT-safe. Returns a 4-byte struct by value.
Definition midi_ci.hpp:163
std::vector< uint8_t > create_profile_specific_data(MUID destination, const ProfileId &id, const std::vector< uint8_t > &data) const
Definition midi_ci.hpp:291
PeSubscriptionManager & subscription_manager()
NOT RT-safe — lazily allocates the underlying PeSubscriptionManager (heap allocation through std::mak...
void add_function_block(const FunctionBlockInfo &block)
NOT RT-safe — std::vector::push_back may reallocate.
Definition midi_ci.hpp:215
Authoritative subscription registry on the responder side.
Definition midi_ci_pe.hpp:224
Definition custom_node_events.hpp:26
CiMessageType
MIDI-CI message types (sub-IDs).
Definition midi_ci.hpp:27
@ ProcessReply
Definition midi_ci.hpp:48
@ ProfileDisable
Pulp legacy Profile Disabled report.
Definition midi_ci.hpp:36
@ InvalidateMUID
Definition midi_ci.hpp:30
@ DiscoveryReply
Definition midi_ci.hpp:29
@ ProfileInquiry
Definition midi_ci.hpp:33
@ PropertySetInquiry
Definition midi_ci.hpp:42
@ PropertySubscribeInquiry
Definition midi_ci.hpp:44
@ ProfileReply
Definition midi_ci.hpp:34
@ ProfileDetailsReply
Profile Details Reply (CI 1.2 §7.6).
Definition midi_ci.hpp:38
@ ProfileDetailsInquiry
Profile Details Inquiry (CI 1.2 §7.6).
Definition midi_ci.hpp:37
@ PropertyNotify
Definition midi_ci.hpp:46
@ PropertySubscribeReply
Definition midi_ci.hpp:45
@ ProfileSetOff
Set Profile Off (CI 1.2 §7.5).
Definition midi_ci.hpp:32
@ PropertySetReply
Definition midi_ci.hpp:43
@ ProcessInquiry
Definition midi_ci.hpp:47
@ PropertyGetInquiry
Definition midi_ci.hpp:40
@ ProfileSpecificData
Profile-Specific Data (CI 1.2 §7.7).
Definition midi_ci.hpp:39
@ PropertyGetReply
Definition midi_ci.hpp:41
@ ProfileEnable
Pulp legacy Profile Enabled report.
Definition midi_ci.hpp:35
@ DiscoveryInquiry
Definition midi_ci.hpp:28
@ ProfileSetOn
Set Profile On (CI 1.2 §7.4).
Definition midi_ci.hpp:31
std::function< void(MUID subscriber_muid, std::string_view resource, std::string_view header_json, const std::vector< uint8_t > &payload)> PeNotifyCallback
Notify callback — fires when a Subscribe peer should be notified of a resource change.
Definition midi_ci.hpp:66
CI device identity (from discovery).
Definition midi_ci.hpp:72
uint8_t max_sysex_size
Definition midi_ci.hpp:79
uint16_t model_id
Definition midi_ci.hpp:76
uint16_t family_id
Definition midi_ci.hpp:75
uint32_t manufacturer_id
Definition midi_ci.hpp:74
uint8_t ci_version
Definition midi_ci.hpp:78
MUID muid
Definition midi_ci.hpp:73
uint32_t software_version
Definition midi_ci.hpp:77
UMP Function Block identifier (MIDI 2.0 §A) — a Function Block is a logical grouping of UMP groups th...
Definition midi_ci.hpp:108
uint8_t value
0x7F = broadcast / "all blocks"
Definition midi_ci.hpp:109
bool operator==(const FunctionBlockId &o) const
Definition midi_ci.hpp:113
bool is_broadcast() const
Definition midi_ci.hpp:112
static FunctionBlockId broadcast()
Definition midi_ci.hpp:111
Description of a single Function Block as advertised by an endpoint.
Definition midi_ci.hpp:119
std::string name
UMP Function Block Name (UTF-8).
Definition midi_ci.hpp:121
FunctionBlockId id
Definition midi_ci.hpp:120
uint8_t first_group
First UMP group included (0..15).
Definition midi_ci.hpp:122
bool ui_hint_receiver
Definition midi_ci.hpp:126
bool ui_hint_sender
Definition midi_ci.hpp:127
bool is_midi1
true = MIDI 1 protocol; false = MIDI 2
Definition midi_ci.hpp:125
uint8_t group_count
Number of UMP groups in the block.
Definition midi_ci.hpp:123
bool active
Whether the block is currently advertised.
Definition midi_ci.hpp:124
MIDI-CI MUID (Message Unique Identifier) — 28-bit random ID.
Definition midi_ci.hpp:52
bool operator==(const MUID &o) const
Definition midi_ci.hpp:58
bool is_broadcast() const
Definition midi_ci.hpp:57
static MUID broadcast()
Definition midi_ci.hpp:56
uint32_t value
Definition midi_ci.hpp:53
One active subscription state — owned by PeSubscriptionManager.
Definition midi_ci_pe.hpp:205
Profile Details Inquiry/Reply payload (CI 1.2 §7.6) — per-profile metadata the responder publishes wh...
Definition midi_ci.hpp:134
std::vector< uint8_t > data
Profile-defined data payload.
Definition midi_ci.hpp:137
uint8_t target
Profile-defined target byte.
Definition midi_ci.hpp:136
ProfileId id
Definition midi_ci.hpp:135
CI Profile identifier (5 bytes).
Definition midi_ci.hpp:83
uint8_t level
Definition midi_ci.hpp:87
uint8_t version
Definition midi_ci.hpp:86
uint8_t reserved
Definition midi_ci.hpp:88
uint8_t number
Definition midi_ci.hpp:85
uint8_t bank
Definition midi_ci.hpp:84
bool operator==(const ProfileId &o) const
Definition midi_ci.hpp:90
CI Profile state.
Definition midi_ci.hpp:96
uint16_t channel_count
Definition midi_ci.hpp:99
ProfileId id
Definition midi_ci.hpp:97
bool enabled
Definition midi_ci.hpp:98