100 lines
2.4 KiB
C++
100 lines
2.4 KiB
C++
/*
|
|
sender.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 "source.h"
|
|
|
|
namespace SACN {
|
|
|
|
/**
|
|
* @brief Source::Source
|
|
* @param cid
|
|
*/
|
|
Source::Source(UUID::uuid cid)
|
|
: Appliance(cid)
|
|
{
|
|
fctn_ = "libESTA sACN Source";
|
|
}
|
|
|
|
|
|
/**
|
|
* @brief Source::create
|
|
* @param num
|
|
*/
|
|
void Source::create(const uint16_t num)
|
|
{
|
|
if (universes_.count(num))
|
|
return;
|
|
universes_.emplace(num, new Universe());
|
|
|
|
auto source = std::shared_ptr<UniverseSource>(new UniverseSource());
|
|
source->setCID(this->cid());
|
|
source->setDescription(this->name());
|
|
source->setUniverse(num);
|
|
universes_[num]->setSource(source);
|
|
}
|
|
|
|
|
|
/**
|
|
* @brief Source::terminate
|
|
* @param num
|
|
*/
|
|
void Source::terminate(const uint16_t num)
|
|
{
|
|
if (!universes_.count(num))
|
|
return;
|
|
|
|
auto source = universes_[num]->source();
|
|
source->setOptions(0 | source->isForced()
|
|
| source->isPreview()
|
|
| DATA::STREAM_TERMINATED);
|
|
}
|
|
|
|
|
|
/**
|
|
* @brief Source::end
|
|
* @param num
|
|
*/
|
|
void Source::end(const uint16_t num)
|
|
{
|
|
if (!universes_.count(num))
|
|
return;
|
|
|
|
universes_.erase(num);
|
|
}
|
|
|
|
|
|
/**
|
|
* @brief Source::universe
|
|
* @param num
|
|
* @return
|
|
*/
|
|
Universe * Source::universe(const uint16_t num)
|
|
{
|
|
if (!universes_.count(num))
|
|
return 0;
|
|
|
|
return universes_.at(num);
|
|
}
|
|
|
|
} // SACN
|