NanoOcp
Minimal AES70 / OCP.1 TCP client/server library for d&b Soundscape devices
Loading...
Searching...
No Matches
NanoOcp1 Namespace Reference

Minimal AES70 / OCP.1 TCP client/server library built on JUCE. More...

Namespaces

namespace  Amp5D
 
namespace  AmpDx
 
namespace  AmpDxDy
 
namespace  AmpDy
 
namespace  AmpGeneric
 Object definitions common to all d&b amplifier platforms.
 
namespace  DS100
 OCA object definitions for the d&b audiotechnik DS100 signal engine.
 

Classes

struct  ConnectionStateMessage
 
struct  DataDeliveryMessage
 
class  NanoOcp1Base
 Abstract base class shared by NanoOcp1Client and NanoOcp1Server. More...
 
class  NanoOcp1Client
 OCP.1 TCP client with automatic reconnection. More...
 
class  NanoOcp1Server
 OCP.1 TCP server that accepts a single incoming connection at a time. More...
 
struct  Ocp1CommandDefinition
 Parameter bundle that fully describes one OCA controllable property. More...
 
class  Ocp1CommandResponseRequired
 
class  Ocp1Connection
 Low-level TCP socket manager for a single OCP.1 connection. More...
 
class  Ocp1ConnectionServer
 TCP accept-loop server base class for OCP.1 connections. More...
 
class  Ocp1Header
 
class  Ocp1KeepAlive
 
class  Ocp1Message
 Abstract base class for all OCP.1 protocol messages. More...
 
class  Ocp1Notification
 
class  Ocp1Response
 
class  SafeActionImpl
 
class  Variant
 Type-erased OCA parameter value with built-in marshal/unmarshal support. More...
 

Typedefs

using ByteVector = std::vector< std::uint8_t >
 Binary buffer type used throughout NanoOcp for all serialized OCP.1 data.
 
typedef std::uint32_t BoxAndObjNo
 Shorthand for the combined box-and-object-number part of an ONo.
 

Enumerations

enum  Ocp1DataType {
  OCP1DATATYPE_NONE = 0 ,
  OCP1DATATYPE_BOOLEAN = 1 ,
  OCP1DATATYPE_INT8 = 2 ,
  OCP1DATATYPE_INT16 = 3 ,
  OCP1DATATYPE_INT32 = 4 ,
  OCP1DATATYPE_INT64 = 5 ,
  OCP1DATATYPE_UINT8 = 6 ,
  OCP1DATATYPE_UINT16 = 7 ,
  OCP1DATATYPE_UINT32 = 8 ,
  OCP1DATATYPE_UINT64 = 9 ,
  OCP1DATATYPE_FLOAT32 = 10 ,
  OCP1DATATYPE_FLOAT64 = 11 ,
  OCP1DATATYPE_STRING = 12 ,
  OCP1DATATYPE_BIT_STRING = 13 ,
  OCP1DATATYPE_BLOB = 14 ,
  OCP1DATATYPE_BLOB_FIXED_LEN = 15 ,
  OCP1DATATYPE_DB_POSITION = 32 ,
  OCP1DATATYPE_CUSTOM = 128
}
 OCA base data type codes, matching OcaBaseDataType in the AES70 specification. More...
 

Functions

static constexpr std::uint8_t uint8_8 (8)
 
static constexpr std::uint8_t uint8_16 (16)
 
static constexpr std::uint8_t uint8_24 (24)
 
static constexpr std::uint8_t uint8_32 (32)
 
static constexpr std::uint8_t uint8_40 (40)
 
static constexpr std::uint8_t uint8_48 (48)
 
static constexpr std::uint8_t uint8_56 (56)
 
bool DataToBool (const ByteVector &parameterData, bool *pOk=nullptr)
 Convenience helper method to convert a byte vector into a bool.
 
ByteVector DataFromBool (bool boolValue)
 Convenience helper method to convert a bool into a byte vector.
 
std::int32_t DataToInt32 (const ByteVector &parameterData, bool *pOk)
 
ByteVector DataFromInt32 (std::int32_t intValue)
 
std::uint8_t DataToUint8 (const ByteVector &parameterData, bool *pOk)
 
ByteVector DataFromUint8 (std::uint8_t value)
 
std::uint16_t DataToUint16 (const ByteVector &parameterData, bool *pOk)
 
ByteVector DataFromUint16 (std::uint16_t value)
 
std::uint32_t DataToUint32 (const ByteVector &parameterData, bool *pOk)
 
ByteVector DataFromUint32 (std::uint32_t intValue)
 
std::uint64_t DataToUint64 (const ByteVector &parameterData, bool *pOk)
 
ByteVector DataFromUint64 (std::uint64_t intValue)
 
std::string DataToString (const ByteVector &parameterData, bool *pOk)
 
ByteVector DataFromString (const std::string &string)
 
std::float_t DataToFloat (const ByteVector &parameterData, bool *pOk)
 
ByteVector DataFromFloat (std::float_t floatValue)
 
std::double_t DataToDouble (const ByteVector &parameterData, bool *pOk)
 
ByteVector DataFromDouble (std::double_t doubleValue)
 
ByteVector DataFromPosition (std::float_t x, std::float_t y, std::float_t z)
 
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 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)
 
ByteVector DataFromOnoForSubscription (std::uint32_t ono, bool add)
 
std::string StatusToString (std::uint8_t status)
 
std::string DataTypeToString (int dataType)
 
std::string HandleToString (std::uint32_t handle)
 
std::uint32_t ReadUint32 (const char *buffer)
 
std::uint32_t ReadUint32 (const std::uint8_t *buffer)
 
std::uint16_t ReadUint16 (const char *buffer)
 
std::uint16_t ReadUint16 (const std::uint8_t *buffer)
 
std::uint32_t GetONo (std::uint32_t type, std::uint32_t record, std::uint32_t channel, std::uint32_t boxAndObjectNumber)
 
std::uint32_t GetONoTy2 (std::uint32_t type, std::uint32_t record, std::uint32_t channel, std::uint32_t boxNumber, std::uint32_t objectNumber)
 

Variables

AES70 class definition levels

Inheritance-depth constants used as m_propertyDefLevel in Ocp1CommandDefinition.

In AES70 every property is defined at a specific level in the OCA class hierarchy. The def-level is the number of classes between OcaRoot (level 1) and the class that introduces the property. NanoOcp uses these constants to build the correct Ocp1CommandDefinition::m_propertyDefLevel fields.

Example: OcaGain inherits OcaRoot → OcaWorker → OcaActuator → OcaGain, so DefLevel_OcaGain = 4. The Prop_Gain property in OcaGain therefore has m_propertyDefLevel = 4.

static constexpr int DefLevel_OcaRoot = 1
 
static constexpr int DefLevel_OcaAgent = 1 + DefLevel_OcaRoot
 
static constexpr int DefLevel_OcaWorker = 1 + DefLevel_OcaRoot
 
static constexpr int DefLevel_OcaActuator = 1 + DefLevel_OcaWorker
 
static constexpr int DefLevel_OcaPolarity = 1 + DefLevel_OcaActuator
 
static constexpr int DefLevel_OcaSwitch = 1 + DefLevel_OcaActuator
 
static constexpr int DefLevel_OcaGain = 1 + DefLevel_OcaActuator
 
static constexpr int DefLevel_OcaMute = 1 + DefLevel_OcaActuator
 
static constexpr int DefLevel_OcaDelay = 1 + DefLevel_OcaActuator
 
static constexpr int DefLevel_OcaBasicActuator = 1 + DefLevel_OcaActuator
 
static constexpr int DefLevel_OcaInt32Actuator = 1 + DefLevel_OcaBasicActuator
 
static constexpr int DefLevel_OcaFloat32Actuator = 1 + DefLevel_OcaBasicActuator
 
static constexpr int DefLevel_OcaStringActuator = 1 + DefLevel_OcaBasicActuator
 
static constexpr int DefLevel_OcaSensor = 1 + DefLevel_OcaWorker
 
static constexpr int DefLevel_OcaLevelSensor = 1 + DefLevel_OcaSensor
 
static constexpr int DefLevel_OcaAudioLevelSensor = 1 + DefLevel_OcaLevelSensor
 
static constexpr int DefLevel_OcaBasicSensor = 1 + DefLevel_OcaSensor
 
static constexpr int DefLevel_OcaBooleanSensor = 1 + DefLevel_OcaBasicSensor
 
static constexpr int DefLevel_OcaInt32Sensor = 1 + DefLevel_OcaBasicSensor
 
static constexpr int DefLevel_OcaStringSensor = 1 + DefLevel_OcaBasicSensor
 
static constexpr int DefLevel_dbOcaDataTransfer = 1 + DefLevel_OcaAgent
 d&b data-transfer agent (DS100 scene control).
 
static constexpr int DefLevel_dbOcaSceneAgent = 1 + DefLevel_dbOcaDataTransfer
 DS100 scene agent, extends dbOcaDataTransfer.
 
static constexpr int DefLevel_dbOcaPositionAgentDeprecated = 1 + DefLevel_OcaAgent
 Deprecated d&b 3D position agent (pre-firmware DB000CD0).
 
static constexpr int DefLevel_dbOcaSpeakerPositionAgentDeprecated = 1 + DefLevel_dbOcaPositionAgentDeprecated
 Deprecated d&b speaker-position agent.
 

Detailed Description

Minimal AES70 / OCP.1 TCP client/server library built on JUCE.

Overview

NanoOcp is a lightweight implementation of the OCA (Open Control Architecture) wire protocol OCP.1 (TCP framing) from the AES70 standard. It is intentionally "nano" — no object database, no root-block management, no full AES70 compliance — just enough to send and receive OCA commands, responses, notifications, and keep-alives over a plain TCP socket.

Key concepts

Concept Description
ONo (Object Number) 32-bit identifier that uniquely addresses one controllable parameter on an OCA device. Generated via GetONo() / GetONoTy2() from type, record, channel, and box/object numbers.
Command A client-to-device message. Ocp1CommandResponseRequired carries a handle so the response can be correlated.
Response Device reply to a command. The handle in the response matches the originating command handle.
Notification Unsolicited device-to-client message fired when a subscribed property changes. Matched to a subscription via ONo + def-level + property-index.
KeepAlive Heartbeat exchanged in both directions to detect dropped connections.
AddSubscription Command that registers interest in a property: the device will send Notifications whenever that property changes.

Typical usage pattern (client side, as used by <tt>DeviceController</tt> in Umsci)

// 1. Create client, choose whether callbacks fire on the JUCE message thread
// callbacksOnMessageThread=false: callbacks fire on the socket thread
auto client = std::make_unique<NanoOcp1::NanoOcp1Client>(
"192.168.1.100", 50014, false);
// 2. Wire up callbacks BEFORE start()
client->onConnectionEstablished = [this]() { handleConnected(); };
client->onConnectionLost = [this]() { handleDisconnected(); };
client->onDataReceived = [this](const NanoOcp1::ByteVector& data) -> bool {
if (!msg) return false;
if (msg->GetMessageType() == NanoOcp1::Ocp1Message::Notification) {
auto* notif = static_cast<NanoOcp1::Ocp1Notification*>(msg.get());
// match notif->GetEmitterOno() against your subscription table …
}
return true;
};
// 3. Start — begins reconnect timer; first successful TCP connect fires onConnectionEstablished
client->start();
// 4. Subscribe to a property (e.g. source position of sound object 5 on a DS100)
std::uint32_t subHandle;
auto subCmd = NanoOcp1::Ocp1CommandResponseRequired(posDef.AddSubscriptionCommand(), subHandle);
client->sendData(subCmd.GetSerializedData());
// 5. Get the current value
std::uint32_t getHandle;
auto getCmd = NanoOcp1::Ocp1CommandResponseRequired(posDef.GetValueCommand(), getHandle);
client->sendData(getCmd.GetSerializedData());
// 6. Set a new value
NanoOcp1::Variant newPos(0.5f, 0.5f, 0.0f); // x, y, z normalised
std::uint32_t setHandle;
posDef.SetValueCommand(newPos), setHandle);
client->sendData(setCmd.GetSerializedData());
@ Notification
Unsolicited property change from device to client.
static std::unique_ptr< Ocp1Message > UnmarshalOcp1Message(const ByteVector &receivedData)
Type-erased OCA parameter value with built-in marshal/unmarshal support.
Definition Variant.h:102
std::vector< std::uint8_t > ByteVector
Binary buffer type used throughout NanoOcp for all serialized OCP.1 data.
OCA definition for a sound object's 3D position in real-world space (En-Scene).

Threading model

NanoOcp1Client runs its socket I/O on a dedicated Ocp1Connection::ConnectionThread. When callbacksOnMessageThread=false (as DeviceController uses), all three callbacks (onDataReceived, onConnectionEstablished, onConnectionLost) fire on the socket thread. When callbacksOnMessageThread=true, they are marshaled to the JUCE message thread via juce::MessageManager::callAsync.

File map

Header Contents
NanoOcp1.h NanoOcp1Client, NanoOcp1Server, NanoOcp1Base
Ocp1Connection.h Raw TCP socket management (abstract)
Ocp1ConnectionServer.h Accept-loop server
Ocp1Message.h Message structs and factory; Ocp1CommandDefinition
Ocp1DataTypes.h ByteVector, Ocp1DataType, marshal/unmarshal helpers
Variant.h Type-erased OCA value with marshal/unmarshal
Ocp1ObjectDefinitions.h Generic d&b amp object definitions (AmpGeneric/DxDy/5D)
Ocp1DS100ObjectDefinitions.h DS100-specific object definitions (namespace DS100)

Typedef Documentation

◆ BoxAndObjNo

typedef std::uint32_t NanoOcp1::BoxAndObjNo

Shorthand for the combined box-and-object-number part of an ONo.

An OCA Object Number (ONo) encodes type, record, channel, and a boxAndObjectNumber packed together by GetONo(). The BoxAndObjNo constants in each device namespace (e.g. DS100::Fixed_GUID = 0x0f) are the boxAndObjectNumber argument to GetONo(). Concrete dbOcaObjectDef_* structs call GetONo() in their constructors so callers never need to compose ONos manually.

Definition at line 38 of file Ocp1ObjectDefinitions.h.

◆ ByteVector

typedef std::vector< std::uint8_t > NanoOcp1::ByteVector

Binary buffer type used throughout NanoOcp for all serialized OCP.1 data.

Every Ocp1Message::GetSerializedData(), DataFromX(), and Variant::ToParamData() returns a ByteVector. The sendData() / sendMessage() methods also take one. This is a drop-in replacement for juce::MemoryBlock that avoids the JUCE dependency in the data-layer headers.

Definition at line 36 of file Ocp1DataTypes.h.

Enumeration Type Documentation

◆ Ocp1DataType

OCA base data type codes, matching OcaBaseDataType in the AES70 specification.

Each Ocp1CommandDefinition stores a m_propertyType from this enum, which tells the marshaling helpers how to encode/decode the property value:

Value Name C++ type Byte width
0 NONE
1 BOOLEAN bool 1
2–5 INT8/16/32/64 int8–64_t 1–8
6–9 UINT8/16/32/64 uint8–64_t 1–8
10 FLOAT32 float_t 4
11 FLOAT64 double_t 8
12 STRING std::string 2 (len) + N
13 BIT_STRING variable
14 BLOB ByteVector variable
15 BLOB_FIXED_LEN ByteVector fixed
32 DB_POSITION 3 × float_t 12 — used by CdbOcaPositionAgentDeprecated
128 CUSTOM user-defined

In Ocp1DS100ObjectDefinitions.h, most DS100 spatial properties use OCP1DATATYPE_BLOB with a known fixed layout (e.g. 3 × 4-byte floats for XYZ, 6 × 4-byte floats for aiming+position). Variant::ToPosition() and Variant::ToAimingAndPosition() decode those layouts.

Values match OcaBaseDataType in the Bosch AES70 reference implementation.

Enumerator
OCP1DATATYPE_NONE 

No type; used as "not set" sentinel.

OCP1DATATYPE_BOOLEAN 

Single byte: 0 = false, non-zero = true.

OCP1DATATYPE_INT8 

Signed 8-bit integer.

OCP1DATATYPE_INT16 

Signed 16-bit integer, big-endian.

OCP1DATATYPE_INT32 

Signed 32-bit integer, big-endian.

OCP1DATATYPE_INT64 

Signed 64-bit integer, big-endian.

OCP1DATATYPE_UINT8 

Unsigned 8-bit integer.

OCP1DATATYPE_UINT16 

Unsigned 16-bit integer, big-endian.

OCP1DATATYPE_UINT32 

Unsigned 32-bit integer, big-endian.

OCP1DATATYPE_UINT64 

Unsigned 64-bit integer, big-endian.

OCP1DATATYPE_FLOAT32 

IEEE 754 single-precision float, big-endian (4 bytes).

OCP1DATATYPE_FLOAT64 

IEEE 754 double-precision float, big-endian (8 bytes).

OCP1DATATYPE_STRING 

OCA string: 2-byte big-endian length prefix followed by UTF-8 bytes.

OCP1DATATYPE_BIT_STRING 

Packed bit string.

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_DB_POSITION 

d&b-specific 3D position blob (3 × float32); used by deprecated position agent.

OCP1DATATYPE_CUSTOM 

User-defined / vendor-specific type.

Definition at line 67 of file Ocp1DataTypes.h.

Function Documentation

◆ DataFromAimingAndPosition()

ByteVector NanoOcp1::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 
)

Convenience helper method to convert a 3D aiming and position (six 32-bit floats) into a byte vector

Note
The aiming angles are marshaled first and the position second, to keep in line with the CdbOcaAimingAndPosition::Marshal method.
Parameters
[in]horHorizontal aiming (yaw).
[in]vertVertical aiming (pitch).
[in]rotRotational aiming (roll).
[in]xPosition along x axis.
[in]yPosition along y axis.
[in]zPosition along z axis.
Returns
The values as a byte vector.

Definition at line 367 of file Ocp1DataTypes.cpp.

Referenced by DataFromPositionAndRotation().

◆ DataFromBool()

ByteVector NanoOcp1::DataFromBool ( bool  boolValue)

Convenience helper method to convert a bool into a byte vector.

Parameters
boolValueValue to be converted.
Returns
The value as a byte vector.

Definition at line 57 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataFromDouble()

ByteVector NanoOcp1::DataFromDouble ( std::double_t  doubleValue)

Convenience helper method to convert a 64-bit double into a byte vector

Parameters
[in]doubleValueValue to be converted.
Returns
The value as a byte vector.

Definition at line 318 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataFromFloat()

ByteVector NanoOcp1::DataFromFloat ( std::float_t  floatValue)

Convenience helper method to convert a 32-bit float into a byte vector

Parameters
[in]floatValueValue to be converted.
Returns
The value as a byte vector.

Definition at line 275 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataFromInt32()

ByteVector NanoOcp1::DataFromInt32 ( std::int32_t  value)

Convenience helper method to convert a Int32 into a byte vector

Parameters
[in]valueValue to be converted.
Returns
The value as a byte vector.

Definition at line 83 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataFromOnoForSubscription()

ByteVector NanoOcp1::DataFromOnoForSubscription ( std::uint32_t  ono,
bool  add = true 
)

Convenience helper method to generate a byte vector containing the parameters necessary for an AddSubscription or RemoveSubscription command for a given object.

Parameters
[in]onoONo of the object that the subscription shall be added or removed for.
[in]addTrue to generate a AddSubscription command. False to generate a RemoveSubscription command.
Returns
The parameters as a byte vector.

Definition at line 413 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Ocp1CommandDefinition::AddSubscriptionCommand(), and NanoOcp1::Ocp1CommandDefinition::RemoveSubscriptionCommand().

◆ DataFromPosition()

ByteVector NanoOcp1::DataFromPosition ( std::float_t  x,
std::float_t  y,
std::float_t  z 
)

Convenience helper method to convert a 3D position (three 32-bit floats) into a byte vector

Parameters
[in]xPosition along x axis.
[in]yPosition along y axis.
[in]zPosition along z axis.
Returns
The values as a byte vector.

Definition at line 336 of file Ocp1DataTypes.cpp.

◆ DataFromPositionAndRotation()

ByteVector NanoOcp1::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 
)

Definition at line 362 of file Ocp1DataTypes.cpp.

References DataFromAimingAndPosition().

◆ DataFromString()

ByteVector NanoOcp1::DataFromString ( const std::string &  string)

Convenience helper method to convert a std::string into a byte vector

Parameters
[in]stringstd::string to be converted.
Returns
The value as a byte vector.

Definition at line 235 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataFromUint16()

ByteVector NanoOcp1::DataFromUint16 ( std::uint16_t  value)

Convenience helper method to convert a Uint16 into a byte vector

Parameters
[in]valueValue to be converted.
Returns
The value as a byte vector.

Definition at line 142 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataFromUint32()

ByteVector NanoOcp1::DataFromUint32 ( std::uint32_t  value)

Convenience helper method to convert a Uint32 into a byte vector

Parameters
[in]valueValue to be converted.
Returns
The value as a byte vector.

Definition at line 171 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::DS100::dbOcaObjectDef_SceneAgent::ApplyCommand(), NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataFromUint64()

ByteVector NanoOcp1::DataFromUint64 ( std::uint64_t  value)

Convenience helper method to convert a Uint64 into a byte vector

Parameters
[in]valueValue to be converted.
Returns
The value as a byte vector.

Definition at line 204 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataFromUint8()

ByteVector NanoOcp1::DataFromUint8 ( std::uint8_t  value)

Convenience helper method to convert a Uint8 into a byte vector

Parameters
[in]valueValue to be converted.
Returns
The value as a byte vector.

Definition at line 113 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToByteVector(), and NanoOcp1::Variant::ToParamData().

◆ DataToBool()

bool NanoOcp1::DataToBool ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a bool.

Parameters
parameterDataVector of bytes containing the value to be converted.
pOkOptional parameter to verify if the conversion was successful.
Returns
The value contained in the parameterData as bool.

Definition at line 39 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToBool(), NanoOcp1::Variant::ToBoolVector(), and NanoOcp1::Variant::Variant().

◆ DataToDouble()

std::double_t NanoOcp1::DataToDouble ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a 64-bit double.

Parameters
[in]parameterDataVector of bytes containing the value to be converted.
[in]pOkOptional parameter to verify if the conversion was successful.
Returns
The value contained in the parameterData as a double.

Definition at line 291 of file Ocp1DataTypes.cpp.

References uint8_16(), uint8_24(), uint8_32(), uint8_40(), uint8_48(), uint8_56(), and uint8_8().

Referenced by NanoOcp1::Variant::ToDouble(), and NanoOcp1::Variant::Variant().

◆ DataToFloat()

std::float_t NanoOcp1::DataToFloat ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a 32-bit float.

Parameters
[in]parameterDataVector of bytes containing the value to be converted.
[in]pOkOptional parameter to verify if the conversion was successful.
Returns
The value contained in the parameterData as a float.

Definition at line 253 of file Ocp1DataTypes.cpp.

References uint8_16(), uint8_24(), and uint8_8().

Referenced by NanoOcp1Demo::MainComponent::OnOcp1MessageReceived(), NanoOcp1::Variant::ToAimingAndPosition(), NanoOcp1::Variant::ToFloat(), NanoOcp1::Variant::ToPosition(), and NanoOcp1::Variant::Variant().

◆ DataToInt32()

std::int32_t NanoOcp1::DataToInt32 ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a Int32

Parameters
[in]parameterDataVector of bytes containing the value to be converted.
[in]pOkOptional parameter to verify if the conversion was successful.
Returns
The value contained in the parameterData as a Int32.

Definition at line 62 of file Ocp1DataTypes.cpp.

References uint8_16(), uint8_24(), and uint8_8().

Referenced by NanoOcp1::Variant::ToInt32(), and NanoOcp1::Variant::Variant().

◆ DataToString()

std::string NanoOcp1::DataToString ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a std::string

Parameters
[in]parameterDataVector of bytes containing the string to be converted. Note that the first two bytes contain the string's length.
[in]pOkOptional parameter to verify if the conversion was successful.
Returns
The string contained in the parameterData as a std::string.

Definition at line 219 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1Demo::MainComponent::OnOcp1MessageReceived(), NanoOcp1::Variant::ToString(), and NanoOcp1::Variant::Variant().

◆ DataToUint16()

std::uint16_t NanoOcp1::DataToUint16 ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a Uint16

Parameters
[in]parameterDataVector of bytes containing the value to be converted.
[in]pOkOptional parameter to verify if the conversion was successful.
Returns
The value contained in the parameterData as a Uint16.

Definition at line 122 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Ocp1KeepAlive::GetHeartBeatSeconds(), NanoOcp1Demo::MainComponent::OnOcp1MessageReceived(), NanoOcp1::Variant::ToBoolVector(), NanoOcp1::Variant::ToStringVector(), NanoOcp1::Variant::ToUInt16(), and NanoOcp1::Variant::Variant().

◆ DataToUint32()

std::uint32_t NanoOcp1::DataToUint32 ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a Uint32

Parameters
[in]parameterDataVector of bytes containing the value to be converted.
[in]pOkOptional parameter to verify if the conversion was successful.
Returns
The value contained in the parameterData as a Uint32.

Definition at line 151 of file Ocp1DataTypes.cpp.

References uint8_16(), uint8_24(), and uint8_8().

Referenced by NanoOcp1::Ocp1KeepAlive::GetHeartBeatMilliseconds(), NanoOcp1Demo::MainComponent::OnOcp1MessageReceived(), NanoOcp1::Variant::ToUInt32(), and NanoOcp1::Variant::Variant().

◆ DataToUint64()

std::uint64_t NanoOcp1::DataToUint64 ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a Uint64

Parameters
[in]parameterDataVector of bytes containing the value to be converted.
[in]pOkOptional parameter to verify if the conversion was successful.
Returns
The value contained in the parameterData as a Uint64.

Definition at line 184 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToUInt64(), and NanoOcp1::Variant::Variant().

◆ DataToUint8()

std::uint8_t NanoOcp1::DataToUint8 ( const ByteVector parameterData,
bool *  pOk = nullptr 
)

Convenience helper method to convert a byte vector into a Uint8

Parameters
[in]parameterDataVector of bytes containing the value to be converted.
[in]pOkOptional parameter to verify if the conversion was successful.
Returns
The value contained in the parameterData as a Uint8.

Definition at line 96 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1::Variant::ToUInt8(), and NanoOcp1::Variant::Variant().

◆ DataTypeToString()

std::string NanoOcp1::DataTypeToString ( int  dataType)

Convenience method to convert an integer representing an Ocp1DataType to its string representation.

Parameters
[in]dataTypeInteger representing an Ocp1DataType.
Returns
The string representation of the Ocp1DataType.

Definition at line 515 of file Ocp1DataTypes.cpp.

References OCP1DATATYPE_BIT_STRING, OCP1DATATYPE_BLOB, OCP1DATATYPE_BLOB_FIXED_LEN, OCP1DATATYPE_BOOLEAN, OCP1DATATYPE_CUSTOM, OCP1DATATYPE_DB_POSITION, OCP1DATATYPE_FLOAT32, OCP1DATATYPE_FLOAT64, OCP1DATATYPE_INT16, OCP1DATATYPE_INT32, OCP1DATATYPE_INT64, OCP1DATATYPE_INT8, OCP1DATATYPE_STRING, OCP1DATATYPE_UINT16, OCP1DATATYPE_UINT32, OCP1DATATYPE_UINT64, and OCP1DATATYPE_UINT8.

◆ GetONo()

std::uint32_t NanoOcp1::GetONo ( std::uint32_t  type,
std::uint32_t  record,
std::uint32_t  channel,
std::uint32_t  boxAndObjectNumber 
)

Convenience method to generate a unique target object number. This is the method to use when addressing regular amp objects.

Parameters
[in]typeThe object type.
[in]recordThe object record number value.
[in]channelThe object channel number value.
[in]boxAndObjectNumberThe aggregate box and target number.
Returns
The object ONo.

Definition at line 627 of file Ocp1DataTypes.cpp.

◆ GetONoTy2()

std::uint32_t NanoOcp1::GetONoTy2 ( std::uint32_t  type,
std::uint32_t  record,
std::uint32_t  channel,
std::uint32_t  boxNumber,
std::uint32_t  objectNumber 
)

Convenience method to generate a unique target object number. This is the method to use when addressing newer Matrix type object (to be confirmed).

Parameters
[in]typeThe object type.
[in]recordThe object record number value.
[in]channelThe object channel number value.
[in]boxNumberThe objects box number.
[in]objectNumberThe objects target number.
Returns
The object ONo.

Definition at line 635 of file Ocp1DataTypes.cpp.

◆ HandleToString()

std::string NanoOcp1::HandleToString ( std::uint32_t  handle)

Convenience method to convert an integer representing an OCA Response handle to its string representation. It will return std::string(handle) most of the time, except in cases OCA_INVALID_SESSIONID and OCA_LOCAL_SESSIONID.

Parameters
[in]handleOCA Response handle.
Returns
The string representation of the handle.

Definition at line 579 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1Demo::MainComponent::MainComponent(), and NanoOcp1Demo::MainComponent::OnOcp1MessageReceived().

◆ ReadUint16() [1/2]

std::uint16_t NanoOcp1::ReadUint16 ( const char *  buffer)

Convenience method to read 2 bytes from a buffer.

Parameters
[in]bufferPointer to the start of the data to be read.
Returns
Resulting 2 bytes as an uint16_t.

Definition at line 615 of file Ocp1DataTypes.cpp.

References uint8_8().

Referenced by NanoOcp1::Ocp1Header::Ocp1Header(), and NanoOcp1::Ocp1Message::UnmarshalOcp1Message().

◆ ReadUint16() [2/2]

std::uint16_t NanoOcp1::ReadUint16 ( const std::uint8_t *  buffer)

Convenience method to read 2 bytes from a buffer.

Parameters
[in]bufferPointer to the start of the data to be read.
Returns
Resulting 2 bytes as an uint16_t.

Definition at line 621 of file Ocp1DataTypes.cpp.

References uint8_8().

◆ ReadUint32() [1/2]

std::uint32_t NanoOcp1::ReadUint32 ( const char *  buffer)

Convenience method to read 4 bytes from a buffer.

Parameters
[in]bufferPointer to the start of the data to be read.
Returns
Resulting 4 bytes as an uint32_t.

Definition at line 599 of file Ocp1DataTypes.cpp.

References uint8_16(), uint8_24(), and uint8_8().

Referenced by NanoOcp1::Ocp1Header::Ocp1Header(), and NanoOcp1::Ocp1Message::UnmarshalOcp1Message().

◆ ReadUint32() [2/2]

std::uint32_t NanoOcp1::ReadUint32 ( const std::uint8_t *  buffer)

Convenience method to read 4 bytes from a buffer.

Parameters
[in]bufferPointer to the start of the data to be read.
Returns
Resulting 4 bytes as an uint32_t.

Definition at line 607 of file Ocp1DataTypes.cpp.

References uint8_16(), uint8_24(), and uint8_8().

◆ StatusToString()

std::string NanoOcp1::StatusToString ( std::uint8_t  status)

Convenience method to convert an integer representing an OcaStatus to its string representation.

Parameters
[in]statusInteger representing an OcaStatus.
Returns
The string representation of the OcaStatus.

Definition at line 453 of file Ocp1DataTypes.cpp.

Referenced by NanoOcp1Demo::MainComponent::OnOcp1MessageReceived().

◆ uint8_16()

static constexpr std::uint8_t NanoOcp1::uint8_16 ( 16  )
staticconstexpr

◆ uint8_24()

static constexpr std::uint8_t NanoOcp1::uint8_24 ( 24  )
staticconstexpr

◆ uint8_32()

static constexpr std::uint8_t NanoOcp1::uint8_32 ( 32  )
staticconstexpr

Referenced by DataToDouble().

◆ uint8_40()

static constexpr std::uint8_t NanoOcp1::uint8_40 ( 40  )
staticconstexpr

Referenced by DataToDouble().

◆ uint8_48()

static constexpr std::uint8_t NanoOcp1::uint8_48 ( 48  )
staticconstexpr

Referenced by DataToDouble().

◆ uint8_56()

static constexpr std::uint8_t NanoOcp1::uint8_56 ( 56  )
staticconstexpr

Referenced by DataToDouble().

◆ uint8_8()

static constexpr std::uint8_t NanoOcp1::uint8_8 ( )
staticconstexpr

Variable Documentation

◆ DefLevel_dbOcaDataTransfer

constexpr int NanoOcp1::DefLevel_dbOcaDataTransfer = 1 + DefLevel_OcaAgent
staticconstexpr

d&b data-transfer agent (DS100 scene control).

Definition at line 75 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_dbOcaPositionAgentDeprecated

constexpr int NanoOcp1::DefLevel_dbOcaPositionAgentDeprecated = 1 + DefLevel_OcaAgent
staticconstexpr

Deprecated d&b 3D position agent (pre-firmware DB000CD0).

Definition at line 77 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_dbOcaSceneAgent

constexpr int NanoOcp1::DefLevel_dbOcaSceneAgent = 1 + DefLevel_dbOcaDataTransfer
staticconstexpr

DS100 scene agent, extends dbOcaDataTransfer.

Definition at line 76 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_dbOcaSpeakerPositionAgentDeprecated

constexpr int NanoOcp1::DefLevel_dbOcaSpeakerPositionAgentDeprecated = 1 + DefLevel_dbOcaPositionAgentDeprecated
staticconstexpr

Deprecated d&b speaker-position agent.

Definition at line 78 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaActuator

constexpr int NanoOcp1::DefLevel_OcaActuator = 1 + DefLevel_OcaWorker
staticconstexpr

Definition at line 57 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaAgent

constexpr int NanoOcp1::DefLevel_OcaAgent = 1 + DefLevel_OcaRoot
staticconstexpr

Definition at line 55 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaAudioLevelSensor

constexpr int NanoOcp1::DefLevel_OcaAudioLevelSensor = 1 + DefLevel_OcaLevelSensor
staticconstexpr

Definition at line 69 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaBasicActuator

constexpr int NanoOcp1::DefLevel_OcaBasicActuator = 1 + DefLevel_OcaActuator
staticconstexpr

Definition at line 63 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaBasicSensor

constexpr int NanoOcp1::DefLevel_OcaBasicSensor = 1 + DefLevel_OcaSensor
staticconstexpr

Definition at line 70 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaBooleanSensor

constexpr int NanoOcp1::DefLevel_OcaBooleanSensor = 1 + DefLevel_OcaBasicSensor
staticconstexpr

Definition at line 71 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaDelay

constexpr int NanoOcp1::DefLevel_OcaDelay = 1 + DefLevel_OcaActuator
staticconstexpr

Definition at line 62 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaFloat32Actuator

constexpr int NanoOcp1::DefLevel_OcaFloat32Actuator = 1 + DefLevel_OcaBasicActuator
staticconstexpr

Definition at line 65 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaGain

constexpr int NanoOcp1::DefLevel_OcaGain = 1 + DefLevel_OcaActuator
staticconstexpr

Definition at line 60 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaInt32Actuator

constexpr int NanoOcp1::DefLevel_OcaInt32Actuator = 1 + DefLevel_OcaBasicActuator
staticconstexpr

Definition at line 64 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaInt32Sensor

constexpr int NanoOcp1::DefLevel_OcaInt32Sensor = 1 + DefLevel_OcaBasicSensor
staticconstexpr

Definition at line 72 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaLevelSensor

constexpr int NanoOcp1::DefLevel_OcaLevelSensor = 1 + DefLevel_OcaSensor
staticconstexpr

Definition at line 68 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaMute

constexpr int NanoOcp1::DefLevel_OcaMute = 1 + DefLevel_OcaActuator
staticconstexpr

Definition at line 61 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaPolarity

constexpr int NanoOcp1::DefLevel_OcaPolarity = 1 + DefLevel_OcaActuator
staticconstexpr

Definition at line 58 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaRoot

constexpr int NanoOcp1::DefLevel_OcaRoot = 1
staticconstexpr

Definition at line 54 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaSensor

constexpr int NanoOcp1::DefLevel_OcaSensor = 1 + DefLevel_OcaWorker
staticconstexpr

Definition at line 67 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaStringActuator

constexpr int NanoOcp1::DefLevel_OcaStringActuator = 1 + DefLevel_OcaBasicActuator
staticconstexpr

Definition at line 66 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaStringSensor

constexpr int NanoOcp1::DefLevel_OcaStringSensor = 1 + DefLevel_OcaBasicSensor
staticconstexpr

Definition at line 73 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaSwitch

constexpr int NanoOcp1::DefLevel_OcaSwitch = 1 + DefLevel_OcaActuator
staticconstexpr

Definition at line 59 of file Ocp1ObjectDefinitions.h.

◆ DefLevel_OcaWorker

constexpr int NanoOcp1::DefLevel_OcaWorker = 1 + DefLevel_OcaRoot
staticconstexpr

Definition at line 56 of file Ocp1ObjectDefinitions.h.