summaryrefslogtreecommitdiff
path: root/test/poi-service
diff options
context:
space:
mode:
authorasanoaozora <fifitaneki@hotmail.com>2016-10-31 16:10:42 +0100
committerasanoaozora <fifitaneki@hotmail.com>2016-10-31 16:10:42 +0100
commit8f226312ea99856ce35cf2d8a1ba49ada995f507 (patch)
tree055fa5f8a225f8a29e499b0b3b801be0d0848359 /test/poi-service
parent1399a1bf18d317e7622e0ce52d1415a3f9efb826 (diff)
downloadpoi-service-8f226312ea99856ce35cf2d8a1ba49ada995f507.tar.gz
POI POC updated to CommonAPI 3.1.9
Diffstat (limited to 'test/poi-service')
-rw-r--r--test/poi-service/poi-manager-client/CMakeLists.txt8
-rw-r--r--test/poi-service/poi-manager-client/README.md13
-rw-r--r--test/poi-service/poi-manager-client/commonapi-dbus.ini9
-rw-r--r--test/poi-service/poi-manager-client/commonapi4dbus.ini4
-rw-r--r--test/poi-service/poi-manager-client/main.cpp87
-rwxr-xr-xtest/poi-service/test-poi-capi.py30
6 files changed, 76 insertions, 75 deletions
diff --git a/test/poi-service/poi-manager-client/CMakeLists.txt b/test/poi-service/poi-manager-client/CMakeLists.txt
index 4ca7451..c06f869 100644
--- a/test/poi-service/poi-manager-client/CMakeLists.txt
+++ b/test/poi-service/poi-manager-client/CMakeLists.txt
@@ -43,12 +43,12 @@ endif()
# Packages
find_package(PkgConfig REQUIRED)
-find_package(CommonAPI 3.1.5 REQUIRED)
-find_package(CommonAPI-DBus 3.1.5 REQUIRED)
+find_package(CommonAPI)
+find_package(CommonAPI-DBus)
#pkg_check_modules(DBUS "dbus-1 >= 1.8.4") // #to be fixed, it doesn't work so the paths are set manually (see above)
-pkg_check_modules(COMMONAPI "CommonAPI >= 3.1.5")
-pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 3.1.5")
+pkg_check_modules(COMMONAPI "CommonAPI >= 3.1.9")
+pkg_check_modules(COMMONAPI_DBUS "CommonAPI-DBus >= 3.1.9")
pkg_check_modules(SQLITE3 REQUIRED sqlite3)
pkg_check_modules(GOBJECT gobject-2.0)
diff --git a/test/poi-service/poi-manager-client/README.md b/test/poi-service/poi-manager-client/README.md
index 7380743..3990040 100644
--- a/test/poi-service/poi-manager-client/README.md
+++ b/test/poi-service/poi-manager-client/README.md
@@ -9,9 +9,18 @@ NB: The server part is located under ../../src/poi-manager-service
Desktop: Tested under Ubuntu 16.04 LTS 64 bits
## Prerequisites
-You need CommonAPI 3.1.5 and Franca 0.9.1 installed
+You need CommonAPI 3.1.9 and Franca 0.9.1 installed
For the Ubuntu 64 bits, due to the use of symbol versioning LIBDBUS_1_0 by CommonAPI-DBus, the patched version of DBus has to be >= 1.10.0
-NB: the patch common-api-dbus-runtime/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch failed a little bit, it's needed to update the dbus/dbus-string.h manually
+NB: In case you migrate from 3.1.5 to 3.1.9, due to a cmake issue (wrong management of micro version), it's necessary to do:
+```
+sudo mv /usr/local/lib/cmake/CommonAPI-3.1.5 /usr/local/lib/cmake/oldCommonAPI-3.1.5
+```
+Symbolic links are also not well managed, so you need to fix it:
+```
+sudo ln -sfn /usr/local/lib/libCommonAPI.so.3.1.9 /usr/local/lib/libCommonAPI.so.3
+sudo ln -sfn /usr/local/lib/libCommonAPI-DBus.so.3.1.9 /usr/local/lib/libCommonAPI-DBus.so.3
+```
+NB: the patch common-api-dbus-runtime/src/dbus-patches/capi-dbus-add-support-for-custom-marshalling.patch may fail a little bit, in that case it's needed to update the dbus/dbus-string.h manually
## How to build
First it's required to set some paths:
diff --git a/test/poi-service/poi-manager-client/commonapi-dbus.ini b/test/poi-service/poi-manager-client/commonapi-dbus.ini
deleted file mode 100644
index 087c481..0000000
--- a/test/poi-service/poi-manager-client/commonapi-dbus.ini
+++ /dev/null
@@ -1,9 +0,0 @@
-[local:org.genivi.navigation.poiservice.POIContentAccessModule:POIContentAccessModuleService]
-service=org.genivi.navigation.poiservice
-path=/org/genivi/navigation/poiservice/POIContentAccessModule
-interface=org.genivi.navigation.poiservice.POIContentAccessModule
-[local:org.genivi.navigation.poiservice.POIContentAccess:POIContentAccessService]
-service=org.genivi.navigation.poiservice
-path=/org/genivi/navigation/poiservice/POIContentAccess
-interface=org.genivi.navigation.poiservice.POIContentAccess
-
diff --git a/test/poi-service/poi-manager-client/commonapi4dbus.ini b/test/poi-service/poi-manager-client/commonapi4dbus.ini
deleted file mode 100644
index 1e5b30b..0000000
--- a/test/poi-service/poi-manager-client/commonapi4dbus.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[default]
-binding=dbus
-
-
diff --git a/test/poi-service/poi-manager-client/main.cpp b/test/poi-service/poi-manager-client/main.cpp
index 2b54576..8f15d48 100644
--- a/test/poi-service/poi-manager-client/main.cpp
+++ b/test/poi-service/poi-manager-client/main.cpp
@@ -64,7 +64,7 @@ public:
void getServerStatus();
- void ConfigurationChanged(const std::vector< uint16_t >& changedSettings);
+ void ConfigurationChanged(const std::vector<POIServiceTypes::Settings> &changedSettings);
void CategoriesRemoved(const std::vector< CommonTypes::CategoryID >& categories);
@@ -236,7 +236,7 @@ void contentManager::getServerStatus()
}
-void contentManager::ConfigurationChanged(const std::vector< uint16_t >& changedSettings)
+void contentManager::ConfigurationChanged(const std::vector< POIServiceTypes::Settings >& changedSettings)
{
size_t index;
@@ -487,12 +487,12 @@ void populateWindow(GtkWidget *window,contentManager *clientContentManager)
GtkWidget *button;
GtkWidget *box;
- gtk_window_set_title (GTK_WINDOW (window), "Poi Manager Client");
+ gtk_window_set_title(GTK_WINDOW (window), "Poi Manager Client");
g_signal_connect (window, "delete-event",
G_CALLBACK (deleteWindow), NULL);
- gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+ gtk_container_set_border_width(GTK_CONTAINER (window), 10);
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
@@ -503,51 +503,51 @@ void populateWindow(GtkWidget *window,contentManager *clientContentManager)
g_signal_connect (button, "clicked",
G_CALLBACK (onCreateCategory), clientContentManager);
- gtk_box_pack_start (GTK_BOX(box), button, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
+ gtk_widget_show(button);
- button = gtk_button_new_with_label ("Delete category");
+ button = gtk_button_new_with_label("Delete category");
- g_signal_connect (button, "clicked",
- G_CALLBACK (onDeleteCategory), clientContentManager);
+ g_signal_connect(button, "clicked",
+ G_CALLBACK(onDeleteCategory), clientContentManager);
- gtk_box_pack_start(GTK_BOX (box), button, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
+ gtk_widget_show(button);
- gtk_widget_show (box);
+ gtk_widget_show(box);
- button = gtk_button_new_with_label ("Create POI");
+ button = gtk_button_new_with_label("Create POI");
- g_signal_connect (button, "clicked",
- G_CALLBACK (onCreatePoi), clientContentManager);
+ g_signal_connect(button, "clicked",
+ G_CALLBACK(onCreatePoi), clientContentManager);
- gtk_box_pack_start (GTK_BOX(box), button, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
+ gtk_widget_show(button);
- button = gtk_button_new_with_label ("Delete POI");
+ button = gtk_button_new_with_label("Delete POI");
- g_signal_connect (button, "clicked",
- G_CALLBACK (onDeletePoi), clientContentManager);
+ g_signal_connect(button, "clicked",
+ G_CALLBACK(onDeletePoi), clientContentManager);
- gtk_box_pack_start(GTK_BOX (box), button, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
+ gtk_widget_show(button);
- button = gtk_button_new_with_label ("Search");
+ button = gtk_button_new_with_label("Search");
- g_signal_connect (button, "clicked",
- G_CALLBACK (onSearch), clientContentManager);
+ g_signal_connect(button, "clicked",
+ G_CALLBACK(onSearch), clientContentManager);
- gtk_box_pack_start (GTK_BOX(box), button, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
- gtk_widget_show (button);
+ gtk_widget_show(button);
- gtk_widget_show (box);
+ gtk_widget_show(box);
- gtk_widget_show (window);
+ gtk_widget_show(window);
}
/**
@@ -560,12 +560,12 @@ void populateWindow(GtkWidget *window,contentManager *clientContentManager)
*/
void print_usage (FILE* stream, int exit_code)
{
- fprintf (stream, "Use: %s options [database]\n",program_name);
- fprintf (stream,
+ fprintf(stream, "Use: %s options [database]\n",program_name);
+ fprintf(stream,
" -h --help Display this message.\n"
" -f --file database Open the database.\n"
" -t --test Test.\n");
- exit (exit_code);
+ exit(exit_code);
}
/**
@@ -613,12 +613,12 @@ int main(int argc , char** argv )
program_name = argv[0];
do {
- next_option = getopt_long (argc, argv, short_options,
+ next_option = getopt_long(argc, argv, short_options,
long_options, NULL);
- switch (next_option)
+ switch(next_option)
{
case 'h': /* -h --help */
- print_usage (stdout, 0);
+ print_usage(stdout, 0);
break;
case 't': /* -t --test */
@@ -626,10 +626,10 @@ int main(int argc , char** argv )
clientContentManager = new contentManager(myProxy);
// Create the interface panel
- gtk_init (&argc, &argv);
+ gtk_init(&argc, &argv);
// Create a new window
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// Connect the client to the popup window (for feedback on signals)
clientContentManager->connectPopupWindow(window);
@@ -641,7 +641,7 @@ int main(int argc , char** argv )
myProxy->getCategoriesRemovedEvent().subscribe([&](const std::vector<CommonTypes::CategoryID>& categories) {
clientContentManager->CategoriesRemoved(categories);
});
- myProxy->getConfigurationChangedEvent().subscribe([&](const std::vector< uint16_t >& changedSettings) {
+ myProxy->getConfigurationChangedEvent().subscribe([&](const std::vector< POIServiceTypes::Settings >& changedSettings) {
clientContentManager->ConfigurationChanged(changedSettings);
});
myProxy->getPOIAddedEvent().subscribe([&](const std::vector< POIServiceTypes::POI_ID >& pois) {
@@ -663,11 +663,13 @@ int main(int argc , char** argv )
// loop listening
gtk_main();
+ delete clientContentManager;
+
break;
case 'f': /* -f --file database*/
database_filename = argv[2];
if (!is_readable(database_filename))
- print_usage (stderr, 1);
+ print_usage(stderr, 1);
else
{
// Manage the database content
@@ -675,15 +677,18 @@ int main(int argc , char** argv )
}
break;
case '?': /* Invalid option. */
- print_usage (stderr, 1);
+ print_usage(stderr, 1);
break;
case -1: /* End of options. */
break;
default: /* Error */
- print_usage (stderr, 1);
+ print_usage(stderr, 1);
}
}
while (next_option != -1);
+ myProxy.reset();
+ runtime.reset();
+
return EXIT_SUCCESS;
}
diff --git a/test/poi-service/test-poi-capi.py b/test/poi-service/test-poi-capi.py
index 68e696f..2732468 100755
--- a/test/poi-service/test-poi-capi.py
+++ b/test/poi-service/test-poi-capi.py
@@ -30,12 +30,12 @@ import gobject
import dbus.mainloop.glib
import time
-import pdb;
+#import pdb;
#pdb.set_trace()
#constants as defined in the Navigation API
GENIVI_Configuration_Settings_LOCALE = 37
-GENIVI_SearchStatusState_FINISHED = 1298
-GENIVI_SearchStatusState_NOT_STARTED = 1296
+GENIVI_SearchStatusState_FINISHED = 512
+GENIVI_SearchStatusState_NOT_STARTED = 510
#constants used into the script
TIME_OUT = 10000
@@ -98,25 +98,25 @@ print("Search for hotel and station with keyword: "+ STRING_TO_SEARCH)
bus = dbus.SessionBus()
bus.add_signal_receiver(catch_poi_configurationChanged_signal_handler, \
- dbus_interface = "org.genivi.navigation.poiservice.POIConfiguration", \
+ dbus_interface = "org.genivi.navigation.poiservice.POIConfiguration.v4_0", \
signal_name = "configurationChanged")
bus.add_signal_receiver(catch_poi_poiStatus_signal_handler, \
- dbus_interface = "org.genivi.navigation.poiservice.POISearch", \
+ dbus_interface = "org.genivi.navigation.poiservice.POISearch.v4_0", \
signal_name = "poiStatus")
bus.add_signal_receiver(catch_poi_resultListChanged_signal_handler, \
- dbus_interface = "org.genivi.navigation.poiservice.POISearch", \
+ dbus_interface = "org.genivi.navigation.poiservice.POISearch.v4_0", \
signal_name = "resultListChanged")
-poiConfiguration = bus.get_object('org.genivi.navigation.poiservice.POIConfiguration_POIConfiguration','/POIConfiguration')
-g_poiConfiguration_interface = dbus.Interface(poiConfiguration, dbus_interface='org.genivi.navigation.poiservice.POIConfiguration')
+poiConfiguration = bus.get_object('org.genivi.navigation.poiservice.POIConfiguration.v4_0_POIConfiguration','/POIConfiguration')
+g_poiConfiguration_interface = dbus.Interface(poiConfiguration, dbus_interface='org.genivi.navigation.poiservice.POIConfiguration.v4_0')
-poiContentAccess = bus.get_object('org.genivi.navigation.poiservice.POIContentAccess_POIContentAccess','/POIContentAccess')
-g_poiContentAccess_interface = dbus.Interface(poiContentAccess, dbus_interface='org.genivi.navigation.poiservice.POIContentAccess')
+poiContentAccess = bus.get_object('org.genivi.navigation.poiservice.POIContentAccess.v4_0_POIContentAccess','/POIContentAccess')
+g_poiContentAccess_interface = dbus.Interface(poiContentAccess, dbus_interface='org.genivi.navigation.poiservice.POIContentAccess.v4_0')
-poiSearch = bus.get_object('org.genivi.navigation.poiservice.POISearch_POISearch','/POISearch')
-g_poiSearch_interface = dbus.Interface(poiSearch, dbus_interface='org.genivi.navigation.poiservice.POISearch')
+poiSearch = bus.get_object('org.genivi.navigation.poiservice.POISearch.v4_0_POISearch','/POISearch')
+g_poiSearch_interface = dbus.Interface(poiSearch, dbus_interface='org.genivi.navigation.poiservice.POISearch.v4_0')
g_poiConfiguration_interface.setLocale(dbus.String("fra"),dbus.String("FRA"),dbus.String("Latn"))
@@ -136,11 +136,11 @@ for results in ret:
if results[0][0] == ID_HOTEL:
for attribute in results[1]:
attributes_hotel.append(attribute[0])
- attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_HOTEL),dbus.Int32(1280),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(1314),dbus.Boolean(False)]))
+ attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_HOTEL),dbus.Int32(500),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(522),dbus.Boolean(False)]))
elif results[0][0] == ID_STATION:
for attribute in results[1]:
attributes_station.append(attribute[0])
- attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_STATION),dbus.Int32(1280),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(1314),dbus.Boolean(False)]))
+ attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_STATION),dbus.Int32(500),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(522),dbus.Boolean(False)]))
ret=g_poiSearch_interface.getRootCategory()
@@ -157,7 +157,7 @@ g_poiSearch_interface.setCategories(g_searchHandle,[dbus.Struct([dbus.UInt32(ID_
g_poiSearch_interface.setAttributes(g_searchHandle,attributesDetails)
-g_poiSearch_interface.startPoiSearch(g_searchHandle,dbus.String(STRING_TO_SEARCH),dbus.Int32(1376))
+g_poiSearch_interface.startPoiSearch(g_searchHandle,dbus.String(STRING_TO_SEARCH),dbus.Int32(560))
#main loop