Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CommandPrinter.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  * CommandPrinter.h
17  * Write out RDMCommands in a human-readable format.
18  * Copyright (C) 2012 Simon Newton
19  */
20 
21 #ifndef INCLUDE_OLA_RDM_COMMANDPRINTER_H_
22 #define INCLUDE_OLA_RDM_COMMANDPRINTER_H_
23 
24 #include <stdint.h>
25 #include <ola/rdm/RDMEnums.h>
26 #include <string>
27 
28 namespace ola {
29 namespace rdm {
30 
32  public:
33  CommandPrinter(std::ostream *output,
34  class PidStoreHelper *pid_helper);
35  ~CommandPrinter() {}
36 
37  // New style overloaded methods.
38  void Print(const class RDMCommand *command,
39  bool summarize = false,
40  bool unpack_param_data = true);
41  void Print(const class RDMRequest *request,
42  bool summarize = false,
43  bool unpack_param_data = true);
44  void Print(const class RDMResponse *response,
45  bool summarize = false,
46  bool unpack_param_data = true);
47  void Print(const class RDMDiscoveryRequest *request,
48  bool summarize = false,
49  bool unpack_param_data = true);
50  void Print(const class RDMDiscoveryResponse *response,
51  bool summarize = false,
52  bool unpack_param_data = true);
53 
54  // Deprecated
55  void DisplayRequest(const class RDMRequest *request,
56  bool summarize = false,
57  bool unpack_param_data = true);
58  void DisplayResponse(const class RDMResponse *response,
59  bool summarize = false,
60  bool unpack_param_data = true);
61 
62  void DisplayDiscoveryRequest(const class RDMDiscoveryRequest *request,
63  bool summarize = false,
64  bool unpack_param_data = true);
65 
66  void DisplayDiscoveryResponse(const class RDMDiscoveryResponse *response,
67  bool summarize = false,
68  bool unpack_param_data = true);
69 
70  private:
71  std::ostream *m_output;
72  PidStoreHelper *m_pid_helper;
73 
74  void AppendUIDsAndType(const class RDMCommand *command,
75  const char *message_type);
76  void AppendPortId(const class RDMRequest *request);
77  void AppendMessageLength(const class RDMRequest *request);
78  void AppendVerboseUIDs(const class RDMCommand *command);
79  void AppendPidString(const class RDMCommand *command,
80  const class PidDescriptor *pid_descriptor);
81  void AppendResponseType(const class RDMResponse *response);
82  void AppendVerboseResponseType(const class RDMResponse *response);
83  void AppendHeaderFields(const class RDMCommand *command,
84  const char *command_class);
85 
86  void DisplayParamData(
87  const class PidDescriptor *pid_descriptor,
88  bool unpack_param_data,
89  bool is_request,
90  bool is_get,
91  const uint8_t *param_data,
92  unsigned int param_length);
93  bool GetNackReason(const class RDMCommand *command, uint16_t *reason);
94 };
95 } // namespace rdm
96 } // namespace ola
97 #endif // INCLUDE_OLA_RDM_COMMANDPRINTER_H_
void DisplayDiscoveryResponse(const class RDMDiscoveryResponse *response, bool summarize=false, bool unpack_param_data=true)
Definition: CommandPrinter.cpp:253
An RDM Command that represents responses (GET, SET or DISCOVER).
Definition: RDMCommand.h:457
Definition: CommandPrinter.h:31
CommandPrinter(std::ostream *output, class PidStoreHelper *pid_helper)
Definition: CommandPrinter.cpp:47
RDM Commands that represent requests (GET, SET or DISCOVER).
Definition: RDMCommand.h:234
An RDM response of type DISCOVER_COMMAND.
Definition: RDMCommand.h:743
An RDM request of type DISCOVER_COMMAND.
Definition: RDMCommand.h:674
The base class that all RDM requests & responses inherit from.
Definition: RDMCommand.h:59
void DisplayDiscoveryRequest(const class RDMDiscoveryRequest *request, bool summarize=false, bool unpack_param_data=true)
Definition: CommandPrinter.cpp:181
void DisplayResponse(const class RDMResponse *response, bool summarize=false, bool unpack_param_data=true)
Definition: CommandPrinter.cpp:137
Various constants used in RDM.
void DisplayRequest(const class RDMRequest *request, bool summarize=false, bool unpack_param_data=true)
Definition: CommandPrinter.cpp:96
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
Definition: PidStoreHelper.h:50
Definition: PidStore.h:246