summaryrefslogtreecommitdiff
path: root/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp')
-rw-r--r--CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp
new file mode 100644
index 0000000..f92ae81
--- /dev/null
+++ b/CommonAPI-Examples/E01HelloWorld/src/E01HelloWorldService.cpp
@@ -0,0 +1,33 @@
+/* Copyright (C) 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 <iostream>
+#include <thread>
+
+#include <CommonAPI/CommonAPI.hpp>
+#include "E01HelloWorldStubImpl.hpp"
+
+using namespace std;
+
+int main() {
+ CommonAPI::Runtime::setProperty("LogContext", "E01S");
+ CommonAPI::Runtime::setProperty("LibraryBase", "E01HelloWorld");
+
+ std::shared_ptr<CommonAPI::Runtime> runtime = CommonAPI::Runtime::get();
+
+ std::string domain = "local";
+ std::string instance = "commonapi.examples.HelloWorld";
+ std::string connection = "service-sample";
+
+ std::shared_ptr<E01HelloWorldStubImpl> myService = std::make_shared<E01HelloWorldStubImpl>();
+ runtime->registerService(domain, instance, myService, connection);
+
+ while (true) {
+ std::cout << "Waiting for calls... (Abort with CTRL+C)" << std::endl;
+ std::this_thread::sleep_for(std::chrono::seconds(60));
+ }
+
+ return 0;
+}