Manages subscriptions to properties on remote devices. More...
#include <juce_CISubscriptionManager.h>
Public Member Functions | |
SubscriptionManager (SubscriptionManagerDelegate &delegate) | |
Constructor. | |
SubscriptionKey | beginSubscription (MUID m, const PropertySubscriptionHeader &header) |
Attempts to begin a subscription using the provided details. | |
void | endSubscription (SubscriptionKey) |
Ends an ongoing subscription by us. | |
void | endSubscriptionFromResponder (MUID, String) |
Ends an ongoing subscription as requested from the remote device. | |
void | endSubscriptionsFromResponder (MUID) |
Ends all ongoing subscriptions as requested from a remote device. | |
std::vector< SubscriptionKey > | getOngoingSubscriptions () const |
Returns all of the subscriptions that have been initiated by this manager. | |
std::optional< String > | getSubscribeIdForKey (SubscriptionKey key) const |
If the provided subscription has started successfully, this returns the subscribeId assigned to the subscription by the remote device. | |
std::optional< String > | getResourceForKey (SubscriptionKey key) const |
If the provided subscription has not been cancelled, this returns the name of the subscribed resource. | |
bool | sendPendingMessages () |
Sends any cached messages that need retrying. | |
Manages subscriptions to properties on remote devices.
Occasionally, sending a subscription-begin request may fail, in which case the request will be cached. Cached requests will be sent during a future call to sendPendingMessages().
To use this:
|
explicit |
Constructor.
The delegate functions will be called when necessary to start and cancel property requests.
SubscriptionKey midi_ci::SubscriptionManager::beginSubscription | ( | MUID | m, |
const PropertySubscriptionHeader & | header ) |
Attempts to begin a subscription using the provided details.
void midi_ci::SubscriptionManager::endSubscription | ( | SubscriptionKey | ) |
Ends an ongoing subscription by us.
If the subscription begin request hasn't been sent yet, then this will just cancel the cached request.
If a subscription begin request has been sent, but no response has been received, this will send a notification cancelling the initial request via SubscriptionManagerDelegate::abortPropertyRequest().
If the subscription has started successfully, then this will send a subscription end request via SubscriptionManagerDelegate::sendPropertySubscribe().
Ends an ongoing subscription as requested from the remote device.
Unlike the other overload of endSubscription, this won't notify the delegate. It will only update the internal record of active subscriptions.
Calls Delegate::propertySubscriptionChanged().
void midi_ci::SubscriptionManager::endSubscriptionsFromResponder | ( | MUID | ) |
Ends all ongoing subscriptions as requested from a remote device.
Calls Delegate::propertySubscriptionChanged().
std::vector< SubscriptionKey > midi_ci::SubscriptionManager::getOngoingSubscriptions | ( | ) | const |
Returns all of the subscriptions that have been initiated by this manager.
std::optional< String > midi_ci::SubscriptionManager::getSubscribeIdForKey | ( | SubscriptionKey | key | ) | const |
If the provided subscription has started successfully, this returns the subscribeId assigned to the subscription by the remote device.
std::optional< String > midi_ci::SubscriptionManager::getResourceForKey | ( | SubscriptionKey | key | ) | const |
If the provided subscription has not been cancelled, this returns the name of the subscribed resource.
bool midi_ci::SubscriptionManager::sendPendingMessages | ( | ) |
Sends any cached messages that need retrying.