summaryrefslogtreecommitdiff
path: root/implementation/service_discovery/src/runtime_impl.cpp
blob: 2cc25d2d28e808fa549a27f5d62fb2118ed98762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (C) 2014-2015 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include <vsomeip/defines.hpp>
#include <vsomeip/message.hpp>

#include "../include/constants.hpp"
#include "../include/defines.hpp"
#include "../include/message_impl.hpp"
#include "../include/runtime_impl.hpp"
#include "../include/service_discovery_impl.hpp"

namespace vsomeip {
namespace sd {

std::shared_ptr<runtime> runtime_impl::get() {
    static std::shared_ptr<runtime> the_runtime =
            std::make_shared<runtime_impl>();
    return the_runtime;
}

runtime_impl::~runtime_impl() {
}

std::shared_ptr<service_discovery> runtime_impl::create_service_discovery(
        service_discovery_host *_host) const {
    return std::make_shared < service_discovery_impl > (_host);
}

std::shared_ptr<message_impl> runtime_impl::create_message() const {
    std::shared_ptr < message_impl > its_message =
            std::make_shared<message_impl>();
    its_message->set_service(VSOMEIP_SD_SERVICE);
    its_message->set_instance(VSOMEIP_SD_INSTANCE);
    its_message->set_method(VSOMEIP_SD_METHOD);
    its_message->set_client(VSOMEIP_SD_CLIENT);
    // session must be set dynamically
    its_message->set_protocol_version(protocol_version);
    its_message->set_interface_version(interface_version);
    its_message->set_message_type(message_type);
    its_message->set_return_code(return_code);
    // reboot flag must be set dynamically
    its_message->set_unicast_flag(true);
    return its_message;
}

} // namespace sd
} // namespace vsomeip