Skip to main content

Module property_exchange

Module property_exchange 

Source
Expand description

Minimal MIDI-CI Property Exchange (PE) framing.

Handles Set Property Inquiry (sub-ID2 = 0x36) and replies with ACK (0x37). Spec reference: MIDI-CI 1.2, §7 Property Exchange.

SysEx7 message layout: F0 7E <device_id> 0D <sub_id2> <ci_version> <source_muid: 4 bytes> <dest_muid: 4 bytes> <request_id> <header_len_lo> <header_len_hi> <header_data…> <num_chunks_lo> <num_chunks_hi> <chunk_num_lo> <chunk_num_hi> <body_len_lo> <body_len_hi> <body_data…> F7

Reply header format: [status] (1 byte for Set Reply) or [status, resource] (2 bytes for Get Reply).

Structs§

SetPropertyData
Parsed Set Property Inquiry with resource identifier and body.

Enums§

PeStatus
PE reply status codes (HTTP-inspired).

Constants§

PE_GET_INQUIRY
Sub-ID2: Inquiry Get Property Data (MIDI-CI 1.2)
PE_GET_REPLY
Sub-ID2: Reply to Get Property Data
PE_SET_INQUIRY
Sub-ID2: Inquiry Set Property Data (MIDI-CI 1.2)
PE_SET_REPLY
Sub-ID2: Reply to Set Property Data

Functions§

build_get_inquiry
Build a Get Property Inquiry message (CLI → device).
build_get_reply
Build a Get Property Reply with status and body data.
build_set_inquiry
Build a Set Property Inquiry message (CLI → device). resource is the preset index (carried in header). body must contain only 7-bit safe bytes.
build_set_reply
Build a Set Property Reply with status.
decode_mcoded7
Decode mcoded7 data back to original bytes. Returns the number of bytes written to out.
encode_mcoded7
Encode data using mcoded7 (MIDI-CI spec): every 7 input bytes → 8 output bytes. The first byte of each group carries the high bits (bit 7) of the following 7 bytes. Returns the number of bytes written to out.
extract_body
Legacy helper: extract just the body (ignores resource).
extract_get_body
Extract body from a Get Property Reply.
extract_get_resource
Extract the resource identifier from a Get Property Inquiry.
extract_reply_status
Extract status from a Set Property Reply or Get Property Reply. Status is the first header byte in replies.
extract_set_property
Extract resource identifier and body from a Set Property Inquiry.
is_ci_message
Check if a SysEx buffer is a MIDI-CI message.
is_get_property
Check if the message is a Get Property Inquiry.
is_get_reply
Check if the message is a Get Property Reply.
is_set_property
Check if the message is a Set Property Inquiry.
request_id
Extract the request_id field.
source_muid
Extract the source MUID (4 bytes).