summaryrefslogtreecommitdiff
path: root/test/network_tests/debounce_tests/debounce_test_service.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/network_tests/debounce_tests/debounce_test_service.hpp')
-rw-r--r--test/network_tests/debounce_tests/debounce_test_service.hpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/network_tests/debounce_tests/debounce_test_service.hpp b/test/network_tests/debounce_tests/debounce_test_service.hpp
new file mode 100644
index 0000000..0271ae1
--- /dev/null
+++ b/test/network_tests/debounce_tests/debounce_test_service.hpp
@@ -0,0 +1,48 @@
+// Copyright (C) 2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef DEBOUNCE_TEST_SERVICE_HPP_
+#define DEBOUNCE_TEST_SERVICE_HPP_
+
+#include <atomic>
+#include <condition_variable>
+#include <mutex>
+#include <thread>
+
+#include <gtest/gtest.h>
+
+#include <vsomeip/vsomeip.hpp>
+
+#include "debounce_test_common.hpp"
+
+class debounce_test_service {
+public:
+ debounce_test_service(debounce_test_id_e _test_id);
+
+ bool init();
+ void start();
+ void stop();
+
+ void run();
+ void wait();
+
+private:
+ void on_start(const std::shared_ptr<vsomeip::message> &_message);
+ void on_stop(const std::shared_ptr<vsomeip::message> &_message);
+
+ void start_test();
+
+ debounce_test_id_e test_id_;
+
+ std::mutex run_mutex_;
+ std::condition_variable run_condition_;
+
+ std::atomic<bool> is_running_;
+ std::thread runner_;
+ std::shared_ptr<vsomeip::application> app_;
+};
+
+
+#endif // DEBOUNCE_TEST_SERVICE_HPP_