NanoOcp
Minimal AES70 / OCP.1 TCP client/server library for d&b Soundscape devices
Loading...
Searching...
No Matches
Ocp1DataTypes.h
Go to the documentation of this file.
1/* Copyright (c) 2024, Bernardo Escalona
2 *
3 * This file is part of NanoOcp <https://github.com/ChristianAhrens/NanoOcp>
4 *
5 * This library is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License version 3.0 as published
7 * by the Free Software Foundation.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19#pragma once
20
21#include <vector> //< USE std::vector
22#include <string> //< USE std::to_string
23#include <cmath> //< USE std::float_t, std::double_t
24
25namespace NanoOcp1
26{
27
36using ByteVector = std::vector<std::uint8_t>;
37
38
88
89
96bool DataToBool(const ByteVector& parameterData, bool* pOk = nullptr);
97
103ByteVector DataFromBool(bool boolValue);
104
112std::int32_t DataToInt32(const ByteVector& parameterData, bool* pOk = nullptr);
113
120ByteVector DataFromInt32(std::int32_t value);
121
129std::uint8_t DataToUint8(const ByteVector& parameterData, bool* pOk = nullptr);
130
137ByteVector DataFromUint8(std::uint8_t value);
138
146std::uint16_t DataToUint16(const ByteVector& parameterData, bool* pOk = nullptr);
147
154ByteVector DataFromUint16(std::uint16_t value);
155
163std::uint32_t DataToUint32(const ByteVector& parameterData, bool* pOk = nullptr);
164
171ByteVector DataFromUint32(std::uint32_t value);
172
180std::uint64_t DataToUint64(const ByteVector& parameterData, bool* pOk = nullptr);
181
188ByteVector DataFromUint64(std::uint64_t value);
189
198std::string DataToString(const ByteVector& parameterData, bool* pOk = nullptr);
199
206ByteVector DataFromString(const std::string& string);
207
215std::float_t DataToFloat(const ByteVector& parameterData, bool* pOk = nullptr);
216
223ByteVector DataFromFloat(std::float_t floatValue);
224
232std::double_t DataToDouble(const ByteVector& parameterData, bool* pOk = nullptr);
233
240ByteVector DataFromDouble(std::double_t doubleValue);
241
250ByteVector DataFromPosition(std::float_t x, std::float_t y, std::float_t z);
251
265ByteVector DataFromAimingAndPosition(std::float_t hor, std::float_t vert, std::float_t rot, std::float_t x, std::float_t y, std::float_t z);
266
267[[deprecated("Use DataFromAimingAndPosition instead, this method will be removed in the future. "
268 "NOTE: The order of the input parameters in the new method has been changed to be more consistent with the marshaling order.")]]
269ByteVector DataFromPositionAndRotation(std::float_t x, std::float_t y, std::float_t z, std::float_t hor, std::float_t vert, std::float_t rot);
270
279ByteVector DataFromOnoForSubscription(std::uint32_t ono, bool add = true);
280
287std::string StatusToString(std::uint8_t status);
288
295std::string DataTypeToString(int dataType);
296
304std::string HandleToString(std::uint32_t handle);
305
312std::uint32_t ReadUint32(const char* buffer);
313
320std::uint32_t ReadUint32(const std::uint8_t* buffer);
321
328std::uint16_t ReadUint16(const char* buffer);
329
336std::uint16_t ReadUint16(const std::uint8_t* buffer);
337
348std::uint32_t GetONo(std::uint32_t type, std::uint32_t record, std::uint32_t channel, std::uint32_t boxAndObjectNumber);
349
361std::uint32_t GetONoTy2(std::uint32_t type, std::uint32_t record, std::uint32_t channel, std::uint32_t boxNumber, std::uint32_t objectNumber);
362
363}
Minimal AES70 / OCP.1 TCP client/server library built on JUCE.
Definition NanoOcp1.cpp:23
std::int32_t DataToInt32(const ByteVector &parameterData, bool *pOk)
ByteVector DataFromOnoForSubscription(std::uint32_t ono, bool add)
std::string HandleToString(std::uint32_t handle)
ByteVector DataFromAimingAndPosition(std::float_t hor, std::float_t vert, std::float_t rot, std::float_t x, std::float_t y, std::float_t z)
std::uint32_t GetONo(std::uint32_t type, std::uint32_t record, std::uint32_t channel, std::uint32_t boxAndObjectNumber)
std::string DataToString(const ByteVector &parameterData, bool *pOk)
std::vector< std::uint8_t > ByteVector
Binary buffer type used throughout NanoOcp for all serialized OCP.1 data.
std::float_t DataToFloat(const ByteVector &parameterData, bool *pOk)
Ocp1DataType
OCA base data type codes, matching OcaBaseDataType in the AES70 specification.
@ OCP1DATATYPE_BOOLEAN
Single byte: 0 = false, non-zero = true.
@ OCP1DATATYPE_CUSTOM
User-defined / vendor-specific type.
@ OCP1DATATYPE_FLOAT64
IEEE 754 double-precision float, big-endian (8 bytes).
@ OCP1DATATYPE_DB_POSITION
d&b-specific 3D position blob (3 × float32); used by deprecated position agent.
@ OCP1DATATYPE_NONE
No type; used as "not set" sentinel.
@ OCP1DATATYPE_INT16
Signed 16-bit integer, big-endian.
@ OCP1DATATYPE_STRING
OCA string: 2-byte big-endian length prefix followed by UTF-8 bytes.
@ OCP1DATATYPE_UINT16
Unsigned 16-bit integer, big-endian.
@ OCP1DATATYPE_INT8
Signed 8-bit integer.
@ OCP1DATATYPE_UINT64
Unsigned 64-bit integer, big-endian.
@ OCP1DATATYPE_UINT32
Unsigned 32-bit integer, big-endian.
@ OCP1DATATYPE_FLOAT32
IEEE 754 single-precision float, big-endian (4 bytes).
@ OCP1DATATYPE_BLOB
Variable-length binary blob; layout is property-specific.
@ OCP1DATATYPE_BLOB_FIXED_LEN
Fixed-length binary blob; size determined by the property definition.
@ OCP1DATATYPE_UINT8
Unsigned 8-bit integer.
@ OCP1DATATYPE_INT64
Signed 64-bit integer, big-endian.
@ OCP1DATATYPE_BIT_STRING
Packed bit string.
@ OCP1DATATYPE_INT32
Signed 32-bit integer, big-endian.
ByteVector DataFromUint64(std::uint64_t intValue)
ByteVector DataFromUint32(std::uint32_t intValue)
ByteVector DataFromFloat(std::float_t floatValue)
ByteVector DataFromBool(bool boolValue)
Convenience helper method to convert a bool into a byte vector.
std::uint8_t DataToUint8(const ByteVector &parameterData, bool *pOk)
std::uint32_t DataToUint32(const ByteVector &parameterData, bool *pOk)
ByteVector DataFromUint16(std::uint16_t value)
std::uint16_t DataToUint16(const ByteVector &parameterData, bool *pOk)
ByteVector DataFromString(const std::string &string)
ByteVector DataFromPositionAndRotation(std::float_t x, std::float_t y, std::float_t z, std::float_t hor, std::float_t vert, std::float_t rot)
ByteVector DataFromDouble(std::double_t doubleValue)
ByteVector DataFromUint8(std::uint8_t value)
std::string DataTypeToString(int dataType)
std::uint32_t ReadUint32(const char *buffer)
ByteVector DataFromInt32(std::int32_t intValue)
std::uint16_t ReadUint16(const char *buffer)
std::double_t DataToDouble(const ByteVector &parameterData, bool *pOk)
std::uint32_t GetONoTy2(std::uint32_t type, std::uint32_t record, std::uint32_t channel, std::uint32_t boxNumber, std::uint32_t objectNumber)
std::string StatusToString(std::uint8_t status)
ByteVector DataFromPosition(std::float_t x, std::float_t y, std::float_t z)
std::uint64_t DataToUint64(const ByteVector &parameterData, bool *pOk)
bool DataToBool(const ByteVector &parameterData, bool *pOk)
Convenience helper method to convert a byte vector into a bool.