• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 LOCALROUTINGTESTCLIENT_HPP_
7 #define LOCALROUTINGTESTCLIENT_HPP_
8 
9 #include <gtest/gtest.h>
10 
11 #include <vsomeip/vsomeip.hpp>
12 
13 #include <thread>
14 #include <mutex>
15 #include <condition_variable>
16 #include <functional>
17 
18 #include "../someip_test_globals.hpp"
19 
20 class local_routing_test_client
21 {
22 public:
23     local_routing_test_client(bool _use_tcp);
24     bool init();
25     void start();
26     void stop();
27     void join_sender_thread();
28     void on_state(vsomeip::state_type_e _state);
29     void on_availability(vsomeip::service_t _service,
30             vsomeip::instance_t _instance, bool _is_available);
31     void on_message(const std::shared_ptr<vsomeip::message> &_response);
32     void send();
33     void run();
34 
35 private:
36     std::shared_ptr<vsomeip::application> app_;
37     std::shared_ptr<vsomeip::message> request_;
38     std::mutex mutex_;
39     std::condition_variable condition_;
40     bool blocked_;
41     bool is_available_;
42     std::uint32_t number_of_messages_to_send_;
43     std::uint32_t number_of_sent_messages_;
44     std::uint32_t number_of_acknowledged_messages_;
45     std::thread sender_;
46 };
47 
48 #endif /* LOCALROUTINGTESTCLIENT_HPP_ */
49