summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorasanoaozora <fifitaneki@hotmail.com>2017-07-04 17:46:17 +0200
committerasanoaozora <fifitaneki@hotmail.com>2017-07-04 17:46:17 +0200
commitafa5a4f857628684d39de2618894f423dd1af5c2 (patch)
tree82f0443623bca944c8ee87412d7a9779637da302
parent4c3e24b04f8ff1e41a94f1c1dd181ae3412c3db9 (diff)
downloadpoi-service-afa5a4f857628684d39de2618894f423dd1af5c2.tar.gz
add DLT to several plugins, allow case insensitive search
-rw-r--r--src/navigation/navigation-core/guidance-plugin/CMakeLists.txt7
-rw-r--r--src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx47
-rw-r--r--src/navigation/navigation-core/locationinput-plugin/genivi_navigationcore_locationinput.cxx48
-rw-r--r--src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx31
-rw-r--r--src/navigation/navigation-core/routing-plugin/genivi_navigationcore_routing.cxx59
-rw-r--r--src/navigation/poi-cam/genivi_poiservice_cam_navit.cxx46
-rw-r--r--src/poi-service/poi-server/main.cpp10
-rwxr-xr-xsrc/speech/test-speech-capi.py12
-rwxr-xr-xtest/navigation/script/test-guidance.py11
-rwxr-xr-xtest/navigation/script/test-poi.py2
-rw-r--r--test/poi-service/script/create-scheme.sql6
11 files changed, 143 insertions, 136 deletions
diff --git a/src/navigation/navigation-core/guidance-plugin/CMakeLists.txt b/src/navigation/navigation-core/guidance-plugin/CMakeLists.txt
index 144cff6..deb8951 100644
--- a/src/navigation/navigation-core/guidance-plugin/CMakeLists.txt
+++ b/src/navigation/navigation-core/guidance-plugin/CMakeLists.txt
@@ -35,13 +35,6 @@ if(WITH_SPEECH)
include_directories(${DBUS_GENERATED_INCLUDE_DIR}/speech-service)
endif()
-if(WITH_DLT)
- pkg_check_modules(DLT REQUIRED automotive-dlt)
- add_definitions("-DDLT_ENABLED=1")
- include_directories( ${DLT_INCLUDE_DIRS} )
- set(LIBRARIES ${LIBRARIES} ${DLT_LIBRARIES})
-endif()
-
include_directories(${DBUS_GENERATED_INCLUDE_DIR}/navigation-core)
set(genivi_navigationcore_guidance_LIBS ${PLUGIN_LDFLAGS})
diff --git a/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx b/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx
index b4e60a0..94eb39a 100644
--- a/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx
+++ b/src/navigation/navigation-core/guidance-plugin/genivi_navigationcore_guidance.cxx
@@ -52,16 +52,15 @@
#include "navigation-common-dbus.h"
+#include "log.h"
+
+DLT_DECLARE_CONTEXT(gCtx);
+
#if (!DEBUG_ENABLED)
#undef dbg
#define dbg(level,...) ;
#endif
-#if (DLT_ENABLED)
-#include "dlt.h"
-DLT_DECLARE_CONTEXT(con_test)
-#endif
-
static DBus::Glib::BusDispatcher dispatcher;
static DBus::Connection *conn;
@@ -249,15 +248,9 @@ class Guidance
dbg(lvl_debug,"guidance already active\n");
throw DBus::ErrorFailed("guidance already active");
} else {
-#if (DLT_ENABLED)
- DLT_REGISTER_APP("GUID","Navigation core guidance");
- DLT_REGISTER_CONTEXT(con_test,"TEST","Navigation context for testing");
-#endif
s_guidance=new GuidanceObj(this, SessionHandle, RouteHandle);
m_guidance_active=true;
-#if (DLT_ENABLED)
- DLT_LOG(con_test,DLT_LOG_INFO,DLT_STRING("guidance active: "),DLT_BOOL(m_guidance_active));
-#endif
+ LOG_INFO_MSG(gCtx,"Guidance started");
}
}
@@ -271,11 +264,7 @@ class Guidance
} else {
delete(s_guidance);
m_guidance_active=false;
-#if (DLT_ENABLED)
- DLT_LOG(con_test,DLT_LOG_INFO,DLT_STRING("guidance active: "),DLT_BOOL(m_guidance_active));
- DLT_UNREGISTER_CONTEXT(con_test);
- DLT_UNREGISTER_APP();
-#endif
+ LOG_INFO_MSG(gCtx,"Guidance stopped");
}
}
@@ -780,6 +769,7 @@ GuidanceObj_Callback(GuidanceObj *obj)
return;
mr=obj->get_map_rect();
if (!mr) {
+ LOG_ERROR_MSG(gCtx,"Failed to get map rect");
dbg(lvl_debug,"failed to get map rect\n");
return;
}
@@ -804,13 +794,9 @@ GuidanceObj_Callback(GuidanceObj *obj)
maneuver=GENIVI_NAVIGATIONCORE_INVALID;
}
obj->m_guidance->ManeuverChanged(maneuver);
-#if (DLT_ENABLED)
- DLT_LOG(con_test,DLT_LOG_INFO,DLT_STRING("maneuver: "),DLT_INT16(maneuver));
-#endif
+ LOG_INFO(gCtx,"Maneuver: %d",maneuver);
} else {
-#if (DLT_ENABLED)
- DLT_LOG(con_test,DLT_LOG_ERROR,DLT_STRING("item not found"));
-#endif
+ LOG_ERROR(gCtx,"Maneuver item not found: %p",item);
dbg(lvl_debug,"failed to get level item=%p\n",item);
}
}
@@ -856,9 +842,7 @@ GuidanceObj::get_map_rect(void)
{
struct map *map=navigation_get_map(get_navigation());
if (!map) {
-#if (DLT_ENABLED)
- DLT_LOG(con_test,DLT_LOG_ERROR,DLT_STRING("map_rect null"));
-#endif
+ LOG_ERROR_MSG(gCtx,"map_rect null");
return NULL;
}
return map_rect_new(map, NULL);
@@ -907,9 +891,7 @@ GuidanceObj::GuidanceObj(Guidance *guidance, uint32_t SessionHandle, uint32_t Ro
g_free(ret);
}
m_guidance->GuidanceStatusChanged(GENIVI_NAVIGATIONCORE_ACTIVE, RouteHandle);
-#if (DLT_ENABLED)
- DLT_LOG(con_test,DLT_LOG_INFO,DLT_STRING("guidance status: "),DLT_INT16(GENIVI_NAVIGATIONCORE_ACTIVE));
-#endif
+ LOG_INFO_MSG(gCtx,"Guidance status changed to active");
}
GuidanceObj::~GuidanceObj()
@@ -928,9 +910,7 @@ GuidanceObj::~GuidanceObj()
#if (SPEECH_ENABLED)
delete(m_speechoutput);
#endif
-#if (DLT_ENABLED)
- DLT_LOG(con_test,DLT_LOG_INFO,DLT_STRING("guidance status: "),DLT_INT16(GENIVI_NAVIGATIONCORE_INACTIVE));
-#endif
+ LOG_INFO_MSG(gCtx,"Guidance status changed to inactive");
}
@@ -939,6 +919,9 @@ static class Guidance *s_server;
void
plugin_init(void)
{
+ DLT_REGISTER_APP("GUIDS","GUIDANCE SERVER");
+ DLT_REGISTER_CONTEXT(gCtx,"GUIDS","Global Context");
+
dispatcher.attach(NULL);
DBus::default_dispatcher = &dispatcher;
// FIXME: What dbus address to use?
diff --git a/src/navigation/navigation-core/locationinput-plugin/genivi_navigationcore_locationinput.cxx b/src/navigation/navigation-core/locationinput-plugin/genivi_navigationcore_locationinput.cxx
index 0a098e0..7cdfa95 100644
--- a/src/navigation/navigation-core/locationinput-plugin/genivi_navigationcore_locationinput.cxx
+++ b/src/navigation/navigation-core/locationinput-plugin/genivi_navigationcore_locationinput.cxx
@@ -43,10 +43,9 @@
#include "navigation-common-dbus.h"
-#if (!DEBUG_ENABLED)
-#undef dbg
-#define dbg(level,...) ;
-#endif
+#include "log.h"
+
+DLT_DECLARE_CONTEXT(gCtx);
static DBus::Glib::BusDispatcher dispatcher;
static DBus::Connection *conn;
@@ -102,7 +101,7 @@ class LocationInput
void CreateLocationInput(const uint32_t& sessionHandle, int32_t& error, uint32_t& locationInputHandle)
{
- dbg(lvl_debug,"enter\n");
+ LOG_INFO_MSG(gCtx,"Creation location input");
locationInputHandle=1;
while (handles[locationInputHandle]) {
locationInputHandle++;
@@ -115,8 +114,8 @@ class LocationInput
int32_t DeleteLocationInput(const uint32_t& SessionHandle, const uint32_t& LocationInputHandle)
{
- dbg(lvl_debug,"enter\n");
- LocationInputObj *obj=handles[LocationInputHandle];
+ LOG_INFO_MSG(gCtx,"Delete location input");
+ LocationInputObj *obj=handles[LocationInputHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("location handle invalid");
delete(obj);
@@ -138,7 +137,7 @@ class LocationInput
void SetAddress(const uint32_t& sessionHandle, const uint32_t& locationInputHandle, const std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > >& address)
{
- dbg(lvl_debug,"enter\n");
+ LOG_INFO_MSG(gCtx,"Set address");
LocationInputObj *obj=handles[locationInputHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("location handle invalid");
@@ -147,7 +146,7 @@ class LocationInput
void SetSelectionCriterion(const uint32_t& sessionHandle, const uint32_t& locationInputHandle, const int32_t& selectionCriterion)
{
- dbg(lvl_debug,"enter\n");
+ LOG_INFO_MSG(gCtx,"Set selection criterion");
LocationInputObj *obj=handles[locationInputHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("location handle invalid");
@@ -156,8 +155,8 @@ class LocationInput
void Search(const uint32_t& SessionHandle, const uint32_t& LocationInputHandle, const std::string& InputString, const uint16_t& MaxWindowSize)
{
- dbg(lvl_debug,"enter\n");
- LocationInputObj *obj=handles[LocationInputHandle];
+ LOG_INFO_MSG(gCtx,"Search");
+ LocationInputObj *obj=handles[LocationInputHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("location handle invalid");
obj->Search(SessionHandle, InputString, MaxWindowSize);
@@ -165,8 +164,8 @@ class LocationInput
void SelectEntry(const uint32_t& SessionHandle, const uint32_t& LocationInputHandle, const uint16_t& Index)
{
- dbg(lvl_debug,"enter\n");
- LocationInputObj *obj=handles[LocationInputHandle];
+ LOG_INFO_MSG(gCtx,"Select entry");
+ LocationInputObj *obj=handles[LocationInputHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("location handle invalid");
obj->SelectEntry(SessionHandle, Index);
@@ -295,14 +294,13 @@ LocationInputObj::Spell(uint32_t SessionHandle, const std::string& InputCharacte
char *newstr;
const char *input=InputCharacter.c_str();
int len=strlen(input)+1;
- dbg(lvl_debug,"input '%s' (%d)\n",input,strlen(input));
+ LOG_DEBUG(gCtx,"Input '%s' (%d)",input,strlen(input));
if (m_search.u.str && strlen(m_search.u.str)) {
const char *i=input;
char c;
newstr=g_strdup(m_search.u.str);
- dbg(lvl_debug,"string %s\n",newstr);
+ LOG_DEBUG(gCtx,"String %s",newstr);
while ((c=*i++)) {
- dbg(lvl_debug,"char '%c'\n",c);
if (c == '\b') {
m_spell_backspace=true;
*g_utf8_prev_char(newstr+strlen(newstr))='\0';
@@ -312,7 +310,6 @@ LocationInputObj::Spell(uint32_t SessionHandle, const std::string& InputCharacte
newstr[len]=c;
newstr[len+1]='\0';
}
- dbg(lvl_debug,"string now %s\n",newstr);
}
} else {
if (strcmp(input,"\b"))
@@ -321,12 +318,12 @@ LocationInputObj::Spell(uint32_t SessionHandle, const std::string& InputCharacte
newstr=NULL;
}
g_free(m_search.u.str);
- dbg(lvl_debug,"search string '%s' (%d)\n",newstr,strlen(newstr));
+ LOG_DEBUG(gCtx,"Search string '%s' (%d)",newstr,strlen(newstr));
m_search.u.str=newstr;
m_windowsize=MaxWindowSize;
search_list_search(m_sl, &m_search, 1);
- dbg(lvl_debug,"backspace %d\n",m_spell_backspace);
+ LOG_DEBUG(gCtx,"backspace %d",m_spell_backspace);
m_event=event_add_idle(0, m_callback);
}
@@ -418,8 +415,8 @@ variant_double(double d)
void
LocationInputObj::Idle(void)
{
- dbg(lvl_debug,"enter\n");
- m_locationinput->SearchStatus(m_handle, GENIVI_NAVIGATIONCORE_SEARCHING);
+ LOG_INFO_MSG(gCtx,"Idle callback");
+ m_locationinput->SearchStatus(m_handle, GENIVI_NAVIGATIONCORE_SEARCHING);
struct search_list_result *res;
int chunk=0;
uint16_t count=0,offset=0;
@@ -428,22 +425,18 @@ LocationInputObj::Idle(void)
while ((res=search_list_get_result(m_sl))) {
std::map< int32_t, DBusCommonAPIVariant> entry;
if (res->country && res->country->name) {
- dbg(lvl_debug,"country %s\n",res->country->name);
entry[GENIVI_NAVIGATIONCORE_COUNTRY]._1 = 0;
entry[GENIVI_NAVIGATIONCORE_COUNTRY]._2=variant_string(std::string(res->country->name));
}
if (res->town && res->town->common.town_name) {
- dbg(lvl_debug,"town %s\n",res->town->common.town_name);
entry[GENIVI_NAVIGATIONCORE_CITY]._1 = 0;
entry[GENIVI_NAVIGATIONCORE_CITY]._2=variant_string(std::string(res->town->common.town_name));
}
if (res->street && res->street->name) {
- dbg(lvl_debug,"street %s\n",res->street->name);
entry[GENIVI_NAVIGATIONCORE_STREET]._1 = 0;
entry[GENIVI_NAVIGATIONCORE_STREET]._2=variant_string(std::string(res->street->name));
}
if (res->house_number && res->house_number->house_number) {
- dbg(lvl_debug,"house number %s\n",res->house_number->house_number);
entry[GENIVI_NAVIGATIONCORE_HOUSENUMBER]._1 = 0;
entry[GENIVI_NAVIGATIONCORE_HOUSENUMBER]._2=variant_string(std::string(res->house_number->house_number));
}
@@ -537,7 +530,10 @@ static class LocationInput *server;
void
plugin_init(void)
{
- dispatcher.attach(NULL);
+ DLT_REGISTER_APP("LOIS","LOCATION INPUT SERVER");
+ DLT_REGISTER_CONTEXT(gCtx,"LOIS","Global Context");
+
+ dispatcher.attach(NULL);
DBus::default_dispatcher = &dispatcher;
conn = new DBus::Connection(DBus::Connection::SessionBus());
conn->setup(&dispatcher);
diff --git a/src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx b/src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx
index 88e19a1..5b6f782 100644
--- a/src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx
+++ b/src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx
@@ -46,10 +46,9 @@
#include "navigation-common-dbus.h"
-#if (!DEBUG_ENABLED)
-#undef dbg
-#define dbg(level,...) ;
-#endif
+#include "log.h"
+
+DLT_DECLARE_CONTEXT(gCtx);
static DBus::Glib::BusDispatcher dispatcher;
static DBus::Connection *conn;
@@ -143,21 +142,10 @@ class MapMatchedPosition
return Version;
}
-#if 0
- void
- GetSupportedPositionInfo(std::vector< int32_t >& PositionInfo, uint32_t& Result)
- {
- PositionInfo.push_back(GENIVI_NAVIGATIONCORE_LATITUDE);
- PositionInfo.push_back(GENIVI_NAVIGATIONCORE_LONGITUDE);
- PositionInfo.push_back(GENIVI_NAVIGATIONCORE_SPEED);
- PositionInfo.push_back(GENIVI_NAVIGATIONCORE_HEADING);
- }
-#endif
-
void
GetPosition(const std::vector< int32_t >& valuesToReturn, int32_t& error, std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > >& position)
{
- dbg(lvl_debug,"enter\n");
+ LOG_INFO_MSG(gCtx,"Get position");
struct attr attr;
for (int i = 0 ; i < valuesToReturn.size() ; i++) {
switch (valuesToReturn[i]) {
@@ -262,7 +250,7 @@ class MapMatchedPosition
void
SetSimulationMode(const uint32_t& SessionHandle, const bool& Activate)
{
- dbg(lvl_debug,"enter Activate=%d\n",Activate);
+ LOG_INFO_MSG(gCtx,"Activate simulation mode");
uint16_t newSimulationMode;
struct attr vehicle;
vehicle.type=attr_vehicle;
@@ -277,7 +265,7 @@ class MapMatchedPosition
struct navit *navit=get_navit();
navit_set_attr(navit, &vehicle);
} else {
- dbg(lvl_debug,"Failed to get vehicle\n");
+ LOG_ERROR_MSG(gCtx,"Failed to get vehicle");
}
}
@@ -306,7 +294,7 @@ static void
tracking_attr_position_coord_geo(void)
{
struct attr position_coord_geo, current_item;
- dbg(lvl_debug,"enter\n");
+ LOG_INFO_MSG(gCtx,"Position updated");
if (tracking_get_attr(tracking, attr_position_coord_geo, &position_coord_geo, NULL)) {
std::vector< int32_t >changes;
changes.push_back(GENIVI_NAVIGATIONCORE_LATITUDE);
@@ -365,7 +353,10 @@ config_attr_navit(struct navit *navit, int add)
void
plugin_init(void)
{
- dispatcher.attach(NULL);
+ DLT_REGISTER_APP("MMPS","MAP MATCHED POSITION SERVER");
+ DLT_REGISTER_CONTEXT(gCtx,"MMPS","Global Context");
+
+ dispatcher.attach(NULL);
DBus::default_dispatcher = &dispatcher;
conn = new DBus::Connection(DBus::Connection::SessionBus());
conn->setup(&dispatcher);
diff --git a/src/navigation/navigation-core/routing-plugin/genivi_navigationcore_routing.cxx b/src/navigation/navigation-core/routing-plugin/genivi_navigationcore_routing.cxx
index a987ef8..390f6a7 100644
--- a/src/navigation/navigation-core/routing-plugin/genivi_navigationcore_routing.cxx
+++ b/src/navigation/navigation-core/routing-plugin/genivi_navigationcore_routing.cxx
@@ -50,6 +50,10 @@
#include "navigation-common-dbus.h"
+#include "log.h"
+
+DLT_DECLARE_CONTEXT(gCtx);
+
#if (!DEBUG_ENABLED)
#undef dbg
#define dbg(level,...) ;
@@ -142,7 +146,7 @@ class Routing
void
CreateRoute(const uint32_t& sessionHandle, int32_t& error, uint32_t& routeHandle)
{
- dbg(lvl_debug,"enter\n");
+ LOG_INFO_MSG(gCtx,"Create route");
routeHandle=1;
while (handles[routeHandle]) {
routeHandle++;
@@ -156,7 +160,8 @@ class Routing
int32_t
DeleteRoute(const uint32_t& SessionHandle, const uint32_t& RouteHandle)
{
- RoutingObj *obj=handles[RouteHandle];
+ LOG_INFO_MSG(gCtx,"Delete route");
+ RoutingObj *obj=handles[RouteHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("Route handle invalid");
delete(obj);
@@ -179,7 +184,6 @@ class Routing
GetCostModel(const uint32_t& RouteHandle)
{
uint16_t CostModel;
- dbg(lvl_debug,"enter\n");
RoutingObj *obj=handles[RouteHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("Route handle invalid");
@@ -200,7 +204,6 @@ class Routing
int32_t
SetWaypoints(const uint32_t& SessionHandle , const uint32_t& RouteHandle , const bool& StartFromCurrentPosition , const std::vector< std::map< DBusCommonAPIEnumeration, DBusCommonAPIVariant > >& Waypoints)
{
- dbg(lvl_debug,"enter\n");
RoutingObj *obj=handles[RouteHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("Route handle invalid");
@@ -221,7 +224,6 @@ class Routing
int32_t
CalculateRoute(const uint32_t& SessionHandle , const uint32_t& RouteHandle )
{
- dbg(lvl_debug,"enter\n");
RoutingObj *obj=handles[RouteHandle];
if (!obj)
throw DBus::ErrorInvalidArgs("Route handle invalid");
@@ -504,10 +506,12 @@ void
RoutingObj::SetWaypoints(uint32_t SessionHandle, bool StartFromCurrentPosition, std::vector< std::map< DBusCommonAPIEnumeration, DBusCommonAPIVariant > > Waypoints)
{
if (StartFromCurrentPosition) {
- if (Waypoints.size() != 1)
+ LOG_INFO_MSG(gCtx,"Start from current position");
+ if (Waypoints.size() != 1)
throw DBus::ErrorFailed("StartFromCurrentPosition is set, but Waypoint size is not 1");
} else {
- if (Waypoints.size() != 2)
+ LOG_INFO_MSG(gCtx,"Start from given position");
+ if (Waypoints.size() != 2)
throw DBus::ErrorFailed("StartFromCurrentPosition is not set, but Waypoint size is not 2");
}
for (int i=0 ; i < Waypoints.size(); i++) {
@@ -540,8 +544,7 @@ RoutingObj::map_to_pcoord(std::map< DBusCommonAPIEnumeration, DBusCommonAPIVaria
pc->pro=projection_mg;
pc->x=c.x;
pc->y=c.y;
- dbg(lvl_debug,"lat %f lon %f is 0x%x,0x%x\n",g.lat,g.lng,pc->x,pc->y);
-
+ LOG_DEBUG(gCtx,"Lat %f Lon %f is 0x%x,0x%x",g.lat,g.lng,pc->x,pc->y);
}
void
@@ -550,18 +553,24 @@ RoutingObj::CalculateRoute(uint32_t SessionHandle)
struct pcoord pc;
if (!m_waypoints.size())
- throw DBus::ErrorFailed("no waipoints set");
+ throw DBus::ErrorFailed("no waypoints set");
route_set_profile(m_route.u.route,m_vehicleprofile.u.vehicleprofile);
if (!m_startfromcurrentposition) {
+ LOG_INFO_MSG(gCtx,"Calculate route from A:");
route_set_destination(m_route.u.route, NULL, 0);
map_to_pcoord(m_waypoints[0], &pc);
- route_set_position(m_route.u.route, &pc);
+ LOG_INFO_MSG(gCtx,"To B:");
+ route_set_position(m_route.u.route, &pc);
map_to_pcoord(m_waypoints[1], &pc);
} else {
struct tracking *tracking=get_tracking();
- if (tracking)
- route_set_position_from_tracking(m_route.u.route, tracking, projection_mg);
- map_to_pcoord(m_waypoints[0], &pc);
+ LOG_INFO_MSG(gCtx,"Calculate route from current position");
+ if (tracking){
+ LOG_INFO_MSG(gCtx,"Tracking active");
+ route_set_position_from_tracking(m_route.u.route, tracking, projection_mg);
+ }
+ LOG_INFO_MSG(gCtx,"To B:");
+ map_to_pcoord(m_waypoints[0], &pc);
}
m_route_status = route_status_destination_set;
route_set_destination(m_route.u.route, &pc, 1);
@@ -763,15 +772,15 @@ RoutingObj::GetRouteBoundingBox(::DBus::Struct< ::DBus::Struct< double, double >
map_rect_destroy(mr);
if (first)
throw DBus::ErrorFailed("no route available");
- dbg(lvl_debug,"bounding box 0x%x,0x%x-0x%x,0x%x\n",r.lu.x,r.lu.y,r.rl.x,r.rl.y);
+ LOG_DEBUG(gCtx,"Bounding box: 0x%x,0x%x-0x%x,0x%x",r.lu.x,r.lu.y,r.rl.x,r.rl.y);
transform_to_geo(projection_mg, &r.lu, &g);
boundingBox._1._1=g.lat;
boundingBox._1._2=g.lng;
- dbg(lvl_debug,"%f,%f\n",g.lat,g.lng);
+ LOG_DEBUG(gCtx,"Left: %f,%f",g.lat,g.lng);
transform_to_geo(projection_mg, &r.rl, &g);
boundingBox._2._1=g.lat;
boundingBox._2._2=g.lng;
- dbg(lvl_debug,"-%f,%f\n",g.lat,g.lng);
+ LOG_DEBUG(gCtx,"Right: %f,%f",g.lat,g.lng);
}
void
@@ -785,17 +794,20 @@ RoutingObj_Callback(struct RoutingObj *obj)
{
struct attr route_status;
if (!route_get_attr(obj->m_route.u.route, attr_route_status, &route_status, NULL)) {
- dbg(lvl_debug,"failed to get route status\n");
+ LOG_ERROR_MSG(gCtx,"Failed to get route status");
return;
}
if (route_status.u.num == route_status_destination_set) {
+ LOG_INFO_MSG(gCtx,"Destination set");
obj->m_routing->RouteCalculationProgressUpdate(obj->m_handle, GENIVI_NAVIGATIONCORE_OK, 5);
obj->m_route_status=route_status.u.num;
}
if (route_status.u.num == route_status_building_graph) {
- obj->m_route_status=route_status.u.num;
+ LOG_INFO_MSG(gCtx,"Building graph");
+ obj->m_route_status=route_status.u.num;
}
if (route_status.u.num == route_status_building_path && obj->m_route_status == route_status_building_graph) {
+ LOG_INFO_MSG(gCtx,"Building path");
obj->m_routing->RouteCalculationProgressUpdate(obj->m_handle, GENIVI_NAVIGATIONCORE_OK, 50);
obj->m_route_status=route_status.u.num;
}
@@ -804,13 +816,13 @@ RoutingObj_Callback(struct RoutingObj *obj)
if (route_status.u.num == route_status_path_done_new)
obj->m_routing->RouteCalculationProgressUpdate(obj->m_handle, GENIVI_NAVIGATIONCORE_OK, 100);
obj->m_route_status=route_status.u.num;
- dbg(lvl_debug,"callback routing ok\n");
+ LOG_INFO_MSG(gCtx,"Route path done");
std::map< int32_t, int32_t > unfulfilled_preferences;
obj->m_routing->RouteCalculationSuccessful(obj->m_handle, unfulfilled_preferences);
}
if (route_status.u.num == route_status_not_found) {
obj->m_route_status=route_status.u.num;
- dbg(lvl_debug,"callback routing failed\n");
+ LOG_ERROR_MSG(gCtx,"Routing status not found");
std::map< int32_t, int32_t > unfulfilled_preferences;
obj->m_routing->RouteCalculationFailed(obj->m_handle, GENIVI_NAVIGATIONCORE_UNREACHABLE_DESTINATION, unfulfilled_preferences);
}
@@ -934,7 +946,10 @@ static class Routing *server;
void
plugin_init(void)
{
- event_request_system("glib","genivi_routing");
+ DLT_REGISTER_APP("RTGS","ROUTING SERVER");
+ DLT_REGISTER_CONTEXT(gCtx,"RTGS","Global Context");
+
+ event_request_system("glib","genivi_routing");
dispatcher.attach(NULL);
DBus::default_dispatcher = &dispatcher;
conn = new DBus::Connection(DBus::Connection::SessionBus());
diff --git a/src/navigation/poi-cam/genivi_poiservice_cam_navit.cxx b/src/navigation/poi-cam/genivi_poiservice_cam_navit.cxx
index fa2d798..65c38f9 100644
--- a/src/navigation/poi-cam/genivi_poiservice_cam_navit.cxx
+++ b/src/navigation/poi-cam/genivi_poiservice_cam_navit.cxx
@@ -63,7 +63,7 @@ enum {
CONNECTION_AMOUNT
};
-#define MAX_RESULT_LIST_SIZE 256
+#define MAX_RESULT_LIST_SIZE 1024
static DBus::Glib::BusDispatcher dispatchers[CONNECTION_AMOUNT];
static DBus::Connection *conns[CONNECTION_AMOUNT];
@@ -84,6 +84,28 @@ do_sort_distance(::DBus::Struct< uint32_t, std::string, uint32_t, ::DBus::Struct
return a._5 < b._5;
}
+//case insensitive search
+//code got from stackoverflow, thanks to Kirill V. Lyadvinsky
+template<typename charT>
+struct my_equal {
+ my_equal( const std::locale& loc ) : loc_(loc) {}
+ bool operator()(charT ch1, charT ch2) {
+ return std::toupper(ch1, loc_) == std::toupper(ch2, loc_);
+ }
+private:
+ const std::locale& loc_;
+};
+
+// find substring (case insensitive)
+template<typename T>
+int ci_find_substr( const T& str1, const T& str2, const std::locale& loc = std::locale() )
+{
+ typename T::const_iterator it = std::search( str1.begin(), str1.end(),
+ str2.begin(), str2.end(), my_equal<typename T::value_type>(loc) );
+ if ( it != str1.end() ) return it - str1.begin();
+ else return -1; // not found
+}
+
class PoiContentAccess
: public org::genivi::navigation::poiservice::POIContentAccess_proxy,
@@ -213,7 +235,7 @@ class ContentAccessModule
}
bool
- add_poi(struct item *item, uint32_t category, std::string inputString)
+ search_and_add_poi(struct item *item, uint32_t category, std::string inputString)
{
struct attr label;
struct coord c;
@@ -224,8 +246,7 @@ class ContentAccessModule
if (item_attr_get(item, attr_label, &label)){
result._2=std::string(label.u.str); /* name */
- std::size_t found = result._2.find(inputString);
- if (found!=std::string::npos)
+ if(ci_find_substr(result._2,inputString)!=-1)
stringMatched=true;
}
@@ -429,7 +450,6 @@ class ContentAccessModule
LOG_DEBUG(gCtx,"Start search POI request in area: %x %x %x %x",m_selection.u.c_rect.lu.x,m_selection.u.c_rect.lu.y,m_selection.u.c_rect.rl.x,m_selection.u.c_rect.rl.y);
LOG_DEBUG(gCtx,"String to search: %s",m_inputString.c_str());
- dbg(lvl_debug,"rect 0x%x,0x%x-0x%x,0x%x\n",m_selection.u.c_rect.lu.x,m_selection.u.c_rect.lu.y,m_selection.u.c_rect.rl.x,m_selection.u.c_rect.rl.y);
if (m_msh)
mapset_close(m_msh);
m_msh=mapset_open(m_mapset);
@@ -451,30 +471,32 @@ class ContentAccessModule
ResultListRequested(const uint8_t& camId, const uint32_t& poiSearchHandle, const std::vector< uint32_t >& attributeList, int32_t& statusValue, uint16_t& resultListSize, std::vector< ::DBus::Struct< uint32_t, std::string, uint32_t, ::DBus::Struct< double, double, double >, uint16_t, std::vector< ::DBus::Struct< uint32_t, int32_t, DBusCommonAPIVariant > > > >& resultList)
{
struct item *item;
- int count=0;
+ int count=0;
+ int added=0;
bool isFound;
size_t index;
- dbg(lvl_debug,"enter camId=%d handle=%d\n", camId, poiSearchHandle);
+ LOG_DEBUG(gCtx,"ResultListRequested on CAM number: %d",camId);
do {
- while ((count < MAX_RESULT_LIST_SIZE) && (count < m_max_requested_size) && (item=map_rect_get_item(m_map_rect))) {
+ while ((added < MAX_RESULT_LIST_SIZE) && (added < m_max_requested_size) && (item=map_rect_get_item(m_map_rect))) {
isFound=false;
index=0;
do{ //check if the category matches one of the requested ones
if (item->type == (m_poiCategoriesIdRadius.at(index)).formerId)
{
- if(add_poi(item,(m_poiCategoriesIdRadius.at(index)).givenId,m_inputString)){
+ if(search_and_add_poi(item,(m_poiCategoriesIdRadius.at(index)).givenId,m_inputString)){
//poi are added into m_resultList
- LOG_DEBUG(gCtx,"POI added: %s count: %d",(m_resultList.at(count))._2.c_str(), count);
- count++;
+ added++;
isFound=true;
}
}
index++;
+ count++;
}while((isFound==false)&&(index<m_poiCategoriesIdRadius.size()));
}
} while (map_next());
- dbg(lvl_debug,"got %d items\n",count);
+ LOG_DEBUG(gCtx,"POI search result: scanned: %d added: %d ", count, added);
+
statusValue=GENIVI_POISERVICE_FINISHED;
if (m_sort_func)
std::sort(m_resultList.begin(), m_resultList.end(), m_sort_func);
diff --git a/src/poi-service/poi-server/main.cpp b/src/poi-service/poi-server/main.cpp
index dc4812e..cb6ee28 100644
--- a/src/poi-service/poi-server/main.cpp
+++ b/src/poi-service/poi-server/main.cpp
@@ -120,7 +120,7 @@ void Routing::AlternativeRoutesAvailable (const std::vector<handleId_t>& routeHa
contentAccessModule::contentAccessModule(DBus::Connection &connection, const std::string& service)
: DBus::ObjectProxy(connection, contentAccessModule_OBJECT_PATH,service.c_str())
{
- LOG_INFO_MSG(gCtx,"poi content access module client\n");
+ LOG_INFO_MSG(gCtx,"POI content access module client");
}
contentAccessModule::~contentAccessModule()
@@ -157,7 +157,7 @@ void contentAccessModule::SearchStatusChanged(const uint32_t& poiSearchHandle, c
poiContentAccessServer::poiContentAccessServer(DBus::Connection &connection)
: DBus::ObjectAdaptor(connection, poiContentAccess_OBJECT_PATH)
{
- LOG_INFO_MSG(gCtx,"poi content access server\n");
+ LOG_INFO_MSG(gCtx,"POI content access server");
//version is hard coded
m_version._1 = 0;
@@ -692,7 +692,7 @@ poiSearchServer::poiSearchServer(DBus::Connection &connection, const char* poiDa
categoryId_t value;
categoryId_t parent,child;
- LOG_INFO_MSG(gCtx,"poi server\n");
+ LOG_INFO_MSG(gCtx,"POI server");
//version is hard coded
DBus_version::version_t version;
@@ -2181,8 +2181,8 @@ void print_usage (FILE* stream, int exit_code)
*/
int main(int argc , char** argv )
{
- DLT_REGISTER_APP("MPVS","MAP VIEWER CONTROL SERVER");
- DLT_REGISTER_CONTEXT(gCtx,"MPVS","Global Context");
+ DLT_REGISTER_APP("POIS","POI SEARCH SERVER");
+ DLT_REGISTER_CONTEXT(gCtx,"POIS","Global Context");
GMainLoop * mainloop ;
diff --git a/src/speech/test-speech-capi.py b/src/speech/test-speech-capi.py
index 7fc4bb0..1fc6eb3 100755
--- a/src/speech/test-speech-capi.py
+++ b/src/speech/test-speech-capi.py
@@ -62,20 +62,20 @@ if __name__ == '__main__':
bus = dbus.SessionBus()
bus.add_signal_receiver(catch_speech_notifyConnectionStatus_signal_handler, \
- dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0", \
+ dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v1_0", \
signal_name = "notifyConnectionStatus")
bus.add_signal_receiver(catch_speech_notifyMarkerReached_signal_handler, \
- dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0", \
+ dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v1_0", \
signal_name = "notifyMarkerReached")
bus.add_signal_receiver(catch_speech_notifyQueueStatus_signal_handler, \
- dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0", \
+ dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v1_0", \
signal_name = "notifyQueueStatus")
bus.add_signal_receiver(catch_speech_notifyTTSStatus_signal_handler, \
- dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0", \
+ dbus_interface = "org.genivi.hmi.speechoutputservice.SpeechOutput.v1_0", \
signal_name = "notifyTTSStatus")
-speech = bus.get_object('org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0_SpeechOutput','/SpeechOutput')
-g_speech_interface = dbus.Interface(speech, dbus_interface='org.genivi.hmi.speechoutputservice.SpeechOutput.v4_0')
+speech = bus.get_object('org.genivi.hmi.speechoutputservice.SpeechOutput.v1_0_SpeechOutput','/SpeechOutput')
+g_speech_interface = dbus.Interface(speech, dbus_interface='org.genivi.hmi.speechoutputservice.SpeechOutput.v1_0')
g_speech_interface.addTextChunk(dbus.String("Hello"))
diff --git a/test/navigation/script/test-guidance.py b/test/navigation/script/test-guidance.py
index 8f91a77..81a3ce5 100755
--- a/test/navigation/script/test-guidance.py
+++ b/test/navigation/script/test-guidance.py
@@ -48,12 +48,13 @@ except dltTriggerNotBuilt:
test_name = "guidance"
#constants used into the script
-TIME_OUT = 10000
+TIME_OUT = 20000
HORIZONTAL_SIZE = 800
VERTICAL_SIZE = 480
MAIN_MAP = 0x0010
NUMBER_OF_SEGMENTS = 500
ZOOM_GUIDANCE = 2
+NUMBER_OF_MANEUVERS_BEFORE_STOP = 5
#add signal receivers
def routing_routeCalculationProgressUpdate_handler(routeHandle, status, percentage):
@@ -120,14 +121,17 @@ def guidance_positionOnRouteChanged_handler(offsetOnRoute):
print ("Offset on route: " +str(offsetOnRoute))
def guidance_maneuverChanged_handler(maneuver):
+ global g_amount_of_maneuvers
print ("Maneuver: " +str(maneuver))
ret = g_guidance_interface.GetDestinationInformation()
print ("Travel time: " +str(ret[1]))
ret = g_guidance_interface.GetManeuversList(dbus.UInt16(10),dbus.UInt32(0))
print ("Number of maneuvers: " +str(ret[1]))
print ("Next road to turn: " +str(ret[2][0][4]))
- g_mapmatchedposition_interface.SetSimulationMode(dbus.UInt32(g_navigationcore_session_handle),dbus.Boolean(False))
- g_guidance_interface.StopGuidance(dbus.UInt32(g_navigationcore_session_handle))
+ g_amount_of_maneuvers += 1
+ if g_amount_of_maneuvers > NUMBER_OF_MANEUVERS_BEFORE_STOP:
+ g_mapmatchedposition_interface.SetSimulationMode(dbus.UInt32(g_navigationcore_session_handle),dbus.Boolean(False))
+ g_guidance_interface.StopGuidance(dbus.UInt32(g_navigationcore_session_handle))
def mapmatchedposition_simulationStatusChanged_handler(simulationStatus):
print ("Simulation status: " +str(simulationStatus))
@@ -337,6 +341,7 @@ createMapView()
g_current_route = 0
g_guidance_active = False
+g_amount_of_maneuvers = 0
launch_route_calculation(0)
#main loop
diff --git a/test/navigation/script/test-poi.py b/test/navigation/script/test-poi.py
index 6610a48..7192308 100755
--- a/test/navigation/script/test-poi.py
+++ b/test/navigation/script/test-poi.py
@@ -55,7 +55,7 @@ ATTRIBUTE_SOURCE = 0
ATTRIBUTE_PHONE = 2
RADIUS_HOTEL = 100 #in tenth of meter !
RADIUS_RESTAURANT = 500
-STRING_TO_SEARCH = "hof"
+STRING_TO_SEARCH = "ZUm"
MAX_WINDOW_SIZE = 100
OFFSET = 0
diff --git a/test/poi-service/script/create-scheme.sql b/test/poi-service/script/create-scheme.sql
index 154f550..fe20826 100644
--- a/test/poi-service/script/create-scheme.sql
+++ b/test/poi-service/script/create-scheme.sql
@@ -1,6 +1,6 @@
/**
* @licence app begin@
- * Copyright (C) 2011-2012 PCA Peugeot Citroën
+ * Copyright (C) 2017 PSA GROUP
*
* This file is part of GENIVI Project POISearch Proof Of Concept [POIPOCSupplier].
*
@@ -18,6 +18,8 @@
* Modifications:
* 19-12-2013 Philippe Colliot
* add new fields to poi (brand and operateur)
+ * 04-07-2017 Philippe Colliot
+ * add COLLATE NOCASE to poi name
*
* For further information see http://www.genivi.org/.
* @licence end@
@@ -52,7 +54,7 @@ CREATE TABLE poiattribute (
DROP TABLE IF EXISTS poi;
CREATE TABLE poi (
Id int NOT NULL,
- name text UNIQUE,
+ name text UNIQUE COLLATE NOCASE,
latitude double DEFAULT NULL,
longitude double DEFAULT NULL,
altitude int DEFAULT NULL,