diff options
author | asanoaozora <fifitaneki@hotmail.com> | 2017-04-01 13:20:47 +0200 |
---|---|---|
committer | asanoaozora <fifitaneki@hotmail.com> | 2017-04-01 13:20:47 +0200 |
commit | c5e3febf862efac8b899940e0c441ac7bfa4efdf (patch) | |
tree | 57e42d771b6efadbbe0823bd9b94fb8206024703 | |
parent | 18601bfb4574b1aff5936e05f46b6c9e09f6cee2 (diff) | |
download | navigation-c5e3febf862efac8b899940e0c441ac7bfa4efdf.tar.gz |
fix a bug in POI menu, add set verbose
-rw-r--r-- | src/hmi/qml/Core/NavigationAppHMIMenu.qml | 8 | ||||
-rw-r--r-- | src/hmi/qml/Core/genivi-capi.js | 28 | ||||
-rw-r--r-- | src/hmi/qml/Core/genivi-origin.js | 29 | ||||
-rw-r--r-- | src/hmi/qml/NavigationApp.qml | 3 | ||||
-rw-r--r-- | src/hmi/qml/NavigationAppPOI.qml | 160 |
5 files changed, 147 insertions, 81 deletions
diff --git a/src/hmi/qml/Core/NavigationAppHMIMenu.qml b/src/hmi/qml/Core/NavigationAppHMIMenu.qml index f47eae9..df02a21 100644 --- a/src/hmi/qml/Core/NavigationAppHMIMenu.qml +++ b/src/hmi/qml/Core/NavigationAppHMIMenu.qml @@ -160,7 +160,9 @@ Rectangle { } function pageOpen(command) { - console.log("page open") + if(Genivi.verbose===true){ + console.log("page open") + } menu.state="hidden"; Genivi.hookContext(); container.load(command); @@ -176,6 +178,8 @@ Rectangle { } Component.onCompleted: { - console.log("Level: ",Genivi.entrybackheapsize," Menu: ",pagefile); + if(Genivi.verbose===true){ + console.log("Level: ",Genivi.entrybackheapsize," Menu: ",pagefile); + } } } diff --git a/src/hmi/qml/Core/genivi-capi.js b/src/hmi/qml/Core/genivi-capi.js index d96b2f1..bb50b91 100644 --- a/src/hmi/qml/Core/genivi-capi.js +++ b/src/hmi/qml/Core/genivi-capi.js @@ -47,7 +47,7 @@ data['current_position']=new Array; //the current position data['default_position']=new Array; //the default position used for the showrooom var poi_data=new Array; -var poi_id; +var poi_id=null; var category_id; var categoriesIdNameList; @@ -118,6 +118,7 @@ CostModels[NAVIGATIONCORE_INVALID]="INVALID"; CostModels[NAVIGATIONCORE_FASTEST]="FASTEST"; CostModels[NAVIGATIONCORE_SHORTEST]="SHORTEST"; +var verbose=false; //no log sent to stdout by default var preloadMode=false; //set to true when the address is restored var address = new Object; //to store the address, in order to make the hmi more friendly :-) var tripMode; //trip mode to be displayed by the trip computer menu ("TRIP_NUMBER1", "TRIP_NUMBER2" or "TRIP_INSTANT") @@ -162,7 +163,14 @@ function dump(prefix,args) function hookContext() { - console.log("Routing: ",route_calculated," Guidance: ",guidance_activated," Simulation: ",simulationMode); + if(verbose===true){ + console.log("Routing: ",route_calculated," Guidance: ",guidance_activated," Simulation: ",simulationMode); + } +} + +function setVerbose() +{ + verbose=true; } //Manage the historyOfLastEnteredLocation @@ -297,6 +305,8 @@ function setlang(language,country,script) Qt.include("translations/"+g_language + "_" + g_country+".js"); if(g_language==="eng"){ keyboardLayout=englishLayout; + kbdFirstLayout="ABC"; + kbdSecondLayout="123"; kbdColumns=8; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=4; //number of lines @@ -304,6 +314,8 @@ function setlang(language,country,script) }else{ if(g_language==="fra"){ keyboardLayout=frenchLayout; + kbdFirstLayout="ABC"; + kbdSecondLayout="123"; kbdColumns=8; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=4; //number of lines @@ -311,6 +323,8 @@ function setlang(language,country,script) }else{ if(g_language==="jpn"){ keyboardLayout=japaneseLayout; + kbdFirstLayout="かな"; + kbdSecondLayout="カナ"; kbdColumns=10; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=6; //number of lines @@ -318,6 +332,8 @@ function setlang(language,country,script) }else{ if(g_language==="deu"){ keyboardLayout=germanLayout; + kbdFirstLayout="ABC"; + kbdSecondLayout="123"; kbdColumns=8; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=4; //number of lines @@ -368,7 +384,9 @@ function gettext(arg) function hookMethod(arg) { - console.log("Method: ",arg); + if(verbose===true){ + console.log("Method: ",arg); + } } // Send a dbus message to layer manager @@ -409,7 +427,9 @@ function demonstrator_message(par, iface, func, args) //----------------- DBus signals ----------------- function hookSignal(arg) { - console.log("Signal: ",arg); + if(verbose===true){ + console.log("Signal: ",arg); + } } function connect_simulationStatusChangedSignal(interface,menu) diff --git a/src/hmi/qml/Core/genivi-origin.js b/src/hmi/qml/Core/genivi-origin.js index 85b8640..4a3a685 100644 --- a/src/hmi/qml/Core/genivi-origin.js +++ b/src/hmi/qml/Core/genivi-origin.js @@ -47,7 +47,7 @@ data['current_position']=new Array; //the current position data['default_position']=new Array; //the default position used for the showrooom var poi_data=new Array; -var poi_id; +var poi_id=null; var category_id; var categoriesIdNameList; @@ -118,6 +118,7 @@ CostModels[NAVIGATIONCORE_INVALID]="INVALID"; CostModels[NAVIGATIONCORE_FASTEST]="FASTEST"; CostModels[NAVIGATIONCORE_SHORTEST]="SHORTEST"; +var verbose=false; //no log sent to stdout by default var preloadMode=false; //set to true when the address is restored var address = new Object; //to store the address, in order to make the hmi more friendly :-) var tripMode; //trip mode to be displayed by the trip computer menu ("TRIP_NUMBER1", "TRIP_NUMBER2" or "TRIP_INSTANT") @@ -162,7 +163,14 @@ function dump(prefix,args) function hookContext() { - console.log("Routing: ",route_calculated," Guidance: ",guidance_activated," Simulation: ",simulationMode); + if(verbose===true){ + console.log("Routing: ",route_calculated," Guidance: ",guidance_activated," Simulation: ",simulationMode); + } +} + +function setVerbose() +{ + verbose=true; } //Manage the historyOfLastEnteredLocation @@ -297,6 +305,8 @@ function setlang(language,country,script) Qt.include("translations/"+g_language + "_" + g_country+".js"); if(g_language==="eng"){ keyboardLayout=englishLayout; + kbdFirstLayout="ABC"; + kbdSecondLayout="123"; kbdColumns=8; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=4; //number of lines @@ -304,6 +314,8 @@ function setlang(language,country,script) }else{ if(g_language==="fra"){ keyboardLayout=frenchLayout; + kbdFirstLayout="ABC"; + kbdSecondLayout="123"; kbdColumns=8; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=4; //number of lines @@ -311,6 +323,8 @@ function setlang(language,country,script) }else{ if(g_language==="jpn"){ keyboardLayout=japaneseLayout; + kbdFirstLayout="かな"; + kbdSecondLayout="カナ"; kbdColumns=10; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=6; //number of lines @@ -318,6 +332,8 @@ function setlang(language,country,script) }else{ if(g_language==="deu"){ keyboardLayout=germanLayout; + kbdFirstLayout="ABC"; + kbdSecondLayout="123"; kbdColumns=8; //number of rows per line kbdColumnRatio=4; //size of row spacing (ratio) kbdLines=4; //number of lines @@ -334,7 +350,6 @@ function setlang(language,country,script) } } } - // Default position (for showroom mode) function setDefaultPosition(lat,lon,alt) { @@ -368,7 +383,9 @@ function gettext(arg) function hookMethod(arg) { - console.log("Method: ",arg); + if(verbose===true){ + console.log("Method: ",arg); + } } // Send a dbus message to layer manager @@ -409,7 +426,9 @@ function demonstrator_message(par, iface, func, args) //----------------- DBus signals ----------------- function hookSignal(arg) { - console.log("Signal: ",arg); + if(verbose===true){ + console.log("Signal: ",arg); + } } function connect_simulationStatusChangedSignal(interface,menu) diff --git a/src/hmi/qml/NavigationApp.qml b/src/hmi/qml/NavigationApp.qml index c512d39..fa53f1c 100644 --- a/src/hmi/qml/NavigationApp.qml +++ b/src/hmi/qml/NavigationApp.qml @@ -77,6 +77,9 @@ ApplicationWindow { Genivi.mapviewer_handle(dbusIf,width,height,Genivi.MAPVIEWER_MAIN_MAP); initScale(); + //set verbose mode on + Genivi.setVerbose(); + //launch the HMI load("NavigationAppMain"); } diff --git a/src/hmi/qml/NavigationAppPOI.qml b/src/hmi/qml/NavigationAppPOI.qml index 98439cd..bf0423a 100644 --- a/src/hmi/qml/NavigationAppPOI.qml +++ b/src/hmi/qml/NavigationAppPOI.qml @@ -92,11 +92,6 @@ NavigationAppHMIMenu { select_search.update(); } - function update() - { - selectedValue.text="Lat:\nLon:\nDist:\n"; - } - function spell(input) { keyboardArea.destination.text = input; @@ -113,6 +108,66 @@ NavigationAppHMIMenu { categoryValue.text=model.get(0).name; } + function displayPoiList() + { + var model=view.model; + var ids=[]; + var latitude=0; + var longitude=0; + + if(Genivi.showroom) { + latitude=Genivi.data['default_position']['lat']; + longitude=Genivi.data['default_position']['lon']; + }else{ + latitude=Genivi.data['current_position']['lat']; + longitude=Genivi.data['current_position']['lon']; + } + + if (!latitude && !longitude) { + model.clear(); + model.append({"name":"No position available"}); + return; + } + var categoriesAndRadius=[]; + var categoriesAndRadiusList=[]; + categoriesAndRadius[0]=Genivi.category_id; + categoriesAndRadius[1]=Genivi.radius; + categoriesAndRadiusList.push(categoriesAndRadius); + + Genivi.poisearch_SetCenter(dbusIf,latitude,longitude,0); + Genivi.poisearch_SetCategories(dbusIf,categoriesAndRadiusList); + Genivi.poisearch_StartPoiSearch(dbusIf,"",Genivi.POISERVICE_SORT_BY_DISTANCE); + var attributeList=[]; + attributeList[0]=0; + var res=Genivi.poisearch_RequestResultList(dbusIf,Genivi.offset,Genivi.maxResultListSize,attributeList); + var res_win=res[5]; + var i; + for (i = 0 ; i < res_win.length ; i+=2) { + var id=res_win[i+1][1]; + ids.push(id); + Genivi.poi_data[id]=[]; + Genivi.poi_data[id].id=id; + Genivi.poi_data[id].category=Genivi.category_id; + Genivi.poi_data[id].distance=res_win[i+1][3]; + } + var details=Genivi.poisearch_GetPoiDetails(dbusIf,ids); + for (i = 0 ; i < details[1].length ; i+=2) { + var poi_details=details[1][i+1]; + id=poi_details[1][1]; + Genivi.poi_data[id].name=poi_details[1][3]; + Genivi.poi_data[id].lat=poi_details[1][5][1]; + Genivi.poi_data[id].lon=poi_details[1][5][3]; + } + model.clear(); + for (i = 0 ; i < ids.length ; i+=1) { + id=ids[i]; + var poi_data=Genivi.poi_data[id]; + if((poi_data.name !== "") && (poi_data.name !== "?") ){ //filter empty and unknown names + model.append({"name":poi_data.name,"number":id}); + } + } + } + //------------------------------------------// // Management of "keyboard" configuration //------------------------------------------// @@ -138,6 +193,7 @@ NavigationAppHMIMenu { id:categoryKeyboard; disabled:false; next:poiKeyboard; prev:back; onClicked: { keyboardArea.destination=categoryValue; + Genivi.poi_id=null; //clear current selected poi poiValue.text=""; selectedValue.text="Lat:\nLon:\nDist:\n"; poiName.visible=false; @@ -288,61 +344,7 @@ NavigationAppHMIMenu { id:select_search disabled:!(vehicleLocated || Genivi.showroom ); onClicked: { - var model=view.model; - var ids=[]; - var latitude=0; - var longitude=0; - - if(Genivi.showroom) { - latitude=Genivi.data['default_position']['lat']; - longitude=Genivi.data['default_position']['lon']; - }else{ - latitude=Genivi.data['current_position']['lat']; - longitude=Genivi.data['current_position']['lon']; - } - - if (!latitude && !longitude) { - model.clear(); - model.append({"name":"No position available"}); - return; - } - var categoriesAndRadius=[]; - var categoriesAndRadiusList=[]; - categoriesAndRadius[0]=Genivi.category_id; - categoriesAndRadius[1]=Genivi.radius; - categoriesAndRadiusList.push(categoriesAndRadius); - - Genivi.poisearch_SetCenter(dbusIf,latitude,longitude,0); - Genivi.poisearch_SetCategories(dbusIf,categoriesAndRadiusList); - Genivi.poisearch_StartPoiSearch(dbusIf,"",Genivi.POISERVICE_SORT_BY_DISTANCE); - var attributeList=[]; - attributeList[0]=0; - var res=Genivi.poisearch_RequestResultList(dbusIf,Genivi.offset,Genivi.maxResultListSize,attributeList); - var res_win=res[5]; - var i; - for (i = 0 ; i < res_win.length ; i+=2) { - var id=res_win[i+1][1]; - ids.push(id); - Genivi.poi_data[id]=[]; - Genivi.poi_data[id].id=id; - Genivi.poi_data[id].distance=res_win[i+1][3]; - } - var details=Genivi.poisearch_GetPoiDetails(dbusIf,ids); - for (i = 0 ; i < details[1].length ; i+=2) { - var poi_details=details[1][i+1]; - id=poi_details[1][1]; - Genivi.poi_data[id].name=poi_details[1][3]; - Genivi.poi_data[id].lat=poi_details[1][5][1]; - Genivi.poi_data[id].lon=poi_details[1][5][3]; - } - model.clear(); - for (i = 0 ; i < ids.length ; i+=1) { - id=ids[i]; - var poi_data=Genivi.poi_data[id]; - if((poi_data.name !== "") && (poi_data.name !== "?") ){ //filter empty and unknown names - model.append({"name":poi_data.name,"number":id}); - } - } + displayPoiList(); } } StdButton { @@ -400,22 +402,40 @@ NavigationAppHMIMenu { var categoriesIdNameAndRadius=[]; var ret=Genivi.poisearch_GetAvailableCategories(dbusIf); - var categories=ret[1]; - for (var i = 0 ; i < categories.length ; i+=2) { - if (categories[i+1][3] == 'fuel') { - Genivi.category_id=categories[i+1][1]; - poiCategoryName=categories[i+1][3]; - } - } - Genivi.categoriesIdNameList=categories; + Genivi.categoriesIdNameList=ret[1]; + + if(Genivi.poi_id !== null){ + //there's a selected poi + var poi_data=Genivi.poi_data[Genivi.poi_id]; + poiName.text=poi_data.name; + poiName.visible=true; + for (var i = 0 ; i < Genivi.categoriesIdNameList.length ; i+=2) { + if (Genivi.categoriesIdNameList[i+1][1] === poi_data.category) { + Genivi.category_id=poi_data.category; + poiCategoryName=Genivi.categoriesIdNameList[i+1][3]; + } + } + selectedValue.text="Lat: "+poi_data.lat.toFixed(4)+"\nLon: "+poi_data.lon.toFixed(4)+"\nDist: "+poi_data.distance+" m"; + selectedValueTitle.visible=true; + select_reroute.disabled=false; + select_display_on_map.disabled=false; + displayPoiList(); + }else{ + Genivi.poi_data=[]; + selectedValue.text="Lat:\nLon:\nDist:\n"; + for (var j = 0 ; j < Genivi.categoriesIdNameList.length ; j+=2) { + if (Genivi.categoriesIdNameList[j+1][3] == 'fuel') { + Genivi.category_id=Genivi.categoriesIdNameList[j+1][1]; + poiCategoryName=Genivi.categoriesIdNameList[j+1][3]; + } + } + } - Genivi.poi_data=[]; categoryValue.text=poiCategoryName; keyboardArea.destination=poiValue; // by default poiFrame.visible=true; - update(); if(!Genivi.showroom) { updateCurrentPosition(); } |