JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::midi_ci::PropertyHost Class Referencefinal

Acting as a ResponderListener, instances of this class can formulate appropriate replies to property transactions initiated by remote devices. More...

#include <juce_CIPropertyHost.h>

Inheritance diagram for juce::midi_ci::PropertyHost:
Collaboration diagram for juce::midi_ci::PropertyHost:

Classes

struct  SubscriptionToken
 

Public Member Functions

 PropertyHost (FunctionBlock fb, PropertyDelegate &d, BufferOutput &o, CacheProvider &p)
 
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.
 
std::set< SubscriptionfindSubscriptionsForDevice (MUID device) const
 Returns a set of subscribed resources.
 
std::optional< RequestKeysendSubscriptionUpdate (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.
 
bool tryRespond (ResponderOutput &, const Message::Parsed &) override
 

Static Private Member Functions

static SubscriptionToken findUnusedSubscribeId (const std::map< SubscriptionToken, String > &used)
 
static String subscribeIdFromUid (SubscriptionToken uid)
 
static SubscriptionToken uidFromSubscribeId (String id)
 

Private Attributes

CacheProvidercacheProvider
 
PropertyDelegatedelegate
 
FunctionBlock functionBlock
 
BufferOutputoutput
 
std::map< MUID, std::map< SubscriptionToken, String > > registry
 

Detailed Description

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.

@tags{Audio}

Constructor & Destructor Documentation

◆ PropertyHost()

juce::midi_ci::PropertyHost::PropertyHost ( FunctionBlock  fb,
PropertyDelegate d,
BufferOutput o,
CacheProvider p 
)
inline

Rather than constructing one of these objects yourself, you should configure a Device with property exchange support, and then use Device::getPropertyHost() to retrieve a property host that has been set up to work with that device.

Member Function Documentation

◆ countOngoingTransactions()

int juce::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.

◆ findSubscriptionsForDevice()

std::set< Subscription > juce::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.

◆ findUnusedSubscribeId()

static SubscriptionToken juce::midi_ci::PropertyHost::findUnusedSubscribeId ( const std::map< SubscriptionToken, String > &  used)
staticprivate

◆ sendSubscriptionUpdate()

std::optional< RequestKey > juce::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().

◆ subscribeIdFromUid()

static String juce::midi_ci::PropertyHost::subscribeIdFromUid ( SubscriptionToken  uid)
staticprivate

◆ terminateSubscription()

void juce::midi_ci::PropertyHost::terminateSubscription ( MUID  device,
const String subscribeId 
)

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.

◆ tryRespond()

bool juce::midi_ci::PropertyHost::tryRespond ( ResponderOutput ,
const Message::Parsed  
)
overridevirtual

◆ uidFromSubscribeId()

static SubscriptionToken juce::midi_ci::PropertyHost::uidFromSubscribeId ( String  id)
staticprivate

Member Data Documentation

◆ cacheProvider

CacheProvider& juce::midi_ci::PropertyHost::cacheProvider
private

◆ delegate

PropertyDelegate& juce::midi_ci::PropertyHost::delegate
private

◆ functionBlock

FunctionBlock juce::midi_ci::PropertyHost::functionBlock
private

◆ output

BufferOutput& juce::midi_ci::PropertyHost::output
private

◆ registry

std::map<MUID, std::map<SubscriptionToken, String> > juce::midi_ci::PropertyHost::registry
private

The documentation for this class was generated from the following file: