OpenLCP/protocol/artistic/artnet/device.cpp

297 lines
5.2 KiB
C++

/*
device.cpp
Copyright (c) 2022 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 ARTNET {
Device::Device()
{
/// \cite ARTNET A ArtPollReply packet is broadcast to the Directed Broadcast
/// address by all Art-Net devices on power up.
Device::txArtPollReply(); // Always the reference implimentation, never virual.
}
/**
*/
{
}
/**
*/
{
}
/**
*/
{
}
/**
* @brief Device::rxArtPoll
* @param packet
*/
void Device::rxArtPoll(std::shared_ptr<ArtPoll> packet)
{
auto data_opt = packet->data<poll_data>();
if (!data_opt.has_value())
return;
auto data = data_opt.value();
diagnostic_reporting_behavior = data->talk_to_me;
diagnostic_reporting_threshold = data->diagnostic_level;
/// All device types send an ArtPollReply in response to receiving an ArtPoll.
txArtPollReply();
}
/**
* @brief Device::rxArtPollReply
* @param packet
*/
void Device::rxArtPollReply(std::shared_ptr<ArtPollReply> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtDiagData
* @param packet
*/
void Device::rxArtDiagData(std::shared_ptr<ArtDiagData> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtCommand
* @param packet
*/
void Device::rxArtCommand(std::shared_ptr<ArtCommand> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtDmx
* @param packet
*/
void Device::rxArtDmx(std::shared_ptr<ArtDmx> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtNzs
* @param packet
*/
void Device::rxArtNzs(std::shared_ptr<ArtNzs> packet)
{
if (packet->isVLC())
rxArtVlc(packet);
}
/**
* @brief Device::rxArtVlc
* @param packet
*/
void Device::rxArtVlc(std::shared_ptr<ArtNzs> packet)
{
auto data_opt = packet->data<nzs_data>();
if (!data_opt.has_value())
return;
auto data = std::make_shared<vlc_data>(data_opt.value().get());
}
/**
* @brief Device::rxArtSync
* @param packet
*/
void Device::rxArtSync(std::shared_ptr<ArtSync> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtAddress
* @param packet
*/
void Device::rxArtAddress(std::shared_ptr<ArtAddress> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtInput
* @param packet
*/
void Device::rxArtInput(std::shared_ptr<ArtInput> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtTodRequest
* @param packet
*/
void Device::rxArtTodRequest(std::shared_ptr<ArtTodRequest> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtTodData
* @param packet
*/
void Device::rxArtTodData(std::shared_ptr<ArtTodData> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtTodControl
* @param packet
*/
void Device::rxArtTodControl(std::shared_ptr<ArtTodControl> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtRdm
* @param packet
*/
void Device::rxArtRdm(std::shared_ptr<ArtRdm> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtRdmSub
* @param packet
*/
void Device::rxArtRdmSub(std::shared_ptr<ArtRdmSub> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtFirmwareMaster
* @param packet
*/
void Device::rxArtFirmwareMaster(std::shared_ptr<ArtFirmwareMaster> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtFirmwareReply
* @param packet
*/
void Device::rxArtFirmwareReply(std::shared_ptr<ArtFirmwareReply> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtIpProg
* @param packet
*/
void Device::rxArtIpProg(std::shared_ptr<ArtIpProg> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtIpProgReply
* @param packet
*/
void Device::rxArtIpProgReply(std::shared_ptr<ArtIpProgReply> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtTimeCode
* @param packet
*/
void Device::rxArtTimeCode(std::shared_ptr<ArtTimeCode> packet)
{
(void)packet;
}
/**
* @brief Device::rxArtTrigger
* @param packet
*/
void Device::rxArtTrigger(std::shared_ptr<ArtTrigger> packet)
{
(void)packet;
}
/**
* @brief Device::txArtPollReply
*/
void Device::txArtPollReply()
{
auto packet = std::make_shared<ArtPollReply>();
/// \todo impliment txArtPollReply
}
/**
* @brief Device::txArtDiagData
*/
void Device::txArtDiagData()
{
auto packet = std::make_shared<ArtDiagData>();
/// \todo impliment txArtDiagData
}
} // namespace ARTNET