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
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
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_
Classes that represent RDM commands.
A RDM unique identifier (UID).
Definition IOStack.h:41
The base class that all RDM requests & responses inherit from.
Definition RDMCommand.h:59
Serializes RDMCommands.
Definition RDMCommandSerializer.h:49
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
static bool Write(const RDMCommand &command, ola::io::IOStack *stack)
Write the binary representation of an RDMCommand to an IOStack.
Definition RDMCommandSerializer.cpp:102
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
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
The namespace containing all OLA symbols.
Definition Credentials.cpp:44
Definition RDMPacket.h:44