reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
Event.hxx
Go to the documentation of this file.
1#if !defined(Kurento_Event_hxx)
2#define Kurento_Event_hxx
3
4#include <memory>
5#include <string>
6
7#include "cajun/json/elements.h"
8
9#include "Continuation.hxx"
10
11namespace kurento
12{
13
14class Event
15{
16 public:
17 static std::shared_ptr<Event> make_event(const std::string& eventType, const json::Object& message);
18 virtual ~Event(); // FIXME
19
20
21 protected:
22 Event(const std::string& name);
23
24 private:
25 friend std::ostream& operator<<(std::ostream& strm, const Event& e);
26
27 std::string mName;
28};
29
30inline std::ostream& operator<<(std::ostream& strm, const Event& e)
31{
32 strm << e.mName;
33 return strm;
34}
35
37{
38 public:
39 static const std::string EVENT_NAME;
40
41 OnIceCandidateFoundEvent(const json::Object& message);
43
44 const std::string& getCandidate() const { return mCandidate; };
45 unsigned int getLineIndex() const { return mLineIndex; };
46 const std::string& getId() const { return mId; };
47
48 private:
49 std::string mCandidate;
50 unsigned int mLineIndex;
51 std::string mId;
52};
53
55{
56 public:
57 static const std::string EVENT_NAME;
58
59 OnIceGatheringDoneEvent(const json::Object& message);
61};
62
64{
65 public:
66 static const std::string EVENT_NAME;
67
68 OnConnectionStateChangedEvent(const json::Object& message);
70};
71
73{
74 public:
75 static const std::string EVENT_NAME;
76
77 OnMediaStateChangedEvent(const json::Object& message);
79};
80
82{
83 public:
84 static const std::string EVENT_NAME;
85
86 OnMediaTranscodingStateChangeEvent(const json::Object& message);
88};
89
91{
92 public:
93 static const std::string EVENT_NAME;
94
95 OnMediaFlowInStateChangeEvent(const json::Object& message);
97};
98
100{
101 public:
102 static const std::string EVENT_NAME;
103
104 OnMediaFlowOutStateChangeEvent(const json::Object& message);
106};
107
109{
110 public:
111 static const std::string EVENT_NAME;
112
113 OnKeyframeRequiredEvent(const json::Object& message);
114 virtual ~OnKeyframeRequiredEvent();
115};
116
117class OnErrorEvent : public Event
118{
119 public:
120 static const std::string EVENT_NAME;
121
122 OnErrorEvent(const json::Object& message);
123 virtual ~OnErrorEvent();
124};
125
127{
128public:
129 static const std::string EVENT_NAME;
130
131 OnDataChannelOpenEvent(const json::Object& message);
132 virtual ~OnDataChannelOpenEvent();
133};
134
136{
137 public:
138 virtual ~EventListener() {};
139 virtual void onEvent(std::shared_ptr<Event> event) = 0;
140};
141
142typedef std::function<void (std::shared_ptr<Event> event) >
144
146{
147 public:
149 virtual ~EventContinuation() {};
150 virtual void onEvent(std::shared_ptr<Event> event) override { mContinuation(event); };
151 private:
152 ContinuationEvent mContinuation;
153};
154
155}
156
157#endif
158
159/* ====================================================================
160
161 Copyright (c) 2021, Software Freedom Institute https://softwarefreedom.institute
162 Copyright (c) 2021, Daniel Pocock https://danielpocock.com
163 All rights reserved.
164
165 Redistribution and use in source and binary forms, with or without
166 modification, are permitted provided that the following conditions are
167 met:
168
169 1. Redistributions of source code must retain the above copyright
170 notice, this list of conditions and the following disclaimer.
171
172 2. Redistributions in binary form must reproduce the above copyright
173 notice, this list of conditions and the following disclaimer in the
174 documentation and/or other materials provided with the distribution.
175
176 3. Neither the name of Plantronics nor the names of its contributors
177 may be used to endorse or promote products derived from this
178 software without specific prior written permission.
179
180 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
181 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
183 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
184 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
185 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
186 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
187 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
188 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
189 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
190 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
191
192 ==================================================================== */
virtual void onEvent(std::shared_ptr< Event > event) override
Definition Event.hxx:150
EventContinuation(ContinuationEvent c)
Definition Event.hxx:148
virtual ~EventListener()
Definition Event.hxx:138
virtual void onEvent(std::shared_ptr< Event > event)=0
virtual ~Event()
Definition Event.cxx:24
static std::shared_ptr< Event > make_event(const std::string &eventType, const json::Object &message)
Definition Event.cxx:29
friend std::ostream & operator<<(std::ostream &strm, const Event &e)
Definition Event.hxx:30
static const std::string EVENT_NAME
Definition Event.hxx:66
static const std::string EVENT_NAME
Definition Event.hxx:129
virtual ~OnErrorEvent()
Definition Event.cxx:138
static const std::string EVENT_NAME
Definition Event.hxx:120
unsigned int getLineIndex() const
Definition Event.hxx:45
const std::string & getId() const
Definition Event.hxx:46
const std::string & getCandidate() const
Definition Event.hxx:44
static const std::string EVENT_NAME
Definition Event.hxx:39
static const std::string EVENT_NAME
Definition Event.hxx:57
static const std::string EVENT_NAME
Definition Event.hxx:111
static const std::string EVENT_NAME
Definition Event.hxx:93
static const std::string EVENT_NAME
Definition Event.hxx:102
static const std::string EVENT_NAME
Definition Event.hxx:75
static const std::string EVENT_NAME
Definition Event.hxx:84
This class is used in the logging subsystem to identify logging messages generated from the Kurento c...
std::function< void(std::shared_ptr< Event > event) > ContinuationEvent
Definition Event.hxx:143
std::ostream & operator<<(std::ostream &strm, const Event &e)
Definition Event.hxx:30
void list()
Definition userAdmin.cxx:66