Loading...
Searching...
No Matches
Public Member Functions | List of all members
midi_ci::SubscriptionManager Class Reference

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< SubscriptionKeygetOngoingSubscriptions () const
 Returns all of the subscriptions that have been initiated by this manager.
 
std::optional< StringgetSubscribeIdForKey (SubscriptionKey key) const
 If the provided subscription has started successfully, this returns the subscribeId assigned to the subscription by the remote device.
 
std::optional< StringgetResourceForKey (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.
 

Detailed Description

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:

Constructor & Destructor Documentation

◆ SubscriptionManager()

midi_ci::SubscriptionManager::SubscriptionManager ( SubscriptionManagerDelegate & delegate)
explicit

Constructor.

The delegate functions will be called when necessary to start and cancel property requests.

Member Function Documentation

◆ beginSubscription()

SubscriptionKey midi_ci::SubscriptionManager::beginSubscription ( MUID m,
const PropertySubscriptionHeader & header )

Attempts to begin a subscription using the provided details.

Returns
a token that uniquely identifies this subscription. This token can be passed to endSubscription to terminate an ongoing subscription.

◆ endSubscription()

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().

◆ endSubscriptionFromResponder()

void midi_ci::SubscriptionManager::endSubscriptionFromResponder ( MUID ,
String  )

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().

◆ endSubscriptionsFromResponder()

void midi_ci::SubscriptionManager::endSubscriptionsFromResponder ( MUID )

Ends all ongoing subscriptions as requested from a remote device.

Calls Delegate::propertySubscriptionChanged().

◆ getOngoingSubscriptions()

std::vector< SubscriptionKey > midi_ci::SubscriptionManager::getOngoingSubscriptions ( ) const

Returns all of the subscriptions that have been initiated by this manager.

◆ getSubscribeIdForKey()

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.

◆ getResourceForKey()

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.

◆ sendPendingMessages()

bool midi_ci::SubscriptionManager::sendPendingMessages ( )

Sends any cached messages that need retrying.

Returns
true if there are no more messages to send, or false otherwise

The documentation for this class was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram