2021-05-27 10:59:22 -04:00
|
|
|
/*
|
|
|
|
receiver.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-15 23:36:29 -04:00
|
|
|
#include "acn/appliance.h"
|
2021-05-27 10:59:22 -04:00
|
|
|
#include "data.h"
|
2021-06-02 09:29:27 -04:00
|
|
|
#include "extended.h"
|
2021-05-27 10:59:22 -04:00
|
|
|
#include "sacn.h"
|
|
|
|
#include "universe.h"
|
2021-08-15 23:36:29 -04:00
|
|
|
|
2021-05-27 10:59:22 -04:00
|
|
|
#include <unordered_map>
|
2021-06-02 09:29:27 -04:00
|
|
|
#include <vector>
|
2021-05-27 10:59:22 -04:00
|
|
|
|
|
|
|
namespace SACN {
|
|
|
|
|
|
|
|
class Receiver
|
2021-08-15 23:36:29 -04:00
|
|
|
: public virtual ACN::Appliance
|
2021-05-27 10:59:22 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
Receiver(UUID::uuid = UUID::uuid());
|
2021-08-02 10:09:14 -04:00
|
|
|
~Receiver();
|
|
|
|
|
2021-05-27 10:59:22 -04:00
|
|
|
virtual void subscribe(const uint16_t);
|
|
|
|
virtual void unsubscribe(const uint16_t);
|
2021-06-20 09:12:14 -04:00
|
|
|
Universe * universe(const uint16_t);
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-06-02 09:29:27 -04:00
|
|
|
void discoveryStart();
|
|
|
|
void discoveryStop();
|
|
|
|
void onDiscovered(const EXTENDED::DISCOVERY::Watcher);
|
|
|
|
|
2021-05-27 10:59:22 -04:00
|
|
|
protected:
|
2021-07-28 10:43:43 -04:00
|
|
|
// 5 - E1.31 use of the ACN Root Layer Protocol
|
2021-08-15 23:36:29 -04:00
|
|
|
void dataReceiver(std::shared_ptr<ACN::RLP::Pdu>);
|
|
|
|
void extendedReceiver(std::shared_ptr<ACN::RLP::Pdu>);
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-07-28 10:43:43 -04:00
|
|
|
// 6.2 E1.31 Data Packet Framing Layer
|
|
|
|
void dataFrameHandler(std::shared_ptr<DATA::Pdu>);
|
|
|
|
|
|
|
|
// 6.3 E1.31 Synchronization Packet Framing Layer
|
|
|
|
void syncFrameHandler(std::shared_ptr<EXTENDED::Pdu>);
|
|
|
|
|
|
|
|
// 6.4 E1.31 Universe Discovery Packet Framing Layer
|
|
|
|
void discoveryFrameHandler(std::shared_ptr<EXTENDED::Pdu>);
|
|
|
|
// 8 Universe Discovery Layer
|
2021-06-02 09:29:27 -04:00
|
|
|
void discoveryListHanlder(std::shared_ptr<EXTENDED::DISCOVERY::Pdu>);
|
2021-05-27 10:59:22 -04:00
|
|
|
|
|
|
|
private:
|
2021-08-02 10:09:14 -04:00
|
|
|
std::unordered_map<uint16_t, MergeProxyUniverse*> universes_;
|
2021-06-02 09:29:27 -04:00
|
|
|
std::vector<EXTENDED::DISCOVERY::Watcher> discoveryCallbacks_;
|
2021-05-27 10:59:22 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|