• 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 BIGPAYLOADTESTSERVICE_HPP_
7 #define BIGPAYLOADTESTSERVICE_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 #include <queue>
17 
18 #include "big_payload_test_globals.hpp"
19 #include <vsomeip/internal/logger.hpp>
20 
21 
22 class big_payload_test_service
23 {
24 public:
25     big_payload_test_service(big_payload_test::test_mode _test_mode);
26     bool init();
27     void start();
28     void stop();
29     void offer();
30     void stop_offer();
31     void join_offer_thread();
32     void detach_offer_thread();
33     void on_state(vsomeip::state_type_e _state);
34     void on_message(const std::shared_ptr<vsomeip::message> &_request);
35     void run();
36 
37 private:
38     std::shared_ptr<vsomeip::application> app_;
39     bool is_registered_;
40     std::mutex mutex_;
41     std::condition_variable condition_;
42     bool blocked_;
43     big_payload_test::test_mode test_mode_;
44     std::uint32_t number_of_received_messages_;
45     std::thread offer_thread_;
46     std::uint32_t expected_messages_;
47     vsomeip::service_t service_id_;
48     std::queue<std::shared_ptr<vsomeip::message>> incoming_requests_;
49 };
50 
51 #endif /* BIGPAYLOADTESTSERVICE_HPP_ */
52