Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
PidStoreHelper.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * PidStoreHelper.h
17 * Provides helper methods for loading / accessing the pid store, and dealing
18 * with pids.
19 * Copyright (C) 2011 Simon Newton
20 */
21
31#ifndef INCLUDE_OLA_RDM_PIDSTOREHELPER_H_
32#define INCLUDE_OLA_RDM_PIDSTOREHELPER_H_
33
34#include <stdint.h>
35#include <ola/messaging/Descriptor.h>
36#include <ola/messaging/SchemaPrinter.h>
39#include <ola/rdm/PidStore.h>
42
43#include <string>
44#include <vector>
45
46
47namespace ola {
48namespace rdm {
49
51 public:
52 explicit PidStoreHelper(const std::string &pid_location,
53 unsigned int initial_indent = 0);
55
56 bool Init();
57
59 const std::string &pid_name,
60 uint16_t manufacturer_id) const;
62 uint16_t param_id,
63 uint16_t manufacturer_id) const;
64
66 const ola::messaging::Descriptor *descriptor,
67 const std::vector<std::string> &inputs);
68
69 const uint8_t *SerializeMessage(const ola::messaging::Message *message,
70 unsigned int *data_length);
71
73 const ola::messaging::Descriptor *descriptor,
74 const uint8_t *data,
75 unsigned int data_length);
76
77 const std::string MessageToString(const ola::messaging::Message *message);
78
79 const std::string PrettyPrintMessage(
80 uint16_t manufacturer_id,
81 bool is_set,
82 uint16_t pid,
83 const ola::messaging::Message *message);
84
85 const std::string SchemaAsString(
86 const ola::messaging::Descriptor *descriptor);
87
88 void SupportedPids(uint16_t manufacturer_id,
89 std::vector<std::string> *pid_names) const;
90
91 void SupportedPids(
92 uint16_t manufacturer_id,
93 std::vector<const PidDescriptor*> *descriptors) const;
94
95 private:
96 const std::string m_pid_location;
97 const RootPidStore *m_root_store;
98 StringMessageBuilder m_string_builder;
99 MessageSerializer m_serializer;
100 MessageDeserializer m_deserializer;
101 RDMMessagePrinter m_message_printer;
102 ola::messaging::SchemaPrinter m_schema_printer;
103};
104} // namespace rdm
105} // namespace ola
106#endif // INCLUDE_OLA_RDM_PIDSTOREHELPER_H_
Inflate a message from raw data.
Serialize an RDM message.
Holds information about RDM PIDs.
Used for displaying the RDM data to the command line.
Definition Descriptor.h:399
Definition Message.h:39
Definition SchemaPrinter.h:35
Definition MessageDeserializer.h:45
Definition MessageSerializer.h:41
Definition PidStore.h:248
Definition PidStoreHelper.h:50
const std::string PrettyPrintMessage(uint16_t manufacturer_id, bool is_set, uint16_t pid, const ola::messaging::Message *message)
Pretty print a RDM message based on the PID.
Definition PidStoreHelper.cpp:165
const std::string SchemaAsString(const ola::messaging::Descriptor *descriptor)
Return a string describing the schema for a descriptor.
Definition PidStoreHelper.cpp:230
~PidStoreHelper()
Clean up.
Definition PidStoreHelper.cpp:51
const std::string MessageToString(const ola::messaging::Message *message)
Convert a message to a string.
Definition PidStoreHelper.cpp:148
PidStoreHelper(const std::string &pid_location, unsigned int initial_indent=0)
Set up a new PidStoreHelper object.
Definition PidStoreHelper.cpp:39
const PidDescriptor * GetDescriptor(const std::string &pid_name, uint16_t manufacturer_id) const
Lookup a PidDescriptor by name.
Definition PidStoreHelper.cpp:78
const uint8_t * SerializeMessage(const ola::messaging::Message *message, unsigned int *data_length)
Serialize a message to binary format.
Definition PidStoreHelper.cpp:124
bool Init()
Init the PidStoreHelper, this loads the PID store.
Definition PidStoreHelper.cpp:61
const ola::messaging::Message * BuildMessage(const ola::messaging::Descriptor *descriptor, const std::vector< std::string > &inputs)
Build a Message object from a series of input strings.
Definition PidStoreHelper.cpp:107
void SupportedPids(uint16_t manufacturer_id, std::vector< std::string > *pid_names) const
Return the list of PIDs supported including manufacturer PIDs.
Definition PidStoreHelper.cpp:241
const ola::messaging::Message * DeserializeMessage(const ola::messaging::Descriptor *descriptor, const uint8_t *data, unsigned int data_length)
DeSerialize a message.
Definition PidStoreHelper.cpp:135
Definition RDMMessagePrinters.h:51
The root of the RDM parameter descriptor store.
Definition PidStore.h:68
Definition StringMessageBuilder.h:51
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
Builds a Messagse object from a list of strings and a Descriptor.