2021-05-27 10:59:22 -04:00
|
|
|
/*
|
|
|
|
universe.h
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2021-08-28 14:47:30 -04:00
|
|
|
#include "data.h"
|
2021-08-24 18:10:20 -04:00
|
|
|
#include "dmp/dmp.h"
|
2021-08-15 23:36:29 -04:00
|
|
|
#include "dmx/universe.h"
|
|
|
|
|
2021-08-24 18:10:20 -04:00
|
|
|
#include <cstdint>
|
2021-05-27 10:59:22 -04:00
|
|
|
#include <memory>
|
2021-08-24 18:10:20 -04:00
|
|
|
#include <vector>
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-08-28 09:01:33 -04:00
|
|
|
namespace sACN {
|
|
|
|
|
2021-08-31 09:27:53 -04:00
|
|
|
class Source; ///< forward declare from "sacn/source.h"
|
|
|
|
|
2021-05-27 10:59:22 -04:00
|
|
|
/**
|
2021-08-28 09:01:33 -04:00
|
|
|
* @brief \cite sACN 3.2 Universe
|
|
|
|
*
|
2021-08-28 12:54:26 -04:00
|
|
|
* > A set of up to 512 data slots identified by universe number.
|
|
|
|
* > Note: In E1.31 there may be multiple sources for a universe. See also: Slot.
|
2021-08-02 10:09:14 -04:00
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
class Universe
|
2021-08-24 18:10:20 -04:00
|
|
|
: public DMX::Universe
|
2021-05-27 10:59:22 -04:00
|
|
|
{
|
|
|
|
public:
|
2021-08-31 09:27:53 -04:00
|
|
|
Universe(Source* = nullptr);
|
2021-08-26 16:49:58 -04:00
|
|
|
~Universe();
|
2021-08-02 10:09:14 -04:00
|
|
|
|
2021-08-28 14:47:30 -04:00
|
|
|
virtual void set(ACN::PDU::Message<ACN::DMP::Pdu>, std::shared_ptr<DATA::data_header>);
|
2021-08-28 10:17:53 -04:00
|
|
|
|
2021-08-28 14:47:30 -04:00
|
|
|
virtual std::shared_ptr<DATA::data_header> provenance() const;
|
|
|
|
virtual void setProvenance(std::shared_ptr<DATA::data_header>);
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-08-28 10:17:53 -04:00
|
|
|
virtual bool isSyncronized() const;
|
2021-08-29 01:12:11 -04:00
|
|
|
virtual void synchronize(uint8_t = 0);
|
2021-08-06 12:36:04 -04:00
|
|
|
|
2021-08-30 10:00:54 -04:00
|
|
|
/**
|
|
|
|
* @brief destination IP address
|
|
|
|
*
|
|
|
|
* Setting type to ACN::SDT::SDT_ADDR_NULL will send on the multicast group.
|
|
|
|
*/
|
|
|
|
ipAddress destination;
|
|
|
|
|
2021-08-28 09:04:06 -04:00
|
|
|
protected:
|
|
|
|
/**
|
2021-08-28 12:54:26 -04:00
|
|
|
* @brief \cite sACN 3.7 Active Data Slots
|
2021-08-28 09:04:06 -04:00
|
|
|
*
|
2021-08-28 12:54:26 -04:00
|
|
|
* > When translating ANSI E1.11 DMX512-A \cite DMX to E1.31, the active data
|
|
|
|
* > slots are defined as ranging from data slot 1 to the maximum data slot in
|
|
|
|
* > the most recently received packet with the corresponding START Code.
|
|
|
|
* >
|
|
|
|
* > Devices originating E1.31 shall define their active data slots using
|
|
|
|
* > the DMP First Property Address and DMP Property Count fields shown in
|
|
|
|
* > Table 4-1.
|
2021-08-28 09:04:06 -04:00
|
|
|
*/
|
|
|
|
uint16_t active_data_slots;
|
|
|
|
|
2021-08-31 10:27:30 -04:00
|
|
|
virtual void sACNsend() const;
|
|
|
|
|
2021-05-27 10:59:22 -04:00
|
|
|
private:
|
2021-08-28 14:47:30 -04:00
|
|
|
std::shared_ptr<DATA::data_header> provenance_;
|
2021-08-26 16:49:58 -04:00
|
|
|
std::vector<uint8_t> * sync_data_ = nullptr;
|
2021-08-29 01:12:11 -04:00
|
|
|
uint8_t sync_sequence_ = 0;
|
2021-08-31 09:27:53 -04:00
|
|
|
Source* source_;
|
2021-05-27 10:59:22 -04:00
|
|
|
};
|
|
|
|
|
2021-08-02 10:09:14 -04:00
|
|
|
} // SACN namespace
|