1
0
Fork 0

project restructure + version bump 0.2.0

This commit is contained in:
Kevin Matz 2021-08-24 18:10:20 -04:00
parent 8d24b8b7a1
commit db5f007d22
102 changed files with 2001 additions and 932 deletions

View File

@ -1,127 +1,34 @@
cmake_minimum_required(VERSION 3.20)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# set the project name and version
project(ESTA VERSION 0.1.1 LANGUAGES CXX)
project(OpenLCP VERSION 0.2.0 LANGUAGES CXX)
set(DEFAULT_BUILD_TYPE "Release")
configure_file(config.h.in config.h)
add_compile_definitions(BUILT_WITH_CMAKE)
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC OFF)
set(CMAKE_AUTOMOC OFF)
set(CMAKE_AUTORCC OFF)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
endif()
set(CMAKE_AUTOUIC OFF)
set(CMAKE_AUTOMOC OFF)
set(CMAKE_AUTORCC OFF)
add_compile_definitions(BUILT_WITH_CMAKE)
configure_file(config.h.in config.h)
set(SOURCE_FILES
acn/appliance.cpp
acn/appliance.h
acn/component.h
acn/dmp.cpp
acn/dmp.h
acn/pdu-stream.cpp
acn/pdu-stream.h
acn/pdu.cpp
acn/pdu.h
acn/rlp-tcp.cpp
acn/rlp-tcp.h
acn/rlp-udp.cpp
acn/rlp-udp.h
acn/rlp.cpp
acn/rlp.h
acn/sdt-channel.h
acn/sdt-channel.cpp
acn/sdt-session.h
acn/sdt-session.cpp
acn/sdt-udp.cpp
acn/sdt-udp.h
acn/sdt.cpp
acn/sdt.h
dmx/device.h
dmx/device.cpp
dmx/dmx.h
dmx/personality.h
dmx/personality.cpp
dmx/universe.cpp
dmx/universe.h
otp/advertisement.h
otp/advertisement.cpp
otp/base.h
otp/base.cpp
otp/otp.h
otp/pdu.h
otp/pdu.cpp
otp/transform.h
otp/transform.cpp
rdm/controller.h
rdm/controller.cpp
rdm/device.h
rdm/device.cpp
rdm/E1.37-1.h
rdm/E1.37-2.h
rdm/E1.37-7.h
rdm/message.h
rdm/message.cpp
rdm/parameter.h
rdm/parameter.cpp
rdm/rdm.h
rdm/rdm.cpp
rdm/responder.h
rdm/responder.cpp
rdm/sensor.h
rdm/sensor.cpp
rdm/status.h
rdm/uid.h
rdmnet/broker-protocol.h
rdmnet/broker-protocol.cpp
rdmnet/broker.h
rdmnet/broker.cpp
rdmnet/client.h
rdmnet/client.cpp
rdmnet/component.h
rdmnet/controller.h
rdmnet/controller.cpp
rdmnet/device.h
rdmnet/device.cpp
rdmnet/ept.cpp
rdmnet/ept.h
rdmnet/llrp.cpp
rdmnet/llrp.h
rdmnet/manager.h
rdmnet/manager.cpp
rdmnet/pdu.h
rdmnet/pdu.cpp
rdmnet/rdmnet.h
rdmnet/rpt.cpp
rdmnet/rpt.h
rdmnet/target.h
rdmnet/target.cpp
sacn/data.cpp
sacn/data.h
sacn/extended.cpp
sacn/extended.h
sacn/node.cpp
sacn/node.h
sacn/receiver.cpp
sacn/receiver.h
sacn/sacn.h
sacn/source.cpp
sacn/source.h
sacn/universe.cpp
sacn/universe.h
uuid/uuid.cpp
uuid/uuid.h
)
#add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES})
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
add_library(${PROJECT_NAME} SHARED)
# E1.11
include(dmx/CMakeLists.txt)
# E1.17
include(acn/CMakeLists.txt)
# E1.20
include(rdm/CMakeLists.txt)
# E1.31
include(sacn/CMakeLists.txt)
# E1.33
include(rdmnet/CMakeLists.txt)
# E1.56
include(otp/CMakeLists.txt)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
@ -129,4 +36,5 @@ set_target_properties(${PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_NAME}_LIBRARY)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# GTests
add_subdirectory(test)

View File

@ -1,12 +1,33 @@
# LibESTA
# OpenLCP
A collection of C++ libraries for ESTA sponsored ANSI standards.
A collection of C++ libraries for Lighting Control Protocols, focusing on ESTA
sponsored ANSI standards.
![ESTA Protocols Block Diagram](http://company235.com/img/establockdiagram.png)
## ACN PDU
## Object Architecture
E1.17 is designed around a hierarchical data structure of nested Protocol Data Units. These `PDU` may encapsulate one or more `PDU` of an embedded protocol, or be a data endpoint for that protocol. The following slide describes the relational hierocracy of the `PDU` within `ACN`, `sACN`, `RDMnet`, and `OTP`. While similiar in structure and concept, the `PDU` in `RDMnet` do not inherit directly from the `PDU` in `ACN`. Any omission in the tree is likely due to a combination of poor documentation within the standard and/or incomplete implementation within the library (IE. `SDT`.)
The library encompases both the structured data being communicated between
controllable components, and the control objects that expose the data in
meaningful ways, without needing to know or understand the underlying protocols.
### Objects
Control objects are structured thusly;
![Architecture Flowchart](http://company235.com/img/classdiagram.png)
### Data
Serveral of the ESTA protocols use the E1.17 Protocol Data Unit to transfer
data. The `PDU` are a series of nested hierarchical data structures. `PDU` may
encapsulate one or more `PDU` of an embedded protocol, or be a data endpoint
for that protocol. The following slide describes the relational hierocracy of
the `PDU` within `ACN`, `sACN`, `RDMnet`, and `OTP`. While similiar in
structure and concept, the `PDU` in `RDMnet` do not inherit directly from the
`PDU` in `ACN`, and the `PDU` in `OTP` are notably simpler, as data segments
may not be inherited from sibling `PDU` in the data.
![PDU Hierarch Flowchart](http://company235.com/img/pduflowchart.png)

13
acn/CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
target_sources(${PROJECT_NAME}
PRIVATE
acn/component.h
acn/pdu-stream.cpp
acn/pdu-stream.h
acn/pdu.cpp
acn/pdu.h
)
include(dmp/CMakeLists.txt)
include(rlp/CMakeLists.txt)
include(sdt/CMakeLists.txt)
include(uuid/CMakeLists.txt)

View File

@ -39,7 +39,7 @@ namespace ACN {
class Component {
public:
Component(UUID::uuid cid = UUID::uuid())
: fctn_(std::string("libESTA ACN Component"))
: fctn_(std::string("OpenLCP ACN Component"))
, uacn_(std::string())
, cid_(cid)
{};

View File

@ -28,8 +28,7 @@
#include <memory>
#include <iostream>
namespace ACN {
namespace PDU {
namespace ACN::PDU {
struct pdu_stream_object;
@ -123,6 +122,5 @@ struct pdu_stream_object
};
} // PDU
} // ACN
} // ACN::PDU

View File

@ -28,8 +28,7 @@
#include <vector>
#include "pdu-stream.h"
namespace ACN {
namespace PDU {
namespace ACN::PDU {
class Pdu; // forward declare
@ -216,5 +215,4 @@ template <class T>
using Handler = std::function<void(std::shared_ptr<T>)>;
} // PDU
} // ACN
} // ACN::PDU

View File

@ -32,7 +32,7 @@ static const uint32_t LIB_VERSION = (@PROJECT_VERSION_MAJOR@ << 24) |
@PROJECT_VERSION_PATCH@;
static constexpr char LIB_VERSION_LABEL [] = "@PROJECT_VERSION@";
#else
static constexpr char LIB_NAME [] = "libESTA";
static constexpr char LIB_NAME [] = "libOpenLCP";
static const uint32_t LIB_VERSION = 0x00010001;
static constexpr char LIB_VERSION_LABEL [] = "0.1.1";
#endif

16
dmp/CMakeLists.txt Normal file
View File

@ -0,0 +1,16 @@
target_sources(${PROJECT_NAME}
PUBLIC
dmp/component.h
dmp/controller.h
dmp/device.h
dmp/event.h
dmp/property.h
PRIVATE
dmp/component.cpp
dmp/controller.cpp
dmp/device.cpp
dmp/dmp.cpp
dmp/dmp.h
dmp/event.cpp
dmp/property.cpp
)

38
dmp/component.cpp Normal file
View File

@ -0,0 +1,38 @@
/*
dmp/component.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "component.h"
namespace ACN::DMP {
/**
* @brief Component::Component
*/
Component::Component(UUID::uuid cid)
: SDT::Member(cid)
{
}
} // namespace ACN::DMP

40
dmp/component.h Normal file
View File

@ -0,0 +1,40 @@
/*
dmp/component.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include "sdt/member.h"
namespace ACN::DMP {
/**
* @brief The Component class
*/
class Component
: public SDT::Member
{
public:
Component(UUID::uuid = UUID::uuid());
};
} // namespace ACN::DMP

38
dmp/controller.cpp Normal file
View File

@ -0,0 +1,38 @@
/*
dmp/controller.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "controller.h"
namespace ACN::DMP {
/**
* @brief Controller::Controller
*/
Controller::Controller(UUID::uuid cid)
: SDT::Leader(cid)
{
}
} // namespace ACN::DMP

40
dmp/controller.h Normal file
View File

@ -0,0 +1,40 @@
/*
dmp/controller.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include "sdt/leader.h"
namespace ACN::DMP {
/**
* @brief The Controller class
*/
class Controller
: public SDT::Leader
{
public:
Controller(UUID::uuid = UUID::uuid());
};
} // namespace ACN::DMP

37
dmp/device.cpp Normal file
View File

@ -0,0 +1,37 @@
/*
dmp/device.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "device.h"
namespace ACN::DMP {
/**
* @brief Device::Device
*/
Device::Device()
{
}
} // namespace ACN::DMP

34
dmp/device.h Normal file
View File

@ -0,0 +1,34 @@
/*
dmp/device.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
namespace ACN::DMP {
class Device
{
public:
Device();
};
} // namespace ACN::DMP

View File

@ -24,8 +24,7 @@
#include "dmp.h"
namespace ACN {
namespace DMP {
namespace ACN::DMP {
/**
* @brief range::read_
@ -283,5 +282,4 @@ void Pdu::iStream(PDU::Stream stream)
}
}
} // DMP
} // ACN
} // ACN::DMP

View File

@ -26,11 +26,10 @@
#include <cstdint>
#include <memory>
#include <vector>
#include "pdu.h"
#include "acn/pdu.h"
// Architecture for Control Networks Device Management Protocol
namespace ACN {
namespace DMP {
namespace ACN::DMP {
/**
* @brief 5.1.4 Address and Data Types
@ -209,5 +208,4 @@ public:
};
} // DMP
} // ACN
} // ACN::DMP

37
dmp/event.cpp Normal file
View File

@ -0,0 +1,37 @@
/*
dmp/event.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "event.h"
namespace ACN::DMP {
/**
* @brief Event::Event
*/
Event::Event()
{
}
} // namespace ACN::DMP

34
dmp/event.h Normal file
View File

@ -0,0 +1,34 @@
/*
dmp/event.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
namespace ACN::DMP {
class Event
{
public:
Event();
};
} // namespace ACN::DMP

37
dmp/property.cpp Normal file
View File

@ -0,0 +1,37 @@
/*
dmp/property.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "property.h"
namespace ACN::DMP {
/**
* @brief Property::Property
*/
Property::Property()
{
}
} // namespace ACN::DMP

34
dmp/property.h Normal file
View File

@ -0,0 +1,34 @@
/*
dmp/property.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
namespace ACN::DMP {
class Property
{
public:
Property();
};
} // namespace ACN::DMP

13
dmx/CMakeLists.txt Normal file
View File

@ -0,0 +1,13 @@
target_sources(${PROJECT_NAME}
PUBLIC
dmx/device.h
dmx/patch.h
dmx/personality.h
dmx/universe.h
PRIVATE
dmx/device.cpp
dmx/dmx.h
dmx/patch.cpp
dmx/personality.cpp
dmx/universe.cpp
)

6
dmx/patch.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "patch.h"
Patch::Patch()
{
}

11
dmx/patch.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef PATCH_H
#define PATCH_H
class Patch
{
public:
Patch();
};
#endif // PATCH_H

10
ept/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
target_sources(${PROJECT_NAME}
PUBLIC
ept/client.h
PRIVATE
ept/broker.cpp
ept/broker.h
ept/client.cpp
ept/ept.cpp
ept/ept.h
)

View File

@ -1,5 +1,5 @@
/*
manager.cpp
ept/broker.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -22,27 +22,20 @@
SOFTWARE.
*/
#include "manager.h"
#include "broker.h"
namespace RDMnet {
namespace LLRP {
namespace RDMnet::EPT {
/**
* @brief Manager::Manager
* @brief Broker::Broker
*/
Manager::Manager()
Broker::Broker()
{
}
} // namespace RDMnet::EPT
/**
* @brief Manager::~Manager
*/
Manager::~Manager()
{
}
} // namespace LLRP
} // namespace RDMnet

34
ept/broker.h Normal file
View File

@ -0,0 +1,34 @@
/*
ept/broker.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
namespace RDMnet::EPT {
class Broker
{
public:
Broker();
};
} // namespace RDMnet::EPT

View File

@ -1,5 +1,5 @@
/*
client.cpp
ept/client.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -24,8 +24,7 @@
#include "client.h"
namespace RDMnet {
namespace EPT {
namespace RDMnet::EPT {
/**
* @brief Client::Client
@ -44,8 +43,7 @@ Client::~Client()
}
} // namespace EPT
} // namespace RDMnet
} // namespace RDMnet::EPT

View File

@ -1,5 +1,5 @@
/*
client.h
ept/client.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -25,8 +25,7 @@
#include "ept.h"
namespace RDMnet {
namespace EPT {
namespace RDMnet::EPT {
/**
* @brief The EPT::Client class
@ -38,5 +37,4 @@ public:
virtual ~Client();
};
} // namespace EPT
} // namespace RDMnet
} // namespace RDMnet::EPT

View File

@ -23,11 +23,10 @@
*/
#include "ept.h"
#include "rdmnet.h"
#include "rpt.h"
#include "rdmnet/rdmnet.h"
#include "rpt/rpt.h"
namespace RDMnet {
namespace EPT {
namespace RDMnet::EPT {
/**
* @brief EPT::Pdu::Pdu
@ -132,5 +131,4 @@ void Pdu::iStream(ACN::PDU::Stream stream)
} // namespace STATUS
} // namespace EPT
} // namespace RDMnet
} // namespace RDMnet::EPT

View File

@ -23,11 +23,10 @@
*/
#pragma once
#include "pdu.h"
#include "rdmnet/pdu.h"
#include "uuid/uuid.h"
namespace RDMnet {
namespace EPT {
namespace RDMnet::EPT {
/**
* @brief 1.2.4 Extensible Packet Transport (EPT)
@ -101,5 +100,4 @@ public:
} // namespace STATUS
} // namespace EPT
} // namespace RDMnet
} // namespace RDMnet::EPT

10
llrp/CMakeLists.txt Normal file
View File

@ -0,0 +1,10 @@
target_sources(${PROJECT_NAME}
PUBLIC
llrp/manager.h
PRIVATE
llrp/llrp.cpp
llrp/llrp.h
llrp/manager.cpp
llrp/target.cpp
llrp/target.h
)

View File

@ -23,11 +23,9 @@
*/
#include "llrp.h"
#include "rpt.h"
#include "rdmnet.h"
#include "rpt/rpt.h"
namespace RDMnet {
namespace LLRP {
namespace RDMnet::LLRP {
/**
* @brief llrp_data::iStream
@ -215,5 +213,4 @@ void Pdu::iStream(ACN::PDU::Stream stream)
} // namespace ProbeReply
} // namespace LLRP
} // namespace RDMnet
} // namespace RDMnet::LLRP

View File

@ -23,14 +23,13 @@
*/
#pragma once
#include "pdu.h"
#include "rdmnet.h"
#include "rdmnet/pdu.h"
#include "rdmnet/rdmnet.h"
#include "rdm/uid.h"
#include "rdm/message.h"
#include "uuid/uuid.h"
namespace RDMnet {
namespace LLRP {
namespace RDMnet::LLRP {
/**
* @brief 1.2.1 Low-Level Recovery Protocol (LLRP)
@ -180,5 +179,4 @@ static const PID allowed_pids[] = {
};
} // namespace COMMAND
} // namespace LLRP
} // namespace RDMnet
} // namespace RDMnet::LLRP

52
llrp/manager.cpp Normal file
View File

@ -0,0 +1,52 @@
/*
manager.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "manager.h"
#include "rdmnet/rdmnet.h"
namespace RDMnet::LLRP {
/**
* @brief Manager::Manager
*/
Manager::Manager(UUID::uuid cid)
: ACN::RLP::Appliance(cid)
{
fctn_ = "OpenLCP LLRP Manager";
RlpRegisterVector(VECTOR_ROOT_LLRP, std::bind(&Manager::rlpLlrpReceiver,
this, std::placeholders::_1));
}
/**
* @brief Broker::rlpBrokerReceiver
* @param root
*/
void Manager::rlpLlrpReceiver(std::shared_ptr<ACN::RLP::Pdu> root)
{
(void)root;
}
} // namespace RDMnet::LLRP

View File

@ -23,11 +23,9 @@
*/
#pragma once
#include "rdmnet.h"
#include "llrp.h"
#include "rlp/appliance.h"
namespace RDMnet {
namespace LLRP {
namespace RDMnet::LLRP {
/**
* @brief 5.1.1 LLRP Manager
@ -36,14 +34,15 @@ namespace LLRP {
* configuration tool equipment.
*/
class Manager
: public ACN::RLP::Appliance
{
public:
Manager();
virtual ~Manager();
Manager(UUID::uuid = UUID::uuid());
void rlpLlrpReceiver(std::shared_ptr<ACN::RLP::Pdu>);
virtual void sendProbeRequest() {};
virtual void receiveProbeReply() {};
};
} // namespace LLRP
} // namespace RDMnet
} // namespace RDMnet::LLRP

View File

@ -24,8 +24,7 @@
#include "target.h"
namespace RDMnet {
namespace LLRP {
namespace RDMnet::LLRP {
/**
* @brief Target::Target
@ -84,5 +83,4 @@ void Target::receiveRdmCommand(std::shared_ptr<RPT::COMMAND::Pdu> pdu)
return receiveRDM(RDM::MsgPtr(&data->message));
}
} // namespace LLRP
} // namespace RDMnet
} // namespace RDMnet::LLRP

View File

@ -23,12 +23,10 @@
*/
#pragma once
#include "rdmnet.h"
#include "rpt.h"
#include "rpt/rpt.h"
#include "llrp.h"
namespace RDMnet {
namespace LLRP {
namespace RDMnet::LLRP {
/**
* @brief 5.1.2 LLRP Target
@ -52,5 +50,4 @@ public:
virtual void receiveRDM(const RDM::MsgPtr) = 0;
};
} // namespace LLRP
} // namespace RDMnet
} // namespace RDMnet::LLRP

12
otp/CMakeLists.txt Normal file
View File

@ -0,0 +1,12 @@
target_sources(${PROJECT_NAME}
PRIVATE
otp/advertisement.cpp
otp/advertisement.h
otp/base.cpp
otp/base.h
otp/otp.h
otp/pdu.cpp
otp/pdu.h
otp/transform.cpp
otp/transform.h
)

View File

@ -1,13 +1,9 @@
cmake_minimum_required(VERSION 3.14)
project(QsACNNode VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
endif()
@ -15,18 +11,23 @@ endif()
find_package(QT NAMES Qt6 Qt5 COMPONENTS Network Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Network Gui REQUIRED)
add_library(${PROJECT_NAME} SHARED
qsacnnode_global.h
qsacnnode.cpp
qsacnnode.h
qsacnuniverse.h
universemodel.h
universemodel.cpp
add_library(${PROJECT_NAME} SHARED)
target_sources(${PROJECT_NAME}
PUBLIC
qsacnnode_global.h
qsacnnode.h
qsacnuniverse.h
universemodel.h
PRIVATE
qsacnnode.cpp
universemodel.cpp
)
target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Gui)
target_link_libraries(${PROJECT_NAME} PUBLIC ESTA)
target_link_libraries(${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Gui
OpenLCP)
target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_NAME}_LIBRARY)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(${PROJECT_NAME} PUBLIC QT_LIBRARY)

View File

@ -14,7 +14,7 @@ QSacnNode::QSacnNode(QObject *parent, QUuid cid)
: Appliance(UUID::uuid(cid.toString().toStdString()))
, QUdpSocket(parent)
{
fctn_ = "libESTA QSacnNode";
fctn_ = "OpenLCP QSacnNode";
bind(QHostAddress::AnyIPv4, SACN::ACN_SDT_MULTICAST_PORT);

23
rdm/CMakeLists.txt Normal file
View File

@ -0,0 +1,23 @@
target_sources(${PROJECT_NAME}
PUBLIC
rdm/controller.h
rdm/device.h
rdm/message.h
rdm/parameter.h
rdm/responder.h
rdm/sensor.h
rdm/status.h
PRIVATE
rdm/controller.cpp
rdm/device.cpp
rdm/E1.37-1.h
rdm/E1.37-2.h
rdm/E1.37-7.h
rdm/message.cpp
rdm/parameter.cpp
rdm/rdm.cpp
rdm/rdm.h
rdm/responder.cpp
rdm/sensor.cpp
rdm/uid.h
)

21
rdmnet/CMakeLists.txt Normal file
View File

@ -0,0 +1,21 @@
target_sources(${PROJECT_NAME}
PUBLIC
rdmnet/broker.h
rdmnet/controller.h
rdmnet/device.h
PRIVATE
rdmnet/broker-protocol.cpp
rdmnet/broker-protocol.h
rdmnet/broker.cpp
rdmnet/controller.cpp
rdmnet/device.cpp
rdmnet/implementation.cpp
rdmnet/implementation.h
rdmnet/pdu.cpp
rdmnet/pdu.h
rdmnet/rdmnet.h
)
include(ept/CMakeLists.txt)
include(llrp/CMakeLists.txt)
include(rpt/CMakeLists.txt)

View File

@ -27,8 +27,7 @@
#include "rdm/uid.h"
#include "uuid/uuid.h"
namespace RDMnet {
namespace BrokerProtocol {
namespace RDMnet::BrokerProtocol {
/**
* @brief 1.2.2 Broker Protocol
@ -296,5 +295,4 @@ struct disconnect_data
};
} // namespace BrokerProtocol
} // namespace RDMnet
} // namespace RDMnet::BrokerProtocol

View File

@ -29,11 +29,12 @@ namespace RDMnet {
/**
* @brief Broker::Broker
*/
Broker::Broker(UUID::uuid cid)
: ACN::Appliance(cid)
, LLRP::Target()
Broker::Broker(UUID::uuid cid, RDM::UID uid)
: Implementation(cid, uid)
, EPT::Broker()
, RPT::Broker()
{
fctn_ = "libESTA RDMnet Broker";
fctn_ = "OpenLCP RDMnet Broker";
RlpRegisterVector(VECTOR_ROOT_BROKER, std::bind(&Broker::rlpBrokerReceiver,
this, std::placeholders::_1));
@ -41,20 +42,12 @@ Broker::Broker(UUID::uuid cid)
/**
* @brief Broker::~Broker
* @brief Broker::rlpBrokerReceiver
* @param root
*/
Broker::~Broker()
{
}
void Broker::rlpBrokerReceiver(std::shared_ptr<ACN::RLP::Pdu> root)
{
root->createDataBlock<BrokerProtocol::Pdu>();
// a PDU::Block is guaranteed to have been instantiated, but if the input
// stream failed, it will not list any PDU. OK to loop without checking
// the state of the stream.
auto block = static_cast<ACN::PDU::Block<BrokerProtocol::Pdu>*>(root->data());
for(auto const &frame : *block->pdu)
{

View File

@ -23,10 +23,9 @@
*/
#pragma once
#include "acn/appliance.h"
#include "rdmnet.h"
#include "rpt.h"
#include "target.h"
#include "implementation.h"
#include "ept/broker.h"
#include "rpt/broker.h"
namespace RDMnet {
@ -34,16 +33,15 @@ namespace RDMnet {
* @brief The Broker class
*/
class Broker
: public virtual ACN::Appliance
, public LLRP::Target
: public Implementation
, public EPT::Broker
, public RPT::Broker
{
public:
Broker(UUID::uuid = UUID::uuid());
virtual ~Broker();
Broker(UUID::uuid = UUID::uuid(), RDM::UID = RDM::UID());
void rlpBrokerReceiver(std::shared_ptr<ACN::RLP::Pdu>);
private:
/// @brief 6.2.1.1 Broker Scope
/// A Broker shall participate in a single Scope at a time.

View File

@ -28,21 +28,25 @@ namespace RDMnet {
/**
* @brief Controller::Controller
*/
Controller::Controller(UUID::uuid cid)
: Component(cid)
Controller::Controller(UUID::uuid cid, RDM::UID uid)
: Implementation(cid, uid)
, RDM::Controller()
, LLRP::Target()
, RPT::Controller()
{
fctn_ = "libESTA RDMnet Controller";
fctn_ = "OpenLCP RDMnet Controller";
RlpRegisterVector(VECTOR_ROOT_RPT, std::bind(&Controller::rlpRptReceiver,
this, std::placeholders::_1));
}
/**
* @brief Controller::~Controller
* @brief Controller::rlpRptReceiver
* @param root
*/
Controller::~Controller()
void Controller::rlpRptReceiver(std::shared_ptr<ACN::RLP::Pdu> root)
{
(void)root;
}
} // namespace RDMnet

View File

@ -23,11 +23,9 @@
*/
#pragma once
#include "component.h"
#include "implementation.h"
#include "rdm/controller.h"
#include "rdmnet.h"
#include "rpt.h"
#include "target.h"
#include "rpt/controller.h"
namespace RDMnet {
@ -35,13 +33,14 @@ namespace RDMnet {
* @brief The Controller class
*/
class Controller
: public Component
: public Implementation
, public RDM::Controller
, public LLRP::Target
, public RPT::Controller
{
public:
Controller(UUID::uuid = UUID::uuid());
virtual ~Controller();
Controller(UUID::uuid = UUID::uuid(), RDM::UID = RDM::UID());
void rlpRptReceiver(std::shared_ptr<ACN::RLP::Pdu>);
};
} // namespace RDMnet

View File

@ -28,27 +28,26 @@ namespace RDMnet {
/**
* @brief Controller::Controller
*/
Device::Device(UUID::uuid cid, UUID::uuid rid, RDM::UID uid)
: Component(cid)
, RDM::Responder(uid)
, LLRP::Target()
Device::Device(UUID::uuid cid, RDM::UID uid, UUID::uuid rid)
: Implementation(cid, uid)
, RPT::Device()
, rid_(rid)
{
fctn_ = "libESTA RDMnet Component";
fctn_ = "OpenLCP RDMnet Device";
RlpRegisterVector(VECTOR_ROOT_RPT, std::bind(&Device::rlpRptReceiver,
this, std::placeholders::_1));
}
/**
* @brief Controller::~Controller
* @brief Device::rlpRptReceiver
* @param root
*/
Device::~Device()
void Device::rlpRptReceiver(std::shared_ptr<ACN::RLP::Pdu> root)
{
(void)root;
}
void Device::receiveRDM(const RDM::MsgPtr message)
{
RDM::Responder::receive(message);
}
} // namespace RDMnet

View File

@ -23,11 +23,8 @@
*/
#pragma once
#include "component.h"
#include "rdm/responder.h"
#include "rdmnet.h"
#include "rpt.h"
#include "target.h"
#include "implementation.h"
#include "rpt/device.h"
namespace RDMnet {
@ -35,17 +32,15 @@ namespace RDMnet {
* @brief The Device class
*/
class Device
: public Component
, public RDM::Responder
, public LLRP::Target
: public Implementation
, public RPT::Device
{
public:
Device(UUID::uuid cid = UUID::uuid(),
UUID::uuid rid = UUID::uuid(),
RDM::UID uid = RDM::UID());
virtual ~Device();
RDM::UID uid = RDM::UID(),
UUID::uuid rid = UUID::uuid());
virtual void receiveRDM(const RDM::MsgPtr) override;
void rlpRptReceiver(std::shared_ptr<ACN::RLP::Pdu>);
private:
UUID::uuid rid_;

57
rdmnet/implementation.cpp Normal file
View File

@ -0,0 +1,57 @@
/*
rdmnet/implementation.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "implementation.h"
namespace RDMnet {
/**
* @brief Implementation::Implementation
* @param cid
*/
Implementation::Implementation(UUID::uuid cid, RDM::UID uid)
: ACN::RLP::Appliance(cid)
, RDM::Responder(uid)
, LLRP::Target()
{
fctn_ = "OpenLCP RDMnet Implementation";
RlpRegisterVector(VECTOR_ROOT_LLRP, std::bind(&Implementation::rlpLlrpReceiver,
this, std::placeholders::_1));
RlpRegisterVector(VECTOR_ROOT_EPT, std::bind(&Implementation::rlpEptReceiver,
this, std::placeholders::_1));
}
/**
* @brief Implementation::rlpLlrpReceiver
* @param root
*/
void Implementation::rlpLlrpReceiver(std::shared_ptr<ACN::RLP::Pdu> root)
{
(void)root;
}
} // namespace RDMnet

View File

@ -1,5 +1,5 @@
/*
component.h
rdmnet/implementation.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -23,36 +23,23 @@
*/
#pragma once
#include "acn/component.h"
#include <vector>
#include <string>
#include "rlp/appliance.h"
#include "rdm/responder.h"
#include "llrp/target.h"
namespace RDMnet {
/**
* @brief 6 Broker Protocol
* 6.1.3 Client
* A Client is a Component which connects to a Broker. Clients communicate
* with other Clients which are using the same Client Protocol in the same
* Scope via their connection to the Broker.
*/
class Component
: public ACN::Component
class Implementation
: public ACN::RLP::Appliance
, public RDM::Responder
, public LLRP::Target
{
public:
Component(UUID::uuid cid = UUID::uuid())
: ACN::Component(cid)
{};
virtual ~Component() {};
Implementation(UUID::uuid = UUID::uuid(),
RDM::UID = RDM::UID());
private:
/// @brief 6.2.1 Scopes
/// Each Component participates in one or more Scopes.
std::vector<std::string> scopes_;
void rlpLlrpReceiver(std::shared_ptr<ACN::RLP::Pdu>);
virtual void rlpEptReceiver(std::shared_ptr<ACN::RLP::Pdu>) {};
};
} // namespace RDMnet

12
rlp/CMakeLists.txt Normal file
View File

@ -0,0 +1,12 @@
target_sources(${PROJECT_NAME}
PUBLIC
rlp/appliance.h
PRIVATE
rlp/appliance.cpp
rlp/rlp.cpp
rlp/rlp.h
rlp/tcp.cpp
rlp/tcp.h
rlp/udp.cpp
rlp/udp.h
)

View File

@ -1,5 +1,5 @@
/*
appliance.h
rlp/appliance.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -24,13 +24,10 @@
#include "appliance.h"
#include "dmp.h"
#include "sdt.h"
#include "rlp.h"
#include "rlp-udp.h"
#include "rlp-tcp.h"
#include "udp.h"
#include "tcp.h"
namespace ACN {
namespace ACN::RLP {
/**
* @brief Appliance::Appliance
@ -39,16 +36,7 @@ namespace ACN {
Appliance::Appliance(UUID::uuid cid)
: Component(cid)
{
fctn_ = "libESTA ACN Appliance";
/**
* 1.3.1. Recursive use of PDU Format in Other Protocols
* ... within ACN as currently specified, there is just one higher layer
* protocol defined which interfaces directly to the root layer:
* Session Data Transport
*/
RlpRegisterVector(SDT::SDT_PROTOCOL_ID, std::bind(&Appliance::SdtReceiver,
this, std::placeholders::_1));
fctn_ = "OpenLCP ACN Appliance";
};
@ -117,42 +105,4 @@ void Appliance::RlpRegisterVector(uint32_t vect, PDU::Handler<RLP::Pdu> handle)
rlp_vectors_[vect].push_back(handle);
}
/**
* @brief Appliance::SdtReceiver
* @param rlp
*/
void Appliance::SdtReceiver(std::shared_ptr<RLP::Pdu> root)
{
root->createDataBlock<SDT::Pdu>();
auto block = static_cast<PDU::Block<SDT::Pdu>*>(root->data());
for(auto const &sdt : *block->pdu) {
switch(sdt->vector()) {
/// TODO: handle SDT
default:
break;
}
}
}
/**
* @brief Appliance::DmpReceiver
* @param rlp
*/
void Appliance::DmpReceiver(std::shared_ptr<RLP::Pdu> root)
{
root->createDataBlock<DMP::Pdu>();
auto block = static_cast<PDU::Block<DMP::Pdu>*>(root->data());
for(auto const &dmp : *block->pdu) {
switch(dmp->vector()) {
/// TODO: DMP in root
default:
break;
}
}
}
}; // ACN
}; // ACN::RLP

View File

@ -1,5 +1,5 @@
/*
appliance.h
rlp/appliance.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -23,11 +23,9 @@
*/
#pragma once
#include "component.h"
#include "pdu.h"
#include "acn/component.h"
#include "acn/pdu.h"
#include "rlp.h"
#include "sdt-session.h"
#include "uuid/uuid.h"
#include <map>
#include <memory>
@ -37,7 +35,7 @@
// device. See also appliance.
namespace ACN {
namespace ACN::RLP {
/**
* @brief The Appliance class
@ -61,27 +59,11 @@ public:
virtual void TcpPacketReceiver(PDU::Stream);
protected:
// RLP
void RlpReceiver(std::shared_ptr<RLP::Pdu>);
void RlpRegisterVector(uint32_t, PDU::Handler<RLP::Pdu>);
// RLP->SDT frames
virtual void SdtReceiver(std::shared_ptr<RLP::Pdu>);
// SDT 4.4 SDT Base Layer Messages
// Join, Get Sessions, and Sessions are ad-hoc messages, that is, they are
// not sent within channels. These messages identify their intended recipient
// by CID.
virtual void SdtJoinSession() {};
virtual void SdtGetSessions() {};
virtual void SdtSessions() {};
// RLP->DMP frames
virtual void DmpReceiver(std::shared_ptr<RLP::Pdu>);
private:
std::map<uint32_t, std::vector<PDU::Handler<RLP::Pdu>>> rlp_vectors_;
std::vector<std::shared_ptr<SDT::Session>> sdt_sessions_;
};
}; // ACN
}; // ACN::RLP

View File

@ -24,8 +24,7 @@
#include "rlp.h"
namespace ACN {
namespace RLP {
namespace ACN::RLP {
/**
* @brief rlp_header::streamSize
@ -81,5 +80,4 @@ void Pdu::iStream(PDU::Stream stream)
// protocol dependent data segment // data
}
} // RLP
} // ACN
} // ACN::RLP

View File

@ -25,11 +25,10 @@
#include <cstdint>
#include <memory>
#include "pdu.h"
#include "acn/pdu.h"
#include "uuid/uuid.h"
namespace ACN {
namespace RLP {
namespace ACN::RLP {
/**
* @brief 2.6.1.2.2. Header Field in Root Layer PDUs
@ -58,5 +57,4 @@ public:
void iStream(PDU::Stream) override;
};
} // RLP
} // ACN
} // ACN::RLP

View File

@ -1,5 +1,5 @@
/*
rlp-tcp.cpp
rlp/tcp.cpp
Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com)
@ -22,13 +22,11 @@
SOFTWARE.
*/
#include "rlp-tcp.h"
#include "tcp.h"
#include <cstring>
namespace ACN {
namespace RLP {
namespace TCP {
namespace ACN::RLP::TCP {
/**
* @brief preamble_t::preamble_t
@ -78,6 +76,4 @@ void transport::oStream(PDU::Stream stream) const
*stream << pdu;
}
} // TCP
} // RLP
} // ACN
} // ACN::RLP::TCP

View File

@ -1,5 +1,5 @@
/*
rlp-tcp.h
rlp/tcp.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -25,13 +25,11 @@
#include <cstdint>
#include "rlp.h"
#include "pdu.h"
#include "acn/pdu.h"
// EPI 33. ACN Root Layer Protocol Operation on TCP
namespace ACN {
namespace RLP {
namespace TCP {
namespace ACN::RLP::TCP {
/**
* @brief 3. Frame Preamble Format
@ -66,6 +64,4 @@ static const uint8_t ACN_PACKET_IDENTIFIER[] = { 0x41, 0x53, 0x43, 0x2d,
*/
static const uint32_t INDEFINITE = 0xffffffff;
} // TCP
} // RLP
} // ACN
} // ACN::RLP::TCP

View File

@ -1,5 +1,5 @@
/*
rlp-udp.cpp
rlp/udp.cpp
Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com)
@ -22,13 +22,11 @@
SOFTWARE.
*/
#include "rlp-udp.h"
#include "udp.h"
#include <cstring>
namespace ACN {
namespace RLP {
namespace UDP {
namespace ACN::RLP::UDP {
/**
* @brief preamble::preamble
@ -102,6 +100,4 @@ void transport::oStream(PDU::Stream stream) const
*stream << pdu;
}
} // UDP
} // RLP
} // ACN
} // ACN::RLP::UDP

View File

@ -1,5 +1,5 @@
/*
rlp-udp.h
rlp/udp.h
Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com)
@ -24,13 +24,11 @@
#pragma once
#include "rlp.h"
#include "pdu.h"
#include "acn/pdu.h"
// ACN EPI 17. ACN Root Layer Protocol Operation on UDP
namespace ACN {
namespace RLP {
namespace UDP {
namespace ACN::RLP::UDP {
/**
* @brief ACN_PACKET_IDENTIFIER
@ -68,6 +66,4 @@ struct transport
};
} // UDP
} // RLP
} // ACN
} // ACN::RLP::UDP

11
rpt/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
target_sources(${PROJECT_NAME}
PRIVATE
rpt/broker.cpp
rpt/broker.h
rpt/controller.cpp
rpt/controller.h
rpt/device.cpp
rpt/device.h
rpt/rpt.cpp
rpt/rpt.h
)

41
rpt/broker.cpp Normal file
View File

@ -0,0 +1,41 @@
/*
rpt/broker.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "broker.h"
namespace RDMnet::RPT {
/**
* @brief Broker::Broker
*/
Broker::Broker()
{
}
} // namespace RDMnet::RPT

34
rpt/broker.h Normal file
View File

@ -0,0 +1,34 @@
/*
rpt/broker.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
namespace RDMnet::RPT {
class Broker
{
public:
Broker();
};
} // namespace RDMnet::RPT

37
rpt/controller.cpp Normal file
View File

@ -0,0 +1,37 @@
/*
rpt/controller.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "controller.h"
namespace RDMnet::RPT {
/**
* @brief Controller::Controller
*/
Controller::Controller()
{
}
} // namespace RDMnet::RPT

34
rpt/controller.h Normal file
View File

@ -0,0 +1,34 @@
/*
rpt/controller.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
namespace RDMnet::RPT {
class Controller
{
public:
Controller();
};
} // namespace RDMnet::RPT

37
rpt/device.cpp Normal file
View File

@ -0,0 +1,37 @@
/*
rpt/device.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "device.h"
namespace RDMnet::RPT {
/**
* @brief Device::Device
*/
Device::Device()
{
}
} // namespace RDMnet::RPT

34
rpt/device.h Normal file
View File

@ -0,0 +1,34 @@
/*
rpt/device.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
namespace RDMnet::RPT {
class Device
{
public:
Device();
};
} // namespace RDMnet::RPT

View File

@ -23,11 +23,10 @@
*/
#include "config.h"
#include "rdmnet.h"
#include "rdmnet/rdmnet.h"
#include "rpt.h"
namespace RDMnet {
namespace RPT {
namespace RDMnet::RPT {
const RDM::UID DynamicUidRequest = RDM::UID(0, MY_ESTA_MANUFACTURER_ID, true);
@ -314,5 +313,4 @@ void rpt_data::oStream(ACN::PDU::Stream stream) const
*stream << pdu;
}
} // namespace RPT
} // namespace RDMnet
} // namespace RDMnet::RPT

View File

@ -23,12 +23,11 @@
*/
#pragma once
#include "pdu.h"
#include "rdmnet/pdu.h"
#include "rdm/message.h"
#include "rdm/uid.h"
namespace RDMnet {
namespace RPT {
namespace RDMnet::RPT {
/**
* @brief 1.2.3 RDM Packet Transport (RPT)
@ -126,6 +125,9 @@ public:
};
/**
* @brief The command_data struct
*/
struct command_data
: public ACN::PDU::pdu_data
{
@ -151,7 +153,9 @@ public:
};
/**
* @brief The rpt_header struct
*/
struct rpt_header
: ACN::PDU::pdu_header
{
@ -166,6 +170,9 @@ struct rpt_header
};
/**
* @brief The rpt_data struct
*/
struct rpt_data
: ACN::PDU::pdu_data
{
@ -178,8 +185,4 @@ struct rpt_data
void oStream(ACN::PDU::Stream) const override;
};
} // namespace RPT
} // namespace RDMnet
} // namespace RDMnet::RPT

22
sacn/CMakeLists.txt Normal file
View File

@ -0,0 +1,22 @@
target_sources(${PROJECT_NAME}
PUBLIC
sacn/node.h
sacn/receiver.h
sacn/source.h
sacn/universe.h
sacn/provenance.h
PRIVATE
sacn/data.cpp
sacn/data.h
sacn/extended.cpp
sacn/extended.h
sacn/mergeproxyuniverse.cpp
sacn/mergeproxyuniverse.h
sacn/node.cpp
sacn/provenance.cpp
sacn/provenance.h
sacn/receiver.cpp
sacn/sacn.h
sacn/source.cpp
sacn/universe.cpp
)

View File

@ -22,7 +22,7 @@
SOFTWARE.
*/
#include "acn/dmp.h"
#include "dmp/dmp.h"
#include "data.h"
namespace SACN {

View File

@ -26,8 +26,7 @@
#include "acn/pdu.h"
#include "sacn.h"
namespace SACN {
namespace DATA {
namespace SACN::DATA {
/**
* @brief Table 6-1: E1.31 Data Packet Framing Layer
@ -67,5 +66,4 @@ public:
void iStream(ACN::PDU::Stream) override;
};
} // DATA
} // SACN
} // SACN::DATA

View File

@ -22,7 +22,7 @@
SOFTWARE.
*/
#include "acn/rlp.h"
#include "rlp/rlp.h"
#include "extended.h"
#include "config.h"

View File

@ -28,8 +28,7 @@
#include "uuid/uuid.h"
#include <functional>
namespace SACN {
namespace EXTENDED {
namespace SACN::EXTENDED {
/**
* @brief 6.3 E1.31 Synchronization Packet Framing Layer
@ -131,5 +130,4 @@ public:
} // DISCOVERY
} // EXTENDED
} // SACN
} // SACN::EXTENDED

256
sacn/mergeproxyuniverse.cpp Normal file
View File

@ -0,0 +1,256 @@
/*
mergeproxyuniverse.cpp
Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "mergeproxyuniverse.h"
namespace SACN {
/**
* @brief MergeProxyUniverse::MergeProxyUniverse
*/
MergeProxyUniverse::MergeProxyUniverse()
: SACN::Universe()
{
}
/**
* @brief MergeProxyUniverse::~MergeProxyUniverse
*/
MergeProxyUniverse::~MergeProxyUniverse()
{
for (auto& [_, universe] : sources_)
delete universe;
}
/**
* @brief MergeProxyUniverse::sources
* @return
*/
const std::vector<Provenance> MergeProxyUniverse::sources() const
{
std::vector<Provenance> keys;
for (const auto& [key, _] : sources_)
keys.push_back(key);
return keys;
}
/**
* @brief MergeProxyUniverse::sourceUniverse
* @return
*/
Universe* MergeProxyUniverse::sourceUniverse(const Provenance &src)
{
if (!hasSourceUniverse(src))
newProvenance_(src);
return sources_.at(src);
}
/**
* @brief MergeProxyUniverse::hasSourceUniverse
* @return
*/
bool MergeProxyUniverse::hasSourceUniverse(const Provenance& src) const
{
if (sources_.count(src))
return true;
return false;
}
/**
* @brief MergeProxyUniverse::hassources
* @return
*/
bool MergeProxyUniverse::hasSources() const
{
if (sources_.size())
return true;
return false;
}
/**
* @brief MergeProxyUniverse::deleteSourceUniverse
* @return
*/
void MergeProxyUniverse::deleteSourceUniverse(const Provenance& src)
{
if (sources_.count(src))
{
delete sources_.at(src);
sources_.erase(src);
}
}
/**
* @brief MergeProxyUniverse::addSourceUniverse
*/
void MergeProxyUniverse::addSourceUniverse(Universe* universe)
{
sources_.at(*universe->source()) = universe;
}
/**
* @brief MergeProxyUniverse::dataChangedNotifier
* @param universe
*/
void MergeProxyUniverse::dataChangedNotifier(DMX::Universe* dmx)
{
auto sacn = static_cast<SACN::Universe*>(dmx);
auto universe = dominant_();
if (!universe)
return;
if (sacn->source() == universe->source())
for (const auto &cb : callbacks_)
cb(this);
}
/**
* @brief MergeProxyUniverse::isSyncronized
* @return
*/
bool MergeProxyUniverse::isSyncronized() const
{
auto universe = dominant_();
if (!universe)
return false;
return universe->isSyncronized();
}
/**
* @brief MergeProxyUniverse::source
* @return
*/
std::shared_ptr<Provenance> MergeProxyUniverse::source() const
{
auto universe = dominant_();
if (!universe)
return nullptr;
return universe->source();
}
/**
* @brief MergeProxyUniverse::set
* @param pdu
* @param source
*/
void MergeProxyUniverse::set(std::shared_ptr<ACN::DMP::Pdu> pdu,
std::shared_ptr<Provenance> src)
{
if (!sources_.count(*src))
newProvenance_(*src);
sources_.at(*src)->set(pdu, src);
}
/**
* @brief MergeProxyUniverse::synchronize
*/
void MergeProxyUniverse::synchronize()
{
for ( auto& [_, uni] : sources_)
uni->synchronize();
}
/**
* @brief MergeProxyUniverse::data
* @return
*/
const DMX::DimmerData * MergeProxyUniverse::data() const
{
auto universe = dominant_();
if (!universe)
return nullptr;
return universe->data();
}
/**
* @brief MergeProxyUniverse::slot
* @param s
* @return
*/
uint8_t MergeProxyUniverse::slot(const uint16_t s)
{
auto universe = dominant_();
if (!universe)
return 0;
return universe->slot(s);
}
/**
* @brief MergeProxyUniverse::rxRate
* @return
*/
double MergeProxyUniverse::rxRate()
{
auto universe = dominant_();
if (!universe)
return 0.0;
return universe->rxRate();
}
/**
* @brief MergeProxyUniverse::dominant_
* @return
*/
Universe* MergeProxyUniverse::dominant_() const
{
Universe* ret = nullptr;
for (auto& [_, uni] : sources_)
{
if (uni->rxRate() < (DMX::E111_DATA_LOSS_TIMEOUT / 1000.0))
continue; // stale universes cannot be dominant
if (!ret || uni->source()->priority() > ret->source()->priority())
ret = uni;
}
return ret;
}
/**
* @brief MergeProxyUniverse::newSource_
* @param src
*/
void MergeProxyUniverse::newProvenance_(const Provenance &src)
{
sources_.emplace(src, new Universe());
sources_.at(src)->onData(std::bind(&SACN::MergeProxyUniverse::dataChangedNotifier,
this, std::placeholders::_1));
}
} // namespace SACN

75
sacn/mergeproxyuniverse.h Normal file
View File

@ -0,0 +1,75 @@
/*
mergeproxyuniverse.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include "universe.h"
#include <memory>
#include <unordered_map>
namespace SACN {
/**
* @brief The MergeProxyUniverse class
* 6.2.3.1 Multiple Sources at Highest Priority
* It is possible for there to be multiple sources, all transmitting data
* at the highest currently active priority for a given universe. When this
* occurs, receivers must handle these sources in some way.
*/
class MergeProxyUniverse
: public SACN::Universe
{
public:
MergeProxyUniverse();
~MergeProxyUniverse();
// Source universes:
const std::vector<Provenance> sources() const;
Universe* sourceUniverse(const Provenance&);
bool hasSourceUniverse(const Provenance&) const;
bool hasSources() const;
void deleteSourceUniverse(const Provenance&);
void addSourceUniverse(Universe *);
void dataChangedNotifier(DMX::Universe* universe);
// SACN::Universe overrides:
bool isSyncronized() const override;
std::shared_ptr<Provenance> source() const override;
void set(std::shared_ptr<ACN::DMP::Pdu>, std::shared_ptr<Provenance>) override;
void setProvenance(std::shared_ptr<Provenance>) override {};
void synchronize() override;
// DMX::Universe Overrides:
const DMX::DimmerData *data() const override;
uint8_t slot(const uint16_t) override;
double rxRate() override;
private:
std::unordered_map<Provenance, SACN::Universe*> sources_;
Universe* dominant_() const;
void newProvenance_(const Provenance&);
};
} // SACN namespace

View File

@ -5,7 +5,7 @@ namespace SACN {
Node::Node(UUID::uuid cid)
: Appliance(cid)
{
fctn_ = "libESTA sACN Node";
fctn_ = "OpenLCP sACN Node";
}
} // SACN

75
sacn/provenance.cpp Normal file
View File

@ -0,0 +1,75 @@
/*
provenance.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "provenance.h"
#include "rlp/rlp.h"
namespace SACN {
/**
* @brief Provenance::Provenance
*/
Provenance::Provenance()
: cid_(UUID::uuid())
, description_(std::string())
, universe_(0)
, priority_(100)
, sync_address_(0)
, options_(0)
{}
/**
* @brief Construct a Universe Source from an sACN frame PDU
* @param pdu
*/
Provenance::Provenance(std::shared_ptr<DATA::Pdu> pdu)
{
auto root_header = static_cast<ACN::RLP::rlp_header*>(pdu->parent()->header());
auto frame_header = static_cast<DATA::data_header*>(pdu->header());
cid_ = root_header->cid;
description_ = frame_header->source_name;
universe_ = frame_header->universe;
priority_ = frame_header->priority;
sync_address_ = frame_header->sync_address;
options_ = frame_header->options;
};
/**
* @brief operator ==
* @param a
* @param b
* @return
*/
bool operator== (const Provenance& a, const Provenance& b)
{
return (std::hash<Provenance>{}(a) == std::hash<Provenance>{}(b));
}
} // namespace SACN

97
sacn/provenance.h Normal file
View File

@ -0,0 +1,97 @@
/*
provenance.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include "data.h"
#include "uuid/uuid.h"
#include <cstdint>
#include <string>
namespace SACN {
/**
* @brief The Provenance class
*/
class Provenance
{
public:
Provenance();
Provenance(std::shared_ptr<DATA::Pdu>);
const UUID::uuid CID() const {return cid_;};
const std::string description() const {return description_;}
uint16_t universe() const {return universe_;}
uint8_t priority() const {return priority_;}
uint16_t syncAddress() const {return sync_address_;}
bool isTerminated() const {return options_
& DATA::STREAM_TERMINATED;}
bool isPreview() const {return options_
& DATA::PREVIEW_DATA;}
bool isForced() const {return options_
& DATA::FORCE_SYNCHRONIZATION;}
friend bool operator== (const Provenance& a, const Provenance& b);
void setCID(UUID::uuid cid) { cid_ = cid; }
void setDescription(std::string desc) { description_ = desc; }
void setOptions(uint8_t o) { options_ = o; }
void setUniverse(uint16_t n) { if (n >= 1 && n <= 63999) universe_ = n; }
void setSyncAddress(uint16_t a) { if (a >= 1 && a <= 63999) sync_address_ = a; }
void setPriority(uint8_t p) { if (p <= 200) priority_ = p; }
private:
UUID::uuid cid_;
std::string description_;
uint16_t universe_;
uint8_t priority_;
uint16_t sync_address_;
uint8_t options_;
};
} // SACN namespace
namespace std
{
template<>
/**
* @brief The hash struct specilizaton for SACN::Provenance
*/
struct hash<SACN::Provenance>
{
/**
* @brief operator ()
* @param src
* @return
*/
size_t operator()(SACN::Provenance const& src) const noexcept
{
size_t h1 = hash<string>{}(src.description());
size_t h2 = hash<UUID::uuid>{}(src.CID());
size_t h3 = hash<int>{}(src.priority());
size_t h = h1 ^ h2 ^ h3; // or use boost::hash_combine
return h;
}
};
} // std namespace

View File

@ -37,7 +37,7 @@ namespace SACN {
Receiver::Receiver(UUID::uuid cid)
: Appliance(cid)
{
fctn_ = "libESTA sACN Receiver";
fctn_ = "OpenLCP sACN Receiver";
RlpRegisterVector(VECTOR_ROOT_E131_DATA, std::bind(&Receiver::dataReceiver,
this, std::placeholders::_1));
@ -189,7 +189,7 @@ void Receiver::extendedReceiver(std::shared_ptr<ACN::RLP::Pdu> root)
*
*/
void Receiver::dataFrameHandler(std::shared_ptr<DATA::Pdu> frame) {
auto source = std::shared_ptr<UniverseSource>(new UniverseSource(frame));
auto source = std::shared_ptr<Provenance>(new Provenance(frame));
if (!universes_.count(source->universe()))
return;

View File

@ -23,11 +23,11 @@
*/
#pragma once
#include "acn/appliance.h"
#include "rlp/appliance.h"
#include "data.h"
#include "extended.h"
#include "sacn.h"
#include "universe.h"
#include "mergeproxyuniverse.h"
#include <unordered_map>
#include <vector>
@ -35,7 +35,7 @@
namespace SACN {
class Receiver
: public virtual ACN::Appliance
: public virtual ACN::RLP::Appliance
{
public:
Receiver(UUID::uuid = UUID::uuid());

View File

@ -32,7 +32,7 @@ namespace SACN {
Source::Source(UUID::uuid cid)
: Appliance(cid)
{
fctn_ = "libESTA sACN Source";
fctn_ = "OpenLCP sACN Source";
}
@ -46,11 +46,11 @@ void Source::create(const uint16_t num)
return;
universes_.emplace(num, new Universe());
auto source = std::shared_ptr<UniverseSource>(new UniverseSource());
auto source = std::shared_ptr<Provenance>(new Provenance());
source->setCID(this->cid());
source->setDescription(this->name());
source->setUniverse(num);
universes_[num]->setSource(source);
universes_[num]->setProvenance(source);
}

View File

@ -23,7 +23,7 @@
*/
#pragma once
#include "acn/appliance.h"
#include "rlp/appliance.h"
#include "sacn.h"
#include "universe.h"
@ -33,7 +33,7 @@ namespace SACN {
class Source
: public virtual ACN::Appliance
: public virtual ACN::RLP::Appliance
{
public:
Source(UUID::uuid = UUID::uuid());

View File

@ -22,80 +22,26 @@
SOFTWARE.
*/
#include "acn/rlp.h"
#include "universe.h"
#include "config.h"
namespace SACN {
/**
* @brief UniverseSource::UniverseSource
*/
UniverseSource::UniverseSource()
: cid_(UUID::uuid())
, description_(std::string())
, universe_(0)
, priority_(100)
, sync_address_(0)
, options_(0)
{}
/**
* @brief UniverseSource::UniverseSource
* @param pdu
*
* Construct a Universe Source from an sACN frame PDU
*/
UniverseSource::UniverseSource(std::shared_ptr<DATA::Pdu> pdu)
{
auto root_header = static_cast<ACN::RLP::rlp_header*>(pdu->parent()->header());
auto frame_header = static_cast<DATA::data_header*>(pdu->header());
cid_ = root_header->cid;
description_ = frame_header->source_name;
universe_ = frame_header->universe;
priority_ = frame_header->priority;
sync_address_ = frame_header->sync_address;
options_ = frame_header->options;
};
/**
* @brief operator ==
* @param a
* @param b
* @return
*/
bool operator== (const UniverseSource& a, const UniverseSource& b)
{
return (std::hash<UniverseSource>{}(a) == std::hash<UniverseSource>{}(b));
}
/**
* @brief Universe::Universe
*/
Universe::Universe()
: DMX::Universe(E131_NETWORK_DATA_LOSS_TIMEOUT)
, ACN::DMP::Device()
{
sync_data_.clear();
}
/**
* @brief Universe::~Universe
*/
Universe::~Universe()
{
}
/**
Set universe data from a DMP PDU from a UniverseSource.
*/
void Universe::set(std::shared_ptr<ACN::DMP::Pdu> dmp,
std::shared_ptr<UniverseSource> source)
std::shared_ptr<Provenance> source)
{
/// 7.3 Address Type and Data Type
/// Sources shall set the DMP Layer's Address Type and Data Type to 0xa1.
@ -131,7 +77,7 @@ void Universe::set(std::shared_ptr<ACN::DMP::Pdu> dmp,
if (range.count < 1 || range.count > 513)
return;
setSource(source);
setProvenance(source);
/// 7.7 Property Values (DMX512-A Data)
/// The DMP Layer's Property values field is used to encode the
@ -154,9 +100,9 @@ void Universe::set(std::shared_ptr<ACN::DMP::Pdu> dmp,
* @brief Universe::setSource
* @param source
*/
void Universe::setSource(std::shared_ptr<UniverseSource> source)
void Universe::setProvenance(std::shared_ptr<Provenance> source)
{
source_ = source;
provenance_ = source;
}
@ -190,232 +136,4 @@ void Universe::synchronize()
sync_data_.clear();
}
/**
* @brief MergeProxyUniverse::MergeProxyUniverse
*/
MergeProxyUniverse::MergeProxyUniverse()
: SACN::Universe()
{
}
/**
* @brief MergeProxyUniverse::~MergeProxyUniverse
*/
MergeProxyUniverse::~MergeProxyUniverse()
{
for (auto& [_, universe] : sources_)
delete universe;
}
/**
* @brief MergeProxyUniverse::sources
* @return
*/
const std::vector<UniverseSource> MergeProxyUniverse::sources() const
{
std::vector<UniverseSource> keys;
for (const auto& [key, _] : sources_)
keys.push_back(key);
return keys;
}
/**
* @brief MergeProxyUniverse::sourceUniverse
* @return
*/
Universe* MergeProxyUniverse::sourceUniverse(const UniverseSource &src)
{
if (!hasSourceUniverse(src))
newSource_(src);
return sources_.at(src);
}
/**
* @brief MergeProxyUniverse::hasSourceUniverse
* @return
*/
bool MergeProxyUniverse::hasSourceUniverse(const UniverseSource& src) const
{
if (sources_.count(src))
return true;
return false;
}
/**
* @brief MergeProxyUniverse::hassources
* @return
*/
bool MergeProxyUniverse::hasSources() const
{
if (sources_.size())
return true;
return false;
}
/**
* @brief MergeProxyUniverse::deleteSourceUniverse
* @return
*/
void MergeProxyUniverse::deleteSourceUniverse(const UniverseSource& src)
{
if (sources_.count(src))
{
delete sources_.at(src);
sources_.erase(src);
}
}
/**
* @brief MergeProxyUniverse::addSourceUniverse
*/
void MergeProxyUniverse::addSourceUniverse(Universe* universe)
{
sources_.at(*universe->source()) = universe;
}
/**
* @brief MergeProxyUniverse::dataChangedNotifier
* @param universe
*/
void MergeProxyUniverse::dataChangedNotifier(DMX::Universe* dmx)
{
auto sacn = static_cast<SACN::Universe*>(dmx);
auto universe = dominant_();
if (!universe)
return;
if (sacn->source() == universe->source())
for (const auto &cb : callbacks_)
cb(this);
}
/**
* @brief MergeProxyUniverse::isSyncronized
* @return
*/
bool MergeProxyUniverse::isSyncronized() const
{
auto universe = dominant_();
if (!universe)
return false;
return universe->isSyncronized();
}
/**
* @brief MergeProxyUniverse::source
* @return
*/
std::shared_ptr<UniverseSource> MergeProxyUniverse::source() const
{
auto universe = dominant_();
if (!universe)
return nullptr;
return universe->source();
}
/**
* @brief MergeProxyUniverse::set
* @param pdu
* @param source
*/
void MergeProxyUniverse::set(std::shared_ptr<ACN::DMP::Pdu> pdu,
std::shared_ptr<UniverseSource> src)
{
if (!sources_.count(*src))
newSource_(*src);
sources_.at(*src)->set(pdu, src);
}
/**
* @brief MergeProxyUniverse::synchronize
*/
void MergeProxyUniverse::synchronize()
{
for ( auto& [_, uni] : sources_)
uni->synchronize();
}
/**
* @brief MergeProxyUniverse::data
* @return
*/
const DMX::DimmerData * MergeProxyUniverse::data() const
{
auto universe = dominant_();
if (!universe)
return nullptr;
return universe->data();
}
/**
* @brief MergeProxyUniverse::slot
* @param s
* @return
*/
uint8_t MergeProxyUniverse::slot(const uint16_t s)
{
auto universe = dominant_();
if (!universe)
return 0;
return universe->slot(s);
}
/**
* @brief MergeProxyUniverse::rxRate
* @return
*/
double MergeProxyUniverse::rxRate()
{
auto universe = dominant_();
if (!universe)
return 0.0;
return universe->rxRate();
}
/**
* @brief MergeProxyUniverse::dominant_
* @return
*/
Universe* MergeProxyUniverse::dominant_() const
{
Universe* ret = nullptr;
for (auto& [_, uni] : sources_)
{
if (uni->rxRate() < (DMX::E111_DATA_LOSS_TIMEOUT / 1000.0))
continue; // stale universes cannot be dominant
if (!ret || uni->source()->priority() > ret->source()->priority())
ret = uni;
}
return ret;
}
/**
* @brief MergeProxyUniverse::newSource_
* @param src
*/
void MergeProxyUniverse::newSource_(const UniverseSource &src)
{
sources_.emplace(src, new Universe());
sources_.at(src)->onData(std::bind(&SACN::MergeProxyUniverse::dataChangedNotifier,
this, std::placeholders::_1));
}
}; // SACN
}; // namespace SACN

View File

@ -23,148 +23,38 @@
*/
#pragma once
#include "acn/dmp.h"
#include "data.h"
#include "dmp/dmp.h"
#include "dmp/device.h"
#include "dmx/universe.h"
#include "sacn.h"
#include "uuid/uuid.h"
#include "provenance.h"
#include <cstdint>
#include <memory>
#include <unordered_map>
#include <string>
namespace SACN {
/**
* @brief The UniverseSource class
*/
class UniverseSource
{
public:
UniverseSource();
UniverseSource(std::shared_ptr<DATA::Pdu>);
const UUID::uuid CID() const {return cid_;};
const std::string description() const {return description_;}
uint16_t universe() const {return universe_;}
uint8_t priority() const {return priority_;}
uint16_t syncAddress() const {return sync_address_;}
bool isTerminated() const {return options_
& DATA::STREAM_TERMINATED;}
bool isPreview() const {return options_
& DATA::PREVIEW_DATA;}
bool isForced() const {return options_
& DATA::FORCE_SYNCHRONIZATION;}
friend bool operator== (const UniverseSource& a, const UniverseSource& b);
void setCID(UUID::uuid cid) { cid_ = cid; }
void setDescription(std::string desc) { description_ = desc; }
void setOptions(uint8_t o) { options_ = o; }
void setUniverse(uint16_t n) { if (n >= 1 && n <= 63999) universe_ = n; }
void setSyncAddress(uint16_t a) { if (a >= 1 && a <= 63999) sync_address_ = a; }
void setPriority(uint8_t p) { if (p <= 200) priority_ = p; }
private:
UUID::uuid cid_;
std::string description_;
uint16_t universe_;
uint8_t priority_;
uint16_t sync_address_;
uint8_t options_;
};
} // SACN namespace
namespace std
{
template<>
/**
* @brief The hash struct specilizaton for SACN::UniverseSource
*/
struct hash<SACN::UniverseSource>
{
/**
* @brief operator ()
* @param src
* @return
*/
size_t operator()(SACN::UniverseSource const& src) const noexcept
{
size_t h1 = hash<string>{}(src.description());
size_t h2 = hash<UUID::uuid>{}(src.CID());
size_t h3 = hash<int>{}(src.priority());
size_t h = h1 ^ h2 ^ h3; // or use boost::hash_combine
return h;
}
};
} // std namespace
#include <vector>
namespace SACN {
/**
* @brief The Universe class
*/
class Universe
: public DMX::Universe
: public DMX::Universe
, public ACN::DMP::Device
{
public:
Universe();
~Universe();
virtual bool isSyncronized() const { return (sync_data_.size() > 0); };
virtual std::shared_ptr<UniverseSource> source() const { return source_; }
virtual std::shared_ptr<Provenance> source() const { return provenance_; }
virtual uint8_t slot (const uint16_t) override;
virtual void set(std::shared_ptr<ACN::DMP::Pdu>, std::shared_ptr<UniverseSource>);
virtual void setSource(std::shared_ptr<UniverseSource>);
virtual void set(std::shared_ptr<ACN::DMP::Pdu>, std::shared_ptr<Provenance>);
virtual void setProvenance(std::shared_ptr<Provenance>);
virtual void synchronize();
private:
std::shared_ptr<UniverseSource> source_;
std::shared_ptr<Provenance> provenance_;
std::vector<uint8_t> sync_data_;
};
/**
* @brief The MergeProxyUniverse class
* 6.2.3.1 Multiple Sources at Highest Priority
* It is possible for there to be multiple sources, all transmitting data
* at the highest currently active priority for a given universe. When this
* occurs, receivers must handle these sources in some way.
*/
class MergeProxyUniverse
: public SACN::Universe
{
public:
MergeProxyUniverse();
~MergeProxyUniverse();
// Source universes:
const std::vector<UniverseSource> sources() const;
Universe* sourceUniverse(const UniverseSource&);
bool hasSourceUniverse(const UniverseSource&) const;
bool hasSources() const;
void deleteSourceUniverse(const UniverseSource&);
void addSourceUniverse(Universe *);
void dataChangedNotifier(DMX::Universe* universe);
// SACN::Universe overrides:
bool isSyncronized() const override;
std::shared_ptr<UniverseSource> source() const override;
void set(std::shared_ptr<ACN::DMP::Pdu>, std::shared_ptr<UniverseSource>) override;
void setSource(std::shared_ptr<UniverseSource>) override {};
void synchronize() override;
// DMX::Universe Overrides:
const DMX::DimmerData *data() const override;
uint8_t slot(const uint16_t) override;
double rxRate() override;
private:
std::unordered_map<UniverseSource, SACN::Universe*> sources_;
Universe* dominant_() const;
void newSource_(const UniverseSource&);
};
} // SACN namespace

18
sdt/CMakeLists.txt Normal file
View File

@ -0,0 +1,18 @@
target_sources(${PROJECT_NAME}
PUBLIC
sdt/leader.h
sdt/member.h
PRIVATE
sdt/channel.cpp
sdt/channel.h
sdt/leader.cpp
sdt/member.cpp
sdt/identity.cpp
sdt/identity.h
sdt/sdt.cpp
sdt/sdt.h
sdt/session.cpp
sdt/session.h
sdt/udp.cpp
sdt/udp.h
)

View File

@ -1,5 +1,5 @@
/*
sdt-channel.cpp
sdt/channel.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -22,10 +22,9 @@
SOFTWARE.
*/
#include "sdt-channel.h"
#include "channel.h"
namespace ACN {
namespace SDT {
namespace ACN::SDT {
/**
* @brief Channel::Channel
@ -45,5 +44,4 @@ Channel::~Channel() {
// TODO: close the channel.
}
} // namespace SDT
} // namespace ACN
} // namespace ACN::SDT

View File

@ -1,5 +1,5 @@
/*
sdt-channel.h
sdt/channel.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -23,12 +23,11 @@
*/
#pragma once
#include "component.h"
#include "acn/component.h"
#include <memory>
namespace ACN {
namespace SDT {
namespace ACN::SDT {
/**
* @brief 3.3 Sequenced Channels
@ -56,5 +55,4 @@ private:
Direction direction_ = internal;
};
} // namespace SDT
} // namespace ACN
} // namespace ACN::SDT

34
sdt/identity.cpp Normal file
View File

@ -0,0 +1,34 @@
/*
sdt/member.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "identity.h"
namespace ACN::SDT {
Identity::Identity()
{
}
} // namespace ACN::SDT

34
sdt/identity.h Normal file
View File

@ -0,0 +1,34 @@
/*
sdt/identity.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
namespace ACN::SDT {
class Identity
{
public:
Identity();
};
} // namespace ACN::SDT

67
sdt/leader.cpp Normal file
View File

@ -0,0 +1,67 @@
/*
sdt/leader.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "leader.h"
namespace ACN::SDT {
/**
* @brief Leader::Leader
* @param cid
*/
Leader::Leader(UUID::uuid cid)
: ACN::RLP::Appliance(cid)
{
fctn_ = "OpenLCP SDT Leader";
/**
* 1.3.1. Recursive use of PDU Format in Other Protocols
* ... within ACN as currently specified, there is just one higher layer
* protocol defined which interfaces directly to the root layer:
* Session Data Transport
*/
RlpRegisterVector(SDT::SDT_PROTOCOL_ID, std::bind(&Leader::SdtReceiver,
this, std::placeholders::_1));
}
/**
* @brief Leader::SdtReceiver
* @param rlp
*/
void Leader::SdtReceiver(std::shared_ptr<RLP::Pdu> root)
{
root->createDataBlock<SDT::Pdu>();
auto block = static_cast<PDU::Block<SDT::Pdu>*>(root->data());
for(auto const &sdt : *block->pdu) {
switch(sdt->vector()) {
/// TODO: handle SDT
default:
break;
}
}
}
} // namespace ACN::SDT

54
sdt/leader.h Normal file
View File

@ -0,0 +1,54 @@
/*
sdt/leader.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include "session.h"
#include "rlp/appliance.h"
#include <vector>
#include <memory>
namespace ACN::SDT {
class Leader
: public ACN::RLP::Appliance
{
public:
Leader(UUID::uuid = UUID::uuid());
// RLP->SDT frames
virtual void SdtReceiver(std::shared_ptr<RLP::Pdu>);
// SDT 4.4 SDT Base Layer Messages
// Join, Get Sessions, and Sessions are ad-hoc messages, that is, they are
// not sent within channels. These messages identify their intended recipient
// by CID.
virtual void SdtJoinSession() {};
virtual void SdtGetSessions() {};
virtual void SdtSessions() {};
private:
std::vector<std::shared_ptr<Session>> sdt_sessions_;
};
} // namespace ACN::SDT

39
sdt/member.cpp Normal file
View File

@ -0,0 +1,39 @@
/*
sdt/member.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "member.h"
namespace ACN::SDT {
/**
* @brief Member::Member
* @param cid
*/
Member::Member(UUID::uuid cid)
: ACN::RLP::Appliance(cid)
{
fctn_ = "OpenLCP SDT Member";
}
} // namespace ACN::SDT

37
sdt/member.h Normal file
View File

@ -0,0 +1,37 @@
/*
sdt/member.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#pragma once
#include "rlp/appliance.h"
namespace ACN::SDT {
class Member
: public ACN::RLP::Appliance
{
public:
Member(UUID::uuid = UUID::uuid());
};
} // namespace ACN::SDT

View File

@ -24,8 +24,7 @@
#include "sdt.h"
namespace ACN {
namespace SDT {
namespace ACN::SDT {
namespace CLIENT {
@ -521,6 +520,4 @@ void disconnecting_data::oStream(PDU::Stream stream) const
*stream << reason;
}
} // namespace SDT
} // namespace ACN
} // namespace ACN::SDT

View File

@ -23,16 +23,12 @@
*/
#pragma once
#include "component.h"
#include "pdu.h"
#include "sdt-udp.h" // EPI 18
#include <vector>
#include "acn/pdu.h"
#include "udp.h" // EPI 18
// ANSI E1.17- 2015, Architecture for Control Networks
// Session Data Transport Protocol
namespace ACN {
namespace SDT {
namespace ACN::SDT {
/**
* @brief 7.1 Protocol Code
@ -371,5 +367,4 @@ struct disconnecting_data
void oStream(PDU::Stream) const override;
};
} // SDT
} // ACN
} // ACN::SDT

View File

@ -1,5 +1,5 @@
/*
sdt-session.cpp
sdt/session.cpp
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -22,10 +22,9 @@
SOFTWARE.
*/
#include "sdt-session.h"
#include "session.h"
namespace ACN {
namespace SDT {
namespace ACN::SDT {
/**
* @brief SessionId::operator == sessionID comparitor
@ -67,5 +66,4 @@ SessionId Session::id() {
return ret;
}
} // namespace SDT
} // namespace ACN
} // namespace ACN::SDT

View File

@ -1,5 +1,5 @@
/*
sdt-session.h
sdt/session.h
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
@ -23,12 +23,12 @@
*/
#pragma once
#include "channel.h"
#include "sdt.h"
#include "sdt-channel.h"
namespace ACN {
namespace SDT {
#include <memory>
#include <unordered_map>
namespace ACN::SDT {
/**
* @brief 3.1 Session Identity
@ -84,5 +84,4 @@ private:
};
} // namespace SDT
} // namespace ACN
} // namespace ACN::SDT

View File

@ -1,5 +1,5 @@
/*
sdt-udp.cpp
sdt/udp.cpp
Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com)
@ -23,12 +23,9 @@
*/
#include "sdt.h"
#include "sdt-udp.h"
namespace ACN {
namespace SDT {
namespace UDP {
#include "udp.h"
namespace ACN::SDT::UDP {
/**
* @brief ipAddress::streamSize
@ -99,6 +96,4 @@ void ipAddress::oStream(PDU::Stream stream) const
}
}
}; // UDP
}; // SDT
}; // ACN
}; // ACN::SDT::UDP

View File

@ -1,5 +1,5 @@
/*
sdt-udp.h
sdt/udp.h
Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com)
@ -23,13 +23,11 @@
*/
#pragma once
#include "acn/pdu.h"
#include <cstdint>
#include "pdu.h"
// ACN EPI 18 - Operation of SDT on UDP Networks
namespace ACN {
namespace SDT {
namespace UDP {
namespace ACN::SDT::UDP {
// Table 3. SDT symbolic parameters
static const float MAK_TIMEOUT_FACTOR = 0.1;
@ -64,6 +62,4 @@ struct ipAddress
void oStream(PDU::Stream) const override;
};
} // UDP
} // SDT
} // ACN
} // ACN::SDT::UDP

Some files were not shown because too many files have changed in this diff Show More