Open Lighting Architecture
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ResponderHelper.h
Go to the documentation of this file.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * ResponderHelper.h
17  * Copyright (C) 2013 Simon Newton
18  */
19 
27 #ifndef INCLUDE_OLA_RDM_RESPONDERHELPER_H_
28 #define INCLUDE_OLA_RDM_RESPONDERHELPER_H_
29 
30 #include <string>
31 #include <vector>
32 #include "ola/rdm/RDMCommand.h"
33 #include "ola/rdm/ResponderPersonality.h"
34 
35 namespace ola {
36 namespace rdm {
37 
43  public:
44  // Request Parsing methods
45  static bool ExtractUInt8(const RDMRequest *request, uint8_t *output);
46  static bool ExtractUInt16(const RDMRequest *request, uint16_t *output);
47  static bool ExtractUInt32(const RDMRequest *request, uint32_t *output);
48 
49  // Response Generation methods
50  static const RDMResponse *GetDeviceInfo(
51  const RDMRequest *request,
52  uint16_t device_model,
53  rdm_product_category product_category,
54  uint32_t software_version,
55  uint16_t dmx_footprint,
56  uint8_t current_personality,
57  uint8_t personality_count,
58  uint16_t dmx_start_address,
59  uint16_t sub_device_count,
60  uint8_t sensor_count,
61  uint8_t queued_message_count = 0);
62 
63  static const RDMResponse *GetDeviceInfo(
64  const RDMRequest *request,
65  uint16_t device_model,
66  rdm_product_category product_category,
67  uint32_t software_version,
68  const PersonalityManager *personality_manager,
69  uint16_t dmx_start_address,
70  uint16_t sub_device_count,
71  uint8_t sensor_count,
72  uint8_t queued_message_count = 0);
73 
74  static const RDMResponse *GetProductDetailList(
75  const RDMRequest *request,
76  const std::vector<rdm_product_detail> &product_details,
77  uint8_t queued_message_count = 0);
78 
79  static const RDMResponse *GetPersonality(
80  const RDMRequest *request,
81  const PersonalityManager *personality_manager,
82  uint8_t queued_message_count = 0);
83  static const RDMResponse *SetPersonality(
84  const RDMRequest *request,
85  PersonalityManager *personality_manager,
86  uint16_t start_address,
87  uint8_t queued_message_count = 0);
88 
89  static const RDMResponse *GetPersonalityDescription(
90  const RDMRequest *request,
91  const PersonalityManager *personality_manager,
92  uint8_t queued_message_count = 0);
93 
94  static const RDMResponse *GetSlotInfo(
95  const RDMRequest *request,
96  const PersonalityManager *personality_manager,
97  uint8_t queued_message_count = 0);
98 
99  static const RDMResponse *GetSlotDescription(
100  const RDMRequest *request,
101  const PersonalityManager *personality_manager,
102  uint8_t queued_message_count = 0);
103 
104  static const RDMResponse *GetSlotDefaultValues(
105  const RDMRequest *request,
106  const PersonalityManager *personality_manager,
107  uint8_t queued_message_count = 0);
108 
109  static const RDMResponse *GetDmxAddress(
110  const RDMRequest *request,
111  const PersonalityManager *personality_manager,
112  uint16_t start_address,
113  uint8_t queued_message_count = 0);
114  static const RDMResponse *SetDmxAddress(
115  const RDMRequest *request,
116  const PersonalityManager *personality_manager,
117  uint16_t *dmx_address,
118  uint8_t queued_message_count = 0);
119 
120  static const RDMResponse *GetRealTimeClock(
121  const RDMRequest *request,
122  uint8_t queued_message_count = 0);
123 
124  static const RDMResponse *GetParamDescription(
125  const RDMRequest *request,
126  uint16_t pid,
127  uint8_t pdl_size,
128  rdm_data_type data_type,
129  rdm_command_class command_class,
130  rdm_pid_unit unit,
131  rdm_pid_prefix prefix,
132  uint32_t min_value,
133  uint32_t default_value,
134  uint32_t max_value,
135  string description,
136  uint8_t queued_message_count = 0);
137  static const RDMResponse *GetASCIIParamDescription(
138  const RDMRequest *request,
139  uint16_t pid,
140  rdm_command_class command_class,
141  string description,
142  uint8_t queued_message_count = 0);
143  static const RDMResponse *GetBitFieldParamDescription(
144  const RDMRequest *request,
145  uint16_t pid,
146  uint8_t pdl_size,
147  rdm_command_class command_class,
148  string description,
149  uint8_t queued_message_count = 0);
150 
151  static const RDMResponse *GetString(const RDMRequest *request,
152  const std::string &value,
153  uint8_t queued_message_count = 0);
154 
155  static const RDMResponse *EmptyGetResponse(
156  const RDMRequest *request,
157  uint8_t queued_message_count = 0);
158  static const RDMResponse *EmptySetResponse(
159  const RDMRequest *request,
160  uint8_t queued_message_count = 0);
161 
162  static const RDMResponse *SetString(const RDMRequest *request,
163  std::string *value,
164  uint8_t queued_message_count = 0);
165  static const RDMResponse *GetBoolValue(
166  const RDMRequest *request, bool value,
167  uint8_t queued_message_count = 0);
168  static const RDMResponse *SetBoolValue(
169  const RDMRequest *request, bool *value,
170  uint8_t queued_message_count = 0);
171 
172  static const RDMResponse *GetUInt8Value(
173  const RDMRequest *request, uint8_t value,
174  uint8_t queued_message_count = 0);
175  static const RDMResponse *GetUInt16Value(
176  const RDMRequest *request, uint16_t value,
177  uint8_t queued_message_count = 0);
178  static const RDMResponse *GetUInt32Value(
179  const RDMRequest *request, uint32_t value,
180  uint8_t queued_message_count = 0);
181  static const RDMResponse *SetUInt8Value(
182  const RDMRequest *request, uint8_t *value,
183  uint8_t queued_message_count = 0);
184  static const RDMResponse *SetUInt16Value(
185  const RDMRequest *request, uint16_t *value,
186  uint8_t queued_message_count = 0);
187  static const RDMResponse *SetUInt32Value(
188  const RDMRequest *request, uint32_t *value,
189  uint8_t queued_message_count = 0);
190 };
191 } // namespace rdm
192 } // namespace ola
193 #endif // INCLUDE_OLA_RDM_RESPONDERHELPER_H_