client-cpp  0.8.1
ConnackMessage.hpp
Go to the documentation of this file.
1 
17 #ifndef CONNACKMESSAGE_HPP_
18 #define CONNACKMESSAGE_HPP_
19 
20 #include <cstdint>
21 #include <string>
22 
23 namespace kaa {
24 
25 enum class ConnackReturnCode : std::uint8_t
26 {
27  UNKNOWN = 0x00,
28  ACCEPTED = 0x01,
29  REFUSE_BAD_PROTOCOL = 0x02,
30  REFUSE_ID_REJECT = 0x03,
33  REFUSE_NO_AUTH = 0x06
34 };
35 
37 {
38 public:
39  ConnackMessage(const char *payload, std::uint16_t size);
41 
42  static std::string returnCodeToString(ConnackReturnCode code);
43 
44  std::string getMessage() const;
45  ConnackReturnCode getReturnCode() const { return returnCode_; }
46 
47 private:
48  void parseMessage(const char *payload, std::uint16_t size);
49 
50 private:
51  ConnackReturnCode returnCode_;
52 };
53 
54 }
55 
56 
57 
58 #endif /* CONNACKMESSAGE_HPP_ */
std::string getMessage() const
ConnackMessage(const char *payload, std::uint16_t size)
ConnackReturnCode
static std::string returnCodeToString(ConnackReturnCode code)
ConnackReturnCode getReturnCode() const