summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
author <philippe colliot>2016-04-21 12:00:47 +0200
committer <philippe colliot>2016-04-21 12:00:47 +0200
commita08bc399cbe8d76fdf68ae2eabf93fb808d62eeb (patch)
treee2e2405ffa8c94f731889b7ef55e8f4986c31e65 /test
parente40a59c9bac536836fd80c288a01980d50ec7645 (diff)
downloadnavigation-a08bc399cbe8d76fdf68ae2eabf93fb808d62eeb.tar.gz
Test panel ready for the AMM (still some minor bugs to fix later)
Diffstat (limited to 'test')
-rw-r--r--test/html-based-panel/node-cpp-lbs-modules/Makefile9
-rw-r--r--test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.cpp50
-rw-r--r--test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.hpp5
-rw-r--r--test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.cpp50
-rw-r--r--test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.hpp23
-rw-r--r--test/html-based-panel/server.js11
-rw-r--r--test/html-based-panel/simulation-panel.html45
7 files changed, 186 insertions, 7 deletions
diff --git a/test/html-based-panel/node-cpp-lbs-modules/Makefile b/test/html-based-panel/node-cpp-lbs-modules/Makefile
index 251f4cc..9916ec3 100644
--- a/test/html-based-panel/node-cpp-lbs-modules/Makefile
+++ b/test/html-based-panel/node-cpp-lbs-modules/Makefile
@@ -1,8 +1,8 @@
-all: clean configure.release build pack
+all: clean configure.release build pack install
-release: configure.release build pack
+release: configure.release build pack install
-debug: configure.debug build pack
+debug: configure.debug build pack install
configure.%:
@node-gyp configure --$*
@@ -13,6 +13,9 @@ build:
pack:
npm pack
+install:
+ cd .. ; npm install node-cpp-lbs-modules/node-cpp-lbs-modules-0.1.0.tgz
+
clean:
@node-gyp clean
diff --git a/test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.cpp b/test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.cpp
index b1dcd1c..830e0f0 100644
--- a/test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.cpp
+++ b/test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.cpp
@@ -32,6 +32,7 @@
v8::Persistent<v8::FunctionTemplate> NavigationCoreWrapper::constructor;
v8::Persistent<v8::Function> NavigationCoreWrapper::signalGuidanceStatusChanged;
+v8::Persistent<v8::Function> NavigationCoreWrapper::signalSimulationStatusChanged;
void NavigationCoreWrapper::GuidanceStatusChanged(const int32_t& guidanceStatus, const uint32_t& routeHandle)
{
@@ -65,6 +66,37 @@ v8::Handle<v8::Value> NavigationCoreWrapper::SetGuidanceStatusChangedListener(co
return scope.Close(ret);
}
+void NavigationCoreWrapper::SimulationStatusChanged(const int32_t& simulationStatus)
+{
+ v8::HandleScope scope();
+
+ const unsigned argc = 1;
+ v8::Local<v8::Value> argv[argc];
+
+ argv[0]=v8::Local<v8::Value>::New(v8::Int32::New(simulationStatus));
+
+ v8::Persistent<v8::Function> fct = static_cast<v8::Function*>(*signalSimulationStatusChanged);
+ fct->Call(v8::Context::GetCurrent()->Global(), argc, argv);
+}
+
+v8::Handle<v8::Value> NavigationCoreWrapper::SetSimulationStatusChangedListener(const v8::Arguments& args)
+{
+ v8::HandleScope scope; //to properly clean up v8 handles
+
+ if (!args[0]->IsFunction()) {
+ return v8::ThrowException(
+ v8::Exception::TypeError(v8::String::New("Requires a function as parameter"))
+ );
+ }
+
+ signalSimulationStatusChanged = v8::Persistent<v8::Function>::New(v8::Handle<v8::Function>::Cast(args[0]));
+
+ v8::Local<v8::Object> ret = v8::Object::New();
+ ret->Set( 0, v8::Boolean::New(signalSimulationStatusChanged->IsFunction()) );
+
+ return scope.Close(ret);
+}
+
void NavigationCoreWrapper::Init(v8::Handle<v8::Object> target) {
v8::HandleScope scope;
@@ -79,6 +111,8 @@ void NavigationCoreWrapper::Init(v8::Handle<v8::Object> target) {
// Add all prototype methods, getters and setters here.
NODE_SET_PROTOTYPE_METHOD(constructor, "setGuidanceStatusChangedListener", SetGuidanceStatusChangedListener);
NODE_SET_PROTOTYPE_METHOD(constructor, "getGuidanceStatus", GetGuidanceStatus);
+ NODE_SET_PROTOTYPE_METHOD(constructor, "setSimulationStatusChangedListener", SetSimulationStatusChangedListener);
+ NODE_SET_PROTOTYPE_METHOD(constructor, "getSimulationStatus", GetSimulationStatus);
// This has to be last, otherwise the properties won't show up on the
// object in JavaScript.
@@ -132,4 +166,20 @@ v8::Handle<v8::Value> NavigationCoreWrapper::GetGuidanceStatus(const v8::Argumen
}
+v8::Handle<v8::Value> NavigationCoreWrapper::GetSimulationStatus(const v8::Arguments& args)
+{
+ v8::HandleScope scope; //to properly clean up v8 handles
+
+ // Retrieves the pointer to the wrapped object instance.
+ NavigationCoreWrapper* obj = ObjectWrap::Unwrap<NavigationCoreWrapper>(args.This());
+ int32_t simulationStatus;
+ simulationStatus = obj->mp_navigationCoreProxy->mp_navigationCoreMapMatchedPositionProxy->GetSimulationStatus();
+
+ v8::Local<v8::Object> ret = v8::Object::New();
+ ret->Set( 0, v8::Int32::New(simulationStatus) );
+
+ return scope.Close(ret);
+
+}
+
NODE_MODULE(NavigationCoreWrapper, RegisterModule);
diff --git a/test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.hpp b/test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.hpp
index f7c8f1b..3dbfe36 100644
--- a/test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.hpp
+++ b/test/html-based-panel/node-cpp-lbs-modules/NavigationCoreWrapper.hpp
@@ -54,11 +54,13 @@ variant_int32(int32_t i)
class NavigationCoreWrapper : public node::ObjectWrap {
friend void NavigationCoreProxy::GuidanceStatusChanged(const int32_t& guidanceStatus, const uint32_t& routeHandle);
+ friend void NavigationCoreProxy::SimulationStatusChanged(const int32_t &simulationStatus);
public:
static v8::Persistent<v8::FunctionTemplate> constructor;
static void Init(v8::Handle<v8::Object> target);
static v8::Persistent<v8::Function> signalGuidanceStatusChanged;
+ static v8::Persistent<v8::Function> signalSimulationStatusChanged;
protected:
NavigationCoreWrapper();
@@ -66,9 +68,12 @@ protected:
static v8::Handle<v8::Value> New(const v8::Arguments& args);
static v8::Handle<v8::Value> GetGuidanceStatus(const v8::Arguments& args);
+ static v8::Handle<v8::Value> GetSimulationStatus(const v8::Arguments& args);
static v8::Handle<v8::Value> SetGuidanceStatusChangedListener(const v8::Arguments& args);
void GuidanceStatusChanged(const int32_t& guidanceStatus, const uint32_t& routeHandle);
+ static v8::Handle<v8::Value> SetSimulationStatusChangedListener(const v8::Arguments& args);
+ void SimulationStatusChanged(const int32_t& simulationStatus);
private:
NavigationCoreProxy* mp_navigationCoreProxy;
diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.cpp b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.cpp
index a3dc307..c5402ac 100644
--- a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.cpp
+++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.cpp
@@ -35,6 +35,49 @@ using namespace std;
static DBus::Glib::BusDispatcher *dispatcher;
static DBus::Connection *connection;
+NavigationCoreMapMatchedPositionProxy::NavigationCoreMapMatchedPositionProxy(DBus::Connection &connection, NavigationCoreProxy *navigationCoreProxy)
+ : DBus::ObjectProxy(connection,
+ "/org/genivi/navigationcore",
+ "org.genivi.navigationcore.MapMatchedPosition")
+{
+ mp_navigationCoreProxy = navigationCoreProxy;
+}
+
+void NavigationCoreMapMatchedPositionProxy::SimulationStatusChanged(const int32_t& simulationStatus)
+{
+ mp_navigationCoreProxy->SimulationStatusChanged(simulationStatus);
+}
+
+void NavigationCoreMapMatchedPositionProxy::SimulationSpeedChanged(const uint8_t& speedFactor)
+{
+
+}
+
+void NavigationCoreMapMatchedPositionProxy::PositionUpdate(const std::vector< int32_t >& changedValues)
+{
+
+}
+
+void NavigationCoreMapMatchedPositionProxy::AddressUpdate(const std::vector< int32_t >& changedValues)
+{
+
+}
+
+void NavigationCoreMapMatchedPositionProxy::PositionOnSegmentUpdate(const std::vector< int32_t >& changedValues)
+{
+
+}
+
+void NavigationCoreMapMatchedPositionProxy::StatusUpdate(const std::vector< int32_t >& changedValues)
+{
+
+}
+
+void NavigationCoreMapMatchedPositionProxy::OffRoadPositionChanged(const uint32_t& distance, const int32_t& direction)
+{
+
+}
+
NavigationCoreGuidanceProxy::NavigationCoreGuidanceProxy(DBus::Connection &connection, NavigationCoreProxy *navigationCoreProxy)
: DBus::ObjectProxy(connection,
"/org/genivi/navigationcore",
@@ -43,7 +86,6 @@ NavigationCoreGuidanceProxy::NavigationCoreGuidanceProxy(DBus::Connection &conne
mp_navigationCoreProxy = navigationCoreProxy;
}
-
void NavigationCoreGuidanceProxy::VehicleLeftTheRoadNetwork()
{
@@ -93,6 +135,7 @@ NavigationCoreProxy::NavigationCoreProxy(NavigationCoreWrapper *navigationCoreWr
connection->setup(dispatcher);
mp_navigationCoreWrapper = navigationCoreWrapper;
mp_navigationCoreGuidanceProxy = new NavigationCoreGuidanceProxy(*connection,this);
+ mp_navigationCoreMapMatchedPositionProxy = new NavigationCoreMapMatchedPositionProxy(*connection,this);
}
NavigationCoreProxy::~NavigationCoreProxy()
@@ -106,3 +149,8 @@ void NavigationCoreProxy::GuidanceStatusChanged(const int32_t& guidanceStatus, c
{
mp_navigationCoreWrapper->GuidanceStatusChanged(guidanceStatus,routeHandle);
}
+
+void NavigationCoreProxy::SimulationStatusChanged(const int32_t& simulationStatus)
+{
+ mp_navigationCoreWrapper->SimulationStatusChanged(simulationStatus);
+}
diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.hpp b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.hpp
index 5336e36..44c47aa 100644
--- a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.hpp
+++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/NavigationCoreProxy.hpp
@@ -64,6 +64,26 @@ private:
NavigationCoreProxy* mp_navigationCoreProxy;
};
+class NavigationCoreMapMatchedPositionProxy
+ : public org::genivi::navigationcore::MapMatchedPosition_proxy,
+ public DBus::ObjectProxy
+{
+
+public:
+
+ NavigationCoreMapMatchedPositionProxy(DBus::Connection &connection,NavigationCoreProxy* navigationCoreProxy);
+ void SimulationStatusChanged(const int32_t& simulationStatus);
+ void SimulationSpeedChanged(const uint8_t& speedFactor);
+ void PositionUpdate(const std::vector< int32_t >& changedValues);
+ void AddressUpdate(const std::vector< int32_t >& changedValues);
+ void PositionOnSegmentUpdate(const std::vector< int32_t >& changedValues);
+ void StatusUpdate(const std::vector< int32_t >& changedValues);
+ void OffRoadPositionChanged(const uint32_t& distance, const int32_t& direction);
+
+private:
+ NavigationCoreProxy* mp_navigationCoreProxy;
+};
+
class NavigationCoreWrapper;
class NavigationCoreProxy
{
@@ -71,9 +91,12 @@ class NavigationCoreProxy
public:
NavigationCoreProxy(NavigationCoreWrapper *navigationCoreWrapper);
~NavigationCoreProxy();
+
void GuidanceStatusChanged(const int32_t& guidanceStatus, const uint32_t& routeHandle);
+ void SimulationStatusChanged(const int32_t& simulationStatus);
NavigationCoreGuidanceProxy* mp_navigationCoreGuidanceProxy;
+ NavigationCoreMapMatchedPositionProxy* mp_navigationCoreMapMatchedPositionProxy;
private:
NavigationCoreWrapper* mp_navigationCoreWrapper;
diff --git a/test/html-based-panel/server.js b/test/html-based-panel/server.js
index 38c5296..6ad2a06 100644
--- a/test/html-based-panel/server.js
+++ b/test/html-based-panel/server.js
@@ -120,6 +120,11 @@ var socket_simulation_signal = io.of('/simulation_signal');
var socket_simulation_warning = io.of('/simulation_warning');
// signals
+function simulationStatusChanged(changedValues) {
+ console.log('simulationStatusChanged: ' + changedValues);
+ if(!poll) { socket_simulation_signal.emit('navigationcore_signal', {signal: 'simulationStatusChanged', data: changedValues});}
+}
+var setSimulationStatusChangedListener = i_navigationCoreWrapper.setSimulationStatusChangedListener(simulationStatusChanged);
function guidanceStatusChanged(changedValues) {
console.log('guidanceStatusChanged: ' + changedValues);
if(!poll) { socket_simulation_signal.emit('navigationcore_signal', {signal: 'guidanceStatusChanged', data: changedValues});}
@@ -137,7 +142,7 @@ function tripDataUpdated(changedValues) {
var setTripDataUpdatedListener = i_fuelStopAdvisorWrapper.setTripDataUpdatedListener(tripDataUpdated);
function fuelStopAdvisorWarning(changedValues) {
console.log('fuelStopAdvisorWarning: ' + changedValues);
- if(!poll) { socket_simulation_signal.emit('demonstrator_signal', {signal: 'fuelStopAdvisorWarning', data: changedValues});}
+ socket_simulation_signal.emit('demonstrator_signal', {signal: 'fuelStopAdvisorWarning', data: changedValues});
}
var setFuelStopAdvisorWarningListener = i_fuelStopAdvisorWrapper.setFuelStopAdvisorWarningListener(fuelStopAdvisorWarning);
function tripDataResetted(changedValues) {
@@ -155,6 +160,7 @@ socket_simulation_get.on('connection', function (client) {
client.on('navigationcore_request', function (message) {
switch(message.interface) {
case "NavigationCoreGuidance":
+ case "NavigationCoreMapMatchedPosition":
console.log('Message received: Interface-->' + message.interface +' Method-->', message.method +' Parameters-->' + message.parameters);
if (message.method in i_navigationCoreWrapper && typeof i_navigationCoreWrapper[message.method] === "function") {
var data = i_navigationCoreWrapper[message.method](message.parameters);
@@ -235,7 +241,8 @@ setInterval(function(){
if(poll) {
socket_simulation_signal.emit('positioning_signal', {signal: 'positionUpdate', data: 0});
socket_simulation_signal.emit('demonstrator_signal', {signal: 'tripDataUpdated', data: 0});
- socket_simulation_signal.emit('navigationcore_signal', {signal: 'guidanceStatusChanged', data: 0});
+ socket_simulation_signal.emit('navigationcore_signal', {signal: 'guidanceStatusChanged', data: 0});
+ socket_simulation_signal.emit('navigationcore_signal', {signal: 'simulationStatusChanged', data: 0});
}
}, 1000);
diff --git a/test/html-based-panel/simulation-panel.html b/test/html-based-panel/simulation-panel.html
index 4bf9937..7367662 100644
--- a/test/html-based-panel/simulation-panel.html
+++ b/test/html-based-panel/simulation-panel.html
@@ -128,6 +128,11 @@ socket_simulation_get.on('navigationcore_answer', function(message) {
if(message.request === 'getGuidanceStatus')
{
getGuidanceStatusReturn(message.answer);
+ } else {
+ if(message.request === 'getSimulationStatus')
+ {
+ getSimulationStatusReturn(message.answer);
+ }
}
})
@@ -136,6 +141,11 @@ console.log(message);
if(message.signal === 'guidanceStatusChanged')
{
guidanceStatusChanged(message.data);
+ } else {
+ if(message.signal === 'simulationStatusChanged')
+ {
+ simulationStatusChanged(message.data);
+ }
}
})
@@ -170,6 +180,11 @@ socket_simulation_signal.on('demonstrator_signal', function(message) {
if(message.signal === 'tripDataUpdated')
{
tripDataUpdated(message.data);
+ } else {
+ if(message.signal === 'fuelStopAdvisorWarning')
+ {
+ fuelStopAdvisorWarning(message.data);
+ }
}
})
@@ -177,7 +192,7 @@ socket_simulation_signal.on('demonstrator_signal', function(message) {
var scenarii = new Enum({'START': 1, 'INITIALIZATION': 2, 'HIGH_TANK_LEVEL': 3, 'LOW_TANK_LEVEL': 4});
<!-- DBus GENIVI constants -->
-var genivi_constants = new Enum({'GENIVI_FUELSTOPADVISOR_FUEL_LEVEL': 33, 'GENIVI_FUELSTOPADVISOR_INSTANT_FUEL_CONSUMPTION_PER_DISTANCE': 35, 'GENIVI_FUELSTOPADVISOR_TANK_DISTANCE': 34, 'GENIVI_FUELSTOPADVISOR_ENHANCED_TANK_DISTANCE': 36,'GENIVI_NAVIGATIONCORE_ACTIVE':96,'GENIVI_NAVIGATIONCORE_INACTIVE':97});
+var genivi_constants = new Enum({'GENIVI_FUELSTOPADVISOR_FUEL_LEVEL': 33, 'GENIVI_FUELSTOPADVISOR_INSTANT_FUEL_CONSUMPTION_PER_DISTANCE': 35, 'GENIVI_FUELSTOPADVISOR_TANK_DISTANCE': 34, 'GENIVI_FUELSTOPADVISOR_ENHANCED_TANK_DISTANCE': 36,'GENIVI_NAVIGATIONCORE_ACTIVE':96,'GENIVI_NAVIGATIONCORE_INACTIVE':97,'GENIVI_NAVIGATIONCORE_SIMULATION_STATUS_RUNNING': 545});
<!-- initialization -->
var today=new Date();
@@ -205,6 +220,17 @@ function getVersion() {
function getVersionReturn(answer) {
document.getElementById("version").innerHTML=answer[3];
}
+function getSimulationStatus() {
+ socket_simulation_get.emit('navigationcore_request', {interface: 'NavigationCoreMapMatchedPosition', method: 'getSimulationStatus', parameters: []});
+}
+function getSimulationStatusReturn(answer) {
+ if (answer[0] === genivi_constants.get('GENIVI_NAVIGATIONCORE_SIMULATION_STATUS_RUNNING').value) {
+ document.getElementById("simulation_status").innerHTML= 'ON';
+ }
+ else {
+ document.getElementById("simulation_status").innerHTML= 'OFF';
+ }
+}
function getGuidanceStatus() {
socket_simulation_get.emit('navigationcore_request', {interface: 'NavigationCoreGuidance', method: 'getGuidanceStatus', parameters: []});
}
@@ -273,19 +299,36 @@ function getInstantConsumptionReturn(answer) {
<!-- signals -->
function positionUpdate(changedValues) {
+//for the moment, the changedValues is not used
getPositionInfo();
}
function tripDataUpdated(number) {
+//for the moment, the changedValues is not used
getInstantData();
getLevel();
getInstantConsumption();
}
function guidanceStatusChanged(changedValues) {
+//for the moment, the changedValues is not used
getGuidanceStatus();
}
+function simulationStatusChanged(changedValues) {
+//for the moment, the changedValues is not used
+ getSimulationStatus();
+}
+
+function fuelStopAdvisorWarning(changedValues) {
+ if (changedValues === true) {
+ document.getElementById("warning_status").innerHTML='ON';
+ }
+ else {
+ document.getElementById("warning_status").innerHTML='OFF';
+ }
+}
+
<!-- some other functions -->
function stepChange(button) {
var data = scenarii.get(button.value).key;