1
0
Fork 0

doc updates

This commit is contained in:
Kevin Matz 2021-06-22 21:26:03 -04:00
parent 32ef49554b
commit c3c0cc884a
1 changed files with 65 additions and 26 deletions

View File

@ -27,8 +27,11 @@
namespace SACN {
/**
Constructor. Register RLP vector callbacks.
*/
* @brief Receiver::Receiver
* @param cid
*
* Constructor. Register RLP vector callbacks.
*/
Receiver::Receiver(UUID::uuid cid)
: Appliance(cid)
{
@ -39,11 +42,21 @@ Receiver::Receiver(UUID::uuid cid)
}
/**
* @brief Receiver::subscribe
* @param num
*/
void Receiver::subscribe(const uint16_t num) {
if (!universes_.count(num))
universes_.emplace(num, new SACN::Universe());
if (universes_.count(num))
return;
universes_.emplace(num, new SACN::Universe());
}
/**
* @brief Receiver::unsubscribe
* @param num
*/
void Receiver::unsubscribe(const uint16_t num) {
if (!universes_.count(num))
return;
@ -51,36 +64,50 @@ void Receiver::unsubscribe(const uint16_t num) {
universes_.erase(num);
}
Universe * Receiver::universe(const uint16_t universe) {
if (universes_.count(universe))
return universes_.at(universe);
return 0;
/**
* @brief Receiver::universe
* @param num
* @return
*/
Universe * Receiver::universe(const uint16_t num) {
if (!universes_.count(num))
return 0;
return universes_.at(num);
}
/**
* @brief Receiver::discoveryStart
*/
void Receiver::discoveryStart() {
subscribe(SACN::E131_DISCOVERY_UNIVERSE);
}
/**
* @brief Receiver::discoveryStop
*/
void Receiver::discoveryStop() {
unsubscribe(SACN::E131_DISCOVERY_UNIVERSE);
}
/**
register a discovery consumer callback function
@param const Watcher something that wants to know about available universes.
*/
* @brief Receiver::onDiscovered
* @param cb something that wants to know about available universes.
*/
void Receiver::onDiscovered(const EXTENDED::DISCOVERY::Watcher cb) {
discoveryCallbacks_.push_back(cb);
}
/**
Receive VECTOR_ROOT_E131_DATA vector'd packets.
@param root is a shared pointer to the PDU
*/
* @brief Receiver::rootDataHandler
* @param root a shared pointer to the PDU
*
* Receive VECTOR_ROOT_E131_DATA vector'd packets.
*/
void Receiver::rootDataHandler(std::shared_ptr<RLP::Pdu> root) {
auto block = PDU::readBlock<DATA::Pdu>(root->stream(), root);
if (root->stream()->fail())
@ -102,10 +129,11 @@ void Receiver::rootDataHandler(std::shared_ptr<RLP::Pdu> root) {
/**
Receive VECTOR_ROOT_E131_EXTENDED vector'd packets.
@param root is a shared pointer to the PDU
*/
* @brief Receiver::rootExtendedHandler
* @param root a shared pointer to the PDU
*
* Receive VECTOR_ROOT_E131_EXTENDED vector'd packets.
*/
void Receiver::rootExtendedHandler(std::shared_ptr<RLP::Pdu> root) {
auto block = PDU::readBlock<EXTENDED::Pdu>(root->stream(), root);
if (root->stream()->fail())
@ -127,6 +155,10 @@ void Receiver::rootExtendedHandler(std::shared_ptr<RLP::Pdu> root) {
}
/**
* @brief Receiver::discoveryPacketHandler
* @param frame
*/
void Receiver::discoveryPacketHandler(std::shared_ptr<EXTENDED::Pdu> frame) {
auto block = PDU::readBlock<EXTENDED::DISCOVERY::Pdu>(frame->stream(), frame);
if (frame->stream()->fail())
@ -148,6 +180,10 @@ void Receiver::discoveryPacketHandler(std::shared_ptr<EXTENDED::Pdu> frame) {
}
/**
* @brief Receiver::discoveryListHanlder
* @param pdu
*/
void Receiver::discoveryListHanlder(std::shared_ptr<EXTENDED::DISCOVERY::Pdu> pdu) {
// header may be inherited. check that one exists
if (!pdu->header())
@ -166,12 +202,15 @@ void Receiver::discoveryListHanlder(std::shared_ptr<EXTENDED::DISCOVERY::Pdu> pd
/**
Receive `VECTOR_ROOT_E131_DATA -> VECTOR_E131_DATA_PACKET` vector'd packets.
Merging will be based on frame header. PDU data will be read as a block of DMP PDUs and passed to the universe.
@param pdu is a shared pointer to the PDU
*/
* @brief Receiver::dataPacketHandler
* @param frame
*
* Receive `VECTOR_ROOT_E131_DATA -> VECTOR_E131_DATA_PACKET` vector'd packets.
*
* Merging will be based on frame header. PDU data will be read as a block of
* DMP PDUs and passed to the universe.
*
*/
void Receiver::dataPacketHandler(std::shared_ptr<DATA::Pdu> frame) {
// header may be inherited. check that one exists
if (!frame->header())