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

| 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
30
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>
37#include <ola/rdm/MessageDeserializer.h>
38#include <ola/rdm/MessageSerializer.h>
39#include <ola/rdm/PidStore.h>
40#include <ola/rdm/RDMMessagePrinters.h>
41#include <ola/rdm/StringMessageBuilder.h>
42
43#include <string>
44#include <vector>
45
46
47namespace ola {
48namespace rdm {
49
50 class PidStoreHelper {
51 public:
52 explicit PidStoreHelper(const std::string &pid_location,
53 unsigned int initial_indent = 0);
54 ~PidStoreHelper();
55
56 bool Init();
57
58 const PidDescriptor *GetDescriptor(
59 const std::string &pid_name,
60 uint16_t manufacturer_id) const;
61 const PidDescriptor *GetDescriptor(
62 uint16_t param_id,
63 uint16_t manufacturer_id) const;
64
65 const ola::messaging::Message *BuildMessage(
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
72 const ola::messaging::Message *DeserializeMessage(
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_
MessageDeserializer.h
Inflate a message from raw data.
MessageSerializer.h
Serialize an RDM message.
PidStore.h
Holds information about RDM PIDs.
RDMMessagePrinters.h
Used for displaying the RDM data to the command line.
ola::messaging::Descriptor
Definition Descriptor.h:399
ola::messaging::Message
Definition Message.h:39
ola::messaging::SchemaPrinter
Definition SchemaPrinter.h:35
ola::rdm::MessageDeserializer
Definition MessageDeserializer.h:45
ola::rdm::MessageSerializer
Definition MessageSerializer.h:41
ola::rdm::PidDescriptor
Definition PidStore.h:248
ola::rdm::PidStoreHelper::PrettyPrintMessage
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
ola::rdm::PidStoreHelper::SchemaAsString
const std::string SchemaAsString(const ola::messaging::Descriptor *descriptor)
Return a string describing the schema for a descriptor.
Definition PidStoreHelper.cpp:230
ola::rdm::PidStoreHelper::~PidStoreHelper
~PidStoreHelper()
Clean up.
Definition PidStoreHelper.cpp:51
ola::rdm::PidStoreHelper::MessageToString
const std::string MessageToString(const ola::messaging::Message *message)
Convert a message to a string.
Definition PidStoreHelper.cpp:148
ola::rdm::PidStoreHelper::PidStoreHelper
PidStoreHelper(const std::string &pid_location, unsigned int initial_indent=0)
Set up a new PidStoreHelper object.
Definition PidStoreHelper.cpp:39
ola::rdm::PidStoreHelper::GetDescriptor
const PidDescriptor * GetDescriptor(const std::string &pid_name, uint16_t manufacturer_id) const
Lookup a PidDescriptor by name.
Definition PidStoreHelper.cpp:78
ola::rdm::PidStoreHelper::SerializeMessage
const uint8_t * SerializeMessage(const ola::messaging::Message *message, unsigned int *data_length)
Serialize a message to binary format.
Definition PidStoreHelper.cpp:124
ola::rdm::PidStoreHelper::Init
bool Init()
Init the PidStoreHelper, this loads the PID store.
Definition PidStoreHelper.cpp:61
ola::rdm::PidStoreHelper::BuildMessage
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
ola::rdm::PidStoreHelper::SupportedPids
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
ola::rdm::PidStoreHelper::DeserializeMessage
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
ola::rdm::RDMMessagePrinter
Definition RDMMessagePrinters.h:51
ola::rdm::RootPidStore
The root of the RDM parameter descriptor store.
Definition PidStore.h:68
ola::rdm::StringMessageBuilder
Definition StringMessageBuilder.h:51
ola::rdm
PLASA E1.20 Remote Device Management.
Definition AckTimerResponder.cpp:38
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
StringMessageBuilder.h
Builds a Messagse object from a list of strings and a Descriptor.