Open Lighting Architecture: include/ola/rdm/RDMReply.h Source File

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
RDMReply.h
1/*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * RDMReply.h
17 * The RDMReply object.
18 * Copyright (C) 2015 Simon Newton
19 */
20
21#ifndef INCLUDE_OLA_RDM_RDMREPLY_H_
22#define INCLUDE_OLA_RDM_RDMREPLY_H_
23
24#include <ola/base/Macro.h>
25#include <ola/rdm/RDMCommand.h>
26#include <ola/rdm/RDMFrame.h>
27#include <ola/rdm/RDMResponseCodes.h>
28
29#include <string>
30#include <memory>
31
32namespace ola {
33namespace rdm {
34
43 struct RDMReply {
44 public:
48 explicit RDMReply(RDMStatusCode status_code);
49
55 RDMReply(RDMStatusCode status_code, RDMResponse *response);
56
63 RDMReply(RDMStatusCode status_code,
64 RDMResponse *response,
65 const RDMFrames &frames);
66
70 RDMStatusCode StatusCode() const { return m_status_code; }
71
79 const RDMResponse* Response() const { return m_response.get(); }
80
88 RDMResponse* MutableResponse() { return m_response.get(); }
89
95 const RDMFrames& Frames() const { return m_frames; }
96
102 bool operator==(const RDMReply &other) const;
103
108
113 std::string ToString() const;
114
121 friend std::ostream& operator<<(std::ostream &out,
122 const RDMReply &reply) {
123 return out << reply.ToString();
124 }
125
127
134 static RDMReply* FromFrame(const RDMFrame &frame,
135 const RDMRequest *request = NULL);
136
143 static RDMReply* DUBReply(const RDMFrame &frame);
144
145 private:
146 RDMStatusCode m_status_code;
147 std::auto_ptr<RDMResponse> m_response;
148 RDMFrames m_frames;
149
150 RDMReply(const RDMReply &) = delete;
151 const RDMReply &operator=(const RDMReply &) = delete;
152};
153} // namespace rdm
154} // namespace ola
155#endif // INCLUDE_OLA_RDM_RDMREPLY_H_
Macro.h
Helper macros.
RDMCommand.h
Classes that represent RDM commands.
RDMResponseCodes.h
Enums representing the states of a response. This is generated from the proto file.
ola::rdm::RDMFrame
The raw data for a RDM message and its associated timing information.
Definition RDMFrame.h:40
ola::rdm::RDMRequest
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition RDMCommand.h:234
ola::rdm::RDMResponse
An RDM Command that represents responses (GET, SET or DISCOVER).
Definition RDMCommand.h:457
ola::rdm
PLASA E1.20 Remote Device Management.
Definition AckTimerResponder.cpp:38
ola::rdm::RDMFrames
std::vector< RDMFrame > RDMFrames
A vector of RDMFrames.
Definition RDMFrame.h:113
ola::rdm::RDMStatusCode
RDMStatusCode
RDM Status Codes.
Definition RDMResponseCodes.h:45
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
ola::plugin::artnet::RDMReply::RDMReply
RDMReply(RDMStatusCode status_code)
Create a new RDMReply from a RDM Response Code.
Definition RDMReply.cpp:47
ola::rdm::RDMReply
Holds the final state of an RDM request.
Definition RDMReply.h:43
ola::rdm::RDMReply::ToString
std::string ToString() const
Create a human readable string from the RDMReply object.
Definition RDMReply.cpp:70
ola::rdm::RDMReply::Response
const RDMResponse * Response() const
Returns the RDMResponse if there is one.
Definition RDMReply.h:79
ola::rdm::RDMReply::StatusCode
RDMStatusCode StatusCode() const
Return the RDMStatusCode for the request.
Definition RDMReply.h:70
ola::rdm::RDMReply::operator<<
friend std::ostream & operator<<(std::ostream &out, const RDMReply &reply)
Output an RDMReply object to an ostream.
Definition RDMReply.h:121
ola::rdm::RDMReply::DUBReply
static RDMReply * DUBReply(const RDMFrame &frame)
A helper method to create a RDMReply for a DUB response.
Definition RDMReply.cpp:95
ola::rdm::RDMReply::Frames
const RDMFrames & Frames() const
The frames that make up this RDM reply.
Definition RDMReply.h:95
ola::rdm::RDMReply::operator==
bool operator==(const RDMReply &other) const
Test for equality.
Definition RDMReply.cpp:64
ola::rdm::RDMReply::MutableResponse
RDMResponse * MutableResponse()
Returns a pointer to a mutable RDMResponse.
Definition RDMReply.h:88
ola::rdm::RDMReply::FromFrame
static RDMReply * FromFrame(const RDMFrame &frame, const RDMRequest *request=NULL)
A helper method to create a RDMReply from raw frame data.
Definition RDMReply.cpp:79
ola::rdm::RDMReply::RDMReply
RDMReply(RDMStatusCode status_code)
Create a new RDMReply from a RDM Response Code.
Definition RDMReply.cpp:47