blob: 774ca5be27bf6bc7d0b7f985980ce95a23767902 (
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
51
52
53
54
55
56
|
/* Copyright (C) 2014 Mentor Graphics
* Author: Marco Residori(marco_residori@mentor.com)
* 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 <CommonAPI/CommonAPI.h>
#include "EnhancedPositionStubImpl.h"
#include "PositionFeedbackStubImpl.h"
#include "ConfigurationStubImpl.h"
#include "log.h"
DLT_DECLARE_CONTEXT(gCtx);
using namespace std;
int main() {
DLT_REGISTER_APP("ENHS","ENHANCED-POSITION-SERVICE");
DLT_REGISTER_CONTEXT(gCtx,"ENHS","Global Context");
std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::load();
std::shared_ptr<CommonAPI::Factory> factory = runtime->createFactory();
std::shared_ptr<CommonAPI::ServicePublisher> servicePublisher = runtime->getServicePublisher();
const std::string& serviceEnhancedPositionAddress = "local:org.genivi.positioning.EnhancedPosition:org.genivi.positioning.EnhancedPosition";
std::shared_ptr<EnhancedPositionStubImpl> myServiceEnhancedPosition = std::make_shared<EnhancedPositionStubImpl>();
servicePublisher->registerService(myServiceEnhancedPosition, serviceEnhancedPositionAddress, factory);
myServiceEnhancedPosition->run();
const std::string& servicePositionFeedbackAddress = "local:org.genivi.positioning.PositionFeedback:org.genivi.positioning.PositionFeedback";
std::shared_ptr<PositionFeedbackStubImpl> myServicePositionFeedback = std::make_shared<PositionFeedbackStubImpl>();
servicePublisher->registerService(myServicePositionFeedback, servicePositionFeedbackAddress, factory);
myServicePositionFeedback->run();
const std::string& serviceConfigurationAddress = "local:org.genivi.positioning.Configuration:org.genivi.positioning.Configuration";
std::shared_ptr<ConfigurationStubImpl> myServiceConfiguration = std::make_shared<ConfigurationStubImpl>();
servicePublisher->registerService(myServiceConfiguration, serviceConfigurationAddress, factory);
myServiceConfiguration->run();
while (true) {
LOG_INFO_MSG(gCtx,"Waiting for calls... (Abort with CTRL+C)");
std::this_thread::sleep_for(std::chrono::seconds(60));
}
myServiceEnhancedPosition->shutdown();
myServicePositionFeedback->shutdown();
myServiceConfiguration->shutdown();
return 0;
}
|