JUCE: juce::midi_ci::SubscriptionManager Class Reference

JUCE

- Main Page
- Related Pages
- Topics
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

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.

## 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:

- pass a SubscriptionManagerDelegate (such as a ci::Device) to the constructor
- call sendPendingMessages() periodically, e.g. in a timer callback

## Constructor & Destructor Documentation

## ◆ SubscriptionManager()

juce::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 juce::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 juce::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 juce::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 juce::midi_ci::SubscriptionManager::endSubscriptionsFromResponder | ( | MUID |  | ) |

Ends all ongoing subscriptions as requested from a remote device.

Calls Delegate::propertySubscriptionChanged().

## ◆ getOngoingSubscriptions()

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

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

## ◆ getSubscribeIdForKey()

std::optional< String > juce::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 > juce::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 juce::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:

- juce_CISubscriptionManager.h