Ring Daemon
Loading...
Searching...
No Matches
jami_signal.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2026 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 "jami_signal.h"
19
20namespace jami {
21
24{
25 static SignalHandlerMap handlers = {
26 /* Call */
49
50 /* Configuration */
81#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
83#endif
84#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
87#endif
91
92 /* Presence */
98
99 /* Audio */
102
103 /* DataTransfer */
105
106#ifdef ENABLE_VIDEO
107 /* MediaPlayer */
109
110 /* Video */
114#ifdef __ANDROID__
119#endif
124#endif
125
126 /* Conversation */
144
145#ifdef ENABLE_PLUGIN
147#endif
148 };
149
150 return handlers;
151}
152
153}; // namespace jami
154
155namespace libjami {
156
157void
158registerSignalHandlers(const std::map<std::string, std::shared_ptr<CallbackWrapperBase>>& handlers)
159{
160 auto& handlers_ = jami::getSignalHandlers();
161 for (auto& item : handlers) {
162 auto iter = handlers_.find(item.first);
163 if (iter == handlers_.end()) {
164 JAMI_ERR("Signal %s not supported", item.first.c_str());
165 continue;
166 }
167 iter->second = item.second;
168 }
169}
170
171void
173{
174 auto& handlers_ = jami::getSignalHandlers();
175 for (auto& item : handlers_) {
176 item.second = {};
177 }
178}
179
180} // namespace libjami
#define JAMI_ERR(...)
Definition logger.h:230
std::map< std::string, std::shared_ptr< libjami::CallbackWrapperBase > > SignalHandlerMap
Definition jami_signal.h:53
void emitSignal(Args... args)
Definition jami_signal.h:64
SignalHandlerMap & getSignalHandlers()
void registerSignalHandlers(const std::map< std::string, std::shared_ptr< CallbackWrapperBase > > &handlers)
void unregisterSignalHandlers()