1 // Copyright (C) 2015-2017 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 SECURITY_TEST_SERVICE_HPP 7 #define SECURITY_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 <thread> 16 #include <mutex> 17 #include <condition_variable> 18 19 class security_test_service { 20 public: 21 security_test_service(); 22 bool init(); 23 void start(); 24 void stop(); 25 void offer(); 26 void stop_offer(); 27 void join_offer_thread(); 28 void on_state(vsomeip::state_type_e _state); 29 void on_message(const std::shared_ptr<vsomeip::message> &_request); 30 void on_message_shutdown(const std::shared_ptr<vsomeip::message> &_request); 31 void run(); 32 33 private: 34 std::shared_ptr<vsomeip::application> app_; 35 bool is_registered_; 36 37 std::mutex mutex_; 38 std::condition_variable condition_; 39 bool blocked_; 40 std::uint32_t number_of_received_messages_; 41 std::thread offer_thread_; 42 }; 43 44 #endif // SECURITY_TEST_SERVICE_HPP 45