NAP
artnetinputcomponent.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 // Local Includes
8 #include "artnetevent.h"
9 
10 // External Includes
11 #include <component.h>
12 #include <entity.h>
13 #include <nap/signalslot.h>
14 
15 namespace nap
16 {
18 
19  class ArtNetInputComponentInstance;
20  class ArtNetService;
21 
27  class NAPAPI ArtNetInputComponent : public Component
28  {
29  RTTI_ENABLE(Component)
31  public:
32  uint8 mNet = 0;
33  uint8 mSubNet = 0;
34  uint8 mUniverse = 0;
35  bool mReceiveAll = false;
36  };
37 
39 
48  {
49  RTTI_ENABLE(ComponentInstance)
50  public:
51  // Default constructor
52  ArtNetInputComponentInstance(EntityInstance& entity, Component& resource) : ComponentInstance(entity, resource) { }
53 
54  // Unregister with service
56 
62  virtual bool init(utility::ErrorState& errorState) override;
63 
64  uint8 mNet = 0;
65  uint8 mSubNet = 0;
66  uint8 mUniverse = 0;
67  bool mReceiveAll = false;
68 
70 
75  Signal<const ArtNetEvent&>* getPacketReceived() { return &packetReceived; }
76 
77  protected:
82  void trigger(const ArtNetEvent& event);
83 
84  private:
85  friend class ArtNetService;
86 
87  ArtNetService* mService = nullptr; // Art-Net Service set when initialized
88  };
89 }
nap::ArtNetInputComponentInstance::ArtNetInputComponentInstance
ArtNetInputComponentInstance(EntityInstance &entity, Component &resource)
Definition: artnetinputcomponent.h:52
nap::ArtNetInputComponentInstance::packetReceived
Signal< const ArtNetEvent & > packetReceived
Triggered when the component receives an ArtDmx packet event.
Definition: artnetinputcomponent.h:69
nap::ArtNetInputComponent
Definition: artnetinputcomponent.h:27
nap::uint8
uint8_t uint8
Definition: numeric.h:16
nap::ArtNetInputComponentInstance::getPacketReceived
Signal< const ArtNetEvent & > * getPacketReceived()
Definition: artnetinputcomponent.h:75
nap::utility::ErrorState
Definition: errorstate.h:19
nap::ArtNetEvent
Definition: artnetevent.h:20
nap::ArtNetInputComponentInstance
Definition: artnetinputcomponent.h:47
nap::Signal
Definition: signalslot.h:28
nap::ArtNetService
Definition: artnetservice.h:39
nap::EntityInstance
Definition: entity.h:34
nap::ComponentInstance
Definition: component.h:43
nap::Component
Definition: component.h:151
nap
Definition: templateapp.h:17