1 // Copyright (C) 2020 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 2 // This Source Code Form is subject to the terms of the Mozilla Public 3 // License, v. 2.0. If a copy of the MPL was not distributed with this 4 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 6 #ifndef E2E_PROFILE_04_TEST_SERVICE_HPP_ 7 #define E2E_PROFILE_04_TEST_SERVICE_HPP_ 8 9 #include <gtest/gtest.h> 10 11 #include <vsomeip/vsomeip.hpp> 12 13 #include "../someip_test_globals.hpp" 14 15 #include <atomic> 16 #include <condition_variable> 17 #include <mutex> 18 #include <thread> 19 20 class e2e_profile_04_test_service { 21 public: 22 e2e_profile_04_test_service(); 23 24 bool init(); 25 void start(); 26 void stop(); 27 void offer(); 28 void stop_offer(); 29 void join_offer_thread(); 30 void on_state(vsomeip::state_type_e _state); 31 void on_message(const std::shared_ptr<vsomeip::message> &_request); 32 void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request); 33 void run(); 34 35 private: 36 std::shared_ptr<vsomeip::application> app_; 37 bool is_registered_; 38 39 bool blocked_; 40 std::mutex mutex_; 41 std::condition_variable condition_; 42 43 std::thread offer_thread_; 44 45 std::atomic<uint32_t> received_; 46 }; 47 48 #endif // E2E_PROFILE_04_TEST_SERVICE_HPP_ 49