diff options
author | psa <psa@ubuntu> | 2014-06-27 18:33:18 +0200 |
---|---|---|
committer | psa <psa@ubuntu> | 2014-06-27 18:33:18 +0200 |
commit | fbcd0001ce137d168a9fdeacd849cec9c3b49ea5 (patch) | |
tree | 5f8ca4a779e74bb6c79a15b243fc6afe7c396ba1 | |
parent | 93ae1931321812685e96bc6b4905bcad2aa062f9 (diff) | |
download | navigation-fbcd0001ce137d168a9fdeacd849cec9c3b49ea5.tar.gz |
improve HMI, fix some bugs
-rw-r--r-- | src/fuel-stop-advisor/fuel-stop-advisor.cpp | 48 | ||||
-rw-r--r-- | src/fuel-stop-advisor/fuel-stop-advisor.xml | 13 | ||||
-rw-r--r-- | src/hmi/qml/CameraSettings.qml | 23 | ||||
-rw-r--r-- | src/hmi/qml/Core/Keyboard.qml | 4 | ||||
-rw-r--r-- | src/hmi/qml/Core/genivi.js | 2 | ||||
-rw-r--r-- | src/hmi/qml/Core/style-sheets/style-constants.js | 2 | ||||
-rw-r--r-- | src/hmi/qml/NavigationBrowseMap.qml | 33 | ||||
-rw-r--r-- | src/hmi/qml/POI.qml | 1 | ||||
-rw-r--r-- | src/hmi/qml/TripComputer.qml | 2 |
9 files changed, 77 insertions, 51 deletions
diff --git a/src/fuel-stop-advisor/fuel-stop-advisor.cpp b/src/fuel-stop-advisor/fuel-stop-advisor.cpp index cb904d4..5f56373 100644 --- a/src/fuel-stop-advisor/fuel-stop-advisor.cpp +++ b/src/fuel-stop-advisor/fuel-stop-advisor.cpp @@ -225,18 +225,16 @@ class FuelStopAdvisor else { if (iter->first == CTripComputer::TRIPCOMPUTER_TANK_DISTANCE) - { + { //tank distance is valid, so it means that fuel level is valid too ret[GENIVI_FUELSTOPADVISOR_TANK_DISTANCE]=variant_uint16(boost::get<uint16_t>(iter->second)); + ret[GENIVI_FUELSTOPADVISOR_FUEL_LEVEL]=variant_uint16(fuelLevel); + if (this->routeHandle != 0) + { // a route is valid so it makes sense to calculate enhanced tank distance + ret[GENIVI_FUELSTOPADVISOR_ENHANCED_TANK_DISTANCE]=variant_uint16(enhancedDistance(fuelLevel,remaining)+0.5); + } } } } - // for the demo check is fuel level available - if (fuelLevel != 0) - { - ret[GENIVI_FUELSTOPADVISOR_FUEL_LEVEL]=variant_uint16(fuelLevel); - ret[GENIVI_FUELSTOPADVISOR_ENHANCED_TANK_DISTANCE]=variant_uint16(enhancedDistance(fuelLevel,remaining)+0.5); - } - return ret; } @@ -345,7 +343,6 @@ class FuelStopAdvisor uint32_t odometer; uint16_t level; uint16_t consumption; - double remaining; double time; @@ -413,24 +410,30 @@ class FuelStopAdvisor fuelLevel = level; //to avoid re-ask it to amb - if (advisorMode) { - enhancedDistance(tripComputerInput.fuelLevel, remaining); - printf("Advisor %f vs %d\n",remaining, distanceThreshold); - if (remaining < distanceThreshold) { - printf("Warning %f < %d\n",remaining, distanceThreshold); - FuelStopAdvisorWarning(); - } - } TripDataUpdated(0); //arg is for future use } + void updateEnhancedDistance() + { + double remaining; + if (advisorMode) { + enhancedDistance(fuelLevel, remaining); + printf("Advisor %f vs %d\n",remaining, distanceThreshold); + if (remaining < distanceThreshold) { + printf("Warning %f < %d\n",remaining, distanceThreshold); + FuelStopAdvisorWarning(); + } + TripDataUpdated(0); //arg is for future use + } + } + void SetFuelAdvisorSettings(const bool& advisorMode, const uint8_t& distanceThreshold) { printf("SetFuelAdvisorSettings(%d,%d)\n",advisorMode, distanceThreshold); this->advisorMode=advisorMode; this->distanceThreshold=distanceThreshold; - update_data(); + updateEnhancedDistance(); } void @@ -444,9 +447,16 @@ class FuelStopAdvisor { printf("SetRouteHandle %d\n",routeHandle); this->routeHandle=routeHandle; - update_data(); + updateEnhancedDistance(); } + void ReleaseRouteHandle(const uint32_t& routeHandle) + { + printf("ResetRouteHandle %d\n",routeHandle); + this->routeHandle=0; + updateEnhancedDistance(); + } + private: DBus::Glib::BusDispatcher amb_dispatcher; DBus::Connection *amb_conn; diff --git a/src/fuel-stop-advisor/fuel-stop-advisor.xml b/src/fuel-stop-advisor/fuel-stop-advisor.xml index 32d7356..f6cb6fe 100644 --- a/src/fuel-stop-advisor/fuel-stop-advisor.xml +++ b/src/fuel-stop-advisor/fuel-stop-advisor.xml @@ -171,7 +171,18 @@ </doc> <arg name="routeHandle" type="u" direction="in"> <doc> - <line>routeHandle = Route handle. Range[0x0:0x7fffffff]. 0x0 is reserved as an invalid handle value, which clears the route here</line> + <line>routeHandle = Route handle. Range[0x0:0x7fffffff]. </line> + </doc> + </arg> + </method> + + <method name="ReleaseRouteHandle"> + <doc> + <line>ReleaseRouteHandle = This method release the route handle for the enhanced tank distance</line> + </doc> + <arg name="routeHandle" type="u" direction="in"> + <doc> + <line>routeHandle = Route handle. Range[0x0:0x7fffffff].</line> </doc> </arg> </method> diff --git a/src/hmi/qml/CameraSettings.qml b/src/hmi/qml/CameraSettings.qml index 7e93aab..ea665eb 100644 --- a/src/hmi/qml/CameraSettings.qml +++ b/src/hmi/qml/CameraSettings.qml @@ -29,6 +29,7 @@ import QtQuick 1.0 import "Core" import "Core/genivi.js" as Genivi; +import "Core/style-sheets/style-constants.js" as Constants; HMIMenu { id: menu @@ -164,30 +165,30 @@ HMIMenu { property real scrollspeed: 40 spacing: menu.wspc/3; - StdButton { id:north; text:"North"; explode:false; next:south; prev:distancem + StdButton { id:north; text:"North"; explode:false; next:south; prev:distancem; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { set_angle(0); } } - StdButton { id:south; text:"South"; explode:false; next:east; prev:north + StdButton { id:south; text:"South"; explode:false; next:east; prev:north; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { set_angle(180); } } - StdButton { id:east; text:"East"; explode:false; next:west; prev:south + StdButton { id:east; text:"East"; explode:false; next:west; prev:south; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { set_angle(90); } } - StdButton { id:west; text:"West"; explode:false; next:back; prev:east + StdButton { id:west; text:"West"; explode:false; next:back; prev:east; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { set_angle(270); } } - StdButton { id:back; text:"Back"; explode:false; next:tiltp; prev:west + StdButton { id:back; text:"Back"; explode:false; next:tiltp; prev:west; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { Genivi.data['show_current_position']=true; move_stop(); @@ -211,32 +212,32 @@ HMIMenu { height:content.h spacing:menu.wspc/3 - StdButton { id:tiltp; text:"Tilt+"; explode:false; next:tiltm; prev:back + StdButton { id:tiltp; text:"Tilt+"; explode:false; next:tiltm; prev:back; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {camera_start_clamp("CameraTiltAngle",-10,0);} onReleased: {camera_stop();} } - StdButton { id:tiltm; text:"Tilt-"; explode:false; next:heightp; prev:tiltp + StdButton { id:tiltm; text:"Tilt-"; explode:false; next:heightp; prev:tiltp; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {camera_start_clamp("CameraTiltAngle",10,90);} onReleased: {camera_stop();} } - StdButton { id:heightp; text:"Height+"; explode:false; next:heightm; prev:tiltm + StdButton { id:heightp; text:"Height+"; explode:false; next:heightm; prev:tiltm; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {camera_start("CameraHeight",10);} onReleased: {camera_stop();} } - StdButton { id:heightm; text:"Height-"; explode:false; next:distancep; prev:heightp + StdButton { id:heightm; text:"Height-"; explode:false; next:distancep; prev:heightp; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {camera_start("CameraHeight",-10);} onReleased: {camera_stop();} } - StdButton { id:distancep; text:"Distance+"; explode:false; next:distancem; prev:heightm + StdButton { id:distancep; text:"Distance+"; explode:false; next:distancem; prev:heightm; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {camera_start("CameraDistanceFromTargetPoint",10);} onReleased: {camera_stop();} } - StdButton { id:distancem; text:"Distance-"; explode:false; next:north; prev:distancep + StdButton { id:distancem; text:"Distance-"; explode:false; next:north; prev:distancep; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {camera_start("CameraDistanceFromTargetPoint",-10);} onReleased: {camera_stop();} } diff --git a/src/hmi/qml/Core/Keyboard.qml b/src/hmi/qml/Core/Keyboard.qml index 18e608f..cda9796 100644 --- a/src/hmi/qml/Core/Keyboard.qml +++ b/src/hmi/qml/Core/Keyboard.qml @@ -113,10 +113,10 @@ Item { shiftlevel=what; secondLayout=""; var layouts={ - 'ABC':['A','B','C','D','E','F','G','H', + 'ABC':['A','B','C','D','E','F','G','H', 'I','J','K','L','M','N','O','P', 'Q','R','S','T','U','V','W','X', - 'Y','Z','␣','','abc','123','ÄÖÜ','←', + 'Y','Z','␣','','abc','123','ÄÖÜ','←', ], 'abc':['a','b','c','d','e','f','g','h', 'i','j','k','l','m','n','o','p', diff --git a/src/hmi/qml/Core/genivi.js b/src/hmi/qml/Core/genivi.js index d4f7bcf..7e50598 100644 --- a/src/hmi/qml/Core/genivi.js +++ b/src/hmi/qml/Core/genivi.js @@ -230,7 +230,7 @@ function routing_handle_clear(par) { if (g_routing_handle) { routing_message(par, "DeleteRoute", []); - g_routing_handle=null; + g_routing_handle=0; } } diff --git a/src/hmi/qml/Core/style-sheets/style-constants.js b/src/hmi/qml/Core/style-sheets/style-constants.js index c2be181..0ec2a03 100644 --- a/src/hmi/qml/Core/style-sheets/style-constants.js +++ b/src/hmi/qml/Core/style-sheets/style-constants.js @@ -38,3 +38,5 @@ var MENU_WIDTH = 800; //var MENU_BANNER_HEIGHT = 26; var MENU_BANNER_HEIGHT = 0; var MENU_BACKGROUND_COLOR = Qt.rgba(0.070588,0.109803, 0.105882,1); +var MENU_BROWSE_MAP_TEXT_PIXEL_SIZE = 14 +var MENU_BROWSE_MAP_TEXT_PIXEL_COLOR = Qt.rgba(0,0,0,1); diff --git a/src/hmi/qml/NavigationBrowseMap.qml b/src/hmi/qml/NavigationBrowseMap.qml index 181e4e1..5f40222 100644 --- a/src/hmi/qml/NavigationBrowseMap.qml +++ b/src/hmi/qml/NavigationBrowseMap.qml @@ -26,6 +26,7 @@ import QtQuick 1.0 import "Core" import "Core/genivi.js" as Genivi; +import "Core/style-sheets/style-constants.js" as Constants; HMIMenu { id: menu @@ -142,7 +143,7 @@ HMIMenu { mapmatchedpositionAddressUpdateSignal.destroy(); fuelStopAdvisorSignal.destroy(); Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",0,"uint8",0]); - Genivi.fuel_stop_advisor_message(dbusIf,"SetRouteHandle","uint32",0); + Genivi.fuel_stop_advisor_message(dbusIf,"ReleaseRouteHandle",Genivi.g_routing_handle); } function showSurfaces() @@ -409,38 +410,38 @@ HMIMenu { property real panY: 40 //delta in pixel for y panning spacing: menu.wspc/3; - StdButton { id:up; text:"Up"; explode:false; next:left; prev:daynight + StdButton { id:up; text:"Up"; explode:false; next:left; prev:daynight; pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_START,"array",["structure",["uint16",map.width/2,"uint16",map.height/2]]]);} onReleased: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_END,"array",["structure",["uint16",map.width/2,"uint16",map.height/2 + content.panY]]]);} } - StdButton { id:left; text:"Left"; explode:false; next:right; prev:up + StdButton { id:left; text:"Left"; explode:false; next:right; prev:up;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_START,"array",["structure",["uint16",map.width/2,"uint16",map.height/2]]]);} onReleased: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_END,"array",["structure",["uint16",map.width/2 + content.panX,"uint16",map.height/2]]]);} } - StdButton { id:right; text:"Right"; explode:false; next:down; prev:left + StdButton { id:right; text:"Right"; explode:false; next:down; prev:left;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_START,"array",["structure",["uint16",map.width/2,"uint16",map.height/2]]]);} onReleased: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_END,"array",["structure",["uint16",map.width/2 - content.panX,"uint16",map.height/2]]]);} } - StdButton { id:down; text:"Down"; explode:false; next:zoom_in; prev:right + StdButton { id:down; text:"Down"; explode:false; next:zoom_in; prev:right;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onPressed: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_START,"array",["structure",["uint16",map.width/2,"uint16",map.height/2]]]);} onReleased: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewPan", ["uint16",Genivi.MAPVIEWER_PAN_END,"array",["structure",["uint16",map.width/2,"uint16",map.height/2 - content.panY]]]);} } - StdButton { id:zoom_in; text:"+"; explode:false; next:zoom_out; prev:down + StdButton { id:zoom_in; text:"+"; explode:false; next:zoom_out; prev:down;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewScaleByDelta", ["int16",1]);showZoom();} } - StdButton { id:zoom_out; text:"-"; explode:false; next:perspective; prev:zoom_in + StdButton { id:zoom_out; text:"-"; explode:false; next:perspective; prev:zoom_in;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: {Genivi.mapviewercontrol_message(dbusIf, "SetMapViewScaleByDelta", ["int16",-1]);showZoom();} } - StdButton { id:perspective; text:"3d"; explode:false; next:split; prev:zoom_out + StdButton { id:perspective; text:"3d"; explode:false; next:split; prev:zoom_out;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: {togglePerspective();} } - StdButton { id:split; text:"Split"; explode:false; next:orientation; prev:perspective + StdButton { id:split; text:"Split"; explode:false; next:orientation; prev:perspective;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: {toggleSplit();} } - StdButton { id:orientation; text:"N"; explode:false; next:camera; prev:split + StdButton { id:orientation; text:"N"; explode:false; next:camera; prev:split;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: {toggleOrientation();} } - StdButton { id:camera; text:"C"; explode:false; next:back; prev:orientation + StdButton { id:camera; text:"C"; explode:false; next:back; prev:orientation;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { disableSplit(); disconnectSignals(); @@ -497,26 +498,26 @@ HMIMenu { height:content.h spacing:menu.wspc/4 - StdButton { id:back; text:"Back"; next:menub; prev:camera + StdButton { id:back; text:"Back"; next:menub; prev:camera;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { disconnectSignals(); hideSurfaces(); pageOpen(Genivi.data["mapback"]); } } - StdButton { id:menub; text:"Menu"; next:stop; prev:back + StdButton { id:menub; text:"Menu"; next:stop; prev:back;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { disconnectSignals(); hideSurfaces(); pageOpen("MainMenu"); } } - StdButton { id:stop; text:"Stop"; explode:false; next:daynight; prev:menub + StdButton { id:stop; text:"Stop"; explode:false; next:daynight; prev:menub;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: {stopGuidance();} disabled: true } - StdButton { id:daynight; text:""; explode:false; next:up; prev:stop + StdButton { id:daynight; text:""; explode:false; next:up; prev:stop;pixelSize:Constants.MENU_BROWSE_MAP_TEXT_PIXEL_SIZE; onClicked: { toggleDayNight(); } @@ -664,7 +665,7 @@ HMIMenu { if (Genivi.g_routing_handle) { Genivi.fuel_stop_advisor_message(dbusIf,"SetRouteHandle",Genivi.g_routing_handle); } else { - Genivi.fuel_stop_advisor_message(dbusIf,"SetRouteHandle","uint32",0); + Genivi.fuel_stop_advisor_message(dbusIf,"ReleaseRouteHandle",Genivi.g_routing_handle); } Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",1,"uint8",50]); } diff --git a/src/hmi/qml/POI.qml b/src/hmi/qml/POI.qml index 474ca7b..475d818 100644 --- a/src/hmi/qml/POI.qml +++ b/src/hmi/qml/POI.qml @@ -66,6 +66,7 @@ HMIMenu { id:selectedStationValue style: Text.Sunken; smooth: true + clip: true text: " " } Component { diff --git a/src/hmi/qml/TripComputer.qml b/src/hmi/qml/TripComputer.qml index ac39f50..8c0ccb1 100644 --- a/src/hmi/qml/TripComputer.qml +++ b/src/hmi/qml/TripComputer.qml @@ -197,7 +197,7 @@ HMIMenu { if (Genivi.g_routing_handle) { Genivi.fuel_stop_advisor_message(dbusIf,"SetRouteHandle",Genivi.g_routing_handle); } else { - Genivi.fuel_stop_advisor_message(dbusIf,"SetRouteHandle",0); + Genivi.fuel_stop_advisor_message(dbusIf,"ReleaseRouteHandle",Genivi.g_routing_handle); } res=Genivi.fuel_stop_advisor_message(dbusIf,"GetInstantData",[]); for (var i = 0 ; i < res[1].length ; i+=4) { |