Loading...
Searching...
No Matches
server_response.h
Go to the documentation of this file.
/*******************************************************************************
* Copyright (c) 2019-2024 Frank Pagliughi <fpagliughi@mindspring.com>
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v20.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Frank Pagliughi - initial implementation and documentation
*******************************************************************************/
#ifndef __mqtt_server_response_h
#define __mqtt_server_response_h
#include <iostream>
#include "MQTTAsync.h"
#include "mqtt/properties.h"
#include "mqtt/types.h"
namespace mqtt {
class server_response
{
properties props_;
public:
server_response() {}
server_response(const properties& props) : props_{props} {}
server_response(properties&& props) : props_{std::move(props)} {}
virtual ~server_response() {}
const properties& get_properties() const noexcept { return props_; }
};
class connect_response : public server_response
{
string serverURI_;
int mqttVersion_;
bool sessionPresent_;
friend class token;
connect_response(const MQTTAsync_successData5* rsp);
connect_response(const MQTTAsync_successData* rsp);
public:
string get_server_uri() const { return serverURI_; }
int get_mqtt_version() const { return mqttVersion_; }
bool is_session_present() const { return sessionPresent_; }
};
struct subscribe_response : public server_response
{
std::vector<ReasonCode> reasonCodes_;
friend class token;
subscribe_response(MQTTAsync_successData5* rsp);
subscribe_response(size_t n, MQTTAsync_successData* rsp);
public:
const std::vector<ReasonCode>& get_reason_codes() const { return reasonCodes_; }
};
class unsubscribe_response : public server_response
{
std::vector<ReasonCode> reasonCodes_;
friend class token;
unsubscribe_response(MQTTAsync_successData5* rsp);
unsubscribe_response(MQTTAsync_successData*) {}
public:
const std::vector<ReasonCode>& get_reason_codes() const { return reasonCodes_; }
};
} // namespace mqtt
#endif // __mqtt_server_response_h
mqtt::connect_response
Definition server_response.h:73
mqtt::connect_response::is_session_present
bool is_session_present() const
Definition server_response.h:112
mqtt::connect_response::get_server_uri
string get_server_uri() const
Definition server_response.h:99
mqtt::connect_response::get_mqtt_version
int get_mqtt_version() const
Definition server_response.h:104
mqtt::properties
Definition properties.h:293
mqtt::server_response
Definition server_response.h:39
mqtt::server_response::server_response
server_response()
Definition server_response.h:47
mqtt::server_response::get_properties
const properties & get_properties() const noexcept
Definition server_response.h:66
mqtt::server_response::~server_response
virtual ~server_response()
Definition server_response.h:61
mqtt::server_response::server_response
server_response(properties &&props)
Definition server_response.h:57
mqtt::server_response::server_response
server_response(const properties &props)
Definition server_response.h:52
mqtt::token
Definition token.h:54
mqtt::unsubscribe_response
Definition server_response.h:172
mqtt::unsubscribe_response::get_reason_codes
const std::vector< ReasonCode > & get_reason_codes() const
Definition server_response.h:199
mqtt
Definition async_client.h:60
properties.h
mqtt::subscribe_response
Definition server_response.h:131
mqtt::subscribe_response::get_reason_codes
const std::vector< ReasonCode > & get_reason_codes() const
Definition server_response.h:165
mqtt::subscribe_response::reasonCodes_
std::vector< ReasonCode > reasonCodes_
Definition server_response.h:133
mqtt::subscribe_response::subscribe_response
subscribe_response(size_t n, MQTTAsync_successData *rsp)
mqtt::subscribe_response::subscribe_response
subscribe_response(MQTTAsync_successData5 *rsp)
types.h