summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt64
-rw-r--r--LICENSE54
-rw-r--r--README.md25
-rw-r--r--config.xml.in19
-rw-r--r--include/analyze_request.h31
-rw-r--r--include/binder_reply.h34
-rw-r--r--include/genivi/genivi-navicore-constants.h199
-rw-r--r--include/genivi/genivi-navigationcore-proxy.h1147
-rw-r--r--include/genivi/navicore.h140
-rw-r--r--include/genivi_request.h37
-rw-r--r--libnavi/include/BinderClient.h57
-rw-r--r--libnavi/include/JsonRequestGenerator.h29
-rw-r--r--libnavi/include/JsonResponseAnalyzer.h25
-rw-r--r--libnavi/include/RequestManage.h64
-rw-r--r--libnavi/include/RequestManageListener.h17
-rw-r--r--libnavi/include/libnavicore.hpp69
-rw-r--r--libnavi/include/traces.h38
-rw-r--r--libnavi/src/BinderClient.cpp315
-rw-r--r--libnavi/src/JsonRequestGenerator.cpp188
-rw-r--r--libnavi/src/JsonResponseAnalyzer.cpp254
-rw-r--r--libnavi/src/RequestManage.cpp204
-rw-r--r--libnavi/src/navicore.cpp81
-rw-r--r--libnavi/src/navicorelistener.cpp28
-rw-r--r--libnaviapi-agl.pc.in14
-rw-r--r--navigation.pngbin0 -> 38244 bytes
-rw-r--r--src/analyze_request.cpp296
-rw-r--r--src/api.cpp419
-rw-r--r--src/binder_reply.cpp168
-rw-r--r--src/genivi_request.cpp350
-rw-r--r--src/traces.h38
30 files changed, 4404 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..9bd545b
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,64 @@
+cmake_minimum_required(VERSION 2.8.11)
+
+INCLUDE(FindPkgConfig)
+
+set(PROJECT_NAME "agl-service-navigation")
+set(PROJECT_PRETTY_NAME "AFM binding for navigation service")
+set(PROJECT_DESCRIPTION "Binding for AGL Navigation API")
+set(PROJECT_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include)
+set(PROJECT_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
+set(PROJECT_API_VERSION 0.1.0)
+set(PROJECT_URL "https://wiki.automotivelinux.org/eg-navi")
+
+# Set a default build type if none was specified
+if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ message(STATUS "Setting build type to 'Release' as none was specified.")
+ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
+endif()
+
+project(navi_binder)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC ")
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+pkg_check_modules(DBUSCXX REQUIRED dbus-c++-1)
+pkg_check_modules(JSON REQUIRED json-c)
+pkg_check_modules(AFBWSC REQUIRED libafbwsc)
+
+include_directories( ${PROJECT_SOURCE_DIR}/libnavi/include ${PROJECT_SOURCE_DIR}/include ${DBUSCXX_INCLUDE_DIRS} ${JSON_INCLUDE_DIRS} ${AFBWSC_INCLUDE_DIRS} )
+
+add_library( naviapi-agl SHARED libnavi/src/navicore.cpp libnavi/src/navicorelistener.cpp libnavi/src/BinderClient.cpp libnavi/src/JsonRequestGenerator.cpp libnavi/src/JsonResponseAnalyzer.cpp libnavi/src/RequestManage.cpp )
+target_link_libraries( naviapi-agl ${JSON_LIBRARIES} ${AFBWSC_LIBRARIES} )
+set_target_properties(naviapi-agl PROPERTIES VERSION 0.1.0 SOVERSION 0)
+
+install(TARGETS naviapi-agl LIBRARY DESTINATION ${PROJECT_LIBDIR})
+install(FILES ${PROJECT_SOURCE_DIR}/libnavi/include/libnavicore.hpp DESTINATION ${PROJECT_INCLUDEDIR})
+
+add_library( NaviAPIService SHARED src/api.cpp src/analyze_request.cpp src/binder_reply.cpp src/genivi_request.cpp )
+
+target_link_libraries( NaviAPIService ${DBUSCXX_LIBRARIES} ${JSON_LIBRARIES} ${AFBWSC_LIBRARIES} )
+
+##########################################################################
+# AGL binding
+configure_file(config.xml.in config.xml)
+set(BINARY_NAME "naviapi.wgt")
+
+add_custom_command(
+ OUTPUT ${BINARY_NAME}
+ DEPENDS NaviAPIService
+ COMMAND rm -rf package
+ COMMAND mkdir -p package/root
+ COMMAND mkdir -p package/root/lib
+ COMMAND mv config.xml package/root/
+ COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/navigation.png package/root/icon.png
+ COMMAND mv libNaviAPIService.so package/root/lib
+ COMMAND wgtpkg-pack -f -o package/${BINARY_NAME} package/root
+)
+add_custom_target(widget ALL DEPENDS ${BINARY_NAME})
+
+#generate configure file
+configure_file(libnaviapi-agl.pc.in libnaviapi-agl.pc @ONLY)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libnaviapi-agl.pc
+ DESTINATION
+ ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..31c692a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,54 @@
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+ You must give any other recipients of the Work or Derivative Works a copy of this License; and
+ You must cause any modified files to carry prominent notices stating that You changed the files; and
+ You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+ If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7a27f6d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,25 @@
+AGL Navigation API Binder
+===============
+
+Copyright 2017 AISIN AW
+
+author: Yoshito Momiyama <i25461_momiyama@aisin-aw.co.jp>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+===============
+
+This component is a reference implementation of the AGL Navigation API.
+
+
diff --git a/config.xml.in b/config.xml.in
new file mode 100644
index 0000000..25b9e53
--- /dev/null
+++ b/config.xml.in
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" id="naviapi-binding-service" version="0.1">
+ <name>naviapi-binding-service</name>
+ <icon src="icon.png"/>
+ <content src="config.xml" type="application/vnd.agl.service"/>
+ <description>naviapi binding service</description>
+ <author>AISIN AW</author>
+ <license>GPL</license>
+ <feature name="urn:AGL:widget:required-permission">
+ <param name="urn:AGL:permission::public:hidden" value="required" />
+ <param name="http://tizen.org/privilege/internal/dbus" value="required" />
+ </feature>
+ <feature name="urn:AGL:widget:provided-api">
+ <param name="naviapi" value="ws" />
+ </feature>
+ <feature name="urn:AGL:widget:required-api">
+ <param name="lib/libNaviAPIService.so" value="local" />
+ </feature>
+</widget>
diff --git a/include/analyze_request.h b/include/analyze_request.h
new file mode 100644
index 0000000..f570a1c
--- /dev/null
+++ b/include/analyze_request.h
@@ -0,0 +1,31 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <vector>
+
+#include "genivi_request.h"
+
+/**
+ * @brief Analyze requests from BinderClient and create arguments to pass to Genivi API.
+ */
+class AnalyzeRequest
+{
+public:
+ bool CreateParamsGetPosition( const char* req_json_str, std::vector< int32_t >& Params );
+ bool CreateParamsCreateRoute( const char* req_json_str, uint32_t& sessionHdl );
+ bool CreateParamsPauseSimulation( const char* req_json_str, uint32_t& sessionHdl );
+ bool CreateParamsSetSimulationMode( const char* req_json_str, uint32_t& sessionHdl, bool& simuMode );
+ bool CreateParamsCancelRouteCalculation( const char* req_json_str, uint32_t& sessionHdl, uint32_t& routeHdl );
+ bool CreateParamsSetWaypoints( const char* req_json_str, uint32_t& sessionHdl, uint32_t& routeHdl,
+ bool& currentPos, std::vector<Waypoint>& waypointsList );
+ bool CreateParamsCalculateRoute( const char* req_json_str, uint32_t& sessionHdl, uint32_t& routeHdl );
+
+private:
+ bool JsonObjectGetSessionHdl( const char* req_json_str, uint32_t& sessionHdl);
+ bool JsonObjectGetSessionHdlRouteHdl( const char* req_json_str, uint32_t& sessionHdl, uint32_t& routeHdl);
+};
+
diff --git a/include/binder_reply.h b/include/binder_reply.h
new file mode 100644
index 0000000..44e20d0
--- /dev/null
+++ b/include/binder_reply.h
@@ -0,0 +1,34 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <string>
+#include <map>
+#include <vector>
+#include <json-c/json.h>
+
+/**
+ * @brief Response to return to Binder client.
+ */
+typedef struct APIResponse_
+{
+ bool isSuccess;
+ std::string errMessage;
+ json_object* json_data;
+}APIResponse;
+
+/**
+ * @brief Convert information acquired by Genevi API to JSON format.
+ */
+class BinderReply
+{
+public:
+ APIResponse ReplyNavicoreGetPosition( std::map<int32_t, double>& posList );
+ APIResponse ReplyNavicoreGetAllRoutes( std::vector< uint32_t > &allRoutes );
+ APIResponse ReplyNavicoreCreateRoute( uint32_t route );
+ APIResponse ReplyNavicoreGetAllSessions( std::map<uint32_t, std::string> &allSessions );
+};
+
diff --git a/include/genivi/genivi-navicore-constants.h b/include/genivi/genivi-navicore-constants.h
new file mode 100644
index 0000000..4021006
--- /dev/null
+++ b/include/genivi/genivi-navicore-constants.h
@@ -0,0 +1,199 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#ifndef GENIVI_NAVICORE_CONSTANTS_H
+#define GENIVI_NAVICORE_CONSTANTS_H
+
+#define NAVICORE_INVALID 0x0000
+#define NAVICORE_DEFAULT 0xfffe
+#define NAVICORE_ALL 0xffff
+#define NAVICORE_AVAILABLE 0x0001
+#define NAVICORE_NOT_AVAILABLE 0x0002
+#define NAVICORE_TIME_FORMAT 0x0003
+#define NAVICORE_12H 0x0004
+#define NAVICORE_24H 0x0005
+#define NAVICORE_COORDINATES_FORMAT 0x0006
+#define NAVICORE_DEGREES 0x0007
+#define NAVICORE_MINUTES 0x0008
+#define NAVICORE_SECONDS 0x0009
+#define NAVICORE_TIMESTAMP 0x0010
+#define NAVICORE_TIMEZONE_OFFSET 0x0011
+#define NAVICORE_DAYLIGHT_OFFSET 0x0012
+#define NAVICORE_LOCALE 0x0025
+#define NAVICORE_UNITS_OF_MEASUREMENT 0x0030
+#define NAVICORE_LENGTH 0x0031
+#define NAVICORE_METER 0x0032
+#define NAVICORE_MILE 0x0033
+#define NAVICORE_KM 0x0034
+#define NAVICORE_YARD 0x0035
+#define NAVICORE_FOOT 0x0036
+#define NAVICORE_DISABLED_PROMPT 0x0041
+#define NAVICORE_AUTOMATIC_PROMPT 0x0042
+#define NAVICORE_MANUAL_PROMPT 0x0043
+#define NAVICORE_CRUISE 0x0050
+#define NAVICORE_MANEUVER_APPEARED 0x0051
+#define NAVICORE_PRE_ADVICE 0x0052
+#define NAVICORE_ADVICE 0x0053
+#define NAVICORE_PASSED 0x0054
+#define NAVICORE_ACTIVE 0x0060
+#define NAVICORE_INACTIVE 0x0061
+#define NAVICORE_STRAIGHT_ON 0x0070
+#define NAVICORE_CROSSROAD 0x0071
+#define NAVICORE_ROUNDABOUT 0x0072
+#define NAVICORE_HIGHWAY_ENTER 0x0073
+#define NAVICORE_HIGHWAY_EXIT 0x0074
+#define NAVICORE_FOLLOW_SPECIFIC_LANE 0x0075
+#define NAVICORE_DESTINATION 0x0076
+#define NAVICORE_WAYPOINT 0x0077
+#define NAVICORE_TURN 0x0078
+#define NAVICORE_BIFURCATION 0x0079
+#define NAVICORE_LEFT 0x0080
+#define NAVICORE_SLIGHT_LEFT 0x0081
+#define NAVICORE_HARD_LEFT 0x0082
+#define NAVICORE_RIGHT 0x0083
+#define NAVICORE_SLIGHT_RIGHT 0x0084
+#define NAVICORE_HARD_RIGHT 0x0085
+#define NAVICORE_UTURN_RIGHT 0x0086
+#define NAVICORE_UTURN_LEFT 0x0087
+#define NAVICORE_ALL_MANUAL 0x0090
+#define NAVICORE_ALL_AUTOMATIC 0x0091
+#define NAVICORE_TRAFFIC_MANUAL 0x0092
+#define NAVICORE_OFF_ROUTE_MANUAL 0x0093
+#define NAVICORE_LATITUDE 0x00a0
+#define NAVICORE_LONGITUDE 0x00a1
+#define NAVICORE_ALTITUDE 0x00a2
+#define NAVICORE_HEADING 0x00a3
+#define NAVICORE_SPEED 0x00a4
+#define NAVICORE_CLIMB 0x00a5
+#define NAVICORE_COUNTRY 0x00a6
+#define NAVICORE_STATE 0x00a7
+#define NAVICORE_CITY 0x00a8
+#define NAVICORE_ZIPCODE 0x00a9
+#define NAVICORE_STREET 0x00aa
+#define NAVICORE_HOUSENUMBER 0x00ab
+#define NAVICORE_CROSSING 0x00ac
+#define NAVICORE_DISTRICT 0x00ad
+#define NAVICORE_PHONENUMBER 0x00ae
+#define NAVICORE_POINAME 0x00af
+#define NAVICORE_TOWNCENTER 0x00b0
+#define NAVICORE_LOCATION_INPUT 0x00b1
+#define NAVICORE_FULL_ADDRESS 0x00b2
+#define NAVICORE_COUNTRYCODE 0x00b3
+#define NAVICORE_HOUSENAME 0x00b4
+#define NAVICORE_POSTAL_CODE 0x00b5
+#define NAVICORE_NOT_STARTED 0x0c0
+#define NAVICORE_SEARCHING 0x00c1
+#define NAVICORE_FINISHED 0x00c2
+#define NAVICORE_OK 0x00d0
+#define NAVICORE_UNKNOWN 0x00d1
+#define NAVICORE_AMBIGUOUS 0x00d2
+#define NAVICORE_INCONSISTENT 0x00d3
+#define NAVICORE_GNSS_FIX_STATUS 0x00e0
+#define NAVICORE_DR_STATUS 0x00e1
+#define NAVICORE_MM_STATUS 0x00e2
+#define NAVICORE_SIMULATION_MODE 0x00e3
+#define NAVICORE_MATCH_TYPE 0x00f0
+#define NAVICORE_ON_ROAD 0x00f1
+#define NAVICORE_OFF_ROAD 0x00f2
+#define NAVICORE_ON_FERRY 0x00f3
+#define NAVICORE_IN_TUNNEL 0x00f4
+#define NAVICORE_ON_CARPARK 0x00f5
+#define NAVICORE_NO_FIX 0x0100
+#define NAVICORE_TIME_FIX 0x0101
+#define NAVICORE_2D_FIX 0x0102
+#define NAVICORE_3D_FIX 0x0103
+#define NAVICORE_SEGMENT_ID 0x0110
+#define NAVICORE_DIRECTION_ON_SEGMENT 0x0112
+#define NAVICORE_DISTANCE_ON_SEGMENT 0x0113
+#define NAVICORE_INTERMEDIATE_POINTS 0x0120
+#define NAVICORE_WAYPOINT_TYPE 0x0121
+#define NAVICORE_SOFT_POINT 0x0122
+#define NAVICORE_HARD_POINT 0x0123
+#define NAVICORE_CALCULATION_OK 0x0130
+#define NAVICORE_NO_POSITION 0x0131
+#define NAVICORE_UNMATCHED_POSITION 0x0132
+#define NAVICORE_UNREACHABLE_DESTINATION 0x0133
+#define NAVICORE_UNFULFILLED_PREFERENCE_MODE 0x0134
+#define NAVICORE_LINK_ID 0x0140
+#define NAVICORE_START_LATITUDE 0x0141
+#define NAVICORE_END_LATITUDE 0x0142
+#define NAVICORE_START_LONGITUDE 0x0143
+#define NAVICORE_END_LONGITUDE 0x0144
+#define NAVICORE_START_ALTITUDE 0x0145
+#define NAVICORE_END_ALTITUDE 0x0146
+#define NAVICORE_ROAD_NAME 0x0147
+#define NAVICORE_DISTANCE 0x0148
+#define NAVICORE_TIME 0x0149
+#define NAVICORE_MANEUVER 0x014a
+#define NAVICORE_INSTRUCTION 0x014b
+#define NAVICORE_BORDER_CROSSING 0x014c
+#define NAVICORE_ADDITIONAL_INFORMATION 0x014d
+#define NAVICORE_ROAD_NUMBER 0x014e
+#define NAVICORE_START_OFFSET 0x014f
+#define NAVICORE_FASTEST 0x0160
+#define NAVICORE_SHORTEST 0x0161
+#define NAVICORE_ECOLOGICAL 0x0162
+#define NAVICORE_SCENIC 0x0163
+#define NAVICORE_EASY 0x0164
+#define NAVICORE_BALANCED 0x0166
+#define NAVICORE_CHEAPEST 0x0167
+#define NAVICORE_FERRY 0x0170
+#define NAVICORE_TOLL_ROADS 0x0171
+#define NAVICORE_TUNNELS 0x0172
+#define NAVICORE_HIGHWAYS_MOTORWAYS 0x0173
+#define NAVICORE_VEHICLE_SIZE_LIMIT 0x0174
+#define NAVICORE_CRIME_AREAS 0x0175
+#define NAVICORE_BY_CAR 0x0180
+#define NAVICORE_ON_FOOT 0x0181
+#define NAVICORE_LONG_RANGE_TRAINS 0x0182
+#define NAVICORE_PUBLIC_TRANSPORTATION 0x0183
+#define NAVICORE_BY_BICYCLE 0x0184
+#define NAVICORE_BY_TRUCK 0x0185
+#define NAVICORE_BLOCK_NUMBER 0x0186
+#define NAVICORE_UNIT_NUMBER 0x0187
+#define NAVICORE_BEGIN_STREET 0x0188
+#define NAVICORE_ROAD_INTERSECTION 0x0189
+#define NAVICORE_ARRIVAL_TIME 0x018a
+#define NAVICORE_ARRIVAL_DATE 0x018b
+#define NAVICORE_DEPARTURE_TIME 0x018c
+#define NAVICORE_DEPARTURE_DATE 0x018d
+#define NAVICORE_TOTAL_TIME 0x018e
+#define NAVICORE_TOTAL_DISTANCE 0x018f
+#define NAVICORE_PROHIBIT 0x0190
+#define NAVICORE_AVOID 0x0191
+#define NAVICORE_USE 0x0192
+#define NAVICORE_PREFER 0x0193
+#define NAVICORE_IGNORE 0x0194
+#define NAVICORE_TRAFFIC_REALTIME 0x0200
+#define NAVICORE_TRAFFIC 0x0210
+#define NAVICORE_OFF_ROUTE 0x0211
+#define NAVICORE_MANUAL 0x0212
+#define NAVICORE_SIMULATION_STATUS_NO_SIMULATION 0x0220
+#define NAVICORE_SIMULATION_STATUS_RUNNING 0x0221
+#define NAVICORE_SIMULATION_STATUS_PAUSED 0x0222
+#define NAVICORE_SIMULATION_STATUS_FIXED_POSITION 0x0223
+#define NAVICORE_ROAD_FORM_CHANGE 0x0230
+#define NAVICORE_ROAD_REGULAR 0x0231
+#define NAVICORE_ROAD_HIGHWAY_MOTORWAY 0x0232
+#define NAVICORE_ROAD_FERRY 0x0233
+#define NAVICORE_DIRECTION 0x0240
+#define NAVICORE_EXIT_NUMBER 0x0241
+#define NAVICORE_ROAD_FORM 0x0242
+#define NAVICORE_LANE_INFO 0x0243
+#define NAVICORE_LANE_INFO_BITMASK_STRAIGHT 0x0001
+#define NAVICORE_LANE_INFO_BITMASK_SLIGHTRIGHT 0x0002
+#define NAVICORE_LANE_INFO_BITMASK_RIGHT 0x0004
+#define NAVICORE_LANE_INFO_BITMASK_SHARPRIGHT 0x0008
+#define NAVICORE_LANE_INFO_BITMASK_RIGHTUTURN 0x0010
+#define NAVICORE_LANE_INFO_BITMASK_SLIGHTLEFT 0x0020
+#define NAVICORE_LANE_INFO_BITMASK_LEFT 0x0040
+#define NAVICORE_LANE_INFO_BITMASK_SHARPLEFT 0x0080
+#define NAVICORE_LANE_INFO_BITMASK_LEFTUTURN 0x0100
+#define NAVICORE_DIVIDER_UNDEFINED 0x0250
+#define NAVICORE_DIVIDER_INTERRUPTEDLONG 0x0251
+#define NAVICORE_DIVIDER_INTERRUPTEDSHORT 0x0252
+#define NAVICORE_DIVIDER_SOLIDSINGLE 0x0253
+#define NAVICORE_DIVIDER_SOLIDDOUBLE 0x0254
+#define NAVICORE_DIVIDER_SOLIDINTERRUPTED 0x0255
+#define NAVICORE_DIVIDER_INTERRUPTEDSOLID 0x0256
+
+#endif
diff --git a/include/genivi/genivi-navigationcore-proxy.h b/include/genivi/genivi-navigationcore-proxy.h
new file mode 100644
index 0000000..2322fa0
--- /dev/null
+++ b/include/genivi/genivi-navigationcore-proxy.h
@@ -0,0 +1,1147 @@
+
+/*
+ * This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT!
+ */
+
+#ifndef __dbusxx__genivi_navigationcore_proxy_h__PROXY_MARSHAL_H
+#define __dbusxx__genivi_navigationcore_proxy_h__PROXY_MARSHAL_H
+
+#include <dbus-c++-1/dbus-c++/dbus.h>
+#include <cassert>
+
+namespace org {
+namespace genivi {
+namespace navigationcore {
+
+class Session_proxy
+: public ::DBus::InterfaceProxy
+{
+public:
+
+ Session_proxy()
+ : ::DBus::InterfaceProxy("org.genivi.navigationcore.Session")
+ {
+ connect_signal(Session_proxy, SessionDeleted, _SessionDeleted_stub);
+ }
+
+public:
+
+ /* properties exported by this interface */
+public:
+
+ /* methods exported by this interface,
+ * this functions will invoke the corresponding methods on the remote objects
+ */
+ ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > SessionGetVersion()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetVersion");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ uint32_t CreateSession(const std::string& client)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << client;
+ call.member("CreateSession");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ uint32_t argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void DeleteSession(const uint32_t& sessionHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ call.member("DeleteSession");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ int32_t GetSessionStatus(const uint32_t& sessionHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ call.member("GetSessionStatus");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ int32_t argout;
+ ri >> argout;
+ return argout;
+ }
+
+ std::vector< ::DBus::Struct< uint32_t, std::string > > GetAllSessions()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetAllSessions");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::vector< ::DBus::Struct< uint32_t, std::string > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+
+public:
+
+ /* signal handlers for this interface
+ */
+ virtual void SessionDeleted(const uint32_t& sessionHandle) = 0;
+
+private:
+
+ /* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+ */
+ void _SessionDeleted_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t sessionHandle;
+ ri >> sessionHandle;
+ SessionDeleted(sessionHandle);
+ }
+};
+
+} } }
+namespace org {
+namespace genivi {
+namespace navigationcore {
+
+class Routing_proxy
+: public ::DBus::InterfaceProxy
+{
+public:
+
+ Routing_proxy()
+ : ::DBus::InterfaceProxy("org.genivi.navigationcore.Routing")
+ {
+ connect_signal(Routing_proxy, RouteDeleted, _RouteDeleted_stub);
+ connect_signal(Routing_proxy, RouteCalculationCancelled, _RouteCalculationCancelled_stub);
+ connect_signal(Routing_proxy, RouteCalculationSuccessful, _RouteCalculationSuccessful_stub);
+ connect_signal(Routing_proxy, RouteCalculationFailed, _RouteCalculationFailed_stub);
+ connect_signal(Routing_proxy, RouteCalculationProgressUpdate, _RouteCalculationProgressUpdate_stub);
+ connect_signal(Routing_proxy, AlternativeRoutesAvailable, _AlternativeRoutesAvailable_stub);
+ }
+
+public:
+
+ /* properties exported by this interface */
+public:
+
+ /* methods exported by this interface,
+ * this functions will invoke the corresponding methods on the remote objects
+ */
+ ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > RoutingGetVersion()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetVersion");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ uint32_t CreateRoute(const uint32_t& sessionHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ call.member("CreateRoute");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ uint32_t argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void DeleteRoute(const uint32_t& sessionHandle, const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ call.member("DeleteRoute");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void SetCostModel(const uint32_t& sessionHandle, const uint32_t& routeHandle, const int32_t& costModel)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ wi << costModel;
+ call.member("SetCostModel");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ int32_t GetCostModel(const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ call.member("GetCostModel");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ int32_t argout;
+ ri >> argout;
+ return argout;
+ }
+
+ std::vector< int32_t > GetSupportedCostModels()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetSupportedCostModels");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::vector< int32_t > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void SetRoutePreferences(const uint32_t& sessionHandle, const uint32_t& routeHandle, const std::string& countryCode, const std::vector< ::DBus::Struct< int32_t, int32_t > >& roadPreferenceList, const std::vector< ::DBus::Struct< int32_t, int32_t > >& conditionPreferenceList)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ wi << countryCode;
+ wi << roadPreferenceList;
+ wi << conditionPreferenceList;
+ call.member("SetRoutePreferences");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void GetRoutePreferences(const uint32_t& routeHandle, const std::string& countryCode, std::vector< ::DBus::Struct< int32_t, int32_t > >& roadPreferenceList, std::vector< ::DBus::Struct< int32_t, int32_t > >& conditionPreferenceList)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ wi << countryCode;
+ call.member("GetRoutePreferences");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> roadPreferenceList;
+ ri >> conditionPreferenceList;
+ }
+
+ void GetSupportedRoutePreferences(std::vector< ::DBus::Struct< int32_t, int32_t > >& routePreferencesList, std::vector< ::DBus::Struct< int32_t, int32_t > >& conditionPreferenceList)
+ {
+ ::DBus::CallMessage call;
+ call.member("GetSupportedRoutePreferences");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> routePreferencesList;
+ ri >> conditionPreferenceList;
+ }
+
+ void SetRouteSchedule(const uint32_t& sessionHandle, const uint32_t& routeHandle, const std::map< int32_t, uint32_t >& routeSchedule)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ wi << routeSchedule;
+ call.member("SetRouteSchedule");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ std::map< int32_t, uint32_t > GetRouteSchedule(const uint32_t& routeHandle, const std::vector< int32_t >& valuesToReturn)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ wi << valuesToReturn;
+ call.member("GetRouteSchedule");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::map< int32_t, uint32_t > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void SetTransportationMeans(const uint32_t& sessionHandle, const uint32_t& routeHandle, const std::vector< int32_t >& transportationMeansList)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ wi << transportationMeansList;
+ call.member("SetTransportationMeans");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ std::vector< int32_t > GetTransportationMeans(const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ call.member("GetTransportationMeans");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::vector< int32_t > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ std::vector< int32_t > GetSupportedTransportationMeans()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetSupportedTransportationMeans");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::vector< int32_t > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void SetExcludedAreas(const uint32_t& sessionHandle, const uint32_t& routeHandle, const std::vector< std::vector< ::DBus::Struct< double, double > > >& excludedAreas)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ wi << excludedAreas;
+ call.member("SetExcludedAreas");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ std::vector< std::vector< ::DBus::Struct< double, double > > > GetExcludedAreas(const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ call.member("GetExcludedAreas");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::vector< std::vector< ::DBus::Struct< double, double > > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void SetWaypoints(const uint32_t& sessionHandle, const uint32_t& routeHandle, const bool& startFromCurrentPosition, const std::vector< std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > >& waypointsList)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ wi << startFromCurrentPosition;
+ wi << waypointsList;
+ call.member("SetWaypoints");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void GetWaypoints(const uint32_t& routeHandle, bool& startFromCurrentPosition, std::vector< std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > >& waypointsList)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ call.member("GetWaypoints");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> startFromCurrentPosition;
+ ri >> waypointsList;
+ }
+
+ void CalculateRoute(const uint32_t& sessionHandle, const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ call.member("CalculateRoute");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void CancelRouteCalculation(const uint32_t& sessionHandle, const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ call.member("CancelRouteCalculation");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ std::vector< uint32_t > CalculateRoutes(const uint32_t& sessionHandle, const std::vector< uint32_t >& calculatedRoutesList)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << calculatedRoutesList;
+ call.member("CalculateRoutes");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::vector< uint32_t > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void GetRouteSegments(const uint32_t& routeHandle, const int16_t& detailLevel, const std::vector< int32_t >& valuesToReturn, const uint32_t& numberOfSegments, const uint32_t& offset, uint32_t& totalNumberOfSegments, std::vector< std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > >& routeSegments)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ wi << detailLevel;
+ wi << valuesToReturn;
+ wi << numberOfSegments;
+ wi << offset;
+ call.member("GetRouteSegments");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> totalNumberOfSegments;
+ ri >> routeSegments;
+ }
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > GetRouteOverview(const uint32_t& routeHandle, const std::vector< int32_t >& valuesToReturn)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ wi << valuesToReturn;
+ call.member("GetRouteOverview");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ ::DBus::Struct< ::DBus::Struct< double, double >, ::DBus::Struct< double, double > > GetRouteBoundingBox(const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ call.member("GetRouteBoundingBox");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ::DBus::Struct< ::DBus::Struct< double, double >, ::DBus::Struct< double, double > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ std::vector< uint32_t > GetAllRoutes()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetAllRoutes");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::vector< uint32_t > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void SetBlockedRouteStretches(const uint32_t& sessionHandle, const uint32_t& routeHandle, const std::vector< ::DBus::Struct< uint32_t, uint32_t > >& blockParameters)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ wi << blockParameters;
+ call.member("SetBlockedRouteStretches");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ std::vector< ::DBus::Struct< uint32_t, uint32_t > > GetBlockedRouteStretches(const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << routeHandle;
+ call.member("GetBlockedRouteStretches");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::vector< ::DBus::Struct< uint32_t, uint32_t > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+
+public:
+
+ /* signal handlers for this interface
+ */
+ virtual void RouteDeleted(const uint32_t& routeHandle) = 0;
+ virtual void RouteCalculationCancelled(const uint32_t& routeHandle) = 0;
+ virtual void RouteCalculationSuccessful(const uint32_t& routeHandle, const std::map< int32_t, int32_t >& unfullfilledPreferences) = 0;
+ virtual void RouteCalculationFailed(const uint32_t& routeHandle, const int32_t& errorCode, const std::map< int32_t, int32_t >& unfullfilledPreferences) = 0;
+ virtual void RouteCalculationProgressUpdate(const uint32_t& routeHandle, const int32_t& status, const uint8_t& percentage) = 0;
+ virtual void AlternativeRoutesAvailable(const std::vector< uint32_t >& routeHandlesList) = 0;
+
+private:
+
+ /* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+ */
+ void _RouteDeleted_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t routeHandle;
+ ri >> routeHandle;
+ RouteDeleted(routeHandle);
+ }
+ void _RouteCalculationCancelled_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t routeHandle;
+ ri >> routeHandle;
+ RouteCalculationCancelled(routeHandle);
+ }
+ void _RouteCalculationSuccessful_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t routeHandle;
+ ri >> routeHandle;
+ std::map< int32_t, int32_t > unfullfilledPreferences;
+ ri >> unfullfilledPreferences;
+ RouteCalculationSuccessful(routeHandle, unfullfilledPreferences);
+ }
+ void _RouteCalculationFailed_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t routeHandle;
+ ri >> routeHandle;
+ int32_t errorCode;
+ ri >> errorCode;
+ std::map< int32_t, int32_t > unfullfilledPreferences;
+ ri >> unfullfilledPreferences;
+ RouteCalculationFailed(routeHandle, errorCode, unfullfilledPreferences);
+ }
+ void _RouteCalculationProgressUpdate_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t routeHandle;
+ ri >> routeHandle;
+ int32_t status;
+ ri >> status;
+ uint8_t percentage;
+ ri >> percentage;
+ RouteCalculationProgressUpdate(routeHandle, status, percentage);
+ }
+ void _AlternativeRoutesAvailable_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ std::vector< uint32_t > routeHandlesList;
+ ri >> routeHandlesList;
+ AlternativeRoutesAvailable(routeHandlesList);
+ }
+};
+
+} } }
+namespace org {
+namespace genivi {
+namespace navigationcore {
+
+class MapMatchedPosition_proxy
+: public ::DBus::InterfaceProxy
+{
+public:
+
+ MapMatchedPosition_proxy()
+ : ::DBus::InterfaceProxy("org.genivi.navigationcore.MapMatchedPosition")
+ {
+ connect_signal(MapMatchedPosition_proxy, SimulationStatusChanged, _SimulationStatusChanged_stub);
+ connect_signal(MapMatchedPosition_proxy, SimulationSpeedChanged, _SimulationSpeedChanged_stub);
+ connect_signal(MapMatchedPosition_proxy, PositionUpdate, _PositionUpdate_stub);
+ connect_signal(MapMatchedPosition_proxy, AddressUpdate, _AddressUpdate_stub);
+ connect_signal(MapMatchedPosition_proxy, PositionOnSegmentUpdate, _PositionOnSegmentUpdate_stub);
+ connect_signal(MapMatchedPosition_proxy, StatusUpdate, _StatusUpdate_stub);
+ connect_signal(MapMatchedPosition_proxy, OffRoadPositionChanged, _OffRoadPositionChanged_stub);
+ }
+
+public:
+
+ /* properties exported by this interface */
+public:
+
+ /* methods exported by this interface,
+ * this functions will invoke the corresponding methods on the remote objects
+ */
+ ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > MapMatchedPositionGetVersion()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetVersion");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void SetSimulationMode(const uint32_t& sessionHandle, const bool& activate)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << activate;
+ call.member("SetSimulationMode");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ int32_t GetSimulationStatus()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetSimulationStatus");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ int32_t argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void AddSimulationStatusListener()
+ {
+ ::DBus::CallMessage call;
+ call.member("AddSimulationStatusListener");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void RemoveSimulationStatusListener()
+ {
+ ::DBus::CallMessage call;
+ call.member("RemoveSimulationStatusListener");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void SetSimulationSpeed(const uint32_t& sessionHandle, const uint8_t& speedFactor)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << speedFactor;
+ call.member("SetSimulationSpeed");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ uint8_t GetSimulationSpeed()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetSimulationSpeed");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ uint8_t argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void AddSimulationSpeedListener()
+ {
+ ::DBus::CallMessage call;
+ call.member("AddSimulationSpeedListener");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void RemoveSimulationSpeedListener()
+ {
+ ::DBus::CallMessage call;
+ call.member("RemoveSimulationSpeedListener");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void StartSimulation(const uint32_t& sessionHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ call.member("StartSimulation");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void PauseSimulation(const uint32_t& sessionHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ call.member("PauseSimulation");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > GetPosition(const std::vector< int32_t >& valuesToReturn)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << valuesToReturn;
+ call.member("GetPosition");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void SetPosition(const uint32_t& sessionHandle, const std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > >& position)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << position;
+ call.member("SetPosition");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > GetAddress(const std::vector< int32_t >& valuesToReturn)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << valuesToReturn;
+ call.member("GetAddress");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > GetPositionOnSegment(const std::vector< int32_t >& valuesToReturn)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << valuesToReturn;
+ call.member("GetPositionOnSegment");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > GetStatus(const std::vector< int32_t >& valuesToReturn)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << valuesToReturn;
+ call.member("GetStatus");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > argout;
+ ri >> argout;
+ return argout;
+ }
+
+
+public:
+
+ /* signal handlers for this interface
+ */
+ virtual void SimulationStatusChanged(const int32_t& simulationStatus) = 0;
+ virtual void SimulationSpeedChanged(const uint8_t& speedFactor) = 0;
+ virtual void PositionUpdate(const std::vector< int32_t >& changedValues) = 0;
+ virtual void AddressUpdate(const std::vector< int32_t >& changedValues) = 0;
+ virtual void PositionOnSegmentUpdate(const std::vector< int32_t >& changedValues) = 0;
+ virtual void StatusUpdate(const std::vector< int32_t >& changedValues) = 0;
+ virtual void OffRoadPositionChanged(const uint32_t& distance, const int32_t& direction) = 0;
+
+private:
+
+ /* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+ */
+ void _SimulationStatusChanged_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ int32_t simulationStatus;
+ ri >> simulationStatus;
+ SimulationStatusChanged(simulationStatus);
+ }
+ void _SimulationSpeedChanged_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint8_t speedFactor;
+ ri >> speedFactor;
+ SimulationSpeedChanged(speedFactor);
+ }
+ void _PositionUpdate_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ std::vector< int32_t > changedValues;
+ ri >> changedValues;
+ PositionUpdate(changedValues);
+ }
+ void _AddressUpdate_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ std::vector< int32_t > changedValues;
+ ri >> changedValues;
+ AddressUpdate(changedValues);
+ }
+ void _PositionOnSegmentUpdate_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ std::vector< int32_t > changedValues;
+ ri >> changedValues;
+ PositionOnSegmentUpdate(changedValues);
+ }
+ void _StatusUpdate_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ std::vector< int32_t > changedValues;
+ ri >> changedValues;
+ StatusUpdate(changedValues);
+ }
+ void _OffRoadPositionChanged_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t distance;
+ ri >> distance;
+ int32_t direction;
+ ri >> direction;
+ OffRoadPositionChanged(distance, direction);
+ }
+};
+
+} } }
+namespace org {
+namespace genivi {
+namespace navigationcore {
+
+class Guidance_proxy
+: public ::DBus::InterfaceProxy
+{
+public:
+
+ Guidance_proxy()
+ : ::DBus::InterfaceProxy("org.genivi.navigationcore.Guidance")
+ {
+ connect_signal(Guidance_proxy, VehicleLeftTheRoadNetwork, _VehicleLeftTheRoadNetwork_stub);
+ connect_signal(Guidance_proxy, GuidanceStatusChanged, _GuidanceStatusChanged_stub);
+ connect_signal(Guidance_proxy, WaypointReached, _WaypointReached_stub);
+ connect_signal(Guidance_proxy, ManeuverChanged, _ManeuverChanged_stub);
+ connect_signal(Guidance_proxy, PositionOnRouteChanged, _PositionOnRouteChanged_stub);
+ connect_signal(Guidance_proxy, VehicleLeftTheRoute, _VehicleLeftTheRoute_stub);
+ connect_signal(Guidance_proxy, PositionToRouteChanged, _PositionToRouteChanged_stub);
+ connect_signal(Guidance_proxy, ActiveRouteChanged, _ActiveRouteChanged_stub);
+ }
+
+public:
+
+ /* properties exported by this interface */
+public:
+
+ /* methods exported by this interface,
+ * this functions will invoke the corresponding methods on the remote objects
+ */
+ ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > GuidanceGetVersion()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetVersion");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > argout;
+ ri >> argout;
+ return argout;
+ }
+
+ void StartGuidance(const uint32_t& sessionHandle, const uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeHandle;
+ call.member("StartGuidance");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void StopGuidance(const uint32_t& sessionHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ call.member("StopGuidance");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void SetVoiceGuidance(const bool& activate, const std::string& voice)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << activate;
+ wi << voice;
+ call.member("SetVoiceGuidance");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void GetGuidanceDetails(bool& voiceGuidance, bool& vehicleOnTheRoad, bool& isDestinationReached, int32_t& maneuver)
+ {
+ ::DBus::CallMessage call;
+ call.member("GetGuidanceDetails");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> voiceGuidance;
+ ri >> vehicleOnTheRoad;
+ ri >> isDestinationReached;
+ ri >> maneuver;
+ }
+
+ void PlayVoiceManeuver()
+ {
+ ::DBus::CallMessage call;
+ call.member("PlayVoiceManeuver");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void GetWaypointInformation(const uint16_t& requestedNumberOfWaypoints, uint16_t& numberOfWaypoints, std::vector< ::DBus::Struct< uint32_t, uint32_t, int32_t, int32_t, int16_t, int16_t, bool, uint16_t > >& waypointsList)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << requestedNumberOfWaypoints;
+ call.member("GetWaypointInformation");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> numberOfWaypoints;
+ ri >> waypointsList;
+ }
+
+ void GetDestinationInformation(uint32_t& offset, uint32_t& travelTime, int32_t& direction, int32_t& side, int16_t& timeZone, int16_t& daylightSavingTime)
+ {
+ ::DBus::CallMessage call;
+ call.member("GetDestinationInformation");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> offset;
+ ri >> travelTime;
+ ri >> direction;
+ ri >> side;
+ ri >> timeZone;
+ ri >> daylightSavingTime;
+ }
+
+ void GetManeuversList(const uint16_t& requestedNumberOfManeuvers, const uint32_t& maneuverOffset, uint16_t& numberOfManeuvers, std::vector< ::DBus::Struct< std::string, std::string, uint16_t, int32_t, uint32_t, std::vector< ::DBus::Struct< uint32_t, uint32_t, int32_t, int32_t, std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > > > > >& maneuversList)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << requestedNumberOfManeuvers;
+ wi << maneuverOffset;
+ call.member("GetManeuversList");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> numberOfManeuvers;
+ ri >> maneuversList;
+ }
+
+ void SetRouteCalculationMode(const uint32_t& sessionHandle, const int32_t& routeCalculationMode)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ wi << routeCalculationMode;
+ call.member("SetRouteCalculationMode");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void SkipNextManeuver(const uint32_t& sessionHandle)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << sessionHandle;
+ call.member("SkipNextManeuver");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ void GetGuidanceStatus(int32_t& guidanceStatus, uint32_t& routeHandle)
+ {
+ ::DBus::CallMessage call;
+ call.member("GetGuidanceStatus");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ ri >> guidanceStatus;
+ ri >> routeHandle;
+ }
+
+ void SetVoiceGuidanceSettings(const int32_t& promptMode)
+ {
+ ::DBus::CallMessage call;
+ ::DBus::MessageIter wi = call.writer();
+
+ wi << promptMode;
+ call.member("SetVoiceGuidanceSettings");
+ ::DBus::Message ret = invoke_method (call);
+ }
+
+ int32_t GetVoiceGuidanceSettings()
+ {
+ ::DBus::CallMessage call;
+ call.member("GetVoiceGuidanceSettings");
+ ::DBus::Message ret = invoke_method (call);
+ ::DBus::MessageIter ri = ret.reader();
+
+ int32_t argout;
+ ri >> argout;
+ return argout;
+ }
+
+
+public:
+
+ /* signal handlers for this interface
+ */
+ virtual void VehicleLeftTheRoadNetwork() = 0;
+ virtual void GuidanceStatusChanged(const int32_t& guidanceStatus, const uint32_t& routeHandle) = 0;
+ virtual void WaypointReached(const bool& isDestination) = 0;
+ virtual void ManeuverChanged(const int32_t& maneuver) = 0;
+ virtual void PositionOnRouteChanged(const uint32_t& offsetOnRoute) = 0;
+ virtual void VehicleLeftTheRoute() = 0;
+ virtual void PositionToRouteChanged(const uint32_t& distance, const int32_t& direction) = 0;
+ virtual void ActiveRouteChanged(const int32_t& changeCause) = 0;
+
+private:
+
+ /* unmarshalers (to unpack the DBus message before calling the actual signal handler)
+ */
+ void _VehicleLeftTheRoadNetwork_stub(const ::DBus::SignalMessage &sig)
+ {
+ VehicleLeftTheRoadNetwork();
+ }
+ void _GuidanceStatusChanged_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ int32_t guidanceStatus;
+ ri >> guidanceStatus;
+ uint32_t routeHandle;
+ ri >> routeHandle;
+ GuidanceStatusChanged(guidanceStatus, routeHandle);
+ }
+ void _WaypointReached_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ bool isDestination;
+ ri >> isDestination;
+ WaypointReached(isDestination);
+ }
+ void _ManeuverChanged_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ int32_t maneuver;
+ ri >> maneuver;
+ ManeuverChanged(maneuver);
+ }
+ void _PositionOnRouteChanged_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t offsetOnRoute;
+ ri >> offsetOnRoute;
+ PositionOnRouteChanged(offsetOnRoute);
+ }
+ void _VehicleLeftTheRoute_stub(const ::DBus::SignalMessage &sig)
+ {
+ VehicleLeftTheRoute();
+ }
+ void _PositionToRouteChanged_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ uint32_t distance;
+ ri >> distance;
+ int32_t direction;
+ ri >> direction;
+ PositionToRouteChanged(distance, direction);
+ }
+ void _ActiveRouteChanged_stub(const ::DBus::SignalMessage &sig)
+ {
+ ::DBus::MessageIter ri = sig.reader();
+
+ int32_t changeCause;
+ ri >> changeCause;
+ ActiveRouteChanged(changeCause);
+ }
+};
+
+} } }
+#endif //__dbusxx__genivi_navigationcore_proxy_h__PROXY_MARSHAL_H
diff --git a/include/genivi/navicore.h b/include/genivi/navicore.h
new file mode 100644
index 0000000..a80bc1f
--- /dev/null
+++ b/include/genivi/navicore.h
@@ -0,0 +1,140 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#ifndef NAVICORE_H
+#define NAVICORE_H
+
+#include <dbus-c++-1/dbus-c++/dbus.h>
+#include "genivi-navigationcore-proxy.h"
+#include <stdio.h>
+
+class Navicore :
+ public org::genivi::navigationcore::Session_proxy,
+ public org::genivi::navigationcore::Routing_proxy,
+ public org::genivi::navigationcore::MapMatchedPosition_proxy,
+ public org::genivi::navigationcore::Guidance_proxy,
+ public DBus::IntrospectableProxy,
+ public DBus::ObjectProxy
+{
+public:
+ Navicore(DBus::Connection &connection, const char *path, const char *name)
+ : DBus::ObjectProxy(connection, path, name)
+ {
+ };
+
+ // Session
+ void SessionDeleted(const uint32_t& sessionHandle)
+ {
+ printf("NavicoreSession - Session %d deleted\n",sessionHandle);
+ };
+
+ // Routing
+ void RouteDeleted(const uint32_t& routeHandle)
+ {
+ // TODO
+ };
+
+ void RouteCalculationCancelled(const uint32_t& routeHandle)
+ {
+ // TODO
+ };
+
+ void RouteCalculationSuccessful(const uint32_t& routeHandle, const std::map< int32_t, int32_t >& unfullfilledPreferences)
+ {
+ // TODO
+ };
+
+ void RouteCalculationFailed(const uint32_t& routeHandle, const int32_t& errorCode, const std::map< int32_t, int32_t >& unfullfilledPreferences)
+ {
+ // TODO
+ };
+
+ void RouteCalculationProgressUpdate(const uint32_t& routeHandle, const int32_t& status, const uint8_t& percentage)
+ {
+ // TODO
+ };
+
+ void AlternativeRoutesAvailable(const std::vector< uint32_t >& routeHandlesList)
+ {
+ // TODO
+ };
+
+ // MapMatchedPosition
+ void SimulationStatusChanged(const int32_t& simulationStatus)
+ {
+ // TODO
+ };
+
+ void SimulationSpeedChanged(const uint8_t& speedFactor)
+ {
+ // TODO
+ };
+
+ void PositionUpdate(const std::vector< int32_t >& changedValues)
+ {
+ // TODO
+ };
+
+ void AddressUpdate(const std::vector< int32_t >& changedValues)
+ {
+ // TODO
+ };
+
+ void PositionOnSegmentUpdate(const std::vector< int32_t >& changedValues)
+ {
+ // TODO
+ };
+
+ void StatusUpdate(const std::vector< int32_t >& changedValues)
+ {
+ // TODO
+ };
+
+ void OffRoadPositionChanged(const uint32_t& distance, const int32_t& direction)
+ {
+ // TODO
+ };
+
+ // Guidance
+ void VehicleLeftTheRoadNetwork()
+ {
+ // TODO
+ };
+
+ void GuidanceStatusChanged(const int32_t& guidanceStatus, const uint32_t& routeHandle)
+ {
+ // TODO
+ };
+
+ void WaypointReached(const bool& isDestination)
+ {
+ // TODO
+ };
+
+ void ManeuverChanged(const int32_t& maneuver)
+ {
+ // TODO
+ };
+
+ void PositionOnRouteChanged(const uint32_t& offsetOnRoute)
+ {
+ // TODO
+ };
+
+ void VehicleLeftTheRoute()
+ {
+ // TODO
+ };
+
+ void PositionToRouteChanged(const uint32_t& distance, const int32_t& direction)
+ {
+ // TODO
+ };
+
+ void ActiveRouteChanged(const int32_t& changeCause)
+ {
+ // TODO
+ };
+
+};
+
+#endif
diff --git a/include/genivi_request.h b/include/genivi_request.h
new file mode 100644
index 0000000..75201c7
--- /dev/null
+++ b/include/genivi_request.h
@@ -0,0 +1,37 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <map>
+#include <vector>
+#include <stdint.h>
+
+typedef std::tuple<double, double> Waypoint;
+
+/**
+ * @brief Genivi API call.
+ */
+class GeniviRequest
+{
+public:
+ ~GeniviRequest();
+
+ std::map< int32_t, double > NavicoreGetPosition( const std::vector< int32_t >& valuesToReturn );
+ std::vector< uint32_t > NavicoreGetAllRoutes();
+ uint32_t NavicoreCreateRoute( const uint32_t& sessionHandle );
+ void NavicorePauseSimulation( const uint32_t& sessionHandle );
+ void NavicoreSetSimulationMode( const uint32_t& sessionHandle, const bool& activate );
+ void NavicoreCancelRouteCalculation( const uint32_t& sessionHandle, const uint32_t& routeHandle );
+ void NavicoreSetWaypoints( const uint32_t& sessionHandle, const uint32_t& routeHandle,
+ const bool& startFromCurrentPosition, const std::vector<Waypoint>& waypointsList );
+ void NavicoreCalculateRoute( const uint32_t& sessionHandle, const uint32_t& routeHandle );
+ std::map<uint32_t, std::string> NavicoreGetAllSessions();
+
+private:
+ void* navicore_;
+
+ void CreateDBusSession();
+ bool CheckSession();
+};
+
diff --git a/libnavi/include/BinderClient.h b/libnavi/include/BinderClient.h
new file mode 100644
index 0000000..70a6558
--- /dev/null
+++ b/libnavi/include/BinderClient.h
@@ -0,0 +1,57 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <map>
+#include <tuple>
+#include <vector>
+#include <string>
+
+#include "libnavicore.hpp"
+
+#include "RequestManageListener.h"
+#include "RequestManage.h"
+
+#define API_NAME "naviapi"
+
+/**
+ * @brief API name
+ */
+#define VERB_GETPOSITION "navicore_getposition"
+#define VERB_GETALLROUTES "navicore_getallroutes"
+#define VERB_CREATEROUTE "navicore_createroute"
+#define VERB_PAUSESIMULATION "navicore_pausesimulation"
+#define VERB_SETSIMULATIONMODE "navicore_setsimulationmode"
+#define VERB_CANCELROUTECALCULATION "navicore_cancelroutecalculation"
+#define VERB_SETWAYPOINTS "navicore_setwaypoints"
+#define VERB_CALCULATEROUTE "navicore_calculateroute"
+#define VERB_GETALLSESSIONS "navicore_getallsessions"
+
+/**
+ * @brief Binder client class
+ */
+class BinderClient : public RequestManageListener
+{
+public:
+ BinderClient();
+ ~BinderClient();
+
+ bool ConnectServer(std::string url , naviapi::NavicoreListener* listener);
+ void NavicoreGetPosition(const std::vector< int32_t >& valuesToReturn);
+ void NavicoreGetAllRoutes();
+ void NavicoreCreateRoute(const uint32_t& sessionHandle);
+ void NavicorePauseSimulation(const uint32_t& sessionHandle);
+ void NavicoreSetSimulationMode(const uint32_t& sessionHandle, const bool& activate);
+ void NavicoreCancelRouteCalculation(const uint32_t& sessionHandle, const uint32_t& routeHandle);
+ void NavicoreSetWaypoints(const uint32_t& sessionHandle, const uint32_t& routeHandle, const bool& startFromCurrentPosition, const std::vector<naviapi::Waypoint>& waypointsList);
+ void NavicoreCalculateRoute(const uint32_t& sessionHandle, const uint32_t& routeHandle);
+ void NavicoreGetAllSessions();
+
+private:
+ void OnReply(struct json_object *reply);
+
+private:
+ naviapi::NavicoreListener* navicoreListener;
+ RequestManage* requestMng;
+};
+
diff --git a/libnavi/include/JsonRequestGenerator.h b/libnavi/include/JsonRequestGenerator.h
new file mode 100644
index 0000000..7cd6979
--- /dev/null
+++ b/libnavi/include/JsonRequestGenerator.h
@@ -0,0 +1,29 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+#include "libnavicore.hpp"
+
+/**
+* @brief Class for generating Json request
+*/
+class JsonRequestGenerator
+{
+public:
+ static std::string CreateRequestGetPosition(const std::vector< int32_t >& valuesToReturn);
+ static std::string CreateRequestGetAllRoutes();
+ static std::string CreateRequestCreateRoute(const uint32_t* sessionHandle);
+ static std::string CreateRequestPauseSimulation(const uint32_t* sessionHandle);
+ static std::string CreateRequestSetSimulationMode(const uint32_t* sessionHandle, const bool* activate);
+ static std::string CreateRequestCancelRouteCalculation(const uint32_t* sessionHandle, const uint32_t* routeHandle);
+ static std::string CreateRequestSetWaypoints(const uint32_t* sessionHandle, const uint32_t* routeHandle,
+ const bool* startFromCurrentPosition, const std::vector<naviapi::Waypoint>* waypointsList);
+ static std::string CreateRequestCalculateroute(const uint32_t* sessionHandle, const uint32_t* routeHandle);
+ static std::string CreateRequestGetAllSessions();
+};
+
diff --git a/libnavi/include/JsonResponseAnalyzer.h b/libnavi/include/JsonResponseAnalyzer.h
new file mode 100644
index 0000000..50b2cd2
--- /dev/null
+++ b/libnavi/include/JsonResponseAnalyzer.h
@@ -0,0 +1,25 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <json-c/json.h>
+#include <stdint.h>
+#include <string>
+#include <vector>
+#include <map>
+
+#include "libnavicore.hpp"
+
+/**
+* @brief JSON response analysis class
+*/
+class JsonResponseAnalyzer
+{
+public:
+ static std::map< int32_t, naviapi::variant > AnalyzeResponseGetPosition( std::string& res_json );
+ static std::vector< uint32_t > AnalyzeResponseGetAllRoutes( std::string& res_json );
+ static uint32_t AnalyzeResponseCreateRoute( std::string& res_json );
+ static std::map<uint32_t, std::string> AnalyzeResponseGetAllSessions( std::string& res_json );
+};
+
diff --git a/libnavi/include/RequestManage.h b/libnavi/include/RequestManage.h
new file mode 100644
index 0000000..05ffcdf
--- /dev/null
+++ b/libnavi/include/RequestManage.h
@@ -0,0 +1,64 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <stdint.h>
+#include <string>
+#include <pthread.h>
+
+extern "C" {
+ #include <afb/afb-wsj1.h>
+ #include <afb/afb-ws-client.h>
+}
+
+#include "RequestManageListener.h"
+
+/**
+* @brief Class for request
+*/
+class RequestManage
+{
+public:
+ pthread_cond_t cond;
+ pthread_mutex_t mutex;
+
+ struct afb_wsj1* wsj1;
+ std::string* requestURL;
+ struct afb_wsj1_itf wsj1_itf;
+
+private:
+ RequestManageListener* listener;
+ int request_cnt;
+ uint32_t sessionHandle;
+ uint32_t routeHandle;
+
+ // Function called from thread
+ static void* BinderThread(void* param);
+
+ // Callback function
+ void OnReply(struct afb_wsj1_msg *msg);
+ void OnHangup(struct afb_wsj1 *wsj1);
+ void OnCallStatic(const char *api, const char *verb, struct afb_wsj1_msg *msg);
+ void OnEventStatic(const char *event, struct afb_wsj1_msg *msg);
+
+ static void OnReplyStatic(void *closure, struct afb_wsj1_msg *msg);
+ static void OnHangupStatic(void *closure, struct afb_wsj1 *wsj1);
+ static void OnCallStatic(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg);
+ static void OnEventStatic(void *closure, const char *event, struct afb_wsj1_msg *msg);
+
+// ==================================================================================================
+// public
+// ==================================================================================================
+public:
+ RequestManage();
+ ~RequestManage();
+
+ bool Connect(const char* api_url, RequestManageListener* listener);
+ bool IsConnect();
+ bool CallBinderAPI(const char *api, const char *verb, const char *object);
+ void SetSessionHandle(uint32_t session);
+ uint32_t GetSessionHandle();
+ void SetRouteHandle(uint32_t route);
+ uint32_t GetRouteHandle();
+};
+
diff --git a/libnavi/include/RequestManageListener.h b/libnavi/include/RequestManageListener.h
new file mode 100644
index 0000000..3b0c932
--- /dev/null
+++ b/libnavi/include/RequestManageListener.h
@@ -0,0 +1,17 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <json-c/json.h>
+
+class RequestManageListener
+{
+public:
+ RequestManageListener() {
+ }
+ virtual ~RequestManageListener() {
+ }
+
+ virtual void OnReply(struct json_object *reply) = 0;
+};
+
diff --git a/libnavi/include/libnavicore.hpp b/libnavi/include/libnavicore.hpp
new file mode 100644
index 0000000..66200d9
--- /dev/null
+++ b/libnavi/include/libnavicore.hpp
@@ -0,0 +1,69 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#pragma once
+
+#include <map>
+#include <string>
+#include <tuple>
+#include <vector>
+
+#include <stdint.h>
+
+namespace naviapi {
+
+static const uint32_t NAVICORE_TIMESTAMP = 0x0010;
+static const uint32_t NAVICORE_LATITUDE = 0x00a0;
+static const uint32_t NAVICORE_LONGITUDE = 0x00a1;
+static const uint32_t NAVICORE_HEADING = 0x00a3;
+static const uint32_t NAVICORE_SPEED = 0x00a4;
+static const uint32_t NAVICORE_SIMULATION_MODE = 0x00e3;
+
+typedef union
+{
+ bool _bool;
+ int32_t _int32_t;
+ uint32_t _uint32_t;
+ double _double;
+} variant;
+
+typedef std::tuple<double, double> Waypoint;
+
+class NavicoreListener
+{
+public:
+ NavicoreListener();
+ virtual ~NavicoreListener();
+
+ virtual void getAllSessions_reply(const std::map< uint32_t, std::string >& allSessions);
+ virtual void getPosition_reply(std::map< int32_t, variant > position);
+ virtual void getAllRoutes_reply(std::vector< uint32_t > allRoutes);
+ virtual void createRoute_reply(uint32_t routeHandle);
+}; // class NavicoreListener
+
+class Navicore
+{
+private:
+ NavicoreListener* mListener;
+
+public:
+ Navicore();
+ virtual ~Navicore();
+
+ bool connect(int argc, char *argv[], NavicoreListener* listener);
+ void disconnect();
+
+ void getAllSessions();
+ void getPosition(std::vector<int32_t> params);
+ void getAllRoutes();
+ void createRoute(uint32_t session);
+
+ void pauseSimulation(uint32_t session);
+ void setSimulationMode(uint32_t session, bool activate);
+ void cancelRouteCalculation(uint32_t session, uint32_t routeHandle);
+ void setWaypoints(uint32_t session, uint32_t routeHandle, bool flag, std::vector<Waypoint>);
+ void calculateRoute(uint32_t session, uint32_t routeHandle);
+
+}; // class Navicore
+
+}; // namespace naviapi
+
diff --git a/libnavi/include/traces.h b/libnavi/include/traces.h
new file mode 100644
index 0000000..a1f96ec
--- /dev/null
+++ b/libnavi/include/traces.h
@@ -0,0 +1,38 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#ifndef __TRACE_H__
+#define __TRACE_H__
+
+#include <stdio.h>
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define PURPLE "\033[35m"
+#define DGREEN "\033[6m"
+#define WHITE "\033[7m"
+#define CYAN "\x1b[36m"
+#define NONE "\033[0m"
+
+#ifdef NDEBUG
+
+#define TRACE_DEBUG_JSON(fmt, args...)
+#define TRACE_DEBUG(fmt, args...)
+#define TRACE_INFO(fmt, args...)
+#define TRACE_WARN(fmt, args...)
+#define TRACE_ERROR(fmt, args...)
+
+#else
+
+#define TRACE_DEBUG(fmt, args...) do { fprintf(stderr, "[%s:%d] " CYAN "DEBUG" NONE ": " fmt "\n", __func__, __LINE__, ##args); } while(0)
+#define TRACE_INFO(fmt, args...) do { fprintf(stderr, "[%s:%d] " GREEN "INFO" NONE ": " fmt "\n", __func__, __LINE__, ##args); } while(0)
+#define TRACE_WARN(fmt, args...) do { fprintf(stderr, "[%s:%d] " YELLOW "WARN" NONE": " fmt "\n", __func__, __LINE__, ##args); } while(0)
+#define TRACE_ERROR(fmt, args...) do { fprintf(stderr, "[%s:%d] " RED "ERROR" NONE ": " fmt "\n", __func__, __LINE__, ##args); } while(0)
+
+#define TRACE_DEBUG_JSON(fmt, args...)
+
+#endif
+
+#endif // __TRACE_H__
diff --git a/libnavi/src/BinderClient.cpp b/libnavi/src/BinderClient.cpp
new file mode 100644
index 0000000..1e1e9e9
--- /dev/null
+++ b/libnavi/src/BinderClient.cpp
@@ -0,0 +1,315 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include <cstring>
+
+#include "BinderClient.h"
+#include "JsonRequestGenerator.h"
+#include "JsonResponseAnalyzer.h"
+
+#include "traces.h"
+
+/**
+ * @brief constructor
+ */
+BinderClient::BinderClient() : navicoreListener(nullptr)
+{
+ requestMng = new RequestManage();
+}
+
+/**
+ * @brief Destructor
+ */
+BinderClient::~BinderClient()
+{
+ delete requestMng;
+}
+
+/**
+ * @brief Connect with the Binder server
+ */
+bool BinderClient::ConnectServer(std::string url, naviapi::NavicoreListener* listener)
+{
+ this->navicoreListener = listener;
+
+ if( !requestMng->Connect(url.c_str(), this))
+ {
+ TRACE_ERROR("cannot connect to binding service.\n");
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * @brief Call Genivi's GetPosition via Binder and get the result
+ */
+void BinderClient::NavicoreGetPosition(const std::vector< int32_t >& valuesToReturn)
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ std::string req_json = JsonRequestGenerator::CreateRequestGetPosition(valuesToReturn);
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_GETPOSITION, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_getposition success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_getposition failed.\n");
+ }
+ }
+}
+
+/**
+ * @brief Get route handle
+ */
+void BinderClient::NavicoreGetAllRoutes()
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ std::string req_json = JsonRequestGenerator::CreateRequestGetAllRoutes();
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_GETALLROUTES, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_getallroutes success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_getallroutes failed.\n");
+ }
+ }
+}
+
+/**
+ * @brief Generate route handle
+ */
+void BinderClient::NavicoreCreateRoute(const uint32_t& sessionHandle)
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ uint32_t session = requestMng->GetSessionHandle();
+ std::string req_json = JsonRequestGenerator::CreateRequestCreateRoute(&session);
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_CREATEROUTE, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_createroute success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_createroute failed.\n");
+ }
+ }
+}
+
+/**
+ * @brief Pause demo
+ */
+void BinderClient::NavicorePauseSimulation(const uint32_t& sessionHandle)
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ uint32_t session = requestMng->GetSessionHandle();
+ std::string req_json = JsonRequestGenerator::CreateRequestPauseSimulation(&session);
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_PAUSESIMULATION, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_pausesimulationmode success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_pausesimulationmode failed.\n");
+ }
+ }
+}
+
+/**
+ * @brief Simulation mode setting
+ */
+void BinderClient::NavicoreSetSimulationMode(const uint32_t& sessionHandle, const bool& activate)
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ uint32_t session = requestMng->GetSessionHandle();
+ std::string req_json = JsonRequestGenerator::CreateRequestSetSimulationMode(&session, &activate);
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_SETSIMULATIONMODE, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_setsimulationmode success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_setsimulationmode failed.\n");
+ }
+ }
+}
+
+/**
+ * @brief Delete route information
+ */
+void BinderClient::NavicoreCancelRouteCalculation(const uint32_t& sessionHandle, const uint32_t& routeHandle)
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ uint32_t session = requestMng->GetSessionHandle();
+ std::string req_json = JsonRequestGenerator::CreateRequestCancelRouteCalculation(&session, &routeHandle);
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_CANCELROUTECALCULATION, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_cancelroutecalculation success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_cancelroutecalculation failed.\n");
+ }
+ }
+}
+
+/**
+ * @brief Destination setting
+ */
+void BinderClient::NavicoreSetWaypoints(const uint32_t& sessionHandle, const uint32_t& routeHandle, const bool& startFromCurrentPosition, const std::vector<naviapi::Waypoint>& waypointsList)
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ uint32_t session = requestMng->GetSessionHandle();
+ uint32_t route = requestMng->GetRouteHandle();
+ std::string req_json = JsonRequestGenerator::CreateRequestSetWaypoints(&session, &route,
+ &startFromCurrentPosition, &waypointsList);
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_SETWAYPOINTS, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_setwaypoints success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_setwaypoints failed.\n");
+ }
+ }
+}
+
+/**
+ * @brief Route calculation processing
+ */
+void BinderClient::NavicoreCalculateRoute(const uint32_t& sessionHandle, const uint32_t& routeHandle)
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ uint32_t session = requestMng->GetSessionHandle();
+ uint32_t route = requestMng->GetRouteHandle();
+ std::string req_json = JsonRequestGenerator::CreateRequestCalculateroute(&session, &route);
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_CALCULATEROUTE, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_calculateroute success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_calculateroute failed.\n");
+ }
+ }
+}
+
+/**
+ * @brief Retrieve session information
+ * @return Map of session information
+ */
+void BinderClient::NavicoreGetAllSessions()
+{
+ // Check if it is connected
+ if( requestMng->IsConnect() )
+ {
+ // JSON request generation
+ std::string req_json = JsonRequestGenerator::CreateRequestGetAllSessions();
+
+ // Send request
+ if( requestMng->CallBinderAPI(API_NAME, VERB_GETALLSESSIONS, req_json.c_str()) )
+ {
+ TRACE_DEBUG("navicore_getallsessions success.\n");
+ }
+ else
+ {
+ TRACE_ERROR("navicore_getallsessions failed.\n");
+ }
+ }
+}
+
+void BinderClient::OnReply(struct json_object* reply)
+{
+ struct json_object* requestObject = nullptr;
+ json_object_object_get_ex(reply, "request", &requestObject);
+
+ struct json_object* infoObject = nullptr;
+ json_object_object_get_ex(requestObject, "info", &infoObject);
+
+ const char* info = json_object_get_string(infoObject);
+
+ char tmpVerb[256];
+ strcpy(tmpVerb, info);
+
+ // Create a new JSON response
+ const char* json_str = json_object_to_json_string_ext(reply, JSON_C_TO_STRING_PRETTY);
+ std::string response_json = std::string( json_str );
+
+ if (strcmp(VERB_GETALLSESSIONS, tmpVerb) == 0)
+ {
+ std::map<uint32_t, std::string> ret = JsonResponseAnalyzer::AnalyzeResponseGetAllSessions(response_json);
+
+ // keep session handle
+ requestMng->SetSessionHandle( ret.begin()->first );
+
+ this->navicoreListener->getAllSessions_reply(ret);
+ }
+ else if (strcmp(VERB_GETPOSITION, tmpVerb) == 0)
+ {
+ std::map< int32_t, naviapi::variant > ret = JsonResponseAnalyzer::AnalyzeResponseGetPosition(response_json);
+
+ this->navicoreListener->getPosition_reply(ret);
+ }
+ else if (strcmp(VERB_GETALLROUTES, tmpVerb) == 0)
+ {
+ std::vector< uint32_t > ret = JsonResponseAnalyzer::AnalyzeResponseGetAllRoutes(response_json);
+
+ // route handle
+ if(ret.size() > 0)
+ {
+ requestMng->SetRouteHandle(ret[0]);
+ }
+
+ this->navicoreListener->getAllRoutes_reply(ret);
+ }
+ else if (strcmp(VERB_CREATEROUTE, tmpVerb) == 0)
+ {
+ uint32_t ret = JsonResponseAnalyzer::AnalyzeResponseCreateRoute(response_json);
+
+ // keep route handle
+ requestMng->SetRouteHandle(ret);
+
+ this->navicoreListener->createRoute_reply(ret);
+ }
+}
+
diff --git a/libnavi/src/JsonRequestGenerator.cpp b/libnavi/src/JsonRequestGenerator.cpp
new file mode 100644
index 0000000..09d68c0
--- /dev/null
+++ b/libnavi/src/JsonRequestGenerator.cpp
@@ -0,0 +1,188 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include <json-c/json.h>
+#include <traces.h>
+#include "JsonRequestGenerator.h"
+
+/**
+ * @brief Generate request for navicore_getposition
+ * @param valuesToReturn Key information you want to obtain
+ * @return json string
+ */
+std::string JsonRequestGenerator::CreateRequestGetPosition(const std::vector< int32_t >& valuesToReturn)
+{
+ std::vector< int32_t >::const_iterator itr;
+
+ struct json_object* request_json = json_object_new_object();
+ struct json_object* json_array = json_object_new_array();
+
+ for (itr = valuesToReturn.begin(); itr != valuesToReturn.end(); itr++)
+ {
+ json_object_array_add(json_array, json_object_new_int(*itr));
+ }
+
+ json_object_object_add(request_json, "valuesToReturn", json_array);
+ TRACE_DEBUG("CreateRequestGetPosition request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
+/**
+ * @brief Generate request for navicore_getallroutes
+ * @return json strin
+ */
+std::string JsonRequestGenerator::CreateRequestGetAllRoutes()
+{
+ // Request is empty and OK
+ struct json_object* request_json = json_object_new_object();
+ TRACE_DEBUG("CreateRequestGetAllRoutes request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
+/**
+ * @brief Generate request for navicore_createroute
+ * @param sessionHandle session handle
+ * @return json string
+ */
+std::string JsonRequestGenerator::CreateRequestCreateRoute(const uint32_t* sessionHandle)
+{
+ struct json_object* request_json = json_object_new_object();
+ json_object_object_add(request_json, "sessionHandle", json_object_new_int(*sessionHandle));
+ TRACE_DEBUG("CreateRequestCreateRoute request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
+/**
+ * @brief Generate request for navicore_pausesimulation
+ * @param sessionHandle session handle
+ * @return json string
+ */
+std::string JsonRequestGenerator::CreateRequestPauseSimulation(const uint32_t* sessionHandle)
+{
+ struct json_object* request_json = json_object_new_object();
+ // sessionHandle
+ json_object_object_add(request_json, "sessionHandle", json_object_new_int(*sessionHandle));
+ TRACE_DEBUG("CreateRequestPauseSimulation request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
+/**
+ * @brief Generate request for navicore_pausesimulation
+ * @param sessionHandle session handle
+ * @param active Simulation state
+ * @return json string
+ */
+std::string JsonRequestGenerator::CreateRequestSetSimulationMode(const uint32_t* sessionHandle, const bool* activate)
+{
+ struct json_object* request_json = json_object_new_object();
+
+ // "sessionHandle"
+ json_object_object_add(request_json, "sessionHandle", json_object_new_int(*sessionHandle));
+
+ // "simulationMode"
+ json_object_object_add(request_json, "simulationMode", json_object_new_boolean(*activate));
+ TRACE_DEBUG("CreateRequestSetSimulationMode request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
+/**
+ * @brief Generate request for navicore_pausesimulation
+ * @param sessionHandle session handle
+ * @param routeHandle route handle
+ * @return json string
+ */
+std::string JsonRequestGenerator::CreateRequestCancelRouteCalculation(const uint32_t* sessionHandle, const uint32_t* routeHandle)
+{
+ struct json_object* request_json = json_object_new_object();
+
+ // "sessionHandle"
+ json_object_object_add(request_json, "sessionHandle", json_object_new_int(*sessionHandle));
+
+ // "route"
+ json_object_object_add(request_json, "route", json_object_new_int(*routeHandle));
+ TRACE_DEBUG("CreateRequestCancelRouteCalculation request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
+/**
+ * @brief Generate request for navicore_setwaypoints
+ * @param sessionHandle session handle
+ * @param routeHandle route handle
+ * @return json string
+ */
+std::string JsonRequestGenerator::CreateRequestSetWaypoints(const uint32_t* sessionHandle, const uint32_t* routeHandle,
+ const bool* startFromCurrentPosition, const std::vector<naviapi::Waypoint>* waypointsList)
+{
+ naviapi::Waypoint destWp;
+
+ struct json_object* request_json = json_object_new_object();
+ struct json_object* json_array = json_object_new_array();
+
+ // "sessionHandle"
+ json_object_object_add(request_json, "sessionHandle", json_object_new_int(*sessionHandle));
+
+ // "route"
+ json_object_object_add(request_json, "route", json_object_new_int(*routeHandle));
+
+ // "startFromCurrentPosition"
+ json_object_object_add(request_json, "startFromCurrentPosition", json_object_new_boolean(*startFromCurrentPosition));
+
+ // "latitude", "longitude"
+ std::vector<naviapi::Waypoint>::const_iterator it;
+ for (it = waypointsList->begin(); it != waypointsList->end(); ++it)
+ {
+ struct json_object* destpoint = json_object_new_object();
+
+ double latitude = std::get<0>(*it);
+ json_object_object_add(destpoint, "latitude", json_object_new_double(latitude));
+
+ double longitude = std::get<1>(*it);
+ json_object_object_add(destpoint, "longitude", json_object_new_double(longitude));
+
+ json_object_array_add(json_array, destpoint);
+ }
+
+ json_object_object_add(request_json, "", json_array);
+ TRACE_DEBUG("CreateRequestSetWaypoints request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
+/**
+ * @brief Generate request for navicore_calculateroute
+ * @param sessionHandle session handle
+ * @param routeHandle route handle
+ * @return json string
+ */
+std::string JsonRequestGenerator::CreateRequestCalculateroute(const uint32_t* sessionHandle, const uint32_t* routeHandle)
+{
+ struct json_object* request_json = json_object_new_object();
+ // "sessionHandle"
+ json_object_object_add(request_json, "sessionHandle", json_object_new_int(*sessionHandle));
+
+ // "route"
+ json_object_object_add(request_json, "route", json_object_new_int(*routeHandle));
+ TRACE_DEBUG("CreateRequestCalculateroute request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
+/**
+ * @brief Generate request for navicore_getallsessions
+ * @return json string
+ */
+std::string JsonRequestGenerator::CreateRequestGetAllSessions()
+{
+ // Request is empty and OK
+ struct json_object* request_json = json_object_new_object();
+ TRACE_DEBUG("CreateRequestGetAllSessions request_json:\n%s\n", json_object_to_json_string(request_json));
+
+ return std::string( json_object_to_json_string( request_json ) );
+}
+
diff --git a/libnavi/src/JsonResponseAnalyzer.cpp b/libnavi/src/JsonResponseAnalyzer.cpp
new file mode 100644
index 0000000..b0d943f
--- /dev/null
+++ b/libnavi/src/JsonResponseAnalyzer.cpp
@@ -0,0 +1,254 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include <traces.h>
+
+#include "JsonResponseAnalyzer.h"
+
+/**
+ * @brief Response analysis of navicore_getallroutes
+ * @param res_json JSON string of response
+ * @return Map information for the key sent in the request
+ */
+std::map< int32_t, naviapi::variant > JsonResponseAnalyzer::AnalyzeResponseGetPosition( std::string& res_json )
+{
+ std::map< int32_t, naviapi::variant > ret;
+
+ TRACE_DEBUG("AnalyzeResponseGetPosition json_obj:\n%s\n", json_object_to_json_string(json_obj));
+
+ // convert to Json Object
+ struct json_object *json_obj = json_tokener_parse( res_json.c_str() );
+
+ // Check key
+ struct json_object *json_map_ary = NULL;
+ if( json_object_object_get_ex(json_obj, "response", &json_map_ary) )
+ {
+ // Check if the response is array information
+ if( json_object_is_type(json_map_ary, json_type_array) )
+ {
+ for (int i = 0; i < json_object_array_length(json_map_ary); ++i)
+ {
+ struct json_object* j_elem = json_object_array_get_idx(json_map_ary, i);
+
+ if( json_object_is_type( j_elem, json_type_object) )
+ {
+ // Check key
+ struct json_object* key = NULL;
+ struct json_object* value = NULL;
+ if( json_object_object_get_ex(j_elem, "key", &key)
+ && json_object_object_get_ex(j_elem, "value", &value) )
+ {
+ if( json_object_is_type(key, json_type_int) )
+ {
+ uint32_t req_key = (uint32_t)json_object_get_int(key);
+
+ switch( req_key )
+ {
+ case naviapi::NAVICORE_LATITUDE:
+ ret[req_key]._double = json_object_get_double(value);
+ break;
+
+ case naviapi::NAVICORE_LONGITUDE:
+ ret[req_key]._double = json_object_get_double(value);
+ break;
+
+ case naviapi::NAVICORE_TIMESTAMP:
+ ret[req_key]._uint32_t = (uint32_t)json_object_get_int(value);
+ break;
+
+ case naviapi::NAVICORE_HEADING:
+ ret[req_key]._uint32_t = (uint32_t)json_object_get_int(value);
+ break;
+
+ case naviapi::NAVICORE_SPEED:
+ ret[req_key]._int32_t = json_object_get_int(value);
+ break;
+
+ case naviapi::NAVICORE_SIMULATION_MODE:
+ ret[req_key]._bool = json_object_get_boolean(value);
+ break;
+
+ default:
+ TRACE_WARN("unknown key type.\n");
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ TRACE_WARN("element type is not object.\n");
+ break;
+ }
+ }
+ }
+ else
+ {
+ TRACE_WARN("response type is not array.\n");
+ }
+ }
+
+ json_object_put(json_obj);
+ return ret;
+}
+
+/**
+ * @brief Response analysis of navicore_getallroutes
+ * @param res_json JSON string of response
+ * @return Route handle array
+ */
+std::vector< uint32_t > JsonResponseAnalyzer::AnalyzeResponseGetAllRoutes( std::string& res_json )
+{
+ std::vector< uint32_t > routeList;
+
+ TRACE_DEBUG("AnalyzeResponseGetAllRoutes json_obj:\n%s\n", json_object_to_json_string(json_obj));
+
+ // convert to Json Object
+ struct json_object *json_obj = json_tokener_parse( res_json.c_str() );
+
+ // Check key
+ struct json_object *json_route_ary = NULL;
+ if( json_object_object_get_ex(json_obj, "response", &json_route_ary) )
+ {
+ // Check if the response is array information
+ if( json_object_is_type(json_route_ary, json_type_array) )
+ {
+ for (int i = 0; i < json_object_array_length(json_route_ary); ++i)
+ {
+ struct json_object* j_elem = json_object_array_get_idx(json_route_ary, i);
+
+ // Check that it is an element
+ struct json_object *json_route_obj = NULL;
+ if( json_object_object_get_ex(j_elem, "route", &json_route_obj) )
+ {
+ // Check if it is an int value
+ if( json_object_is_type(json_route_obj, json_type_int) )
+ {
+ uint32_t routeHandle = (uint32_t)json_object_get_int(json_route_obj);
+ routeList.push_back( routeHandle );
+ }
+ else
+ {
+ TRACE_WARN("route value is not integer.\n");
+ break;
+ }
+ }
+ else
+ {
+ TRACE_WARN("key route is not found.\n");
+ break;
+ }
+ }
+ }
+ else
+ {
+ TRACE_WARN("response type is not array.\n");
+ }
+ }
+
+ json_object_put(json_obj);
+ return routeList;
+}
+
+/**
+ * @brief Response analysis of navicore_createroute
+ * @param res_json JSON string of response
+ * @return Route handle
+ */
+uint32_t JsonResponseAnalyzer::AnalyzeResponseCreateRoute( std::string& res_json )
+{
+ uint32_t routeHandle = 0;
+
+ TRACE_DEBUG("AnalyzeResponseCreateRoute json_obj:\n%s\n", json_object_to_json_string(json_obj));
+
+ // convert to Json Object
+ struct json_object *json_obj = json_tokener_parse( res_json.c_str() );
+
+ // Check key
+ struct json_object *json_root_obj = NULL;
+ struct json_object *json_route_obj = NULL;
+ if( json_object_object_get_ex(json_obj, "response", &json_root_obj)
+ && json_object_object_get_ex(json_root_obj, "route", &json_route_obj) )
+ {
+ // Check if the response is array information
+ if( json_object_is_type(json_route_obj, json_type_int) )
+ {
+ // Get route handle
+ routeHandle = (uint32_t)json_object_get_int(json_route_obj);
+ }
+ else
+ {
+ TRACE_WARN("response type is not integer.\n");
+ }
+ }
+
+ json_object_put(json_obj);
+ return routeHandle;
+}
+
+/**
+ * @brief Response analysis of navicore_getallsessions
+ * @param res_json JSON string of response
+ * @return Map of session information
+ */
+std::map<uint32_t, std::string> JsonResponseAnalyzer::AnalyzeResponseGetAllSessions( std::string& res_json )
+{
+ std::map<uint32_t, std::string> session_map;
+
+ TRACE_DEBUG("AnalyzeResponseGetAllSessions json_obj:\n%s\n", json_object_to_json_string(json_obj));
+
+ // convert to Json Object
+ struct json_object *json_obj = json_tokener_parse( res_json.c_str() );
+
+ // Check key
+ struct json_object *json_map_ary = NULL;
+ if( json_object_object_get_ex(json_obj, "response", &json_map_ary) )
+ {
+ // Check if the response is array information
+ if( json_object_is_type(json_map_ary, json_type_array) )
+ {
+ for (int i = 0; i < json_object_array_length(json_map_ary); ++i)
+ {
+ struct json_object* j_elem = json_object_array_get_idx(json_map_ary, i);
+
+ if( json_object_is_type( j_elem, json_type_object) )
+ {
+ // Check key
+ struct json_object* handle = NULL;
+ struct json_object* client = NULL;
+ if( json_object_object_get_ex(j_elem, "sessionHandle", &handle)
+ && json_object_object_get_ex(j_elem, "client", &client) )
+ {
+ if( json_object_is_type(handle, json_type_int)
+ && json_object_is_type(client, json_type_string) )
+ {
+ uint32_t sessionHandle = (uint32_t)json_object_get_int(handle);
+ std::string clientName = std::string( json_object_get_string(client) );
+
+ // add to map
+ session_map[sessionHandle] = clientName;
+ }
+ else
+ {
+ TRACE_WARN("invalid response.\n");
+ break;
+ }
+ }
+ }
+ else
+ {
+ TRACE_WARN("element type is not object.\n");
+ break;
+ }
+ }
+ }
+ else
+ {
+ TRACE_WARN("response type is not array.\n");
+ }
+ }
+
+ json_object_put(json_obj);
+ return session_map;
+}
+
diff --git a/libnavi/src/RequestManage.cpp b/libnavi/src/RequestManage.cpp
new file mode 100644
index 0000000..7db34e1
--- /dev/null
+++ b/libnavi/src/RequestManage.cpp
@@ -0,0 +1,204 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <time.h>
+#include <unistd.h>
+#include <systemd/sd-event.h>
+#include <json-c/json.h>
+#include <traces.h>
+#include "RequestManage.h"
+
+/**
+ * @brief constructor
+ */
+RequestManage::RequestManage() : listener(nullptr)
+{
+ // Callback setting
+ this->wsj1_itf.on_hangup = RequestManage::OnHangupStatic;
+ this->wsj1_itf.on_call = RequestManage::OnCallStatic;
+ this->wsj1_itf.on_event = RequestManage::OnEventStatic;
+
+ pthread_cond_init(&this->cond, nullptr);
+ pthread_mutex_init(&this->mutex, nullptr);
+}
+
+/**
+ * @brief Destructor
+ */
+RequestManage::~RequestManage()
+{
+}
+
+void* RequestManage::BinderThread(void* param)
+{
+ RequestManage* instance = (RequestManage*) param;
+ sd_event *loop;
+
+ int rc = sd_event_default(&loop);
+ if (rc < 0) {
+ TRACE_ERROR("connection to default event loop failed: %s\n", strerror(-rc));
+ return nullptr;
+ }
+
+ instance->wsj1 = afb_ws_client_connect_wsj1(loop, instance->requestURL->c_str(), &instance->wsj1_itf, nullptr);
+ if (instance->wsj1 == nullptr)
+ {
+ TRACE_ERROR("connection to %s failed: %m\n", api_url);
+ return nullptr;
+ }
+
+ // Signal
+ pthread_mutex_unlock(&instance->mutex);
+ pthread_cond_signal(&instance->cond);
+
+ while (1)
+ {
+ sd_event_run(loop, 1000 * 1000); // 1sec
+ }
+
+ return nullptr;
+}
+
+/**
+ * @brief Connect with a service
+ * @param URL
+ * @return Success or failure of connection
+ */
+bool RequestManage::Connect(const char* api_url, RequestManageListener* listener)
+{
+ this->listener = listener;
+ this->requestURL = new std::string(api_url);
+
+ pthread_t thread_id;
+ pthread_create(&thread_id, nullptr, RequestManage::BinderThread, (void*)this);
+
+ // Wait until response comes
+ pthread_mutex_lock(&this->mutex);
+ pthread_cond_wait(&this->cond, &this->mutex);
+ pthread_mutex_unlock(&this->mutex);
+
+ if (this->wsj1 == nullptr)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * @brief Connection status check with service
+ * @return Connection status
+ */
+bool RequestManage::IsConnect(){
+ return (this->wsj1 != NULL);
+}
+
+/**
+ * @brief Call Binder's API
+ * @param api api
+ * @param verb method
+ * @param req_json Json style request
+ * @return Success or failure of processing
+ */
+bool RequestManage::CallBinderAPI(const char* api, const char* verb, const char* req_json)
+{
+ // Send request
+ int rc = afb_wsj1_call_s(this->wsj1, api, verb, req_json, RequestManage::OnReplyStatic, this);
+ if (rc < 0)
+ {
+ TRACE_ERROR("calling %s/%s(%s) failed: %m\n", api, verb, req_json);
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * @brief Set session handle
+ * @param session Session handle
+ */
+void RequestManage::SetSessionHandle( uint32_t session )
+{
+ this->sessionHandle = session;
+}
+
+/**
+ * @brief Get session handle
+ * @return Session handle
+ */
+uint32_t RequestManage::GetSessionHandle()
+{
+ return this->sessionHandle;
+}
+
+/**
+ * @brief Set route handle
+ * @param route Route handle
+ */
+void RequestManage::SetRouteHandle( uint32_t route )
+{
+ this->routeHandle = route;
+}
+
+/**
+ * @brief Get route handle
+ * @return Route handle
+ */
+uint32_t RequestManage::GetRouteHandle()
+{
+ return this->routeHandle;
+}
+
+void RequestManage::OnReply(struct afb_wsj1_msg *msg)
+{
+ struct json_object * json = afb_wsj1_msg_object_j(msg);
+
+ this->listener->OnReply(json);
+}
+
+void RequestManage::OnHangup(struct afb_wsj1 *wsj1)
+{
+}
+
+void RequestManage::OnCallStatic(const char *api, const char *verb, struct afb_wsj1_msg *msg)
+{
+}
+
+void RequestManage::OnEventStatic(const char *event, struct afb_wsj1_msg *msg)
+{
+}
+
+
+/**
+ * @brief Answer callback from service
+ */
+void RequestManage::OnReplyStatic(void *closure, struct afb_wsj1_msg *msg)
+{
+ RequestManage* instance = (RequestManage *)closure;
+ instance->OnReply(msg);
+}
+
+/**
+ * @brief Service hang notification
+ */
+void RequestManage::OnHangupStatic(void *closure, struct afb_wsj1 *wsj1)
+{
+ printf("DEBUG:%s:%d (%p,%p)\n", __func__, __LINE__, closure, wsj1);
+ fflush(stdout);
+}
+
+void RequestManage::OnCallStatic(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg)
+{
+ printf("DEBUG:%s:%d (%p,%s,%s,%p)\n", __func__, __LINE__, closure, api, verb, msg);
+ fflush(stdout);
+}
+
+void RequestManage::OnEventStatic(void *closure, const char *event, struct afb_wsj1_msg *msg)
+{
+ printf("DEBUG:%s:%d (%p,%s,%p)\n", __func__, __LINE__, closure, event, msg);
+ fflush(stdout);
+}
+
diff --git a/libnavi/src/navicore.cpp b/libnavi/src/navicore.cpp
new file mode 100644
index 0000000..5402aa8
--- /dev/null
+++ b/libnavi/src/navicore.cpp
@@ -0,0 +1,81 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include "libnavicore.hpp"
+#include "BinderClient.h"
+
+static BinderClient mBinderClient;
+
+naviapi::Navicore::Navicore()
+{
+}
+
+naviapi::Navicore::~Navicore()
+{
+}
+
+bool naviapi::Navicore::connect(int argc, char *argv[], NavicoreListener* listener)
+{
+ this->mListener = listener;
+
+ if (argc != 3)
+ {
+ printf("Error: argc != 3 : argc = %d\n", argc);
+ return false;
+ }
+
+ char url[1024];
+ sprintf(url, "ws://localhost:%d/api?token=%s", atoi(argv[1]), argv[2]);
+
+ return mBinderClient.ConnectServer(url, this->mListener);
+}
+
+void naviapi::Navicore::disconnect()
+{
+ // TODO
+}
+
+void naviapi::Navicore::getAllSessions()
+{
+ mBinderClient.NavicoreGetAllSessions();
+}
+
+void naviapi::Navicore::getPosition(std::vector<int32_t> params)
+{
+ mBinderClient.NavicoreGetPosition(params);
+}
+
+void naviapi::Navicore::getAllRoutes()
+{
+ mBinderClient.NavicoreGetAllRoutes();
+}
+
+void naviapi::Navicore::createRoute(uint32_t session)
+{
+ mBinderClient.NavicoreCreateRoute(session);
+}
+
+void naviapi::Navicore::pauseSimulation(uint32_t session)
+{
+ mBinderClient.NavicorePauseSimulation(session);
+}
+
+void naviapi::Navicore::setSimulationMode(uint32_t session, bool activate)
+{
+ mBinderClient.NavicoreSetSimulationMode(session, activate);
+}
+
+void naviapi::Navicore::cancelRouteCalculation(uint32_t session, uint32_t routeHandle)
+{
+ mBinderClient.NavicoreCancelRouteCalculation(session, routeHandle);
+}
+
+void naviapi::Navicore::setWaypoints(uint32_t session, uint32_t routeHandle, bool flag, std::vector<Waypoint> waypoints)
+{
+ mBinderClient.NavicoreSetWaypoints(session, routeHandle, flag, waypoints);
+}
+
+void naviapi::Navicore::calculateRoute(uint32_t session, uint32_t routeHandle)
+{
+ mBinderClient.NavicoreCalculateRoute(session, routeHandle);
+}
+
diff --git a/libnavi/src/navicorelistener.cpp b/libnavi/src/navicorelistener.cpp
new file mode 100644
index 0000000..2aa2b5d
--- /dev/null
+++ b/libnavi/src/navicorelistener.cpp
@@ -0,0 +1,28 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include "libnavicore.hpp"
+
+naviapi::NavicoreListener::NavicoreListener()
+{
+}
+
+naviapi::NavicoreListener::~NavicoreListener()
+{
+}
+
+void naviapi::NavicoreListener::getAllSessions_reply(const std::map< uint32_t, std::string >& allSessions)
+{
+}
+
+void naviapi::NavicoreListener::getPosition_reply(std::map< int32_t, variant > position)
+{
+}
+
+void naviapi::NavicoreListener::getAllRoutes_reply(std::vector< uint32_t > allRoutes)
+{
+}
+
+void naviapi::NavicoreListener::createRoute_reply(uint32_t routeHandle)
+{
+}
+
diff --git a/libnaviapi-agl.pc.in b/libnaviapi-agl.pc.in
new file mode 100644
index 0000000..b7dcb60
--- /dev/null
+++ b/libnaviapi-agl.pc.in
@@ -0,0 +1,14 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+includedir=@PROJECT_INCLUDEDIR@
+libdir=@PROJECT_LIBDIR@
+binding_install_dir=@binding_install_dir@
+
+Name: @PROJECT_PRETTY_NAME@
+Description: @PROJECT_DESCRIPTION@
+Version: @PROJECT_VERSION@
+URL: @PROJECT_URL@
+
+Requires: json-c libafbwsc
+Cflags: -I${includedir}
+Libs: -L${libdir} -lnaviapi-agl
diff --git a/navigation.png b/navigation.png
new file mode 100644
index 0000000..e7ad085
--- /dev/null
+++ b/navigation.png
Binary files differ
diff --git a/src/analyze_request.cpp b/src/analyze_request.cpp
new file mode 100644
index 0000000..593ed42
--- /dev/null
+++ b/src/analyze_request.cpp
@@ -0,0 +1,296 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include "genivi/genivi-navicore-constants.h"
+#include "analyze_request.h"
+#include <stdio.h>
+#include <string.h>
+#include <json-c/json.h>
+#include <string>
+
+
+/**
+ * @brief Create arguments to pass to Genivi API GetPosition.
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] Params An array of key information you want to obtain
+ * @return Success or failure of processing
+ */
+bool AnalyzeRequest::CreateParamsGetPosition( const char* req_json_str, std::vector< int32_t >& Params)
+{
+ struct json_object *req_json = json_tokener_parse(req_json_str);
+ struct json_object* jValuesToReturn = NULL;
+ if( json_object_object_get_ex(req_json, "valuesToReturn", &jValuesToReturn) )
+ {
+ if( json_object_is_type(jValuesToReturn, json_type_array) )
+ {
+ for (int i = 0; i < json_object_array_length(jValuesToReturn); ++i)
+ {
+ struct json_object* j_elem = json_object_array_get_idx(jValuesToReturn, i);
+
+ // JSON type acquisition
+ if( json_object_is_type(j_elem, json_type_int ) )
+ {
+ int32_t req_key = json_object_get_int (j_elem);
+
+ // no supported.
+ if ((NAVICORE_TIMESTAMP == req_key) || (NAVICORE_SPEED == req_key))
+ {
+ continue;
+ }
+ Params.push_back(req_key);
+ }
+ else
+ {
+ fprintf(stdout, "key is not integer type.\n");
+ return false;
+ }
+ }
+ }
+ else
+ {
+ fprintf(stdout, "request is not array type.\n");
+ return false;
+ }
+ }
+ else
+ {
+ fprintf(stdout, "key valuesToReturn not found.\n");
+ return false;
+ }
+
+ return true;
+}
+
+
+/**
+ * @brief Create arguments to pass to Genivi API CreateRoute
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] sessionHdl Session handle
+ * @return Success or failure of processing
+ */
+bool AnalyzeRequest::CreateParamsCreateRoute( const char* req_json_str, uint32_t& sessionHdl )
+{
+ // Get sessionHandle information
+ return JsonObjectGetSessionHdl(req_json_str, sessionHdl);
+}
+
+
+/**
+ * @brief Create arguments to pass to Genivi API PauseSimulation
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] sessionHdl Session handle
+ * @return Success or failure of processing
+ */
+bool AnalyzeRequest::CreateParamsPauseSimulation( const char* req_json_str, uint32_t& sessionHdl )
+{
+ // Get sessionHandle information
+ return JsonObjectGetSessionHdl(req_json_str, sessionHdl);
+}
+
+
+/**
+ * @brief Create arguments to pass to Genivi API CreateRoute
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] sessionHdl Session handle
+ * @param[out] simuMode Simulation mode
+ * @return Success or failure of processing
+ */
+bool AnalyzeRequest::CreateParamsSetSimulationMode( const char* req_json_str, uint32_t& sessionHdl, bool& simuMode )
+{
+ bool ret = false;
+ struct json_object *sess = NULL;
+ struct json_object *simu = NULL;
+
+ struct json_object *req_json = json_tokener_parse(req_json_str);
+ if ((json_object_object_get_ex(req_json, "sessionHandle", &sess)) &&
+ (json_object_object_get_ex(req_json, "simulationMode", &simu)))
+ {
+ if (json_object_is_type(sess, json_type_int) &&
+ json_object_is_type(simu, json_type_boolean))
+ {
+ sessionHdl = json_object_get_int(sess);
+ simuMode = json_object_get_int(simu);
+ ret = true;
+ }
+ else
+ {
+ fprintf(stdout, "key is invalid type.\n");
+ }
+ }
+ else
+ {
+ fprintf(stdout, "key sessionHandle or simulationMode not found.\n");
+ }
+
+ return ret;
+}
+
+
+/**
+ * @brief Create arguments to pass to Genivi API CancelRouteCalculation
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] sessionHdl Session handle
+ * @param[out] routeHdl Route handle
+ * @return Success or failure of processing
+ */
+bool AnalyzeRequest::CreateParamsCancelRouteCalculation( const char* req_json_str, uint32_t& sessionHdl, uint32_t& routeHdl )
+{
+ // Get sessionHandle, RouteHandle
+ return JsonObjectGetSessionHdlRouteHdl(req_json_str, sessionHdl, routeHdl);
+}
+
+
+/**
+ * @brief Create arguments to pass to Genivi API SetWaypoints
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] sessionHdl Session handle
+ * @param[out] routeHdl Route handle
+ * @param[out] currentPos Whether or not to draw a route from the position of the vehicle
+ * @param[out] waypointsList Destination coordinates
+ * @return Success or failure of processing
+ */
+bool AnalyzeRequest::CreateParamsSetWaypoints( const char* req_json_str, uint32_t& sessionHdl, uint32_t& routeHdl,
+ bool& currentPos, std::vector<Waypoint>& waypointsList )
+{
+ bool ret = false;
+ struct json_object *sess = NULL;
+ struct json_object *rou = NULL;
+ struct json_object *current = NULL;
+ struct json_object *wpl = NULL;
+
+ struct json_object *req_json = json_tokener_parse(req_json_str);
+ if ((json_object_object_get_ex(req_json, "sessionHandle", &sess)) &&
+ (json_object_object_get_ex(req_json, "route", &rou)) &&
+ (json_object_object_get_ex(req_json, "startFromCurrentPosition", &current)) &&
+ (json_object_object_get_ex(req_json, "", &wpl)))
+ {
+ if (json_object_is_type(sess, json_type_int) &&
+ json_object_is_type(rou, json_type_int) &&
+ json_object_is_type(current, json_type_boolean) &&
+ json_object_is_type(wpl, json_type_array))
+ {
+ sessionHdl = json_object_get_int(sess);
+ routeHdl = json_object_get_int(rou);
+ currentPos = json_object_get_boolean(current);
+
+ // Get latitude, longitude
+ for (int i = 0; i < json_object_array_length(wpl); ++i)
+ {
+ struct json_object *array = json_object_array_get_idx(wpl, i);
+ struct json_object *lati = NULL;
+ struct json_object *longi = NULL;
+
+ if (json_object_object_get_ex(array, "latitude", &lati) &&
+ json_object_object_get_ex(array, "longitude", &longi)) {
+
+ double latitude = json_object_get_double(lati);
+ double longitude = json_object_get_double(longi);
+ Waypoint destWp(latitude, longitude);
+ waypointsList.push_back(destWp);
+ ret = true;
+ }
+ else
+ {
+ fprintf(stdout, "key latitude or longitude not found.\n");
+ }
+ }
+ }
+ else
+ {
+ fprintf(stdout, "key is invalid type.\n");
+ }
+ }
+ else
+ {
+ fprintf(stdout, "key valuesToReturn not found.\n");
+ }
+
+ return ret;
+}
+
+
+/**
+ * @brief Create arguments to pass to Genivi API CalculateRoute
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] sessionHdl Session handle
+ * @param[out] routeHdl Route handle
+ * @return Success or failure of processing
+ */
+bool AnalyzeRequest::CreateParamsCalculateRoute( const char* req_json_str, uint32_t& sessionHdl, uint32_t& routeHdl )
+{
+ // Get sessionHandle, RouteHandle
+ return JsonObjectGetSessionHdlRouteHdl(req_json_str, sessionHdl, routeHdl);
+}
+
+
+/**
+ * @brief Get session handle and route handle information from JSON
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] Session handle value
+ * @return Success or failure of processing
+ */
+
+bool AnalyzeRequest::JsonObjectGetSessionHdl( const char* req_json_str, uint32_t& sessionHdl)
+{
+ bool ret = false;
+ struct json_object *sess = NULL;
+
+ struct json_object *req_json = json_tokener_parse(req_json_str);
+ if (json_object_object_get_ex(req_json, "sessionHandle", &sess))
+ {
+ if (json_object_is_type(sess, json_type_int))
+ {
+ sessionHdl = json_object_get_int(sess);
+ ret = true;
+ }
+ else
+ {
+ fprintf(stdout, "key is not integer type.\n");
+ }
+ }
+ else
+ {
+ fprintf(stdout, "key sessionHandle not found.\n");
+ }
+
+ return ret;
+}
+
+
+/**
+ * @brief Get session handle and route handle information from JSON
+ * @param[in] req_json_str JSON request from BinderClient
+ * @param[out] Session handle value
+ * @param[out] Route handle value
+ * @return Success or failure of processing
+ */
+
+bool AnalyzeRequest::JsonObjectGetSessionHdlRouteHdl( const char* req_json_str, uint32_t& sessionHdl, uint32_t& routeHdl)
+{
+ bool ret = false;
+ struct json_object *sess = NULL;
+ struct json_object *rou = NULL;
+
+ struct json_object *req_json = json_tokener_parse(req_json_str);
+ if ((json_object_object_get_ex(req_json, "sessionHandle", &sess)) &&
+ (json_object_object_get_ex(req_json, "route", &rou)))
+ {
+ if (json_object_is_type(sess, json_type_int) &&
+ json_object_is_type(rou, json_type_int))
+ {
+ sessionHdl = json_object_get_int(sess);
+ routeHdl = json_object_get_int(rou);
+ ret = true;
+ }
+ else
+ {
+ fprintf(stdout, "key is not integer type.\n");
+ }
+ }
+ else
+ {
+ fprintf(stdout, "key sessionHandle or route not found.\n");
+ }
+
+ return ret;
+}
diff --git a/src/api.cpp b/src/api.cpp
new file mode 100644
index 0000000..bf04453
--- /dev/null
+++ b/src/api.cpp
@@ -0,0 +1,419 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include <string.h>
+
+#include "binder_reply.h"
+#include "genivi_request.h"
+#include "analyze_request.h"
+#include "genivi/genivi-navicore-constants.h"
+
+#define AFB_BINDING_VERSION 2
+
+extern "C" {
+ #include <afb/afb-binding.h>
+}
+
+/**
+ * Variable declaration
+ */
+GeniviRequest* geniviRequest; // Send request to Genivi
+BinderReply* binderReply; // Convert Genivi response result to json format
+AnalyzeRequest* analyzeRequest; // Analyze BinderClient's request and create arguments to pass to GeniviAPI
+
+/**
+ * @brief navicore_getposition request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicoreGetPosition(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s()", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_getposition");
+
+ // Request of Json format request
+ json_object* req_json = afb_req_json(req);
+ const char* req_json_str = json_object_to_json_string(req_json);
+ AFB_REQ_NOTICE(req, "req_json_str = %s", req_json_str);
+
+ // Request analysis and create arguments to pass to Genivi
+ std::vector< int32_t > Params;
+ if( !analyzeRequest->CreateParamsGetPosition( req_json_str, Params ))
+ {
+ afb_req_fail(req, "failed", "navicore_getposition Bad Request");
+ return;
+ }
+
+ // GENIVI API call
+ std::map< int32_t, double > posList = geniviRequest->NavicoreGetPosition( Params );
+
+ // Convert to json style response
+ APIResponse response = binderReply->ReplyNavicoreGetPosition( posList );
+
+ // On success
+ if(response.isSuccess)
+ {
+ AFB_REQ_NOTICE(req, "res_json_str = %s", json_object_to_json_string(response.json_data));
+ // Return success to BinderClient
+ afb_req_success(req, response.json_data, "navicore_getposition");
+ }
+ else
+ {
+ AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__);
+ afb_req_fail(req, "failed", "navicore_getposition Bad Request");
+ }
+
+ // Json object release
+ json_object_put(response.json_data);
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief navicore_getallroutes request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicoreGetAllRoutes(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s()", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_getallroutes");
+
+ // No request information in json format
+ AFB_REQ_NOTICE(req, "req_json_str = none");
+
+ // GENEVI API call
+ std::vector< uint32_t > allRoutes = geniviRequest->NavicoreGetAllRoutes();
+
+ // Convert to json style response
+ APIResponse response = binderReply->ReplyNavicoreGetAllRoutes( allRoutes );
+
+ // On success
+ if(response.isSuccess)
+ {
+ AFB_REQ_NOTICE(req, "res_json_str = %s", json_object_to_json_string(response.json_data));
+ // Return success to BinderClient
+ afb_req_success(req, response.json_data, "navicore_getallroutes");
+ }
+ else
+ {
+ AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__);
+ afb_req_fail(req, "failed", "navicore_getallroutes Bad Request");
+ }
+
+ // json object release
+ json_object_put(response.json_data);
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief navicore_createroute request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicoreCreateRoute(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s ", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_createroute");
+
+ // Request of json format request
+ json_object* req_json = afb_req_json(req);
+ const char* req_json_str = json_object_to_json_string(req_json);
+ AFB_REQ_NOTICE(req, "req_json_str = %s", req_json_str);
+
+ // Request analysis and create arguments to pass to Genivi
+ uint32_t sessionHdl = 0;
+ if( !analyzeRequest->CreateParamsCreateRoute( req_json_str, sessionHdl ))
+ {
+ afb_req_fail(req, "failed", "navicore_createroute Bad Request");
+ return;
+ }
+
+ // GENEVI API call
+ uint32_t routeHdl = geniviRequest->NavicoreCreateRoute( sessionHdl );
+
+ // Convert to json style response
+ APIResponse response = binderReply->ReplyNavicoreCreateRoute( routeHdl );
+
+ // On success
+ if(response.isSuccess)
+ {
+ AFB_REQ_NOTICE(req, "res_json_str = %s", json_object_to_json_string(response.json_data));
+ // Return success to BinderClient
+ afb_req_success(req, response.json_data, "navicore_createroute");
+ }
+ else
+ {
+ AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__);
+ afb_req_fail(req, "failed", "navicore_createroute Bad Request");
+ }
+
+ // json object release
+ json_object_put(response.json_data);
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief navicore_pausesimulation request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicorePauseSimulation(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s()", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_pausesimulation");
+
+ // Request of json format request
+ json_object* req_json = afb_req_json(req);
+ const char* req_json_str = json_object_to_json_string(req_json);
+ AFB_REQ_NOTICE(req, "req_json_str = %s", req_json_str);
+
+ // Request analysis and create arguments to pass to Genivi
+ uint32_t sessionHdl = 0;
+ if( !analyzeRequest->CreateParamsPauseSimulation( req_json_str, sessionHdl ))
+ {
+ afb_req_fail(req, "failed", "navicore_pausesimulation Bad Request");
+ return;
+ }
+
+ // GENEVI API call
+ geniviRequest->NavicorePauseSimulation( sessionHdl );
+
+ // No reply unnecessary API for conversion to json format response is unnecessary
+ AFB_REQ_NOTICE(req, "res_json_str = none");
+
+ // Return success to BinderClient
+ afb_req_success(req, NULL, "navicore_pausesimulation");
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief navicore_setsimulationmode request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicoreSetSimulationMode(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s()", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_setsimulationmode");
+
+ // Request of json format request
+ json_object* req_json = afb_req_json(req);
+ const char* req_json_str = json_object_to_json_string(req_json);
+ AFB_REQ_NOTICE(req, "req_json_str = %s", req_json_str);
+
+ // Request analysis and create arguments to pass to Genivi
+ uint32_t sessionHdl = 0;
+ bool simuMode = false;
+ if( !analyzeRequest->CreateParamsSetSimulationMode( req_json_str, sessionHdl, simuMode ))
+ {
+ afb_req_fail(req, "failed", "navicore_setsimulationmode Bad Request");
+ return;
+ }
+
+ // GENEVI API call
+ geniviRequest->NavicoreSetSimulationMode( sessionHdl, simuMode );
+
+ // No reply unnecessary API for conversion to json format response is unnecessary
+ AFB_REQ_NOTICE(req, "res_json_str = none");
+
+ // Return success to BinderClient
+ afb_req_success(req, NULL, "navicore_setsimulationmode");
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief navicore_cancelroutecalculation request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicoreCancelRouteCalculation(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s()", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_cancelroutecalculation");
+
+ // Request of Json format request
+ json_object* req_json = afb_req_json(req);
+ const char* req_json_str = json_object_to_json_string(req_json);
+ AFB_REQ_NOTICE(req, "req_json_str = %s", req_json_str);
+
+ // Request analysis and create arguments to pass to Genivi
+ uint32_t sessionHdl = 0;
+ uint32_t routeHdl = 0;
+ if( !analyzeRequest->CreateParamsCancelRouteCalculation( req_json_str, sessionHdl, routeHdl ))
+ {
+ afb_req_fail(req, "failed", "navicore_cancelroutecalculation Bad Request");
+ return;
+ }
+
+ // GENEVI API call
+ geniviRequest->NavicoreCancelRouteCalculation( sessionHdl, routeHdl );
+
+ // No reply unnecessary API for conversion to json format response is unnecessary
+ AFB_REQ_NOTICE(req, "res_json_str = none");
+
+ // Return success to BinderClient
+ afb_req_success(req, NULL, "navicore_cancelroutecalculation");
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief navicore_setwaypoints request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicoreWaypoints(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s()", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_setwaypoints");
+
+ // Request of Json format request
+ json_object* req_json = afb_req_json(req);
+ const char* req_json_str = json_object_to_json_string(req_json);
+ AFB_REQ_NOTICE(req, "req_json_str = %s", req_json_str);
+
+ // Request analysis and create arguments to pass to Genivi
+ uint32_t sessionHdl = 0;
+ uint32_t routeHdl = 0;
+ bool currentPos = false;
+ std::vector<Waypoint> waypointsList;
+ if( !analyzeRequest->CreateParamsSetWaypoints( req_json_str, sessionHdl, routeHdl, currentPos, waypointsList ))
+ {
+ afb_req_fail(req, "failed", "navicore_setwaypoints Bad Request");
+ return;
+ }
+
+ // GENEVI API call
+ geniviRequest->NavicoreSetWaypoints( sessionHdl, routeHdl, currentPos, waypointsList );
+
+ // No reply unnecessary API for conversion to json format response is unnecessary
+ AFB_REQ_NOTICE(req, "res_json_str = none");
+
+ // Return success to BinderClient
+ afb_req_success(req, NULL, "navicore_setwaypoints");
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief navicore_calculateroute request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicoreCalculateRoute(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s()", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_calculateroute");
+
+ // Request of Json format request
+ json_object* req_json = afb_req_json(req);
+ const char* req_json_str = json_object_to_json_string(req_json);
+ AFB_REQ_NOTICE(req, "req_json_str = %s", req_json_str);
+
+ // Request analysis and create arguments to pass to Genivi
+ uint32_t sessionHdl = 0;
+ uint32_t routeHdl = 0;
+ if( !analyzeRequest->CreateParamsCalculateRoute( req_json_str, sessionHdl, routeHdl ))
+ {
+ afb_req_fail(req, "failed", "navicore_calculateroute Bad Request");
+ return;
+ }
+
+ // GENEVI API call
+ geniviRequest->NavicoreCalculateRoute( sessionHdl, routeHdl );
+
+ // No reply unnecessary API for conversion to json format response is unnecessary
+ AFB_REQ_NOTICE(req, "res_json_str = none");
+
+ // Return success to BinderClient
+ afb_req_success(req, NULL, "navicore_calculateroute");
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief navicore_getallsessions request callback
+ * @param[in] req Request from client
+ */
+void OnRequestNavicoreGetAllSessions(afb_req req)
+{
+ AFB_REQ_NOTICE(req, "--> Start %s()", __func__);
+ AFB_REQ_DEBUG(req, "request navicore_getallsessions");
+
+ // No request information in Json format
+ AFB_REQ_NOTICE(req, "req_json_str = none");
+
+ // GENEVI API call
+ std::map<uint32_t, std::string> allSessions = geniviRequest->NavicoreGetAllSessions();
+
+ // Convert to json style response
+ APIResponse response = binderReply->ReplyNavicoreGetAllSessions( allSessions );
+
+ // On success
+ if(response.isSuccess)
+ {
+ AFB_REQ_NOTICE(req, "res_json_str = %s", json_object_to_json_string(response.json_data));
+ // Return success to BinderClient
+ afb_req_success(req, response.json_data, "navicore_getallsessions");
+ }
+ else
+ {
+ AFB_REQ_ERROR(req, "%s - %s:%d", response.errMessage.c_str(), __FILE__, __LINE__);
+ afb_req_fail(req, "failed", "navicore_getallsessions Bad Request");
+ }
+
+ // json object release
+ json_object_put(response.json_data);
+
+ AFB_REQ_NOTICE(req, "<-- End %s()", __func__);
+}
+
+
+/**
+ * @brief Callback called at service startup
+ */
+int Init()
+{
+ // Create instance
+ geniviRequest = new GeniviRequest();
+ binderReply = new BinderReply();
+ analyzeRequest = new AnalyzeRequest();
+
+ return 0;
+}
+
+/**
+ * @brief API definition
+ */
+const afb_verb_v2 verbs[] =
+{
+ { verb : "navicore_getposition", callback : OnRequestNavicoreGetPosition },
+ { verb : "navicore_getallroutes", callback : OnRequestNavicoreGetAllRoutes },
+ { verb : "navicore_createroute", callback : OnRequestNavicoreCreateRoute },
+ { verb : "navicore_pausesimulation", callback : OnRequestNavicorePauseSimulation },
+ { verb : "navicore_setsimulationmode", callback : OnRequestNavicoreSetSimulationMode },
+ { verb : "navicore_cancelroutecalculation", callback : OnRequestNavicoreCancelRouteCalculation },
+ { verb : "navicore_setwaypoints", callback : OnRequestNavicoreWaypoints },
+ { verb : "navicore_calculateroute", callback : OnRequestNavicoreCalculateRoute },
+ { verb : "navicore_getallsessions", callback : OnRequestNavicoreGetAllSessions },
+ { verb : NULL }
+};
+
+/**
+ * @brief Service definition
+ */
+const afb_binding_v2 afbBindingV2 =
+{
+ "naviapi",
+ "",
+ "",
+ verbs,
+ NULL,
+ Init
+};
+
diff --git a/src/binder_reply.cpp b/src/binder_reply.cpp
new file mode 100644
index 0000000..172a22a
--- /dev/null
+++ b/src/binder_reply.cpp
@@ -0,0 +1,168 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include "binder_reply.h"
+#include "genivi/genivi-navicore-constants.h"
+
+/**
+ * @brief GeniviAPI GetPosition call
+ * @param[in] posList Map information on key and value of information acquired from Genivi
+ * @return Response information
+ */
+APIResponse BinderReply::ReplyNavicoreGetPosition( std::map<int32_t, double>& posList )
+{
+ APIResponse response = {0};
+
+ // Json information to return as a response
+ struct json_object* response_json = json_object_new_array();
+ std::map<int32_t, double>::iterator it;
+
+ // If the argument map is empty return
+ if(posList.empty())
+ {
+ response.isSuccess = false;
+ response.errMessage = "posList is empty";
+ response.json_data = response_json;
+ return response;
+ }
+
+ // Make the passed Genivi response json format
+ for (it = posList.begin(); it != posList.end(); it++)
+ {
+ struct json_object* obj = json_object_new_object();
+
+ switch(it->first)
+ {
+ case NAVICORE_LATITUDE:
+ json_object_object_add(obj, "key", json_object_new_int(NAVICORE_LATITUDE));
+ json_object_object_add(obj, "value", json_object_new_double(it->second) );
+ json_object_array_add(response_json, obj);
+ break;
+
+ case NAVICORE_LONGITUDE:
+ json_object_object_add(obj, "key", json_object_new_int(NAVICORE_LONGITUDE));
+ json_object_object_add(obj, "value", json_object_new_double(it->second));
+ json_object_array_add(response_json, obj);
+ break;
+
+ case NAVICORE_HEADING:
+ json_object_object_add(obj, "key", json_object_new_int(NAVICORE_HEADING));
+ json_object_object_add(obj, "value", json_object_new_boolean (it->second));
+ json_object_array_add(response_json, obj);
+ break;
+#if 0
+ // no support
+ case NAVICORE_TIMESTAMP:
+ json_object_object_add(obj, "key", json_object_new_int(NAVICORE_TIMESTAMP));
+ json_object_object_add(obj, "value", json_object_new_int(it->second));
+ json_object_array_add(response_json, obj);
+ break;
+
+ // no support
+ case NAVICORE_SPEED:
+ json_object_object_add(obj, "key", json_object_new_int(NAVICORE_SPEED));
+ json_object_object_add(obj, "value", json_object_new_int(it->second));
+ json_object_array_add(response_json, obj);
+ break;
+#endif
+
+ case NAVICORE_SIMULATION_MODE:
+ json_object_object_add(obj, "key", json_object_new_int(NAVICORE_SIMULATION_MODE));
+ json_object_object_add(obj, "value", json_object_new_boolean (it->second));
+ json_object_array_add(response_json, obj);
+ break;
+
+ default:
+ fprintf(stderr, "Unknown key.");
+ json_object_put(obj);
+ break;
+ }
+ }
+
+ response.json_data = response_json;
+ response.isSuccess = true;
+ return response;
+}
+
+/**
+ * @brief GeniviAPI GetAllRoutes call
+ * @param[in] allRoutes Route handle information
+ * @return Response information
+ */
+APIResponse BinderReply::ReplyNavicoreGetAllRoutes( std::vector< uint32_t > &allRoutes )
+{
+ APIResponse response = {0};
+
+ // Json information to return as a response
+ struct json_object* response_json = json_object_new_array();
+
+ if (0 < allRoutes.size())
+ {
+ std::vector< uint32_t >::iterator it;
+
+ for (it = allRoutes.begin(); it != allRoutes.end(); it++)
+ {
+ struct json_object* obj = json_object_new_object();
+ json_object_object_add(obj, "route", json_object_new_int(*it));
+ json_object_array_add(response_json, obj);
+ }
+ }
+
+ response.json_data = response_json;
+ response.isSuccess = true;
+ return response;
+}
+
+/**
+ * @brief GeniviAPI CreateRoute call
+ * @param[in] route Route handle
+ * @return Response information
+ */
+APIResponse BinderReply::ReplyNavicoreCreateRoute( uint32_t route )
+{
+ APIResponse response;
+
+ // Json information to return as a response
+ struct json_object* response_json = json_object_new_object();
+ json_object_object_add(response_json, "route", json_object_new_int(route));
+
+ response.json_data = response_json;
+ response.isSuccess = true;
+ return response;
+}
+
+/**
+ * @brief GeniviAPI GetAllSessions call
+ * @param[in] allSessions Map information on key and value of information acquired from Genivi
+ * @return Response information
+ */
+APIResponse BinderReply::ReplyNavicoreGetAllSessions( std::map<uint32_t, std::string> &allSessions )
+{
+ APIResponse response = {0};
+
+ // Json information to return as a response
+ struct json_object* response_json = json_object_new_array();
+ std::map<uint32_t, std::string>::iterator it;
+
+ for (it = allSessions.begin(); it != allSessions.end(); it++)
+ {
+ struct json_object* obj = json_object_new_object();
+
+ if (NAVICORE_INVALID != it->first)
+ {
+ json_object_object_add(obj, "sessionHandle", json_object_new_int(it->first));
+ json_object_object_add(obj, "client", json_object_new_string(it->second.c_str()));
+ json_object_array_add(response_json, obj);
+ }
+ else
+ {
+ fprintf(stderr, "invalid key.");
+ json_object_put(obj);
+ }
+ }
+
+ response.json_data = response_json;
+ response.isSuccess = true;
+ return response;
+}
+
diff --git a/src/genivi_request.cpp b/src/genivi_request.cpp
new file mode 100644
index 0000000..a485667
--- /dev/null
+++ b/src/genivi_request.cpp
@@ -0,0 +1,350 @@
+// Copyright 2017 AW SOFTWARE CO.,LTD
+// Copyright 2017 AISIN AW CO.,LTD
+
+#include "genivi/navicore.h"
+#include "genivi/genivi-navicore-constants.h"
+#include "genivi_request.h"
+#include <stdio.h>
+#include <exception>
+#include <dbus-c++-1/dbus-c++/dbus.h>
+
+/**
+ * @brief Destructor
+ */
+GeniviRequest::~GeniviRequest()
+{
+ delete (Navicore*)navicore_;
+ navicore_ = NULL;
+}
+
+/**
+ * @brief DBus session creation
+ */
+void GeniviRequest::CreateDBusSession( )
+{
+ try
+ {
+ static DBus::BusDispatcher dispatcher;
+ DBus::default_dispatcher = &dispatcher;
+ DBus::Connection conn = DBus::Connection::SessionBus();
+
+ navicore_ = new Navicore(conn, "/org/genivi/navicore", "org.agl.naviapi");
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+}
+
+/**
+ * @brief Check connection status
+ * @return Presence / absence of connection
+ */
+bool GeniviRequest::CheckSession()
+{
+ if(this->navicore_ == NULL)
+ {
+ this->CreateDBusSession();
+ }
+
+ try
+ {
+ // Get connection status
+ DBus::Connection conn = ((Navicore*)navicore_)->conn();
+ bool isConnect = conn.connected();
+
+ // If it is not connected, it issues an error
+ if(!isConnect)
+ {
+ fprintf(stderr, "Service has no session.\n");
+ }
+
+ return isConnect;
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ return false;
+ }
+}
+
+/**
+ * @brief Call GeniviAPI GetPosition to get information
+ * @param[in] valuesToReturn Key arrangement of information acquired from Genivi
+ * @return Map information on key and value of information acquired from Genivi
+ */
+std::map< int32_t, double > GeniviRequest::NavicoreGetPosition( const std::vector< int32_t >& valuesToReturn )
+{
+ std::map< int32_t, double > ret;
+
+ if( !CheckSession() )
+ {
+ return ret;
+ }
+
+ try
+ {
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > >::iterator it;
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > PosList =
+ ((Navicore*)navicore_)->GetPosition(valuesToReturn);
+ for (it = PosList.begin(); it != PosList.end(); it++)
+ {
+ if (it->first == NAVICORE_LATITUDE || it->second._1 == NAVICORE_LATITUDE)
+ {
+ ret[it->first] = it->second._2.reader().get_double();
+ }
+ else if (it->first == NAVICORE_LONGITUDE || it->second._1 == NAVICORE_LONGITUDE)
+ {
+ ret[it->first] = it->second._2.reader().get_double();
+ }
+ else if (it->first == NAVICORE_HEADING || it->second._1 == NAVICORE_HEADING)
+ {
+ ret[it->first] = it->second._2.reader().get_uint32();
+ }
+#if 0 // no supported
+ else if (it->first == NAVICORE_TIMESTAMP || it->second._1 == NAVICORE_TIMESTAMP)
+ {
+ ret[it->first] = it->second._2.reader().get_uint32();
+ }
+ else if (it->first == NAVICORE_SPEED || it->second._1 == NAVICORE_SPEED)
+ {
+ ret[it->first] = it->second._2.reader().get_int32();
+ }
+#endif
+ else if (it->first == NAVICORE_SIMULATION_MODE || it->second._1 == NAVICORE_SIMULATION_MODE)
+ {
+ ret[it->first] = it->second._2.reader().get_bool();
+ }
+ }
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+
+ return ret;
+}
+
+/**
+ * @brief Call GeniviAPI GetPosition to get information
+ * @return Route handle acquired from Genivi
+ */
+std::vector< uint32_t > GeniviRequest::NavicoreGetAllRoutes( void )
+{
+ if( !CheckSession() )
+ {
+ std::vector< uint32_t > no_route;
+ return no_route;
+ }
+
+ std::vector< uint32_t > allRoutes;
+ try
+ {
+ allRoutes = ((Navicore*)navicore_)->GetAllRoutes();
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+
+ return allRoutes;
+}
+
+
+/**
+ * @brief Call GeniviAPI GetPosition to get information
+ * @param[in] sessionHandle Session handle
+ * @return Route handle acquired from Genivi
+ */
+uint32_t GeniviRequest::NavicoreCreateRoute( const uint32_t& sessionHandle )
+{
+ if( !CheckSession() )
+ {
+ return 0;
+ }
+
+ uint32_t routeHandle = 0;
+ try
+ {
+ routeHandle = ((Navicore*)navicore_)->CreateRoute(sessionHandle);
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+
+ return routeHandle;
+}
+
+/**
+ * @brief Call GeniviAPI PauseSimulation
+ * @param[in] sessionHandle Session handle
+ */
+void GeniviRequest::NavicorePauseSimulation( const uint32_t& sessionHandle )
+{
+ if( !CheckSession() )
+ {
+ return;
+ }
+
+ try
+ {
+ ((Navicore*)navicore_)->PauseSimulation(sessionHandle);
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+}
+
+
+/**
+ * @brief Call GeniviAPI SetSimulationMode
+ * @param[in] sessionHandle Session handle
+ * @param[in] activate Simulation mode enabled / disabled
+ */
+void GeniviRequest::NavicoreSetSimulationMode( const uint32_t& sessionHandle, const bool& activate )
+{
+ if( !CheckSession() )
+ {
+ return;
+ }
+
+ try
+ {
+ ((Navicore*)navicore_)->SetSimulationMode(sessionHandle, activate);
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+}
+
+
+/**
+ * @brief Call GeniviAPI SetSimulationMode
+ * @param[in] sessionHandle Session handle
+ * @param[in] routeHandle Route handle
+ */
+void GeniviRequest::NavicoreCancelRouteCalculation( const uint32_t& sessionHandle, const uint32_t& routeHandle )
+{
+ if( !CheckSession() )
+ {
+ return;
+ }
+
+ try
+ {
+ ((Navicore*)navicore_)->CancelRouteCalculation(sessionHandle, routeHandle);
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+}
+
+/**
+ * @brief Call GeniviAPI SetWaypoints
+ * @param[in] sessionHandle Session handle
+ * @param[in] routeHandle Route handle
+ * @param[in] startFromCurrentPosition Whether or not to draw a route from the position of the vehicle
+ * @param[in] waypointsList Destination coordinates
+ */
+void GeniviRequest::NavicoreSetWaypoints( const uint32_t& sessionHandle, const uint32_t& routeHandle,
+ const bool& startFromCurrentPosition, const std::vector<Waypoint>& waypointsList )
+{
+ if( !CheckSession() )
+ {
+ return;
+ }
+
+ std::vector<Waypoint>::const_iterator it;
+ std::vector< std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > > wpl;
+
+ fprintf(stdout, "session: %d, route: %d, startFromCurrentPosition: %d\n",
+ sessionHandle, routeHandle, startFromCurrentPosition);
+
+ for (it = waypointsList.begin(); it != waypointsList.end(); it++)
+ {
+ std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > Point;
+ ::DBus::Struct< uint8_t, ::DBus::Variant > VarLat, VarLon;
+
+ VarLat._1 = NAVICORE_LATITUDE;
+ VarLat._2.writer().append_double(std::get<0>(*it));
+ fprintf(stdout, "VarLat._1 : %x, VarLat._2 : %lf\n", VarLat._1, VarLat._2.reader().get_double());
+
+ VarLon._1 = NAVICORE_LONGITUDE;
+ VarLon._2.writer().append_double(std::get<1>(*it));
+ fprintf(stdout, "VarLon._1 : %x, VarLon._2 : %lf\n", VarLon._1, VarLon._2.reader().get_double());
+
+ Point[NAVICORE_LATITUDE] = VarLat;
+ Point[NAVICORE_LONGITUDE] = VarLon;
+
+ wpl.push_back(Point);
+ }
+
+ try
+ {
+ ((Navicore*)navicore_)->SetWaypoints(sessionHandle, routeHandle, startFromCurrentPosition, wpl);
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+}
+
+/**
+ * @brief Call GeniviAPI CalculateRoute
+ * @param[in] sessionHandle Session handle
+ * @param[in] routeHandle Route handle
+ */
+void GeniviRequest::NavicoreCalculateRoute( const uint32_t& sessionHandle, const uint32_t& routeHandle )
+{
+ if( !CheckSession() )
+ {
+ return;
+ }
+
+ try
+ {
+ ((Navicore*)navicore_)->CalculateRoute(sessionHandle, routeHandle);
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+}
+
+
+/**
+ * @brief Call GeniviAPI CalculateRoute
+ * @return Map information on key and value of information acquired from Genivi
+ */
+std::map<uint32_t, std::string> GeniviRequest::NavicoreGetAllSessions()
+{
+ std::map<uint32_t, std::string> ret;
+
+ if( !CheckSession() )
+ {
+ return ret;
+ }
+
+ std::vector< ::DBus::Struct< uint32_t, std::string > > ncAllSessions;
+ std::vector< ::DBus::Struct< uint32_t, std::string > >::iterator it;
+
+ try
+ {
+ ncAllSessions = ((Navicore*)navicore_)->GetAllSessions();
+ for (it = ncAllSessions.begin(); it != ncAllSessions.end(); it++)
+ {
+ ret[it->_1] = it->_2;
+ }
+ }
+ catch(const std::exception& e)
+ {
+ fprintf(stderr, "Error:%s\n", e.what());
+ }
+
+ return ret;
+}
+
diff --git a/src/traces.h b/src/traces.h
new file mode 100644
index 0000000..a1f96ec
--- /dev/null
+++ b/src/traces.h
@@ -0,0 +1,38 @@
+// Copyright 2017 AISIN AW CO.,LTD
+
+#ifndef __TRACE_H__
+#define __TRACE_H__
+
+#include <stdio.h>
+
+#define BLACK "\033[30m"
+#define RED "\033[31m"
+#define GREEN "\033[32m"
+#define YELLOW "\033[33m"
+#define BLUE "\033[34m"
+#define PURPLE "\033[35m"
+#define DGREEN "\033[6m"
+#define WHITE "\033[7m"
+#define CYAN "\x1b[36m"
+#define NONE "\033[0m"
+
+#ifdef NDEBUG
+
+#define TRACE_DEBUG_JSON(fmt, args...)
+#define TRACE_DEBUG(fmt, args...)
+#define TRACE_INFO(fmt, args...)
+#define TRACE_WARN(fmt, args...)
+#define TRACE_ERROR(fmt, args...)
+
+#else
+
+#define TRACE_DEBUG(fmt, args...) do { fprintf(stderr, "[%s:%d] " CYAN "DEBUG" NONE ": " fmt "\n", __func__, __LINE__, ##args); } while(0)
+#define TRACE_INFO(fmt, args...) do { fprintf(stderr, "[%s:%d] " GREEN "INFO" NONE ": " fmt "\n", __func__, __LINE__, ##args); } while(0)
+#define TRACE_WARN(fmt, args...) do { fprintf(stderr, "[%s:%d] " YELLOW "WARN" NONE": " fmt "\n", __func__, __LINE__, ##args); } while(0)
+#define TRACE_ERROR(fmt, args...) do { fprintf(stderr, "[%s:%d] " RED "ERROR" NONE ": " fmt "\n", __func__, __LINE__, ##args); } while(0)
+
+#define TRACE_DEBUG_JSON(fmt, args...)
+
+#endif
+
+#endif // __TRACE_H__