Ring Daemon 16.0.0
Loading...
Searching...
No Matches
ring_signal.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#include "ring_signal.h"
19
20namespace jami {
21
24{
25 static SignalHandlerMap handlers = {
26 /* Call */
51
52 /* Configuration */
83#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
85#endif
86#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
89#endif
93
94 /* Presence */
100
101 /* Audio */
104
105 /* DataTransfer */
107
108#ifdef ENABLE_VIDEO
109 /* MediaPlayer */
111
112 /* Video */
116#ifdef __ANDROID__
121#endif
126#endif
127
128 /* Conversation */
148
149#ifdef ENABLE_PLUGIN
151#endif
152 };
153
154 return handlers;
155}
156
157}; // namespace jami
158
159namespace libjami {
160
161void
162registerSignalHandlers(const std::map<std::string, std::shared_ptr<CallbackWrapperBase>>& handlers)
163{
164 auto& handlers_ = jami::getSignalHandlers();
165 for (auto& item : handlers) {
166 auto iter = handlers_.find(item.first);
167 if (iter == handlers_.end()) {
168 JAMI_ERR("Signal %s not supported", item.first.c_str());
169 continue;
170 }
171 iter->second = item.second;
172 }
173}
174
175void
177{
178 auto& handlers_ = jami::getSignalHandlers();
179 for (auto& item : handlers_) {
180 item.second = {};
181 }
182}
183
184} // namespace libjami
#define JAMI_ERR(...)
Definition logger.h:218
std::map< std::string, std::shared_ptr< libjami::CallbackWrapperBase > > SignalHandlerMap
Definition ring_signal.h:54
void emitSignal(Args... args)
Definition ring_signal.h:64
SignalHandlerMap & getSignalHandlers()
void registerSignalHandlers(const std::map< std::string, std::shared_ptr< CallbackWrapperBase > > &handlers)
void unregisterSignalHandlers()