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< Error > | getError () 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. | |
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.
|
strong |
|
explicit |
Creates a result denoting an error state.
midi_ci::PropertyExchangeResult::PropertyExchangeResult | ( | var | headerIn, |
Span< const std::byte > | bodyIn ) |
Creates a result denoting a successful transmission.
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.
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().
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().
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().
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.