Loading...
Searching...
No Matches
juce::midi_ci::PropertyExchangeResult Class Reference

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.

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.

Member Enums

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

Constructors and Destructors

◆ PropertyExchangeResult() [1/2]

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

Creates a result denoting an error state.

References PropertyExchangeResult().

Referenced by PropertyExchangeResult(), and PropertyExchangeResult().

◆ PropertyExchangeResult() [2/2]

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

Creates a result denoting a successful transmission.

References juce::nullopt, and PropertyExchangeResult().

Member Functions

◆ getError()

std::optional< Error > juce::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 juce::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 juce::midi_ci::PropertySubscriptionHeader::parseCondensed().

◆ getHeaderAsRequestHeader()

PropertyRequestHeader juce::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 juce::midi_ci::PropertyRequestHeader::parseCondensed().

◆ getHeaderAsReplyHeader()

PropertyReplyHeader juce::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 juce::midi_ci::PropertyReplyHeader::parseCondensed().

◆ getBody()

Span< const std::byte > juce::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.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram