Acting as a ResponderListener, instances of this class can formulate appropriate replies to property transactions initiated by remote devices. More...
#include <juce_CIPropertyHost.h>
Public Member Functions | |
PropertyHost (FunctionBlock fb, PropertyDelegate &d, BufferOutput &o, CacheProvider &p) | |
std::optional< RequestKey > | sendSubscriptionUpdate (MUID device, const PropertySubscriptionHeader &header, Span< const std::byte > body, std::function< void(const PropertyExchangeResult &)> callback) |
Sends a "Subscription" message from a device, when acting as a subscription responder. | |
void | terminateSubscription (MUID device, const String &subscribeId) |
Terminates a subscription that was started by a remote device. | |
std::set< Subscription > | findSubscriptionsForDevice (MUID device) const |
Returns a set of subscribed resources. | |
int | countOngoingTransactions () const |
Returns the number of transactions that have been initiated by other devices, but not yet completed, normally because the request has been split into several messages. | |
bool | tryRespond (ResponderOutput &, const Message::Parsed &) override |
If the message is processed successfully, and a response sent, then this returns true. | |
Public Member Functions inherited from midi_ci::ResponderDelegate | |
ResponderDelegate ()=default | |
virtual | ~ResponderDelegate ()=default |
Acting as a ResponderListener, instances of this class can formulate appropriate replies to property transactions initiated by remote devices.
PropertyHost instances also contain methods to inform remote devices about changes to local property state.
Keeps track of property subscriptions requested by remote devices.
midi_ci::PropertyHost::PropertyHost | ( | FunctionBlock | fb, |
PropertyDelegate & | d, | ||
BufferOutput & | o, | ||
CacheProvider & | p ) |
std::optional< RequestKey > midi_ci::PropertyHost::sendSubscriptionUpdate | ( | MUID | device, |
const PropertySubscriptionHeader & | header, | ||
Span< const std::byte > | body, | ||
std::function< void(const PropertyExchangeResult &)> | callback ) |
Sends a "Subscription" message from a device, when acting as a subscription responder.
You should call this for all registered subscribers whenever the subscribed property is modified in a way that remote devices don't know about (if a remote device requests a property update, there's no need to send a subscription update after changing the property accordingly).
You should not attempt to start a new subscription on another device using this function. Valid subscription commands are "full", "partial", and "notify". Check the property exchange specification for the intended use of these commands.
To terminate a subscription that was initiated by a remote device, use terminateSubscription().
The provided callback will be called once the remote device has confirmed receipt of the subscription update. If the state of your application changes such that you no longer need to respond/wait for confirmation, you can pass the request key to Device::abortPropertyRequest().
Terminates a subscription that was started by a remote device.
This may be useful if your application has properties that can be added and removed - you can terminate subscriptions to subscribed properties before removing those properties.
std::set< Subscription > midi_ci::PropertyHost::findSubscriptionsForDevice | ( | MUID | device | ) | const |
Returns a set of subscribed resources.
This set contains all active subscriptionIDs for the given device, along with the resources to which those subscriptionIDs refer.
int midi_ci::PropertyHost::countOngoingTransactions | ( | ) | const |
Returns the number of transactions that have been initiated by other devices, but not yet completed, normally because the request has been split into several messages.
|
overridevirtual |
If the message is processed successfully, and a response sent, then this returns true.
Otherwise, returns false, allowing other ResponderDelegates to attempt to handle the message if necessary.
Implements midi_ci::ResponderDelegate.