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

Contains data returned by a responder in response to a request. More...

#include <juce_CIPropertyExchangeResult.h>

Public Types

enum class  Error { partial , notify , tooManyTransactions }
 

Public Member Functions

 PropertyExchangeResult (Error errorIn)
 Creates a result denoting an error state.
 
 PropertyExchangeResult (var headerIn, Span< const std::byte > bodyIn)
 Creates a result denoting a successful transmission.
 
std::optional< ErrorgetError () const
 Returns the result kind, either nullopt for a successful transmission, or an error code if something went wrong.
 
PropertySubscriptionHeader getHeaderAsSubscriptionHeader () const
 Parses the header as a subscription header.
 
PropertyRequestHeader getHeaderAsRequestHeader () const
 Parses the header as a request header.
 
PropertyReplyHeader getHeaderAsReplyHeader () const
 Parses the header as a reply header.
 
Span< const std::byte > getBody () const
 When getKind returns 'full', this is the message payload.
 

Detailed Description

Contains data returned by a responder in response to a request.

PropertyExchangeResult::kind indicates whether the transaction resulted in a well-formed message; however, it's possible that the message is a well-formed message indicating an error in the responder, so it's important to check the 'status' field of the header before attempting to do anything with the payload.

Member Enumeration Documentation

◆ Error

Enumerator
partial 

Got a response, but the responder terminated it before sending a well-formed message.

notify 

Got a notify message terminating the transaction.

tooManyTransactions 

Unable to send the request because doing so would exceed the number of simultaneous inquiries that were declared.

See also
PropertyDelegate::getNumSimultaneousRequestsSupported().

Constructor & Destructor Documentation

◆ PropertyExchangeResult() [1/2]

midi_ci::PropertyExchangeResult::PropertyExchangeResult ( Error errorIn)
explicit

Creates a result denoting an error state.

◆ PropertyExchangeResult() [2/2]

midi_ci::PropertyExchangeResult::PropertyExchangeResult ( var headerIn,
Span< const std::byte > bodyIn )

Creates a result denoting a successful transmission.

Member Function Documentation

◆ getError()

std::optional< Error > midi_ci::PropertyExchangeResult::getError ( ) const

Returns the result kind, either nullopt for a successful transmission, or an error code if something went wrong.

◆ getHeaderAsSubscriptionHeader()

PropertySubscriptionHeader midi_ci::PropertyExchangeResult::getHeaderAsSubscriptionHeader ( ) const

Parses the header as a subscription header.

This may only be called for messages of kind 'full'.

References jassert, and midi_ci::PropertySubscriptionHeader::parseCondensed().

◆ getHeaderAsRequestHeader()

PropertyRequestHeader midi_ci::PropertyExchangeResult::getHeaderAsRequestHeader ( ) const

Parses the header as a request header.

This may only be called for messages of kind 'full'.

References jassert, and midi_ci::PropertyRequestHeader::parseCondensed().

◆ getHeaderAsReplyHeader()

PropertyReplyHeader midi_ci::PropertyExchangeResult::getHeaderAsReplyHeader ( ) const

Parses the header as a reply header.

This may only be called for messages of kind 'full'.

References jassert, and midi_ci::PropertyReplyHeader::parseCondensed().

◆ getBody()

Span< const std::byte > midi_ci::PropertyExchangeResult::getBody ( ) const

When getKind returns 'full', this is the message payload.

Note that this is not stored internally; if you need to keep this data around and reference it in the future, you should copy it into a vector or some other suitable container.


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