blob: cca526c2a65253cae1f4717007cd5650cdb79c52 [file] [log] [blame]
Aline Gondim Santosfd302912022-08-18 12:07:46 -03001/**
2 * Copyright (C) 2020-2021 Savoir-faire Linux Inc.
3 *
4 * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <iostream>
22#include <string.h>
23#include <thread>
24#include <memory>
25#include <plugin/jamiplugin.h>
26
27#include "AudioHandlerTester.h"
28#include "VideoHandlerTester.h"
29#include "ChatHandlerTester.h"
30
31#ifdef WIN32
32#define EXPORT_PLUGIN __declspec(dllexport)
33#else
34#define EXPORT_PLUGIN
35#endif
36
37#define TestSuite_VERSION_MAJOR 1
38#define TestSuite_VERSION_MINOR 0
39#define TestSuite_VERSION_PATCH 0
40
41extern "C" {
42void
43pluginExit(void)
44{}
45
46EXPORT_PLUGIN JAMI_PluginExitFunc
47JAMI_dynPluginInit(const JAMI_PluginAPI* api)
48{
49 std::cout << "*******************" << std::endl;
50 std::cout << "** TestSuite **" << std::endl;
51 std::cout << "*******************" << std::endl << std::endl;
52 std::cout << "Version " << TestSuite_VERSION_MAJOR << "." << TestSuite_VERSION_MINOR << "."
53 << TestSuite_VERSION_PATCH << std::endl;
54
55 // If invokeService doesn't return an error
56 if (api) {
57 std::string dataPath;
58 api->invokeService(api, "getPluginDataPath", &dataPath);
59
60 auto fmpAudio
61 = std::make_unique<jami::AudioHandlerTester>(std::move(dataPath));
62 if (api->manageComponent(api,
63 "CallMediaHandlerManager",
64 fmpAudio.release())) {
65 return nullptr;
66 }
67
68 auto fmpVideo
69 = std::make_unique<jami::VideoHandlerTester>(std::move(dataPath));
70 if (api->manageComponent(api,
71 "CallMediaHandlerManager",
72 fmpVideo.release())) {
73 return nullptr;
74 }
75
76 auto fmpChat
77 = std::make_unique<jami::ChatHandlerTester>(std::move(dataPath));
78 if (api->manageComponent(api,
79 "ChatHandlerManager",
80 fmpChat.release())) {
81 return nullptr;
82 }
83 }
84 return pluginExit;
85}
86}