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 EXTERNALLOCALROUTINGTESTSERVICE_HPP_ 7 #define EXTERNALLOCALROUTINGTESTSERVICE_HPP_ 8 #include <gtest/gtest.h> 9 10 #include <vsomeip/vsomeip.hpp> 11 12 #include <thread> 13 #include <mutex> 14 #include <condition_variable> 15 #include <functional> 16 17 #include "../someip_test_globals.hpp" 18 19 class external_local_routing_test_service 20 { 21 public: 22 external_local_routing_test_service(bool _use_static_routing); 23 bool init(); 24 void start(); 25 void stop(); 26 void offer(); 27 void stop_offer(); 28 void join_offer_thread(); 29 void on_state(vsomeip::state_type_e _state); 30 void on_message(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 bool use_static_routing_; 37 38 std::mutex mutex_; 39 std::condition_variable condition_; 40 bool blocked_; 41 std::uint32_t number_received_messages_local_; 42 std::uint32_t number_received_messages_external_; 43 std::thread offer_thread_; 44 }; 45 46 #endif /* EXTERNALLOCALROUTINGTESTSERVICE_HPP_ */ 47