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

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
RDMCommandSerializer.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 * RDMCommandSerializer.h
17 * Write RDMCommands to a memory buffer.
18 * Copyright (C) 2012 Simon Newton
19 */
20
28
29#ifndef INCLUDE_OLA_RDM_RDMCOMMANDSERIALIZER_H_
30#define INCLUDE_OLA_RDM_RDMCOMMANDSERIALIZER_H_
31
32#include <stdint.h>
33#include <ola/io/ByteString.h>
34#include <ola/io/IOStack.h>
35#include <ola/rdm/RDMCommand.h>
36#include <ola/rdm/UID.h>
37
38namespace ola {
39namespace rdm {
40
41
49 class RDMCommandSerializer {
50 public:
57 static bool Pack(const RDMCommand &command,
58 ola::io::ByteString *output);
59
66 static bool PackWithStartCode(const RDMCommand &command,
67 ola::io::ByteString *output);
68
76 static unsigned int RequiredSize(const RDMCommand &command);
77
88 static bool Pack(const RDMCommand &command,
89 uint8_t *buffer,
90 unsigned int *size);
91
92 // TODO(simon): Add IOQueue Write() method here
93
101 static bool Write(const RDMCommand &command, ola::io::IOStack *stack);
102
106 enum { MAX_PARAM_DATA_LENGTH = 231 };
107
108 private:
109 static const unsigned int CHECKSUM_LENGTH = 2;
110
111 static void PopulateHeader(RDMCommandHeader *header,
112 const RDMCommand &command);
113};
114} // namespace rdm
115} // namespace ola
116#endif // INCLUDE_OLA_RDM_RDMCOMMANDSERIALIZER_H_
RDMCommand.h
Classes that represent RDM commands.
UID.h
A RDM unique identifier (UID).
ola::io::IOStack
Definition IOStack.h:41
ola::rdm::RDMCommand
The base class that all RDM requests & responses inherit from.
Definition RDMCommand.h:59
ola::rdm::RDMCommandSerializer
Serializes RDMCommands.
Definition RDMCommandSerializer.h:49
ola::rdm::RDMCommandSerializer::PackWithStartCode
static bool PackWithStartCode(const RDMCommand &command, ola::io::ByteString *output)
Serialize a RDMCommand to a ByteString, with the RDM Start Code.
Definition RDMCommandSerializer.cpp:68
ola::rdm::RDMCommandSerializer::Write
static bool Write(const RDMCommand &command, ola::io::IOStack *stack)
Write the binary representation of an RDMCommand to an IOStack.
Definition RDMCommandSerializer.cpp:102
ola::rdm::RDMCommandSerializer::RequiredSize
static unsigned int RequiredSize(const RDMCommand &command)
Return the number of bytes required to store the serialized version of the RDMCommand.
Definition RDMCommandSerializer.cpp:34
ola::rdm::RDMCommandSerializer::Pack
static bool Pack(const RDMCommand &command, ola::io::ByteString *output)
Serialize a RDMCommand to a ByteString, without the RDM Start Code.
Definition RDMCommandSerializer.cpp:43
ola::rdm
PLASA E1.20 Remote Device Management.
Definition AckTimerResponder.cpp:38
ola
The namespace containing all OLA symbols.
Definition Credentials.cpp:44