diff options
author | Juergen Gehring <juergen.gehring@bmw.de> | 2014-04-15 16:55:50 +0200 |
---|---|---|
committer | Juergen Gehring <juergen.gehring@bmw.de> | 2014-04-15 16:55:50 +0200 |
commit | 7027807fe96f2c896dbbfc48a5d6ffdbe5086024 (patch) | |
tree | f1c0ea8ef694ef1e8d06fe7f1455118328d1d0ff | |
parent | efaea8832bbc728beba50e455b6e4abeeb237716 (diff) | |
download | genivi-common-api-runtime-7027807fe96f2c896dbbfc48a5d6ffdbe5086024.tar.gz |
Delete old helloworld example.
-rw-r--r-- | CommonAPI-Examples/Makefile.am | 64 | ||||
-rw-r--r-- | CommonAPI-Examples/configure.ac | 46 | ||||
-rw-r--r-- | CommonAPI-Examples/m4/ax_cxx_compile_stdcxx_11.m4 | 107 | ||||
-rw-r--r-- | CommonAPI-Examples/src/helloworld-proxy.cpp | 106 | ||||
-rw-r--r-- | CommonAPI-Examples/src/helloworld-stub.cpp | 115 | ||||
-rw-r--r-- | CommonAPI-Examples/src/helloworld.fidl | 39 |
6 files changed, 0 insertions, 477 deletions
diff --git a/CommonAPI-Examples/Makefile.am b/CommonAPI-Examples/Makefile.am deleted file mode 100644 index a30fd8b..0000000 --- a/CommonAPI-Examples/Makefile.am +++ /dev/null @@ -1,64 +0,0 @@ -ACLOCAL_AMFLAGS = -I m4 - -EXTRA_DIST = LICENSE -MOSTLYCLEANFILES = - -AM_CPPFLAGS = \ - -include $(top_builddir)/build-aux/config.h \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/test \ - ${COMMONAPI_CFLAGS} \ - ${COMMONAPI_DBUS_CFLAGS} \ - -Isrc-gen - -AM_LDFLAGS = \ - ${COMMONAPI_LIBS} \ - ${COMMONAPI_DBUS_LIBS} - -# ------------------------------------------------------------------------------ -bin_PROGRAMS = \ - helloworld-proxy \ - helloworld-stub - -helloworld_proxy_SOURCES = \ - src/helloworld-proxy.cpp \ - src-gen/commonapi/examples/HelloWorldInterface.h \ - src-gen/commonapi/examples/HelloWorldInterfaceProxyBase.h \ - src-gen/commonapi/examples/HelloWorldInterfaceProxy.h \ - src-gen/commonapi/examples/HelloWorldInterfaceDBusProxy.h \ - src-gen/commonapi/examples/HelloWorldInterfaceDBusProxy.cpp \ - src-gen/commonapi/examples/HelloWorldLeaf.h \ - src-gen/commonapi/examples/HelloWorldLeafProxyBase.h \ - src-gen/commonapi/examples/HelloWorldLeafProxy.h \ - src-gen/commonapi/examples/HelloWorldLeafDBusProxy.h \ - src-gen/commonapi/examples/HelloWorldLeafDBusProxy.cpp - -helloworld_stub_SOURCES = \ - src/helloworld-stub.cpp \ - src-gen/commonapi/examples/HelloWorldInterface.h \ - src-gen/commonapi/examples/HelloWorldInterfaceStub.h \ - src-gen/commonapi/examples/HelloWorldInterfaceStubDefault.h \ - src-gen/commonapi/examples/HelloWorldInterfaceStubDefault.cpp \ - src-gen/commonapi/examples/HelloWorldInterfaceDBusStubAdapter.h \ - src-gen/commonapi/examples/HelloWorldInterfaceDBusStubAdapter.cpp \ - src-gen/commonapi/examples/HelloWorldLeaf.h \ - src-gen/commonapi/examples/HelloWorldLeafStub.h \ - src-gen/commonapi/examples/HelloWorldLeafStubDefault.h \ - src-gen/commonapi/examples/HelloWorldLeafStubDefault.cpp \ - src-gen/commonapi/examples/HelloWorldLeafDBusStubAdapter.h \ - src-gen/commonapi/examples/HelloWorldLeafDBusStubAdapter.cpp - -# ------------------------------------------------------------------------------ -MAINTAINERCLEANFILES = \ - Makefile.in \ - aclocal.m4 \ - configure - -clean-local: - -rm -rf src-gen - -maintainer-clean-local: - -rm -rf build-aux - -rm -f config.h.in* - -rm -f m4/libtool*.m4 - -rm -f m4/lt*.m4 diff --git a/CommonAPI-Examples/configure.ac b/CommonAPI-Examples/configure.ac deleted file mode 100644 index 2e196ff..0000000 --- a/CommonAPI-Examples/configure.ac +++ /dev/null @@ -1,46 +0,0 @@ -AC_PREREQ([2.61]) -AC_INIT([GENIVI Common API C++ Examples], - [2.1], - [], - [CommonAPI-Examples]) - -AC_USE_SYSTEM_EXTENSIONS - -AC_CONFIG_MACRO_DIR([m4]) -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_HEADERS([build-aux/config.h]) -AC_CONFIG_FILES([Makefile]) - -AC_CANONICAL_SYSTEM - -AM_INIT_AUTOMAKE([foreign 1.11 silent-rules subdir-objects color-tests -Wall -Werror]) -AM_SILENT_RULES -AM_MAINTAINER_MODE - -AC_PROG_CXX -AC_LANG([C++]) -AX_CXX_COMPILE_STDCXX_11([noext]) - -LT_PREREQ(2.2) -LT_INIT - -PKG_PROG_PKG_CONFIG -PKG_CHECK_MODULES(COMMONAPI, [CommonAPI >= 2.0]) -PKG_CHECK_MODULES(COMMONAPI_DBUS, [CommonAPI-DBus >= 2.0]) - -AC_MSG_RESULT([ - $PACKAGE_NAME v$VERSION - - COMMONAPI_CFLAGS: ${COMMONAPI_CFLAGS} - COMMONAPI_LIBS: ${COMMONAPI_LIBS} - - COMMONAPI_DBUS_CFLAGS: ${COMMONAPI_DBUS_CFLAGS} - COMMONAPI_DBUS_LIBS: ${COMMONAPI_DBUS_LIBS} - - prefix: ${prefix} - CXXFLAGS: ${CXXFLAGS} - LDFLAGS: ${LDFLAGS} -]) - -AC_OUTPUT diff --git a/CommonAPI-Examples/m4/ax_cxx_compile_stdcxx_11.m4 b/CommonAPI-Examples/m4/ax_cxx_compile_stdcxx_11.m4 deleted file mode 100644 index 0d96c07..0000000 --- a/CommonAPI-Examples/m4/ax_cxx_compile_stdcxx_11.m4 +++ /dev/null @@ -1,107 +0,0 @@ -# ============================================================================ -# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html -# ============================================================================ -# -# SYNOPSIS -# -# AX_CXX_COMPILE_STDCXX_11([ext|noext]) -# -# DESCRIPTION -# -# Check for baseline language coverage in the compiler for the C++11 -# standard; if necessary, add switches to CXXFLAGS to enable support. -# Errors out if no mode that supports C++11 baseline syntax can be found. -# The argument, if specified, indicates whether you insist on an extended -# mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. -std=c++11). -# If neither is specified, you get whatever works, with preference for an -# extended mode. -# -# LICENSE -# -# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com> -# Copyright (c) 2012 Zack Weinberg <zackw@panix.com> -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 1 - -m4_define([_AX_CXX_COMPILE_STDCXX_11_testbody], [ - template <typename T> - struct check - { - static_assert(sizeof(int) <= sizeof(T), "not big enough"); - }; - - typedef check<check<bool>> right_angle_brackets; - - int a; - decltype(a) b; - - typedef check<int> check_type; - check_type c; - check_type&& cr = static_cast<check_type&&>(c); -]) - -AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [dnl - m4_if([$1], [], [], - [$1], [ext], [], - [$1], [noext], [], - [m4_fatal([invalid argument `$1' to AX_CXX_COMPILE_STDCXX_11])])dnl - AC_LANG_ASSERT([C++])dnl - ac_success=no - AC_CACHE_CHECK(whether $CXX supports C++11 features by default, - ax_cv_cxx_compile_cxx11, - [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [ax_cv_cxx_compile_cxx11=yes], - [ax_cv_cxx_compile_cxx11=no])]) - if test x$ax_cv_cxx_compile_cxx11 = xyes; then - ac_success=yes - fi - - m4_if([$1], [noext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=gnu++11 -std=gnu++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - - m4_if([$1], [ext], [], [dnl - if test x$ac_success = xno; then - for switch in -std=c++11 -std=c++0x; do - cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx11_$switch]) - AC_CACHE_CHECK(whether $CXX supports C++11 features with $switch, - $cachevar, - [ac_save_CXXFLAGS="$CXXFLAGS" - CXXFLAGS="$CXXFLAGS $switch" - AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_11_testbody])], - [eval $cachevar=yes], - [eval $cachevar=no]) - CXXFLAGS="$ac_save_CXXFLAGS"]) - if eval test x\$$cachevar = xyes; then - CXXFLAGS="$CXXFLAGS $switch" - ac_success=yes - break - fi - done - fi]) - - if test x$ac_success = xno; then - AC_MSG_ERROR([*** A compiler with support for C++11 language features is required.]) - fi -]) diff --git a/CommonAPI-Examples/src/helloworld-proxy.cpp b/CommonAPI-Examples/src/helloworld-proxy.cpp deleted file mode 100644 index 4a017fc..0000000 --- a/CommonAPI-Examples/src/helloworld-proxy.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (C) 2013 BMW Group - * Author: Manfred Bathelt (manfred.bathelt@bmw.de) - * Author: Juergen Gehring (juergen.gehring@bmw.de) - * 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/examples/HelloWorldInterfaceProxy.h> -#include <commonapi/examples/HelloWorldLeafProxy.h> -#include <CommonAPI/CommonAPI.h> -#include <iostream> -#include <future> - - -int main(int argc, char** argv) { - CommonAPI::Runtime::LoadState loadState; - auto runtime = CommonAPI::Runtime::load(loadState); - if (loadState != CommonAPI::Runtime::LoadState::SUCCESS) { - std::cerr << "Error: Unable to load runtime!\n"; - return -1; - } - - std::cout << "Runtime loaded!\n"; - - - auto factory = runtime->createFactory(); - if (!factory) { - std::cerr << "Error: Unable to create factory!\n"; - return -1; - } - - std::cout << "Factory created!\n"; - - - const std::string commonApiAddress = "local:commonapi.examples.HelloWorld:commonapi.examples.HelloWorld"; - auto helloWorldProxy = factory->buildProxy<commonapi::examples::HelloWorldInterfaceProxy>(commonApiAddress); - if (!helloWorldProxy) { - std::cerr << "Error: Unable to build proxy!\n"; - return -1; - } - - std::cout << "Proxy created!\n"; - - std::promise<CommonAPI::AvailabilityStatus> availabilityStatusPromise; - helloWorldProxy->getProxyStatusEvent().subscribe([&](const CommonAPI::AvailabilityStatus& availabilityStatus) { - availabilityStatusPromise.set_value(availabilityStatus); - return CommonAPI::SubscriptionStatus::CANCEL; - }); - - auto availabilityStatusFuture = availabilityStatusPromise.get_future(); - std::cout << "Waiting for proxy availability...\n"; - availabilityStatusFuture.wait(); - - if (availabilityStatusFuture.get() != CommonAPI::AvailabilityStatus::AVAILABLE) { - std::cerr << "Proxy not available!\n"; - return -1; - } - - std::cout << "Proxy available!\n"; - - - helloWorldProxy->getSaySomethingSelectiveEvent().subscribe([&](const std::string& message) { - std::cout << "Received broadcast message: " << message << "\n"; - }); - - const std::string name = "World"; - CommonAPI::CallStatus callStatus; - std::string helloWorldMessage; - - std::cout << "Sending name: '" << name << "'\n"; - helloWorldProxy->sayHello("World", callStatus, helloWorldMessage); - if (callStatus != CommonAPI::CallStatus::SUCCESS) { - std::cerr << "Remote call failed!\n"; - return -1; - } - - std::cout << "Got message: '" << helloWorldMessage << "'\n"; - - const std::string leafInstance = "commonapi.examples.HelloWorld.Leaf"; - CommonAPI::CallStatus callStatusAv; - CommonAPI::AvailabilityStatus availabilityStatus; - helloWorldProxy->getProxyManagerHelloWorldLeaf().getInstanceAvailabilityStatus(leafInstance, callStatusAv, availabilityStatus); - - if (callStatusAv == CommonAPI::CallStatus::SUCCESS && availabilityStatus == CommonAPI::AvailabilityStatus::AVAILABLE) { - auto helloWorldLeafProxy = helloWorldProxy->getProxyManagerHelloWorldLeaf().buildProxy<commonapi::examples::HelloWorldLeafProxy>(leafInstance); - - const std::string nameLeaf = "WorldLeaf"; - CommonAPI::CallStatus callStatusLeaf; - std::string helloWorldLeafMessage; - - std::cout << "Sending name: '" << nameLeaf << "'\n"; - helloWorldLeafProxy->sayHelloLeaf("World", callStatusLeaf, helloWorldLeafMessage); - if (callStatusLeaf != CommonAPI::CallStatus::SUCCESS) { - std::cerr << "Remote call failed!\n"; - return -1; - } - - std::cout << "Got message: '" << helloWorldLeafMessage << "'\n"; - - } else { - std::cout << "Leaf Proxy not available\n"; - sleep(5); - return -1; - } - - return 0; -} diff --git a/CommonAPI-Examples/src/helloworld-stub.cpp b/CommonAPI-Examples/src/helloworld-stub.cpp deleted file mode 100644 index 80e3b46..0000000 --- a/CommonAPI-Examples/src/helloworld-stub.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (C) 2013 BMW Group - * Author: Manfred Bathelt (manfred.bathelt@bmw.de) - * Author: Juergen Gehring (juergen.gehring@bmw.de) - * 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/examples/HelloWorldInterfaceStubDefault.h> -#include <commonapi/examples/HelloWorldLeafStubDefault.h> -#include <CommonAPI/CommonAPI.h> -#include <iostream> -#include <sstream> -#include <thread> - - -class MyHelloWorldStub: public commonapi::examples::HelloWorldInterfaceStubDefault { - private: - std::shared_ptr<CommonAPI::ClientId> lastId; - -public: - virtual void onSaySomethingSelectiveSubscriptionChanged(const std::shared_ptr<CommonAPI::ClientId> clientId, - const CommonAPI::SelectiveBroadcastSubscriptionEvent event) { - if (event == CommonAPI::SelectiveBroadcastSubscriptionEvent::SUBSCRIBED) { - lastId = clientId; - } - } - - virtual void sayHello(std::string name, std::string& message) { - std::stringstream messageStream; - - messageStream << "Hello " << name << "!"; - message = messageStream.str(); - - std::cout << "sayHello('" << name << "'): '" << message << "'\n"; - - std::shared_ptr<CommonAPI::ClientIdList> receivers = std::make_shared<CommonAPI::ClientIdList>(); - - - if (lastId) { - receivers->insert(lastId); - } - this->fireSaySomethingSelective("Broadcast to last ID", receivers); - - //delete receivers; - } -}; - - -class MyHelloWorldLeafStub: public commonapi::examples::HelloWorldLeafStubDefault { - public: - virtual void sayHelloLeaf(std::string name, std::string& message) { - std::stringstream messageStream; - - messageStream << "Hello Leaf " << name << "!"; - message = messageStream.str(); - - std::cout << "sayHelloLeaf('" << name << "'): '" << message << "'\n"; - } -}; - - -int main(int argc, char** argv) { - CommonAPI::Runtime::LoadState loadState; - auto runtime = CommonAPI::Runtime::load(loadState); - if (loadState != CommonAPI::Runtime::LoadState::SUCCESS) { - std::cerr << "Error: Unable to load runtime!\n"; - return -1; - } - - std::cout << "Runtime loaded!\n"; - - - auto factory = runtime->createFactory(); - if (!factory) { - std::cerr << "Error: Unable to create factory!\n"; - return -1; - } - - std::cout << "Factory created!\n"; - - - auto servicePublisher = runtime->getServicePublisher(); - if (!servicePublisher) { - std::cerr << "Error: Unable to load service publisher!\n"; - return -1; - } - - std::cout << "Service publisher loaded!\n"; - - - auto helloWorldStub = std::make_shared<MyHelloWorldStub>(); - const std::string commonApiAddress = "local:commonapi.examples.HelloWorld:commonapi.examples.HelloWorld"; - const bool isStubRegistrationSuccessful = servicePublisher->registerService(helloWorldStub, commonApiAddress, factory); - if (!isStubRegistrationSuccessful) { - std::cerr << "Error: Unable to register service!\n"; - return -1; - } - - std::cout << "Service registration successful!\n"; - - - auto helloWorldLeafStub = std::make_shared<MyHelloWorldLeafStub>(); - const std::string leafInstance = "commonapi.examples.HelloWorld.Leaf"; - const bool leafOk = helloWorldStub->registerManagedStubHelloWorldLeaf(helloWorldLeafStub, leafInstance); - if (!leafOk) { - std::cerr << "Error: Unable to register leaf service!\n"; - return -1; - } - - while(true) { - std::cout << "Waiting for calls... (Abort with CTRL+C)\n"; - sleep(60); - } - - return 0; -} diff --git a/CommonAPI-Examples/src/helloworld.fidl b/CommonAPI-Examples/src/helloworld.fidl deleted file mode 100644 index 9830289..0000000 --- a/CommonAPI-Examples/src/helloworld.fidl +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2013 BMW Group - * Author: Manfred Bathelt (manfred.bathelt@bmw.de) - * Author: Juergen Gehring (juergen.gehring@bmw.de) - * 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/. */ -package commonapi.examples - -interface HelloWorldInterface manages HelloWorldLeaf { - version { major 1 minor 0 } - - method sayHello { - in { - String name - } - out { - String message - } - } - - broadcast saySomething selective { - out { - String message - } - } -} - -interface HelloWorldLeaf { - version { major 1 minor 0 } - - method sayHelloLeaf { - in { - String name - } - out { - String message - } - } -}
\ No newline at end of file |