diff options
Diffstat (limited to 'test')
25 files changed, 3648 insertions, 0 deletions
diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000..9c4c9ea --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,5 @@ +*.user +*.config +*.creator +*.files +*.includes
\ No newline at end of file diff --git a/test/html-based-panel/.gitignore b/test/html-based-panel/.gitignore new file mode 100644 index 0000000..d2c548f --- /dev/null +++ b/test/html-based-panel/.gitignore @@ -0,0 +1,4 @@ +node_modules +~ +build +*.tgz diff --git a/test/html-based-panel/README.md b/test/html-based-panel/README.md new file mode 100644 index 0000000..2657223 --- /dev/null +++ b/test/html-based-panel/README.md @@ -0,0 +1,41 @@ +Preliminary code for testing the implementation of a set of navigation Web API based on GENIVI API +Technology used: nodejs + +To get a given version of nodejs (e.g. 0.12): +curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash +sudo apt-get install -y nodejs +NB: not supported by my trusty :-( + +For the time being, version is v0.10.25: +sudo apt-get install nodejs npm +npm install -g node-gyp + +To build the c++ add-on in C++ and install the module localy for nodejs: +cd ./node-cpp-lbs-modules +npm build . +npm pack +cd .. +npm install node-cpp-lbs-modules/node-cpp-lbs-modules-0.1.0.tgz + +To test: +Intall additional modules for nodejs: +npm install http url fs path socket.io + +Run the server: + +nodejs server.js + +In your browser open the file ./index.html + +Annex: +To debug the C++ add-on: +cd ./node-cpp-lbs-modules +node-gyp configure --debug +node-gyp build --debug +npm pack +cd .. +npm install node-cpp-lbs-modules/node-cpp-lbs-modules-0.1.0.tgz +To see where the issue is in the js file: +nodejs debug server.js +To debug the c++ addon: +gdb --args /usr/bin/nodejs server.js diff --git a/test/html-based-panel/js/resource.js b/test/html-based-panel/js/resource.js new file mode 100644 index 0000000..90dde2c --- /dev/null +++ b/test/html-based-panel/js/resource.js @@ -0,0 +1,33 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen +* +* \file resource.js.in +* +* \brief This file is part of the navigation hmi. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 1.0 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +var generatedNodejsModulePath="node-cpp-lbs-modules/build/Release/"; +var iconPath = "images"; +var constantPath = "."; +exports.generatedNodejsModulePath = generatedNodejsModulePath; +exports.iconPath = iconPath; +exports.constantPath = constantPath; + diff --git a/test/html-based-panel/js/resource.js.in b/test/html-based-panel/js/resource.js.in new file mode 100644 index 0000000..1864885 --- /dev/null +++ b/test/html-based-panel/js/resource.js.in @@ -0,0 +1,33 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen +* +* \file resource.js.in +* +* \brief This file is part of the navigation hmi. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 1.0 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +var generatedNodejsModulePath="@GENERATED_NODEJS_MODULE_PATH@"; +var iconPath = "@ICON_PATH@"; +var constantPath = "@CONSTANT_PATH@"; +exports.generatedNodejsModulePath = generatedNodejsModulePath; +exports.iconPath = iconPath; +exports.constantPath = constantPath; + diff --git a/test/html-based-panel/node-cpp-lbs-modules/FuelStopAdvisorWrapper.cpp b/test/html-based-panel/node-cpp-lbs-modules/FuelStopAdvisorWrapper.cpp new file mode 100644 index 0000000..a34f0bc --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/FuelStopAdvisorWrapper.cpp @@ -0,0 +1,232 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#include <node.h> + +#include "FuelStopAdvisorWrapper.hpp" + +using namespace std; + + +v8::Persistent<v8::FunctionTemplate> FuelStopAdvisorWrapper::constructor; + +v8::Persistent<v8::Function> FuelStopAdvisorWrapper::signalTripDataUpdated; + +void FuelStopAdvisorWrapper::TripDataUpdated(const uint8_t& number) +{ + v8::HandleScope scope(); + + const unsigned argc = 1; + v8::Local<v8::Value> argv[argc]; + + argv[0]=v8::Local<v8::Value>::New(v8::Integer::New(number)); + + v8::Persistent<v8::Function> fct = static_cast<v8::Function*>(*signalTripDataUpdated); + fct->Call(v8::Context::GetCurrent()->Global(), argc, argv); +} + +v8::Handle<v8::Value> FuelStopAdvisorWrapper::SetTripDataUpdatedListener(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")) + ); + } + + signalTripDataUpdated = 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(signalTripDataUpdated->IsFunction()) ); + + return scope.Close(ret); +} + +v8::Persistent<v8::Function> FuelStopAdvisorWrapper::signalFuelStopAdvisorWarning; + +void FuelStopAdvisorWrapper::FuelStopAdvisorWarning(const bool &destinationCantBeReached) +{ + v8::HandleScope scope; + + const unsigned argc = 1; + v8::Local<v8::Value> argv[argc]; + + argv[0]=v8::Local<v8::Value>::New(v8::Boolean::New(destinationCantBeReached)); + + v8::Persistent<v8::Function> fct = static_cast<v8::Function*>(*signalFuelStopAdvisorWarning); + fct->Call(v8::Context::GetCurrent()->Global(), argc, argv); +} + +v8::Handle<v8::Value> FuelStopAdvisorWrapper::SetFuelStopAdvisorWarningListener(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")) + ); + } + + signalFuelStopAdvisorWarning = 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(signalFuelStopAdvisorWarning->IsFunction()) ); + + return scope.Close(ret); +} + +v8::Persistent<v8::Function> FuelStopAdvisorWrapper::signalTripDataResetted; + +void FuelStopAdvisorWrapper::TripDataResetted(const uint8_t& number) +{ + v8::HandleScope scope; + + const unsigned argc = 1; + v8::Local<v8::Value> argv[argc]; + + argv[0]=v8::Local<v8::Value>::New(v8::Integer::New(number)); + + v8::Persistent<v8::Function> fct = static_cast<v8::Function*>(*signalTripDataResetted); + fct->Call(v8::Context::GetCurrent()->Global(), argc, argv); +} + +v8::Handle<v8::Value> FuelStopAdvisorWrapper::SetTripDataResettedListener(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")) + ); + } + + signalTripDataResetted = 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(signalTripDataResetted->IsFunction()) ); + + return scope.Close(ret); +} + +void FuelStopAdvisorWrapper::Init(v8::Handle<v8::Object> target) { + v8::HandleScope scope; + + v8::Local<v8::FunctionTemplate> tpl = v8::FunctionTemplate::New(New); + v8::Local<v8::String> name = v8::String::NewSymbol("FuelStopAdvisorWrapper"); + + constructor = v8::Persistent<v8::FunctionTemplate>::New(tpl); + // ObjectWrap uses the first internal field to store the wrapped pointer. + constructor->InstanceTemplate()->SetInternalFieldCount(1); + constructor->SetClassName(name); + + // Add all prototype methods, getters and setters here. + NODE_SET_PROTOTYPE_METHOD(constructor, "getVersion", GetVersion); + NODE_SET_PROTOTYPE_METHOD(constructor, "getInstantData", GetInstantData); + NODE_SET_PROTOTYPE_METHOD(constructor, "setTripDataUpdatedListener", SetTripDataUpdatedListener); + NODE_SET_PROTOTYPE_METHOD(constructor, "setFuelStopAdvisorWarningListener", SetFuelStopAdvisorWarningListener); + NODE_SET_PROTOTYPE_METHOD(constructor, "setTripDataResettedListener", SetTripDataResettedListener); + + // This has to be last, otherwise the properties won't show up on the + // object in JavaScript. + target->Set(name, constructor->GetFunction()); +} + +FuelStopAdvisorWrapper::FuelStopAdvisorWrapper() { +} + +FuelStopAdvisorWrapper::~FuelStopAdvisorWrapper() { +} + +v8::Handle<v8::Value> FuelStopAdvisorWrapper::New(const v8::Arguments& args) { + v8::HandleScope scope; + + if (!args.IsConstructCall()) { + return v8::ThrowException(v8::Exception::TypeError( + v8::String::New("Use the new operator to create instances of this object.")) + ); + } + + // Creates a new instance object of this type and wraps it. + FuelStopAdvisorWrapper* obj = new FuelStopAdvisorWrapper(); + + DemonstratorProxy* proxy = new DemonstratorProxy(obj); + obj->mp_demonstratorProxy = proxy; + obj->Wrap(args.This()); + + return args.This(); +} + +v8::Handle<v8::Value> FuelStopAdvisorWrapper::GetVersion(const v8::Arguments& args) { + v8::HandleScope scope; //to properly clean up v8 handles + + // Retrieves the pointer to the wrapped object instance. + FuelStopAdvisorWrapper* obj = ObjectWrap::Unwrap<FuelStopAdvisorWrapper>(args.This()); + + ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > DBus_version = obj->mp_demonstratorProxy->mp_fuelStopAdvisorProxy->GetVersion(); + + v8::Local<v8::Object> ret = v8::Object::New(); + ret->Set( 0, v8::Int32::New(DBus_version._1) ); + ret->Set( 1, v8::Int32::New(DBus_version._2) ); + ret->Set( 2, v8::Int32::New(DBus_version._3) ); + ret->Set( 3, v8::String::New(DBus_version._4.c_str()) ); + + return scope.Close(ret); +} + +v8::Handle<v8::Value> FuelStopAdvisorWrapper::GetInstantData(const v8::Arguments& args) { + v8::HandleScope scope; //to properly clean up v8 handles + + // Retrieves the pointer to the wrapped object instance. + FuelStopAdvisorWrapper* obj = ObjectWrap::Unwrap<FuelStopAdvisorWrapper>(args.This()); + + std::map< uint16_t, ::DBus::Variant > instant_data = obj->mp_demonstratorProxy->mp_fuelStopAdvisorProxy->GetInstantData(); + + v8::Local<v8::Array> ret = v8::Array::New(); + + for (std::map< uint16_t, ::DBus::Variant >::iterator iter = instant_data.begin(); iter != instant_data.end(); iter++) { + v8::Local<v8::Object> data = v8::Object::New(); + ::DBus::Variant value; + value = iter->second; + data->Set(v8::String::New("key"), v8::Uint32::New(iter->first)); + switch (iter->first) { + case GENIVI_FUELSTOPADVISOR_DISTANCE: + case GENIVI_FUELSTOPADVISOR_ENHANCED_TANK_DISTANCE: + data->Set(v8::String::New("value"), v8::Number::New(value)); + default: + break; + } + ret->Set(ret->Length(), data); + } + + return scope.Close(ret); +} + +void RegisterModule(v8::Handle<v8::Object> target) { + FuelStopAdvisorWrapper::Init(target); +} + +NODE_MODULE(FuelStopAdvisorWrapper, RegisterModule); diff --git a/test/html-based-panel/node-cpp-lbs-modules/FuelStopAdvisorWrapper.hpp b/test/html-based-panel/node-cpp-lbs-modules/FuelStopAdvisorWrapper.hpp new file mode 100644 index 0000000..d8ab224 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/FuelStopAdvisorWrapper.hpp @@ -0,0 +1,77 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#ifndef FUELSTOPADVISERWRAPPER_HPP +#define FUELSTOPADVISERWRAPPER_HPP + +#define USE_DBUS 0 + +#include <node.h> +#include <node_buffer.h> + +#include "./dbus-proxies/DemonstratorProxy.hpp" + +#include <string> +#include <vector> +#include <map> + +// Do not include this line. It's generally frowned upon to use namespaces +// in header files as it may cause issues with other code that includes your +// header file. +// using namespace v8; + +class FuelStopAdvisorWrapper : public node::ObjectWrap { + friend void DemonstratorProxy::TripDataResetted(const uint8_t &number); + friend void DemonstratorProxy::TripDataUpdated(const uint8_t &number); + friend void DemonstratorProxy::FuelStopAdvisorWarning(const bool &destinationCantBeReached); + +public: + static v8::Persistent<v8::FunctionTemplate> constructor; + static void Init(v8::Handle<v8::Object> target); + static v8::Persistent<v8::Function> signalTripDataUpdated; + static v8::Persistent<v8::Function> signalFuelStopAdvisorWarning; + static v8::Persistent<v8::Function> signalTripDataResetted; + +protected: + FuelStopAdvisorWrapper(); + ~FuelStopAdvisorWrapper(); + + static v8::Handle<v8::Value> New(const v8::Arguments& args); + static v8::Handle<v8::Value> GetVersion(const v8::Arguments& args); + static v8::Handle<v8::Value> GetInstantData(const v8::Arguments& args); + + static v8::Handle<v8::Value> SetTripDataResettedListener(const v8::Arguments& args); + void TripDataResetted(const uint8_t& number); + static v8::Handle<v8::Value> SetTripDataUpdatedListener(const v8::Arguments& args); + void TripDataUpdated(const uint8_t& number); + static v8::Handle<v8::Value> SetFuelStopAdvisorWarningListener(const v8::Arguments& args); + void FuelStopAdvisorWarning(const bool& destinationCantBeReached); + +private: + DemonstratorProxy* mp_demonstratorProxy; +}; + +#endif diff --git a/test/html-based-panel/node-cpp-lbs-modules/Makefile b/test/html-based-panel/node-cpp-lbs-modules/Makefile new file mode 100644 index 0000000..251f4cc --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/Makefile @@ -0,0 +1,19 @@ +all: clean configure.release build pack + +release: configure.release build pack + +debug: configure.debug build pack + +configure.%: + @node-gyp configure --$* + +build: + @node-gyp build + +pack: + npm pack + +clean: + @node-gyp clean + +.PHONY: build diff --git a/test/html-based-panel/node-cpp-lbs-modules/PositioningEnhancedPositionWrapper.cpp b/test/html-based-panel/node-cpp-lbs-modules/PositioningEnhancedPositionWrapper.cpp new file mode 100644 index 0000000..413e3c0 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/PositioningEnhancedPositionWrapper.cpp @@ -0,0 +1,178 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#include <node.h> + +#include "PositioningEnhancedPositionWrapper.hpp" + +using namespace std; + + +v8::Persistent<v8::FunctionTemplate> PositioningEnhancedPositionWrapper::constructor; + +v8::Persistent<v8::Function> PositioningEnhancedPositionWrapper::signalPositionUpdate; +void PositioningEnhancedPositionWrapper::PositionUpdate(const uint64_t& changedValues) { + v8::HandleScope scope; + + const unsigned argc = 2; + uint64to32 data; + data.full = changedValues; + v8::Local<v8::Value> argv[argc]; + argv[0] = v8::Local<v8::Value>::New(v8::Uint32::New(data.p.high)); + argv[1] = v8::Local<v8::Value>::New(v8::Uint32::New(data.p.low)); + + v8::Persistent<v8::Function> fct = static_cast<v8::Function*>(*signalPositionUpdate); + fct->Call(v8::Context::GetCurrent()->Global(), argc, argv); +} +v8::Handle<v8::Value> PositioningEnhancedPositionWrapper::SetPositionUpdateListener(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")) + ); + } + + signalPositionUpdate = 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(signalPositionUpdate->IsFunction()) ); + + return scope.Close(ret); +} + +void PositioningEnhancedPositionWrapper::Init(v8::Handle<v8::Object> target) { + v8::HandleScope scope; + + v8::Local<v8::FunctionTemplate> tpl = v8::FunctionTemplate::New(New); + v8::Local<v8::String> name = v8::String::NewSymbol("PositioningEnhancedPositionWrapper"); + + constructor = v8::Persistent<v8::FunctionTemplate>::New(tpl); + // ObjectWrap uses the first internal field to store the wrapped pointer. + constructor->InstanceTemplate()->SetInternalFieldCount(1); + constructor->SetClassName(name); + + // Add all prototype methods, getters and setters here. + NODE_SET_PROTOTYPE_METHOD(constructor, "getVersion", GetVersion); + NODE_SET_PROTOTYPE_METHOD(constructor, "getPositionInfo", GetPositionInfo); + NODE_SET_PROTOTYPE_METHOD(constructor, "setPositionUpdateListener", SetPositionUpdateListener); + + // This has to be last, otherwise the properties won't show up on the + // object in JavaScript. + target->Set(name, constructor->GetFunction()); +} + +PositioningEnhancedPositionWrapper::PositioningEnhancedPositionWrapper() { +} + +PositioningEnhancedPositionWrapper::~PositioningEnhancedPositionWrapper() { +} + +v8::Handle<v8::Value> PositioningEnhancedPositionWrapper::New(const v8::Arguments& args) { + v8::HandleScope scope; + + if (!args.IsConstructCall()) { + return v8::ThrowException(v8::Exception::TypeError( + v8::String::New("Use the new operator to create instances of this object.")) + ); + } + + // Creates a new instance object of this type and wraps it. + PositioningEnhancedPositionWrapper* obj = new PositioningEnhancedPositionWrapper(); + + PositioningProxy* proxy = new PositioningProxy(obj); + obj->mp_positioningProxy = proxy; + obj->Wrap(args.This()); + + return args.This(); +} + +v8::Handle<v8::Value> PositioningEnhancedPositionWrapper::GetVersion(const v8::Arguments& args) { + v8::HandleScope scope; //to properly clean up v8 handles + + // Retrieves the pointer to the wrapped object instance. + PositioningEnhancedPositionWrapper* obj = ObjectWrap::Unwrap<PositioningEnhancedPositionWrapper>(args.This()); + + ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > DBus_version = obj->mp_positioningProxy->mp_enhancedPositionProxy->GetVersion(); + + v8::Local<v8::Object> ret = v8::Object::New(); + ret->Set( 0, v8::Int32::New(DBus_version._1) ); + ret->Set( 1, v8::Int32::New(DBus_version._2) ); + ret->Set( 2, v8::Int32::New(DBus_version._3) ); + ret->Set( 3, v8::String::New(DBus_version._4.c_str()) ); + + return scope.Close(ret); +} + +v8::Handle<v8::Value> PositioningEnhancedPositionWrapper::GetPositionInfo(const v8::Arguments& args) { + v8::HandleScope scope; //to properly clean up v8 handles + + // Retrieves the pointer to the wrapped object instance. + PositioningEnhancedPositionWrapper* obj = ObjectWrap::Unwrap<PositioningEnhancedPositionWrapper>(args.This()); + uint64_t valuesToReturn=GENIVI_ENHANCEDPOSITIONSERVICE_LATITUDE | GENIVI_ENHANCEDPOSITIONSERVICE_LONGITUDE | GENIVI_ENHANCEDPOSITIONSERVICE_ALTITUDE; + uint64_t timestamp; + std::map< uint64_t, ::DBus::Variant > position; + obj->mp_positioningProxy->mp_enhancedPositionProxy->GetPositionInfo(valuesToReturn, timestamp, position); + + + v8::Local<v8::Array> ret = v8::Array::New(); + + v8::Local<v8::Object> tst = v8::Object::New(); + uint64to32 t; + t.full = timestamp; + tst->Set(v8::String::New("timestamp_msb"), v8::Uint32::New(t.p.high)); + tst->Set(v8::String::New("timestamp_lsb"), v8::Uint32::New(t.p.low)); + ret->Set(ret->Length(), tst); + + for (std::map< uint64_t, ::DBus::Variant >::iterator iter = position.begin(); iter != position.end(); iter++) { + v8::Local<v8::Object> data = v8::Object::New(); + ::DBus::Variant value; + uint64to32 key; + value = iter->second; + key.full = iter->first; + data->Set(v8::String::New("key_msb"), v8::Uint32::New(key.p.high)); + data->Set(v8::String::New("key_lsb"), v8::Uint32::New(key.p.low)); + switch (iter->first) { + case GENIVI_ENHANCEDPOSITIONSERVICE_LATITUDE: + case GENIVI_ENHANCEDPOSITIONSERVICE_LONGITUDE: + case GENIVI_ENHANCEDPOSITIONSERVICE_ALTITUDE: + default: + data->Set(v8::String::New("value"), v8::Number::New(value)); + break; + } + ret->Set(ret->Length(), data); + } + + return scope.Close(ret); +} + + +void RegisterModule(v8::Handle<v8::Object> target) { + PositioningEnhancedPositionWrapper::Init(target); +} + +NODE_MODULE(PositioningEnhancedPositionWrapper, RegisterModule); diff --git a/test/html-based-panel/node-cpp-lbs-modules/PositioningEnhancedPositionWrapper.hpp b/test/html-based-panel/node-cpp-lbs-modules/PositioningEnhancedPositionWrapper.hpp new file mode 100644 index 0000000..c9f37ad --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/PositioningEnhancedPositionWrapper.hpp @@ -0,0 +1,77 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#ifndef POSITIONINGENHANCEDPOSITIONWRAPPER_HPP +#define POSITIONINGENHANCEDPOSITIONWRAPPER_HPP + +#define USE_DBUS 0 + +#include <node.h> +#include <node_buffer.h> + +#include "./dbus-proxies/PositioningProxy.hpp" + +#include <string> +#include <vector> +#include <map> + +// Do not include this line. It's generally frowned upon to use namespaces +// in header files as it may cause issues with other code that includes your +// header file. +// using namespace v8; + +class PositioningEnhancedPositionWrapper : public node::ObjectWrap { + friend void PositioningProxy::PositionUpdate(const uint64_t &changedValues); + +public: + static v8::Persistent<v8::FunctionTemplate> constructor; + static void Init(v8::Handle<v8::Object> target); + static v8::Persistent<v8::Function> signalPositionUpdate; + +protected: + PositioningEnhancedPositionWrapper(); + ~PositioningEnhancedPositionWrapper(); + + typedef union { + uint64_t full; + struct { + uint32_t low; + uint32_t high; + } p; + } uint64to32; + + static v8::Handle<v8::Value> New(const v8::Arguments& args); + static v8::Handle<v8::Value> GetVersion(const v8::Arguments& args); + static v8::Handle<v8::Value> GetPositionInfo(const v8::Arguments& args); + + static v8::Handle<v8::Value> SetPositionUpdateListener(const v8::Arguments& args); + static void PositionUpdate(const uint64_t& changedValues); + +private: + PositioningProxy* mp_positioningProxy; +}; + +#endif diff --git a/test/html-based-panel/node-cpp-lbs-modules/binding.gyp b/test/html-based-panel/node-cpp-lbs-modules/binding.gyp new file mode 100644 index 0000000..559f19a --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/binding.gyp @@ -0,0 +1,38 @@ +{ + 'targets': [ + { + 'target_name': 'PositioningProxy', + 'product_prefix': 'lib', + 'type': 'shared_library', + 'sources': [ './dbus-proxies/PositioningProxy.cpp' ], + 'include_dirs': ['./','/usr/include/dbus-c++-1/','/usr/include/glib-2.0/','/usr/lib/i386-linux-gnu/glib-2.0/include/','/usr/lib/x86_64-linux-gnu/glib-2.0/include/'], + 'cflags_cc': ['-Wall', '-std=gnu++11', '-fexceptions','-fPIC'], + 'libraries': ['-ldbus-c++-1 -ldbus-1 -ldbus-c++-glib-1', '-L/usr/lib/i386-linux-gnu/'] + }, + { + 'target_name': 'PositioningEnhancedPositionWrapper', + 'dependencies': [ 'PositioningProxy' ], + 'sources': [ './PositioningEnhancedPositionWrapper.cpp' ], + 'include_dirs': ['./','./dbus-proxies','/usr/include/dbus-c++-1/','/usr/include/glib-2.0/','/usr/lib/i386-linux-gnu/glib-2.0/include/','/usr/lib/x86_64-linux-gnu/glib-2.0/include/'], + 'cflags_cc': ['-Wall', '-std=gnu++11', '-fexceptions'], + 'libraries': ['-ldbus-c++-1 -ldbus-1 -ldbus-c++-glib-1', '-L/usr/lib/i386-linux-gnu/'] + }, + { + 'target_name': 'DemonstratorProxy', + 'product_prefix': 'lib', + 'type': 'shared_library', + 'sources': [ './dbus-proxies/DemonstratorProxy.cpp' ], + 'include_dirs': ['./','/usr/include/dbus-c++-1/','/usr/include/glib-2.0/','/usr/lib/i386-linux-gnu/glib-2.0/include/','/usr/lib/x86_64-linux-gnu/glib-2.0/include/'], + 'cflags_cc': ['-Wall', '-std=gnu++11', '-fexceptions','-fPIC'], + 'libraries': ['-ldbus-c++-1 -ldbus-1 -ldbus-c++-glib-1', '-L/usr/lib/i386-linux-gnu/'] + }, + { + 'target_name': 'FuelStopAdvisorWrapper', + 'dependencies': [ 'DemonstratorProxy' ], + 'sources': [ './FuelStopAdvisorWrapper.cpp' ], + 'include_dirs': ['./','./dbus-proxies','/usr/include/dbus-c++-1/','/usr/include/glib-2.0/','/usr/lib/i386-linux-gnu/glib-2.0/include/','/usr/lib/x86_64-linux-gnu/glib-2.0/include/'], + 'cflags_cc': ['-Wall', '-std=gnu++11', '-fexceptions'], + 'libraries': ['-ldbus-c++-1 -ldbus-1 -ldbus-c++-glib-1', '-L/usr/lib/i386-linux-gnu/'] + } + ] +} diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/DemonstratorProxy.cpp b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/DemonstratorProxy.cpp new file mode 100644 index 0000000..dc0096c --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/DemonstratorProxy.cpp @@ -0,0 +1,120 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#include <node.h> + +#include "DemonstratorProxy.hpp" +#include "../FuelStopAdvisorWrapper.hpp" + +using namespace v8; +using namespace std; + +static DBus::Glib::BusDispatcher *dispatcher; +static DBus::Connection *connection; +static DBus::Glib::BusDispatcher *amb_dispatcher; +static DBus::Connection *amb_connection; + +FuelStopAdvisorProxy::FuelStopAdvisorProxy(DBus::Connection &connection, DemonstratorProxy *demonstratorProxy) + : DBus::ObjectProxy(connection, + "/org/genivi/demonstrator/FuelStopAdvisor", + "org.genivi.demonstrator.FuelStopAdvisor") +{ + mp_demonstratorProxy = demonstratorProxy; +} + +void FuelStopAdvisorProxy::TripDataResetted(const uint8_t& number) +{ + mp_demonstratorProxy->TripDataResetted(number); +} + +void FuelStopAdvisorProxy::TripDataUpdated(const uint8_t& number) +{ + mp_demonstratorProxy->TripDataUpdated(number); +} + +void FuelStopAdvisorProxy::FuelStopAdvisorWarning(const bool& destinationCantBeReached) +{ + mp_demonstratorProxy->FuelStopAdvisorWarning(destinationCantBeReached); +} + +ManagerProxy::ManagerProxy(DBus::Connection &connection, DemonstratorProxy *demonstratorProxy) + : DBus::ObjectProxy(connection, + "/", + "org.automotive.message.broker") +{ + mp_demonstratorProxy = demonstratorProxy; +} + +DemonstratorProxy::DemonstratorProxy(FuelStopAdvisorWrapper *fuelStopAdvisorWrapper) +{ + dispatcher = new DBus::Glib::BusDispatcher(); + DBus::default_dispatcher = dispatcher; + dispatcher->attach(NULL); + connection = new DBus::Connection(DBus::Connection::SessionBus()); + connection->setup(dispatcher); + mp_fuelStopAdvisorWrapper = fuelStopAdvisorWrapper; + mp_fuelStopAdvisorProxy = new FuelStopAdvisorProxy(*connection,this); + + amb_dispatcher = new DBus::Glib::BusDispatcher(); + DBus::default_dispatcher = amb_dispatcher; + amb_dispatcher->attach(NULL); + amb_connection = new DBus::Connection(DBus::Connection::SessionBus()); + amb_connection->setup(amb_dispatcher); + + mp_managerProxy = new ManagerProxy(*amb_connection, this); + + mp_managerProxy->m_fuel = mp_managerProxy->FindObject("Fuel"); + mp_managerProxy->m_odometer = mp_managerProxy->FindObject("Odometer"); + mp_managerProxy->m_engine_speed = mp_managerProxy->FindObject("EngineSpeed"); + + mp_managerProxy->mp_fuel_properties = new Properties(*amb_connection,mp_managerProxy->m_fuel[0]); + mp_managerProxy->mp_odometer_properties = new Properties(*amb_connection,mp_managerProxy->m_odometer[0]); + mp_managerProxy->mp_engine_speed_properties = new Properties(*amb_connection,mp_managerProxy->m_engine_speed[0]); + +} + +DemonstratorProxy::~DemonstratorProxy() +{ + delete mp_fuelStopAdvisorProxy; + delete mp_managerProxy; + delete connection; + delete dispatcher; +} + +void DemonstratorProxy::TripDataResetted(const uint8_t& number) +{ + mp_fuelStopAdvisorWrapper->TripDataResetted(number); +} + +void DemonstratorProxy::TripDataUpdated(const uint8_t& number) +{ + mp_fuelStopAdvisorWrapper->TripDataUpdated(number); +} + +void DemonstratorProxy::FuelStopAdvisorWarning(const bool& destinationCantBeReached) +{ + mp_fuelStopAdvisorWrapper->FuelStopAdvisorWarning(destinationCantBeReached); +} diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/DemonstratorProxy.hpp b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/DemonstratorProxy.hpp new file mode 100644 index 0000000..41ba258 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/DemonstratorProxy.hpp @@ -0,0 +1,124 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#ifndef FUELSTOPADVISORPROXY_HPP +#define FUELSTOPADVISORPROXY_HPP + +#include "genivi-dbus-model.h" + +#include <node.h> +#include <node_buffer.h> + +#include <string> +#include <vector> +#include <map> + +// Do not include this line. It's generally frowned upon to use namespaces +// in header files as it may cause issues with other code that includes your +// header file. +// using namespace v8; + +class DemonstratorProxy; +class FuelStopAdvisorProxy + : public org::genivi::demonstrator::FuelStopAdvisor_proxy, + public DBus::ObjectProxy +{ +public: + + FuelStopAdvisorProxy(DBus::Connection &connection,DemonstratorProxy* demonstratorProxy); + void TripDataResetted(const uint8_t& number); + void TripDataUpdated(const uint8_t& number); + void FuelStopAdvisorWarning(const bool& destinationCantBeReached); + +private: + DemonstratorProxy* mp_demonstratorProxy; +}; + +class Properties +: public ::DBus::InterfaceProxy, + public ::DBus::ObjectProxy +{ + public: + + Properties(::DBus::Connection &connection, ::DBus::Path path) + : ::DBus::InterfaceProxy("org.freedesktop.DBus.Properties"), + ::DBus::ObjectProxy(connection, path,"org.automotive.message.broker") + { + } + ::DBus::Variant Get(const std::string &iface, const std::string &property) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << iface; + wi << property; + call.member("Get"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + ::DBus::Variant argout; + ri >> argout; + return argout; + } +}; + +class ManagerProxy + : public org::automotive::Manager_proxy, + public DBus::ObjectProxy +{ +public: + + ManagerProxy(DBus::Connection &connection, DemonstratorProxy *demonstratorProxy); + std::vector< ::DBus::Path > m_fuel; + std::vector< ::DBus::Path > m_odometer; + std::vector< ::DBus::Path > m_engine_speed; + Properties *mp_fuel_properties; + Properties *mp_odometer_properties; + Properties *mp_engine_speed_properties; + +private: + DemonstratorProxy* mp_demonstratorProxy; + +}; + +class FuelStopAdvisorWrapper; +class DemonstratorProxy +{ +public: + DemonstratorProxy(FuelStopAdvisorWrapper* fuelStopAdvisorWrapper); + ~DemonstratorProxy(); + + FuelStopAdvisorProxy* mp_fuelStopAdvisorProxy; + void TripDataResetted(const uint8_t& number); + void TripDataUpdated(const uint8_t& number); + void FuelStopAdvisorWarning(const bool& destinationCantBeReached); + + ManagerProxy* mp_managerProxy; + +private: + FuelStopAdvisorWrapper* mp_fuelStopAdvisorWrapper; +}; + +#endif diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/PositioningProxy.cpp b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/PositioningProxy.cpp new file mode 100644 index 0000000..903767e --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/PositioningProxy.cpp @@ -0,0 +1,72 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#include <node.h> + +#include "PositioningProxy.hpp" +#include "../PositioningEnhancedPositionWrapper.hpp" + +using namespace v8; +using namespace std; + +static DBus::Glib::BusDispatcher *dispatcher; +static DBus::Connection *connection; + +PositioningEnhancedPositionProxy::PositioningEnhancedPositionProxy(DBus::Connection &connection, PositioningProxy *positioningProxy) + : DBus::ObjectProxy(connection, + "/org/genivi/positioning/EnhancedPosition", + "org.genivi.positioning.EnhancedPosition") +{ + mp_positioningProxy = positioningProxy; +} + +void PositioningEnhancedPositionProxy::PositionUpdate(const uint64_t& changedValues) +{ + mp_positioningProxy->PositionUpdate(changedValues); +} + +PositioningProxy::PositioningProxy(PositioningEnhancedPositionWrapper *positioningEnhancedPositionWrapper) +{ + dispatcher = new DBus::Glib::BusDispatcher(); + DBus::default_dispatcher = dispatcher; + dispatcher->attach(NULL); + connection = new DBus::Connection(DBus::Connection::SessionBus()); + connection->setup(dispatcher); + mp_positioningEnhancedPositionWrapper = positioningEnhancedPositionWrapper; + mp_enhancedPositionProxy = new PositioningEnhancedPositionProxy(*connection,this); +} + +PositioningProxy::~PositioningProxy() +{ + delete mp_enhancedPositionProxy; + delete connection; + delete dispatcher; +} + +void PositioningProxy::PositionUpdate(const uint64_t& changedValues) +{ + mp_positioningEnhancedPositionWrapper->PositionUpdate(changedValues); +} diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/PositioningProxy.hpp b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/PositioningProxy.hpp new file mode 100644 index 0000000..becec4c --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/PositioningProxy.hpp @@ -0,0 +1,72 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#ifndef POSITIONINGPROXY_HPP +#define POSITIONINGPROXY_HPP + +#include "genivi-dbus-model.h" + +#include <node.h> +#include <node_buffer.h> + +#include <string> +#include <vector> +#include <map> + +// Do not include this line. It's generally frowned upon to use namespaces +// in header files as it may cause issues with other code that includes your +// header file. +// using namespace v8; + +class PositioningProxy; +class PositioningEnhancedPositionProxy + : public org::genivi::positioning::EnhancedPosition_proxy, + public DBus::ObjectProxy +{ +public: + + PositioningEnhancedPositionProxy(DBus::Connection &connection,PositioningProxy* positioningProxy); + void PositionUpdate(const uint64_t& changedValues); + +private: + PositioningProxy* mp_positioningProxy; +}; + +class PositioningEnhancedPositionWrapper; +class PositioningProxy +{ +public: + PositioningProxy(PositioningEnhancedPositionWrapper* positioningEnhancedPositionWrapper); + ~PositioningProxy(); + + PositioningEnhancedPositionProxy* mp_enhancedPositionProxy; + void PositionUpdate(const uint64_t& changedValues); + +private: + PositioningEnhancedPositionWrapper* mp_positioningEnhancedPositionWrapper; +}; + +#endif diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/amb_proxy.h b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/amb_proxy.h new file mode 100644 index 0000000..de3f9d0 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/amb_proxy.h @@ -0,0 +1,136 @@ + +/* + * This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT! + */ + +#ifndef __dbusxx___home_psa_Desktop_genivi_navigation_application_master_src_build_fuel_stop_advisor_amb_proxy_h__PROXY_MARSHAL_H +#define __dbusxx___home_psa_Desktop_genivi_navigation_application_master_src_build_fuel_stop_advisor_amb_proxy_h__PROXY_MARSHAL_H + +#include <dbus-c++/dbus.h> +#include <cassert> + +namespace org { +namespace automotive { + +class Manager_proxy +: public ::DBus::InterfaceProxy +{ +public: + + Manager_proxy() + : ::DBus::InterfaceProxy("org.automotive.Manager") + { + } + +public: + + /* properties exported by this interface */ +public: + + /* methods exported by this interface, + * this functions will invoke the corresponding methods on the remote objects + */ + std::vector< ::DBus::Path > FindObject(const std::string& searchstring) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << searchstring; + call.member("FindObject"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + std::vector< ::DBus::Path > argout; + ri >> argout; + return argout; + } + + ::DBus::Path FindObjectForZone(const std::string& searchstring, const int32_t& zone) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << searchstring; + wi << zone; + call.member("FindObjectForZone"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + ::DBus::Path argout; + ri >> argout; + return argout; + } + + ::DBus::Path FindObjectForSourceZone(const std::string& searchstring, const std::string& source, const int32_t& zone) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << searchstring; + wi << source; + wi << zone; + call.member("FindObjectForSourceZone"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + ::DBus::Path argout; + ri >> argout; + return argout; + } + + std::vector< std::string > List() + { + ::DBus::CallMessage call; + call.member("List"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + std::vector< std::string > argout; + ri >> argout; + return argout; + } + + std::vector< int32_t > ZonesForObjectName(const std::string& searchstring) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << searchstring; + call.member("ZonesForObjectName"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + std::vector< int32_t > argout; + ri >> argout; + return argout; + } + + std::vector< std::string > SourcesForObjectName(const std::string& searchstring) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << searchstring; + call.member("SourcesForObjectName"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + std::vector< std::string > argout; + ri >> argout; + return argout; + } + + +public: + + /* signal handlers for this interface + */ + +private: + + /* unmarshalers (to unpack the DBus message before calling the actual signal handler) + */ +}; + +} } +#endif //__dbusxx___home_psa_Desktop_genivi_navigation_application_master_src_build_fuel_stop_advisor_amb_proxy_h__PROXY_MARSHAL_H diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/constants.h b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/constants.h new file mode 100644 index 0000000..21f42b1 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/constants.h @@ -0,0 +1,17 @@ + +/* This is an automatically generated file, do not edit */ + +enum GENIVI_FUELSTOPADVISOR_Constants { + GENIVI_FUELSTOPADVISOR_METRIC = 0x0010, + GENIVI_FUELSTOPADVISOR_NON_METRIC = 0x0011, + GENIVI_FUELSTOPADVISOR_ODOMETER = 0x0020, + GENIVI_FUELSTOPADVISOR_FUEL_LEVEL = 0x0021, + GENIVI_FUELSTOPADVISOR_TANK_DISTANCE = 0x0022, + GENIVI_FUELSTOPADVISOR_INSTANT_FUEL_CONSUMPTION_PER_DISTANCE = 0x0023, + GENIVI_FUELSTOPADVISOR_ENHANCED_TANK_DISTANCE = 0x0024, + GENIVI_FUELSTOPADVISOR_DISTANCE = 0x0030, + GENIVI_FUELSTOPADVISOR_TIME = 0x0031, + GENIVI_FUELSTOPADVISOR_AVERAGE_FUEL_CONSUMPTION_PER_DISTANCE = 0x0032, + GENIVI_FUELSTOPADVISOR_AVERAGE_SPEED = 0x0033, +}; +
\ No newline at end of file diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/enhanced-position-proxy.h b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/enhanced-position-proxy.h new file mode 100644 index 0000000..0472243 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/enhanced-position-proxy.h @@ -0,0 +1,105 @@ + +/* + * This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT! + */ + +#ifndef __dbusxx__enhanced_position_proxy_h__PROXY_MARSHAL_H +#define __dbusxx__enhanced_position_proxy_h__PROXY_MARSHAL_H + +#include <dbus-c++/dbus.h> +#include <cassert> + +namespace org { +namespace genivi { +namespace positioning { + +class EnhancedPosition_proxy +: public ::DBus::InterfaceProxy +{ +public: + + EnhancedPosition_proxy() + : ::DBus::InterfaceProxy("org.genivi.positioning.EnhancedPosition") + { + connect_signal(EnhancedPosition_proxy, PositionUpdate, _PositionUpdate_stub); + } + +public: + + /* properties exported by this interface */ +public: + + /* methods exported by this interface, + * this functions will invoke the corresponding methods on the remote objects + */ + ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > GetVersion() + { + ::DBus::CallMessage call; + call.member("GetVersion"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > argout; + ri >> argout; + return argout; + } + + void GetPositionInfo(const uint64_t& valuesToReturn, uint64_t& timestamp, std::map< uint64_t, ::DBus::Variant >& data) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << valuesToReturn; + call.member("GetPositionInfo"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + ri >> timestamp; + ri >> data; + } + + void GetSatelliteInfo(uint64_t& timestamp, std::vector< ::DBus::Struct< uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, bool > >& satelliteInfo) + { + ::DBus::CallMessage call; + call.member("GetSatelliteInfo"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + ri >> timestamp; + ri >> satelliteInfo; + } + + void GetTime(uint64_t& timestamp, std::map< uint64_t, ::DBus::Variant >& time) + { + ::DBus::CallMessage call; + call.member("GetTime"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + ri >> timestamp; + ri >> time; + } + + +public: + + /* signal handlers for this interface + */ + virtual void PositionUpdate(const uint64_t& changedValues) = 0; + +private: + + /* unmarshalers (to unpack the DBus message before calling the actual signal handler) + */ + void _PositionUpdate_stub(const ::DBus::SignalMessage &sig) + { + ::DBus::MessageIter ri = sig.reader(); + + uint64_t changedValues; + ri >> changedValues; + PositionUpdate(changedValues); + } +}; + +} } } +#endif //__dbusxx__enhanced_position_proxy_h__PROXY_MARSHAL_H diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/fuel-stop-advisor_proxy.h b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/fuel-stop-advisor_proxy.h new file mode 100644 index 0000000..c0582d1 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/fuel-stop-advisor_proxy.h @@ -0,0 +1,191 @@ + +/* + * This file was automatically generated by dbusxx-xml2cpp; DO NOT EDIT! + */ + +#ifndef __dbusxx___home_psa_Desktop_genivi_navigation_application_master_src_build_fuel_stop_advisor_fuel_stop_advisor_proxy_h__PROXY_MARSHAL_H +#define __dbusxx___home_psa_Desktop_genivi_navigation_application_master_src_build_fuel_stop_advisor_fuel_stop_advisor_proxy_h__PROXY_MARSHAL_H + +#include <dbus-c++/dbus.h> +#include <cassert> + +namespace org { +namespace genivi { +namespace demonstrator { + +class FuelStopAdvisor_proxy +: public ::DBus::InterfaceProxy +{ +public: + + FuelStopAdvisor_proxy() + : ::DBus::InterfaceProxy("org.genivi.demonstrator.FuelStopAdvisor") + { + connect_signal(FuelStopAdvisor_proxy, TripDataResetted, _TripDataResetted_stub); + connect_signal(FuelStopAdvisor_proxy, TripDataUpdated, _TripDataUpdated_stub); + connect_signal(FuelStopAdvisor_proxy, FuelStopAdvisorWarning, _FuelStopAdvisorWarning_stub); + } + +public: + + /* properties exported by this interface */ +public: + + /* methods exported by this interface, + * this functions will invoke the corresponding methods on the remote objects + */ + ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > GetVersion() + { + ::DBus::CallMessage call; + call.member("GetVersion"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > argout; + ri >> argout; + return argout; + } + + void SetUnits(const std::map< uint16_t, uint16_t >& data) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << data; + call.member("SetUnits"); + ::DBus::Message ret = invoke_method (call); + } + + std::map< uint16_t, ::DBus::Variant > GetInstantData() + { + ::DBus::CallMessage call; + call.member("GetInstantData"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + std::map< uint16_t, ::DBus::Variant > argout; + ri >> argout; + return argout; + } + + uint8_t GetSupportedTripNumbers() + { + ::DBus::CallMessage call; + call.member("GetSupportedTripNumbers"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + uint8_t argout; + ri >> argout; + return argout; + } + + std::map< uint16_t, ::DBus::Variant > GetTripData(const uint8_t& number) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << number; + call.member("GetTripData"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + std::map< uint16_t, ::DBus::Variant > argout; + ri >> argout; + return argout; + } + + void ResetTripData(const uint8_t& number) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << number; + call.member("ResetTripData"); + ::DBus::Message ret = invoke_method (call); + } + + void SetFuelAdvisorSettings(const bool& advisorMode, const uint8_t& distanceThreshold) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << advisorMode; + wi << distanceThreshold; + call.member("SetFuelAdvisorSettings"); + ::DBus::Message ret = invoke_method (call); + } + + void GetFuelAdvisorSettings(bool& advisorMode, uint8_t& distanceThreshold, bool& destinationCantBeReached) + { + ::DBus::CallMessage call; + call.member("GetFuelAdvisorSettings"); + ::DBus::Message ret = invoke_method (call); + ::DBus::MessageIter ri = ret.reader(); + + ri >> advisorMode; + ri >> distanceThreshold; + ri >> destinationCantBeReached; + } + + void SetRouteHandle(const uint32_t& routeHandle) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << routeHandle; + call.member("SetRouteHandle"); + ::DBus::Message ret = invoke_method (call); + } + + void ReleaseRouteHandle(const uint32_t& routeHandle) + { + ::DBus::CallMessage call; + ::DBus::MessageIter wi = call.writer(); + + wi << routeHandle; + call.member("ReleaseRouteHandle"); + ::DBus::Message ret = invoke_method (call); + } + + +public: + + /* signal handlers for this interface + */ + virtual void TripDataResetted(const uint8_t& number) = 0; + virtual void TripDataUpdated(const uint8_t& number) = 0; + virtual void FuelStopAdvisorWarning(const bool& destinationCantBeReached) = 0; + +private: + + /* unmarshalers (to unpack the DBus message before calling the actual signal handler) + */ + void _TripDataResetted_stub(const ::DBus::SignalMessage &sig) + { + ::DBus::MessageIter ri = sig.reader(); + + uint8_t number; + ri >> number; + TripDataResetted(number); + } + void _TripDataUpdated_stub(const ::DBus::SignalMessage &sig) + { + ::DBus::MessageIter ri = sig.reader(); + + uint8_t number; + ri >> number; + TripDataUpdated(number); + } + void _FuelStopAdvisorWarning_stub(const ::DBus::SignalMessage &sig) + { + ::DBus::MessageIter ri = sig.reader(); + + bool destinationCantBeReached; + ri >> destinationCantBeReached; + FuelStopAdvisorWarning(destinationCantBeReached); + } +}; + +} } } +#endif //__dbusxx___home_psa_Desktop_genivi_navigation_application_master_src_build_fuel_stop_advisor_fuel_stop_advisor_proxy_h__PROXY_MARSHAL_H diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/genivi-dbus-model.h b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/genivi-dbus-model.h new file mode 100644 index 0000000..e88918d --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/genivi-dbus-model.h @@ -0,0 +1,1568 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2013-2014, PCA Peugeot Citroen +* +* \file poi-common-dbus-data-model.h +* +* \brief This file is part of the poi proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 1.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* 10-02-2014, Philippe Colliot, refinement and migration to the new repository +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +#ifndef __GENIVIDBUSMODEL_H__ +#define __GENIVIDBUSMODEL_H__ + +#include <stdbool.h> +#include <unistd.h> +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <iostream> +#include <fstream> + + +#include <dbus-c++/dbus.h> +#include <dbus-c++/glib-integration.h> +#include "positioning-constants.h" +#include "enhanced-position-proxy.h" +#include "amb_proxy.h" +#include "constants.h" +#include "fuel-stop-advisor_proxy.h" + +typedef uint32_t poiId_t; +typedef uint32_t categoryId_t; +typedef uint32_t resourceId_t; +typedef uint32_t attributeId_t; +typedef uint32_t handleId_t; +typedef uint8_t camId_t; + +/* How to + The below classes are gateways between internal data and DBus data + Internal access is provided by set and get + DBus access is provided by setDBus and getDBus + Code rules: + if data name is MYNAME: +class DBus_MYNAME // DBus data type ex:(qqqs) +{ +public: + struct MYNAME_t //no class used into this public structure + { +... + }; + + typedef ... DBus_MYNAME_t; + + DBus_MYNAME(){ +... + } + + ~DBus_MYNAME(){} + + void set(MYNAME_t value){ +... + } + + MYNAME_t get(){ +... + return(m_MYNAME); + } + + void setDBus(DBus_MYNAME_t value){ +... + } + + DBus_MYNAME_t getDBus(){ + DBus_MYNAME_t return_value; +... + return(return_value); + } + +private: + MYNAME_t m_MYNAME; +}; + +*/ + +class DBus_dataFormatConverter +{ +public: + typedef ::DBus::Struct< uint8_t, ::DBus::Variant > DBusCommonAPIVariant; + + DBus_dataFormatConverter() + { + } + ~ DBus_dataFormatConverter() + { + } + DBusCommonAPIVariant createVariantString(std::string str) + { + DBusCommonAPIVariant var; + DBus::MessageIter iter = var._2.writer(); + iter.append_string(str.c_str()); + return var; + } + + DBusCommonAPIVariant createVariantUint16(uint16_t value) + { + DBusCommonAPIVariant var; + DBus::MessageIter iter = var._2.writer(); + iter.append_uint16(value); + return var; + } + + DBusCommonAPIVariant createVariantArrayUint16(std::vector< uint16_t > value) + { + DBusCommonAPIVariant var; + DBus::MessageIter iter=var._2.writer(); + iter << value; + return var; + } + + DBusCommonAPIVariant createVariantUint32(uint32_t value) + { + DBusCommonAPIVariant var; + DBus::MessageIter iter = var._2.writer(); + iter.append_uint32(value); + return var; + } + + DBusCommonAPIVariant createVariantArrayUint32(std::vector< uint32_t > value) + { + DBusCommonAPIVariant var; + DBus::MessageIter iter=var._2.writer(); + iter << value; + return var; + } + +}; + +class DBus_version : DBus_dataFormatConverter // (qqqs) +{ +public: + struct version_t + { + ushort major; + ushort minor; + ushort micro; + std::string date; + }; + + typedef ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > DBus_version_t; + + DBus_version(){ + m_version.major = 0; + m_version.minor = 0; + m_version.micro = 0; + m_version.date = ""; + } + + ~DBus_version(){} + + void set(version_t value){ + m_version.major = value.major; + m_version.minor = value.minor; + m_version.micro = value.micro; + m_version.date = value.date; + } + + version_t get(){ + return(m_version); + } + + void setDBus(DBus_version_t value){ + m_version.major = value._1; + m_version.minor = value._2; + m_version.micro = value._3; + m_version.date = value._4; + } + + DBus_version_t getDBus(){ + DBus_version_t return_value; + return_value._1 = m_version.major; + return_value._2 = m_version.minor; + return_value._3 = m_version.micro; + return_value._4 = m_version.date; + return(return_value); + } + +private: + version_t m_version; +}; + +class DBus_categoryDetails : DBus_dataFormatConverter // (uau(yv)sbs(yv)) -->in this implementation, the two variant data are string +{ +public: + struct categoryDetails_t + { + categoryId_t id; //Category unique id + std::vector<categoryId_t> parents_id; //list of parent categories unique id + std::string icons; //visual icons set + std::string name; + bool top_level; //false if predefined, true if created by plugin + std::string description; //short category description (optional) + std::string media; //media associated (html web site, audio, video, ...) (optional) + }; + + typedef ::DBus::Struct< uint32_t, std::vector< uint32_t >, DBusCommonAPIVariant, std::string, bool, std::string, DBusCommonAPIVariant > DBus_categoryDetails_t; + + DBus_categoryDetails() + { + m_categoryDetails.id = 0; + m_categoryDetails.parents_id.clear(); + m_categoryDetails.parents_id.push_back(0); //one element by default + m_categoryDetails.icons = ""; + m_categoryDetails.name = ""; + m_categoryDetails.top_level = true; + m_categoryDetails.description = ""; + m_categoryDetails.media = ""; + } + + ~DBus_categoryDetails(){} + + void set(categoryDetails_t value) + { + size_t index; + m_categoryDetails.id = value.id; + m_categoryDetails.parents_id.clear(); + for (index=0;index<value.parents_id.size();index++) + { + m_categoryDetails.parents_id.push_back(value.parents_id.at(index)); + } + m_categoryDetails.icons = value.icons; + m_categoryDetails.name = value.name; + m_categoryDetails.top_level = value.top_level; + m_categoryDetails.description = value.description; + m_categoryDetails.media = value.media; + } + + categoryDetails_t get() + { + return(m_categoryDetails); + } + + void setDBus(DBus_categoryDetails_t value) + { + size_t index; + m_categoryDetails.id = value._1; + m_categoryDetails.parents_id.clear(); + for (index=0;index<value._2.size();index++) + { + m_categoryDetails.parents_id.push_back(value._2.at(index)); + } + m_categoryDetails.icons = value._3._2.reader().get_string(); + m_categoryDetails.name = value._4; + m_categoryDetails.top_level = value._5; + m_categoryDetails.description = value._6; + m_categoryDetails.description = value._7._2.reader().get_string(); + } + + DBus_categoryDetails_t getDBus() + { + size_t index; + DBus_categoryDetails_t return_value; + + return_value._1 = m_categoryDetails.id; + return_value._2.clear(); + for (index=0;index<m_categoryDetails.parents_id.size();index++) + { + return_value._2.push_back(m_categoryDetails.parents_id.at(index)); + } + return_value._3 = createVariantString(m_categoryDetails.icons); + return_value._4 = m_categoryDetails.name; + return_value._5 = m_categoryDetails.top_level; + return_value._6 = m_categoryDetails.description; + return_value._7 = createVariantString(m_categoryDetails.media); + return(return_value); + } + +private: + categoryDetails_t m_categoryDetails; +}; + +class DBus_categoryOperator : DBus_dataFormatConverter // (is(yv)) -->in this implementation, the variant data is a string +{ +public: + struct categoryOperator_t + { + int32_t type; //attribute operator type enum(INVALID,MORE_THAN,LESS_THAN,EQUAL, ....) + std::string name; //attribute operator name + std::string value; //attribute operator value + }; + + typedef ::DBus::Struct< int32_t, std::string, DBusCommonAPIVariant > DBus_categoryOperator_t; + + DBus_categoryOperator(){ + m_categoryOperator.type = 0; + m_categoryOperator.name = ""; + m_categoryOperator.value = ""; + } + + ~DBus_categoryOperator(){ + } + + void set(categoryOperator_t value){ + m_categoryOperator.type = value.type; + m_categoryOperator.name = value.name; + m_categoryOperator.value = value.value; + } + + categoryOperator_t get(){ + return(m_categoryOperator); + } + + void setDBus(DBus_categoryOperator_t value){ + m_categoryOperator.type = value._1; + m_categoryOperator.name = value._2; + m_categoryOperator.value = value._3._2.reader().get_string(); + } + + DBus_categoryOperator_t getDBus(){ + DBus_categoryOperator_t return_value; + return_value._1 = m_categoryOperator.type; + return_value._2 = m_categoryOperator.name; + return_value._3 = createVariantString(m_categoryOperator.value); + return(return_value); + } + +private: + categoryOperator_t m_categoryOperator; +}; + +class DBus_categoryAttribute : DBus_dataFormatConverter // (usia(is(yv))) +{ +public: + struct categoryAttribute_t + { + attributeId_t id; //attribute unique id + std::string name; //attribute unique name + int32_t type; //enum(INVALID,STRING,INTEGER,COORDINATES ...) + std::vector<DBus_categoryOperator::categoryOperator_t > oper; + }; + + typedef ::DBus::Struct< uint32_t, std::string, int32_t, std::vector< ::DBus::Struct< int32_t, std::string, DBusCommonAPIVariant > > > DBus_categoryAttribute_t; + + DBus_categoryAttribute(){ + DBus_categoryOperator op; + m_categoryAttribute.id = 0; + m_categoryAttribute.name = ""; + m_categoryAttribute.type = 0; + m_categoryAttribute.oper.clear(); + m_categoryAttribute.oper.push_back(op.get()); //one element by default + } + + ~DBus_categoryAttribute(){ + } + + void set(categoryAttribute_t value){ + size_t index; + m_categoryAttribute.id = value.id; + m_categoryAttribute.name = value.name; + m_categoryAttribute.type = value.type; + m_categoryAttribute.oper.clear(); + for (index=0;index<value.oper.size();index++) + { + m_categoryAttribute.oper.push_back(value.oper.at(index)); + } + } + + categoryAttribute_t get(){ + return(m_categoryAttribute); + } + + void setDBus(DBus_categoryAttribute_t value){ + size_t index; + DBus_categoryOperator op; + m_categoryAttribute.id = value._1; + m_categoryAttribute.name = value._2; + m_categoryAttribute.type = value._3; + m_categoryAttribute.oper.clear(); + for (index=0;index<value._4.size();index++) + { + op.setDBus(value._4.at(index)); + m_categoryAttribute.oper.push_back(op.get()); + } + } + + DBus_categoryAttribute_t getDBus(){ + DBus_categoryAttribute_t return_value; + size_t index; + DBus_categoryOperator op; + return_value._1 = m_categoryAttribute.id; + return_value._2 = m_categoryAttribute.name; + return_value._3 = m_categoryAttribute.type; + return_value._4.clear(); + for (index=0;index<m_categoryAttribute.oper.size();index++) + { + op.set(m_categoryAttribute.oper.at(index)); + return_value._4.push_back(op.getDBus()); + } + return(return_value); + } + +private: + categoryAttribute_t m_categoryAttribute; +}; + +class DBus_categorySortOption : DBus_dataFormatConverter // (us) +{ +public: + struct categorySortOption_t + { + uint32_t id; //enum(GENIVI_POISERVICE_SORT_DEFAULT,GENIVI_POISERVICE_SORT_BY_DISTANCE,GENIVI_POISERVICE_SORT_BY_TIME ... ) + std::string name; //name to be displayed by application + }; + + typedef ::DBus::Struct< uint32_t, std::string > DBus_categorySortOption_t; + + DBus_categorySortOption(){ + m_categorySortOption.id = 0; + m_categorySortOption.name = ""; + } + + ~DBus_categorySortOption(){ + } + + void set(categorySortOption_t value){ + m_categorySortOption.id = value.id; + m_categorySortOption.name = value.name; + } + + categorySortOption_t get(){ + return(m_categorySortOption); + } + + void setDBus(DBus_categorySortOption_t value){ + m_categorySortOption.id = value._1; + m_categorySortOption.name = value._2; + } + + DBus_categorySortOption_t getDBus(){ + DBus_categorySortOption_t return_value; + return_value._1 = m_categorySortOption.id; + return_value._2 = m_categorySortOption.name; + return(return_value); + } + +private: + categorySortOption_t m_categorySortOption; +}; + +class DBus_category : DBus_dataFormatConverter // ( (uau(yv)sbs(yv)) a(usia(is(yv))) a(us) ) +{ +public: + struct category_t + { + DBus_categoryDetails::categoryDetails_t details; + std::vector<DBus_categoryAttribute::categoryAttribute_t> attributes; + std::vector<DBus_categorySortOption::categorySortOption_t> sortOptions; + }; + + typedef ::DBus::Struct< ::DBus::Struct< uint32_t, std::vector< uint32_t >, DBusCommonAPIVariant, std::string, bool, std::string, DBusCommonAPIVariant >, std::vector< ::DBus::Struct< uint32_t, std::string, int32_t, std::vector< ::DBus::Struct< int32_t, std::string, DBusCommonAPIVariant > > > >, std::vector< ::DBus::Struct< uint32_t, std::string > > > DBus_category_t; + + DBus_category() + { + DBus_categoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + m_category.details = details.get(); + m_category.attributes.clear(); + m_category.attributes.push_back(attrib.get()); //one element by default + m_category.sortOptions.clear(); + m_category.sortOptions.push_back(sortOption.get()); //one element by default + } + + ~ DBus_category(){} + + void set(category_t value) + { + size_t index; + m_category.details = value.details; + m_category.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_category.attributes.push_back(value.attributes.at(index)); + } + m_category.sortOptions.clear(); + for (index=0;index<value.sortOptions.size();index++) + { + m_category.sortOptions.push_back(value.sortOptions.at(index)); + } + } + + category_t get() + { + return(m_category); + } + + void setDBus(DBus_category_t value) + { + size_t index; + DBus_categoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + details.setDBus(value._1); + m_category.details = details.get(); + m_category.attributes.clear(); + for (index=0;index<value._2.size();index++) + { + attrib.setDBus(value._2.at(index)); + m_category.attributes.push_back(attrib.get()); + } + m_category.sortOptions.clear(); + for (index=0;index<value._3.size();index++) + { + sortOption.setDBus(value._3.at(index)); + m_category.sortOptions.push_back(sortOption.get()); + } + } + + DBus_category_t getDBus() + { + DBus_category_t return_value; + size_t index; + DBus_categoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + details.set(m_category.details); + return_value._1 = details.getDBus(); + return_value._2.clear(); + for(index=0;index<m_category.attributes.size();index++) + { + attrib.set(m_category.attributes.at(index)); + return_value._2.push_back(attrib.getDBus()); + } + return_value._3.clear(); + for(index=0;index<m_category.sortOptions.size();index++) + { + sortOption.set(m_category.sortOptions.at(index)); + return_value._3.push_back(sortOption.getDBus()); + } + return(return_value); + } + +private: + category_t m_category; +}; + +class DBus_categoryIdLevel : DBus_dataFormatConverter // (ub) +{ +public: + struct categoryIdLevel_t + { + categoryId_t id; + bool top_level; //false if predefined, true if created by plugin + }; + + typedef ::DBus::Struct< uint32_t, bool > DBus_categoryIdLevel_t; + + + DBus_categoryIdLevel(){ + m_categoryIdLevel.id = 0; + m_categoryIdLevel.top_level = true; + } + + ~DBus_categoryIdLevel(){} + + void set(categoryIdLevel_t value){ + m_categoryIdLevel.id = value.id; + m_categoryIdLevel.top_level = value.top_level; + } + + categoryIdLevel_t get(){ + return(m_categoryIdLevel); + } + + void setDBus(DBus_categoryIdLevel_t value){ + m_categoryIdLevel.id = value._1; + m_categoryIdLevel.top_level = value._2; + } + + DBus_categoryIdLevel_t getDBus(){ + DBus_categoryIdLevel_t return_value; + return_value._1 = m_categoryIdLevel.id; + return_value._2 = m_categoryIdLevel.top_level; + return(return_value); + } + +private: + categoryIdLevel_t m_categoryIdLevel; +}; + +class DBus_categoryReason : DBus_dataFormatConverter // (uq) +{ +public: + struct categoryReason_t + { + categoryId_t id; + ushort reason; //enum(ADDED,REMOVED,ATTR_ADDED,ATTR_MODIFIED,ATTR_REMOVED, ... ) + }; + + typedef ::DBus::Struct< uint32_t, uint16_t > DBus_categoryReason_t; + + + DBus_categoryReason(){ + m_categoryReason.id = 0; + m_categoryReason.reason = true; + } + + ~DBus_categoryReason(){} + + void set(categoryReason_t value){ + m_categoryReason.id = value.id; + m_categoryReason.reason = value.reason; + } + + categoryReason_t get(){ + return(m_categoryReason); + } + + void setDBus(DBus_categoryReason_t value){ + m_categoryReason.id = value._1; + m_categoryReason.reason = value._2; + } + + DBus_categoryReason_t getDBus(){ + DBus_categoryReason_t return_value; + return_value._1 = m_categoryReason.id; + return_value._2 = m_categoryReason.reason; + return(return_value); + } + +private: + categoryReason_t m_categoryReason; +}; + +class DBus_categoryIdName : DBus_categoryIdLevel // (usb) +{ +public: + + struct categoryIdName_t + { + DBus_categoryIdLevel::categoryIdLevel_t id; + std::string name; + }; + + typedef ::DBus::Struct< uint32_t, std::string, bool > DBus_categoryIdName_t; + + + DBus_categoryIdName(){ + m_categoryIdName = ""; + } + + ~DBus_categoryIdName(){} + + void set(categoryIdName_t value){ + DBus_categoryIdLevel::set(value.id); + m_categoryIdName = value.name; + } + + categoryIdName_t get(){ + categoryIdName_t return_value; + return_value.id = DBus_categoryIdLevel::get(); + return_value.name = m_categoryIdName; + return(return_value); + } + + void setDBus(DBus_categoryIdName_t value){ + DBus_categoryIdLevel::DBus_categoryIdLevel_t id; + id._1 = value._1; + id._2 = value._3; + DBus_categoryIdLevel::setDBus(id); + m_categoryIdName = value._2; + } + + DBus_categoryIdName_t getDBus(){ + DBus_categoryIdName_t return_value; + DBus_categoryIdLevel::DBus_categoryIdLevel_t id; + id = DBus_categoryIdLevel::getDBus(); + return_value._1 = id._1; + return_value._2 = m_categoryIdName; + return_value._3 = id._2; + return(return_value); + } + +private: + std::string m_categoryIdName; +}; + +class DBus_categoryRadius : DBus_dataFormatConverter // (uu) +{ +public: + struct categoryRadius_t + { + categoryId_t id; + uint radius; + }; + + typedef ::DBus::Struct< uint32_t, uint32_t > DBus_categoryRadius_t; + + DBus_categoryRadius(){ + m_categoryRadius.id = 0; + m_categoryRadius.radius = 0; + } + + ~DBus_categoryRadius(){} + + void set(categoryRadius_t value){ + m_categoryRadius.id = value.id; + m_categoryRadius.radius = value.radius; + } + + categoryRadius_t get(){ + return(m_categoryRadius); + } + + void setDBus(DBus_categoryRadius_t value){ + m_categoryRadius.id = value._1; + m_categoryRadius.radius = value._2; + } + + DBus_categoryRadius_t getDBus(){ + DBus_categoryRadius_t return_value; + return_value._1 = m_categoryRadius.id; + return_value._2 = m_categoryRadius.radius; + return(return_value); + } + +private: + categoryRadius_t m_categoryRadius; +}; + +class DBus_poiAttribute : DBus_dataFormatConverter // (ui(yv)) -->in this implementation, the variant data is a string +{ +public: + struct poiAttribute_t + { + attributeId_t id; + int32_t type; + std::string value; + }; + + typedef ::DBus::Struct< uint32_t, int32_t, DBusCommonAPIVariant > DBus_poiAttribute_t; + + + DBus_poiAttribute(){ + m_attribute.id = 0; + m_attribute.type = 0; + m_attribute.value = ""; + } + + ~DBus_poiAttribute(){} + + void set(poiAttribute_t value){ + m_attribute.id = value.id; + m_attribute.type = value.type; + m_attribute.value = value.value; + } + + poiAttribute_t get(){ + return(m_attribute); + } + + void setDBus(DBus_poiAttribute_t value){ + m_attribute.id = value._1; + m_attribute.type = value._2; + m_attribute.value = value._3._2.reader().get_string(); + } + + DBus_poiAttribute_t getDBus(){ + DBus_poiAttribute_t return_value; + return_value._1 = m_attribute.id; + return_value._2 = m_attribute.type; + return_value._3 = createVariantString(m_attribute.value); + return(return_value); + } + +private: + poiAttribute_t m_attribute; +}; + +class DBus_attributeDetails : DBus_poiAttribute //(uui(yv)ib) -->in this implementation, the variant data is string +{ +public: + struct attributeDetails_t + { + DBus_poiAttribute::poiAttribute_t attribute; + categoryId_t categoryId; //Category unique id + int32_t oper; //enum(INVALID,MORE_THAN,LESS_THAN,EQUAL, ....) + bool mandatory; //true if the attribute is mandatory for the search and false for optional + }; + + typedef ::DBus::Struct< uint32_t, uint32_t, int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant >, int32_t, bool > DBus_attributeDetails_t; + + + DBus_attributeDetails(){ + m_attributeDetails.categoryId = 0; + m_attributeDetails.oper = 0; + m_attributeDetails.mandatory = true; + } + + ~DBus_attributeDetails(){} + + void set(attributeDetails_t value){ + DBus_poiAttribute::set(value.attribute); + m_attributeDetails.categoryId = value.categoryId; + m_attributeDetails.oper = value.oper; + m_attributeDetails.mandatory = value.mandatory; + } + + attributeDetails_t get(){ + attributeDetails_t return_value; + return_value.attribute = DBus_poiAttribute::get(); + return_value.categoryId = m_attributeDetails.categoryId; + return_value.oper = m_attributeDetails.oper; + return_value.mandatory = m_attributeDetails.mandatory; + return(return_value); + } + + void setDBus(DBus_attributeDetails_t value){ + DBus_poiAttribute::DBus_poiAttribute_t attribute; + attribute._1 = value._1; + attribute._2 = value._3; + attribute._3 = value._4; + DBus_poiAttribute::setDBus(attribute); + m_attributeDetails.categoryId = value._2; + m_attributeDetails.oper = value._5; + m_attributeDetails.mandatory = value._6; + } + + DBus_attributeDetails_t getDBus(){ + DBus_attributeDetails_t return_value; + DBus_poiAttribute::DBus_poiAttribute_t attribute; + attribute = DBus_poiAttribute::getDBus(); + return_value._1 = attribute._1; + return_value._2 = m_attributeDetails.categoryId; + return_value._3 = attribute._2; + return_value._4 = attribute._3; + return_value._5 = m_attributeDetails.oper; + return_value._6 = m_attributeDetails.mandatory; + return(return_value); + } + +private: + attributeDetails_t m_attributeDetails; +}; + +class DBus_geoCoordinate3D : DBus_dataFormatConverter //(ddd) +{ +public: + struct geoCoordinate3D_t + { + double latitude; + double longitude; + double altitude; + }; + typedef ::DBus::Struct< double, double, double > DBus_geoCoordinate3D_t; + + DBus_geoCoordinate3D(){ + m_geoCoordinate3D.latitude = 48.85792; //by default center of Paris + m_geoCoordinate3D.longitude = 2.3383145; + m_geoCoordinate3D.altitude = 0; + } + + ~DBus_geoCoordinate3D(){} + + void set(geoCoordinate3D_t value){ + m_geoCoordinate3D.latitude = value.latitude; + m_geoCoordinate3D.longitude = value.longitude; + m_geoCoordinate3D.altitude = value.altitude; + } + + geoCoordinate3D_t get(){ + return(m_geoCoordinate3D); + } + + void setDBus(DBus_geoCoordinate3D_t value){ + m_geoCoordinate3D.latitude = value._1; + m_geoCoordinate3D.longitude = value._2; + m_geoCoordinate3D.altitude = value._3; + } + + DBus_geoCoordinate3D_t getDBus(){ + DBus_geoCoordinate3D_t return_value; + return_value._1 = m_geoCoordinate3D.latitude; + return_value._2 = m_geoCoordinate3D.longitude; + return_value._3 = m_geoCoordinate3D.altitude; + return(return_value); + } + +private: + geoCoordinate3D_t m_geoCoordinate3D; +}; + +class DBus_poiDetails : DBus_dataFormatConverter //(us(ddd)) +{ +public: + struct poiDetails_t + { + poiId_t id; + std::string name; + DBus_geoCoordinate3D::geoCoordinate3D_t location; + }; + typedef ::DBus::Struct< uint32_t, std::string, ::DBus::Struct< double, double, double > > DBus_poiDetails_t; + + DBus_poiDetails(){ + DBus_geoCoordinate3D loc; + + m_poiDetails.id = 0; + m_poiDetails.name = ""; + m_poiDetails.location = loc.get(); + } + + ~DBus_poiDetails(){} + + void set(poiDetails_t value){ + m_poiDetails.id = value.id; + m_poiDetails.name = value.name; + m_poiDetails.location = value.location; + } + + poiDetails_t get(){ + return(m_poiDetails); + } + + void setDBus(DBus_poiDetails_t value){ + DBus_geoCoordinate3D loc; + + m_poiDetails.id = value._1; + m_poiDetails.name = value._2; + loc.setDBus(value._3); + m_poiDetails.location = loc.get(); + } + + DBus_poiDetails_t getDBus(){ + DBus_geoCoordinate3D loc; + DBus_poiDetails_t return_value; + return_value._1 = m_poiDetails.id; + return_value._2 = m_poiDetails.name; + loc.set(m_poiDetails.location); + return_value._3 = loc.getDBus(); + return(return_value); + } + +private: + poiDetails_t m_poiDetails; +}; + +class DBus_searchResult : DBus_dataFormatConverter //(uuia(ui(yv))) -->in this implementation, the variant data depends on the value of 'type' +{ +public: + struct searchResult_t + { + poiId_t id; + uint distance; + int32_t route_status; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< uint32_t, uint32_t, int32_t, std::vector< ::DBus::Struct< uint32_t, int32_t, DBusCommonAPIVariant > > > DBus_searchResult_t; + + DBus_searchResult(){ + DBus_poiAttribute attrib; + m_searchResult.id = 0; + m_searchResult.distance = 0; + m_searchResult.route_status = 0; + m_searchResult.attributes.clear(); + m_searchResult.attributes.push_back(attrib.get()); + } + + ~DBus_searchResult(){ + } + + void set(searchResult_t value){ + size_t index; + m_searchResult.id = value.id; + m_searchResult.distance = value.distance; + m_searchResult.route_status = value.route_status; + m_searchResult.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_searchResult.attributes.push_back(value.attributes.at(index)); + } + } + + searchResult_t get(){ + return(m_searchResult); + } + + void setDBus(DBus_searchResult_t value){ + size_t index; + DBus_poiAttribute attrib; + m_searchResult.id = value._1; + m_searchResult.distance = value._2; + m_searchResult.route_status = value._3; + m_searchResult.attributes.clear(); + for (index=0;index<value._4.size();index++) + { + attrib.setDBus(value._4.at(index)); + m_searchResult.attributes.push_back(attrib.get()); + } + } + + DBus_searchResult_t getDBus(){ + DBus_searchResult_t return_value; + size_t index; + DBus_poiAttribute attrib; + return_value._1 = m_searchResult.id; + return_value._2 = m_searchResult.distance; + return_value._3 = m_searchResult.route_status; + return_value._4.clear(); + for (index=0;index<m_searchResult.attributes.size();index++) + { + attrib.set(m_searchResult.attributes.at(index)); + return_value._4.push_back(attrib.getDBus()); + } + return(return_value); + } + +private: + searchResult_t m_searchResult; +}; + +class DBus_searchResultDetails : DBus_dataFormatConverter // ((us(ddd))aua(ui(yv))) -->in this implementation, the variant data depends on the value of 'type' +{ +public: + struct searchResultDetails_t + { + DBus_poiDetails::poiDetails_t details; + std::vector<categoryId_t> categories; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< ::DBus::Struct< uint32_t, std::string, ::DBus::Struct< double, double, double > >, std::vector< uint32_t >, std::vector< ::DBus::Struct< uint32_t, int32_t, DBusCommonAPIVariant > > > DBus_searchResultDetails_t; + + + DBus_searchResultDetails(){ + DBus_poiDetails details; + DBus_poiAttribute attrib; + m_searchResultDetails.details = details.get(); + m_searchResultDetails.categories.clear(); + m_searchResultDetails.categories.push_back(0); //one element by default + m_searchResultDetails.attributes.clear(); + m_searchResultDetails.attributes.push_back(attrib.get()); //one element by default + } + + ~DBus_searchResultDetails(){} + + void set(searchResultDetails_t value){ + size_t index; + m_searchResultDetails.details = value.details; + m_searchResultDetails.categories.clear(); + for (index=0;index<value.categories.size();index++) + { + m_searchResultDetails.categories.push_back(value.categories.at(index)); + } + m_searchResultDetails.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_searchResultDetails.attributes.push_back(value.attributes.at(index)); + } + } + + searchResultDetails_t get(){ + return(m_searchResultDetails); + } + + void setDBus(DBus_searchResultDetails_t value){ + size_t index; + DBus_poiDetails details; + DBus_poiAttribute attrib; + + details.setDBus(value._1); + m_searchResultDetails.details = details.get(); + m_searchResultDetails.categories.clear(); + for (index=0;index<value._2.size();index++) + { + m_searchResultDetails.categories.push_back(value._2.at(index)); + } + m_searchResultDetails.attributes.clear(); + for (index=0;index<value._3.size();index++) + { + attrib.setDBus(value._3.at(index)); + m_searchResultDetails.attributes.push_back(attrib.get()); + } + } + + DBus_searchResultDetails_t getDBus(){ + DBus_searchResultDetails_t return_value; + size_t index; + DBus_poiDetails details; + DBus_poiAttribute attrib; + + details.set(m_searchResultDetails.details); + return_value._1 = details.getDBus(); + return_value._2.clear(); + for (index=0;index<m_searchResultDetails.categories.size();index++) + { + return_value._2.push_back(m_searchResultDetails.categories.at(index)); + } + return_value._3.clear(); + for (index=0;index<m_searchResultDetails.attributes.size();index++) + { + attrib.set(m_searchResultDetails.attributes.at(index)); + return_value._3.push_back(attrib.getDBus()); + } + + return(return_value); + } + +private: + searchResultDetails_t m_searchResultDetails; +}; + +class DBus_poiCAMDetails : DBus_dataFormatConverter // (usq(ddd)qa(ui(yv))) -->in this implementation, the variant data depends on the value of 'type' +{ +public: + struct poiCAMDetails_t //no class used into this public structure + { + poiId_t source_id; + std::string name; + categoryId_t category; + DBus_geoCoordinate3D::geoCoordinate3D_t location; + ushort distance; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< uint32_t, std::string, uint32_t, ::DBus::Struct< double, double, double >, uint16_t, std::vector< ::DBus::Struct< uint32_t, int32_t, DBusCommonAPIVariant > > > DBus_poiCAMDetails_t; + + DBus_poiCAMDetails(){ + DBus_poiAttribute attrib; + DBus_geoCoordinate3D loc; + + m_poiCAMDetails.source_id = 0; + m_poiCAMDetails.name = ""; + m_poiCAMDetails.category = 0; + m_poiCAMDetails.location = loc.get(); + m_poiCAMDetails.distance = 0; + m_poiCAMDetails.attributes.clear(); + m_poiCAMDetails.attributes.push_back(attrib.get()); + } + + ~DBus_poiCAMDetails(){} + + void set(poiCAMDetails_t value){ + size_t index; + + m_poiCAMDetails.source_id = value.source_id; + m_poiCAMDetails.name = value.name; + m_poiCAMDetails.category = value.category; + m_poiCAMDetails.location = value.location; + m_poiCAMDetails.distance = value.distance; + m_poiCAMDetails.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_poiCAMDetails.attributes.push_back(value.attributes.at(index)); + } + } + + poiCAMDetails_t get(){ + return(m_poiCAMDetails); + } + + void setDBus(DBus_poiCAMDetails_t value){ + size_t index; + DBus_geoCoordinate3D loc; + DBus_poiAttribute attrib; + + m_poiCAMDetails.source_id = value._1; + m_poiCAMDetails.name = value._2; + m_poiCAMDetails.category = value._3; + loc.setDBus(value._4); + m_poiCAMDetails.location = loc.get(); + m_poiCAMDetails.distance = value._5, + m_poiCAMDetails.attributes.clear(); + for (index=0;index<value._6.size();index++) + { + attrib.setDBus(value._6.at(index)); + m_poiCAMDetails.attributes.push_back(attrib.get()); + } + } + + DBus_poiCAMDetails_t getDBus(){ + DBus_poiCAMDetails_t return_value; + size_t index; + DBus_geoCoordinate3D loc; + DBus_poiAttribute attrib; + + return_value._1 = m_poiCAMDetails.source_id; + return_value._2 = m_poiCAMDetails.name; + return_value._3 = m_poiCAMDetails.category; + loc.set(m_poiCAMDetails.location); + return_value._4 = loc.getDBus(); + return_value._5 = m_poiCAMDetails.distance; + return_value._6.clear(); + for (index=0;index<m_poiCAMDetails.attributes.size();index++) + { + attrib.set(m_poiCAMDetails.attributes.at(index)); + return_value._6.push_back(attrib.getDBus()); + } + return(return_value); + } + +private: + poiCAMDetails_t m_poiCAMDetails; +}; + +class DBus_CAMcategoryDetails : DBus_dataFormatConverter // (au(yv)ss(yv)) -->in this implementation, the variant data is string +{ +public: + struct CAMcategoryDetails_t + { + std::vector<categoryId_t> parents_id; + std::string icons; + std::string name; + std::string short_desc; + std::string media; + }; + + typedef ::DBus::Struct< std::vector< uint32_t >, DBusCommonAPIVariant, std::string, std::string, DBusCommonAPIVariant > DBus_CAMcategoryDetails_t; + + DBus_CAMcategoryDetails(){ + m_CAMcategoryDetails.parents_id.clear(); + m_CAMcategoryDetails.parents_id.push_back(0); //one element by default + m_CAMcategoryDetails.icons = ""; + m_CAMcategoryDetails.name = ""; + m_CAMcategoryDetails.short_desc = ""; + m_CAMcategoryDetails.media = ""; + } + + ~DBus_CAMcategoryDetails(){} + + void set(CAMcategoryDetails_t value){ + size_t index; + m_CAMcategoryDetails.parents_id.clear(); + for (index=0;index<value.parents_id.size();index++) + { + m_CAMcategoryDetails.parents_id.push_back(value.parents_id.at(index)); + } + m_CAMcategoryDetails.icons = value.icons; + m_CAMcategoryDetails.name = value.name; + m_CAMcategoryDetails.short_desc = value.short_desc; + m_CAMcategoryDetails.media = value.media; + } + + CAMcategoryDetails_t get(){ + return(m_CAMcategoryDetails); + } + + void setDBus(DBus_CAMcategoryDetails_t value){ + size_t index; + m_CAMcategoryDetails.parents_id.clear(); + for (index=0;index<value._1.size();index++) + { + m_CAMcategoryDetails.parents_id.push_back(value._1.at(index)); + } + m_CAMcategoryDetails.icons = value._2._2.reader().get_string(); + m_CAMcategoryDetails.name = value._3; + m_CAMcategoryDetails.short_desc = value._4; + m_CAMcategoryDetails.media = value._5._2.reader().get_string(); + } + + DBus_CAMcategoryDetails_t getDBus(){ + DBus_CAMcategoryDetails_t return_value; + size_t index; + return_value._1.clear(); + for (index=0;index<m_CAMcategoryDetails.parents_id.size();index++) + { + return_value._1.push_back(m_CAMcategoryDetails.parents_id.at(index)); + } + return_value._2 = createVariantString(m_CAMcategoryDetails.icons); + return_value._3 = m_CAMcategoryDetails.name; + return_value._4 = m_CAMcategoryDetails.short_desc; + return_value._5 = createVariantString(m_CAMcategoryDetails.media); + return(return_value); + } + +private: + CAMcategoryDetails_t m_CAMcategoryDetails; +}; + +class DBus_CAMcategory : DBus_dataFormatConverter // ((au(yv)ss(yv))a(usia(is(yv)))a(us)) -->in this implementation, the variant data is string +{ +public: + struct CAMcategory_t //no class used into this public structure + { + DBus_CAMcategoryDetails::CAMcategoryDetails_t details; + std::vector<DBus_categoryAttribute::categoryAttribute_t> attributes; + std::vector<DBus_categorySortOption::categorySortOption_t> sortOptions; + }; + + typedef ::DBus::Struct< ::DBus::Struct< std::vector< uint32_t >, DBusCommonAPIVariant, std::string, std::string, DBusCommonAPIVariant >, std::vector< ::DBus::Struct< uint32_t, std::string, int32_t, std::vector< ::DBus::Struct< int32_t, std::string, DBusCommonAPIVariant > > > >, std::vector< ::DBus::Struct< uint32_t, std::string > > > DBus_CAMcategory_t; + + DBus_CAMcategory(){ + DBus_CAMcategoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + m_CAMcategory.details = details.get(); + m_CAMcategory.attributes.clear(); + m_CAMcategory.attributes.push_back(attrib.get()); //one element by default + m_CAMcategory.sortOptions.clear(); + m_CAMcategory.sortOptions.push_back(sortOption.get()); //one element by default + } + + ~DBus_CAMcategory(){} + + void set(CAMcategory_t value){ + size_t index; + m_CAMcategory.details = value.details; + m_CAMcategory.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_CAMcategory.attributes.push_back(value.attributes.at(index)); + } + m_CAMcategory.sortOptions.clear(); + for (index=0;index<value.sortOptions.size();index++) + { + m_CAMcategory.sortOptions.push_back(value.sortOptions.at(index)); + } + } + + CAMcategory_t get(){ + return(m_CAMcategory); + } + + void setDBus(DBus_CAMcategory_t value){ + size_t index; + DBus_CAMcategoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + details.setDBus(value._1); + m_CAMcategory.details = details.get(); + m_CAMcategory.attributes.clear(); + for (index=0;index<value._2.size();index++) + { + attrib.setDBus(value._2.at(index)); + m_CAMcategory.attributes.push_back(attrib.get()); + } + m_CAMcategory.sortOptions.clear(); + for (index=0;index<value._3.size();index++) + { + sortOption.setDBus(value._3.at(index)); + m_CAMcategory.sortOptions.push_back(sortOption.get()); + } + } + + DBus_CAMcategory_t getDBus(){ + DBus_CAMcategory_t return_value; + size_t index; + DBus_CAMcategoryDetails details; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + details.set(m_CAMcategory.details); + return_value._1 = details.getDBus(); + return_value._2.clear(); + for(index=0;index<m_CAMcategory.attributes.size();index++) + { + attrib.set(m_CAMcategory.attributes.at(index)); + return_value._2.push_back(attrib.getDBus()); + } + return_value._3.clear(); + for(index=0;index<m_CAMcategory.sortOptions.size();index++) + { + sortOption.set(m_CAMcategory.sortOptions.at(index)); + return_value._3.push_back(sortOption.getDBus()); + } + return(return_value); + } + +private: + CAMcategory_t m_CAMcategory; +}; + +class DBus_CAMcategoryUpdate : DBus_dataFormatConverter // (ua(usia(is(yv)))a(us)) -->in this implementation, the variant data is string +{ +public: + struct CAMcategoryUpdate_t //no class used into this public structure + { + categoryId_t unique_id; + std::vector<DBus_categoryAttribute::categoryAttribute_t> attributes; + std::vector<DBus_categorySortOption::categorySortOption_t> sortOptions; + }; + + typedef ::DBus::Struct< uint32_t, std::vector< ::DBus::Struct< uint32_t, std::string, int32_t, std::vector< ::DBus::Struct< int32_t, std::string, DBusCommonAPIVariant > > > >, std::vector< ::DBus::Struct< uint32_t, std::string > > > DBus_CAMcategoryUpdate_t; + + DBus_CAMcategoryUpdate(){ + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + m_CAMcategoryUpdate.unique_id = 0; + m_CAMcategoryUpdate.attributes.clear(); + m_CAMcategoryUpdate.attributes.push_back(attrib.get()); //one element by default + m_CAMcategoryUpdate.sortOptions.clear(); + m_CAMcategoryUpdate.sortOptions.push_back(sortOption.get()); //one element by default + } + + ~DBus_CAMcategoryUpdate(){} + + void set(CAMcategoryUpdate_t value){ + size_t index; + m_CAMcategoryUpdate.unique_id = value.unique_id; + m_CAMcategoryUpdate.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_CAMcategoryUpdate.attributes.push_back(value.attributes.at(index)); + } + m_CAMcategoryUpdate.sortOptions.clear(); + for (index=0;index<value.sortOptions.size();index++) + { + m_CAMcategoryUpdate.sortOptions.push_back(value.sortOptions.at(index)); + } + } + + CAMcategoryUpdate_t get(){ + return(m_CAMcategoryUpdate); + } + + void setDBus(DBus_CAMcategoryUpdate_t value){ + size_t index; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + m_CAMcategoryUpdate.unique_id = value._1; + m_CAMcategoryUpdate.attributes.clear(); + for (index=0;index<value._2.size();index++) + { + attrib.setDBus(value._2.at(index)); + m_CAMcategoryUpdate.attributes.push_back(attrib.get()); + } + m_CAMcategoryUpdate.sortOptions.clear(); + for (index=0;index<value._3.size();index++) + { + sortOption.setDBus(value._3.at(index)); + m_CAMcategoryUpdate.sortOptions.push_back(sortOption.get()); + } + } + + DBus_CAMcategoryUpdate_t getDBus(){ + DBus_CAMcategoryUpdate_t return_value; + size_t index; + DBus_categoryAttribute attrib; + DBus_categorySortOption sortOption; + + return_value._1 = m_CAMcategoryUpdate.unique_id; + return_value._2.clear(); + for(index=0;index<m_CAMcategoryUpdate.attributes.size();index++) + { + attrib.set(m_CAMcategoryUpdate.attributes.at(index)); + return_value._2.push_back(attrib.getDBus()); + } + return_value._3.clear(); + for(index=0;index<m_CAMcategoryUpdate.sortOptions.size();index++) + { + sortOption.set(m_CAMcategoryUpdate.sortOptions.at(index)); + return_value._3.push_back(sortOption.getDBus()); + } + return(return_value); + } + +private: + CAMcategoryUpdate_t m_CAMcategoryUpdate; +}; + +class DBus_PoiAddedDetails : DBus_dataFormatConverter // (s(ddd)a(ui(yv))) -->in this implementation, the variant data depends on the value of 'type' +{ +public: + struct PoiAddedDetails_t + { + std::string name; + DBus_geoCoordinate3D::geoCoordinate3D_t location; + std::vector<DBus_poiAttribute::poiAttribute_t> attributes; + }; + + typedef ::DBus::Struct< std::string, ::DBus::Struct< double, double, double >, std::vector< ::DBus::Struct< uint32_t, int32_t, DBusCommonAPIVariant > > > DBus_PoiAddedDetails_t; + + + DBus_PoiAddedDetails(){ + DBus_geoCoordinate3D loc; + DBus_poiAttribute attrib; + + m_PoiAddedDetails.name = ""; + m_PoiAddedDetails.location = loc.get(); + m_PoiAddedDetails.attributes.clear(); + m_PoiAddedDetails.attributes.push_back(attrib.get()); //one element by default + } + + ~DBus_PoiAddedDetails(){} + + void set(PoiAddedDetails_t value){ + size_t index; + m_PoiAddedDetails.name = value.name; + m_PoiAddedDetails.location = value.location; + + m_PoiAddedDetails.attributes.clear(); + for (index=0;index<value.attributes.size();index++) + { + m_PoiAddedDetails.attributes.push_back(value.attributes.at(index)); + } + } + + PoiAddedDetails_t get(){ + return(m_PoiAddedDetails); + } + + void setDBus(DBus_PoiAddedDetails_t value){ + DBus_geoCoordinate3D loc; + size_t index; + DBus_poiAttribute attrib; + + m_PoiAddedDetails.name = value._1; + loc.setDBus(value._2); + m_PoiAddedDetails.location = loc.get(); + + m_PoiAddedDetails.attributes.clear(); + for (index=0;index<value._3.size();index++) + { + attrib.setDBus(value._3.at(index)); + m_PoiAddedDetails.attributes.push_back(attrib.get()); + } + } + + DBus_PoiAddedDetails_t getDBus(){ + DBus_PoiAddedDetails_t return_value; + size_t index; + DBus_poiAttribute attrib; + DBus_geoCoordinate3D loc; + + return_value._1 = m_PoiAddedDetails.name; + + loc.set(m_PoiAddedDetails.location); + return_value._2 = loc.getDBus(); + + return_value._3.clear(); + for (index=0;index<m_PoiAddedDetails.attributes.size();index++) + { + attrib.set(m_PoiAddedDetails.attributes.at(index)); + return_value._3.push_back(attrib.getDBus()); + } + + return(return_value); + } + +private: + PoiAddedDetails_t m_PoiAddedDetails; +}; + + +#endif diff --git a/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/positioning-constants.h b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/positioning-constants.h new file mode 100644 index 0000000..64fd839 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/dbus-proxies/positioning-constants.h @@ -0,0 +1,61 @@ + +/* This is an automatically generated file, do not edit */ + + + +enum GENIVI_ENHANCEDPOSITIONSERVICE_Constants { + GENIVI_ENHANCEDPOSITIONSERVICE_LATITUDE = 0x00000001, + GENIVI_ENHANCEDPOSITIONSERVICE_LONGITUDE = 0x00000002, + GENIVI_ENHANCEDPOSITIONSERVICE_ALTITUDE = 0x00000004, + GENIVI_ENHANCEDPOSITIONSERVICE_HEADING = 0x00000008, + GENIVI_ENHANCEDPOSITIONSERVICE_SPEED = 0x00000010, + GENIVI_ENHANCEDPOSITIONSERVICE_CLIMB = 0x00000020, + GENIVI_ENHANCEDPOSITIONSERVICE_ROLL_RATE = 0x00000040, + GENIVI_ENHANCEDPOSITIONSERVICE_PITCH_RATE = 0x00000080, + GENIVI_ENHANCEDPOSITIONSERVICE_YAW_RATE = 0x00000100, + GENIVI_ENHANCEDPOSITIONSERVICE_PDOP = 0x00000200, + GENIVI_ENHANCEDPOSITIONSERVICE_HDOP = 0x00000400, + GENIVI_ENHANCEDPOSITIONSERVICE_VDOP = 0x00000800, + GENIVI_ENHANCEDPOSITIONSERVICE_USED_SATELLITES = 0x00001000, + GENIVI_ENHANCEDPOSITIONSERVICE_TRACKED_SATELLITES = 0x00002000, + GENIVI_ENHANCEDPOSITIONSERVICE_VISIBLE_SATELLITES = 0x00004000, + GENIVI_ENHANCEDPOSITIONSERVICE_SIGMA_HPOSITION = 0x00008000, + GENIVI_ENHANCEDPOSITIONSERVICE_SIGMA_ALTITUDE = 0x00010000, + GENIVI_ENHANCEDPOSITIONSERVICE_SIGMA_HEADING = 0x00020000, + GENIVI_ENHANCEDPOSITIONSERVICE_SIGMA_SPEED = 0x00040000, + GENIVI_ENHANCEDPOSITIONSERVICE_SIGMA_CLIMB = 0x00080000, + GENIVI_ENHANCEDPOSITIONSERVICE_GNSS_FIX_STATUS = 0x00100000, + GENIVI_ENHANCEDPOSITIONSERVICE_DR_STATUS = 0x00200000, + GENIVI_ENHANCEDPOSITIONSERVICE_RELIABILTY_INDEX = 0x00400000, + GENIVI_ENHANCEDPOSITIONSERVICE_USED_SATELLITESYSTEMS = 0x00800000, + GENIVI_ENHANCEDPOSITIONSERVICE_YEAR = 0x01000000, + GENIVI_ENHANCEDPOSITIONSERVICE_MONTH = 0x02000000, + GENIVI_ENHANCEDPOSITIONSERVICE_DAY = 0x04000000, + GENIVI_ENHANCEDPOSITIONSERVICE_HOUR = 0x08000000, + GENIVI_ENHANCEDPOSITIONSERVICE_MINUTE = 0x10000000, + GENIVI_ENHANCEDPOSITIONSERVICE_SECOND = 0x20000000, + GENIVI_ENHANCEDPOSITIONSERVICE_MS = 0x40000000, + GENIVI_ENHANCEDPOSITIONSERVICE_TIME_SCALE = 0x80000000, + GENIVI_ENHANCEDPOSITIONSERVICE_LEAP_SECONDS = 0x100000000, + GENIVI_ENHANCEDPOSITIONSERVICE_INVALID = 0x00000000, + GENIVI_ENHANCEDPOSITIONSERVICE_GPS = 0x00000001, + GENIVI_ENHANCEDPOSITIONSERVICE_GLONASS = 0x00000002, + GENIVI_ENHANCEDPOSITIONSERVICE_GALILEO = 0x00000004, + GENIVI_ENHANCEDPOSITIONSERVICE_BEIDOU = 0x00000008, + GENIVI_ENHANCEDPOSITIONSERVICE_COMPASS = 0x00000008, + GENIVI_ENHANCEDPOSITIONSERVICE_GPS_L2 = 0x00000010, + GENIVI_ENHANCEDPOSITIONSERVICE_GPS_L5 = 0x00000020, + GENIVI_ENHANCEDPOSITIONSERVICE_GLONASS_L2 = 0x00000040, + GENIVI_ENHANCEDPOSITIONSERVICE_BEIDOU_B2 = 0x00000080, + GENIVI_ENHANCEDPOSITIONSERVICE_SBAS_WAAS = 0x00010000, + GENIVI_ENHANCEDPOSITIONSERVICE_SBAS_EGNOS = 0x00020000, + GENIVI_ENHANCEDPOSITIONSERVICE_SBAS_MSAS = 0x00040000, + GENIVI_ENHANCEDPOSITIONSERVICE_SBAS_QZSS_SAIF = 0x00080000, + GENIVI_ENHANCEDPOSITIONSERVICE_SBAS_SDCM = 0x00100000, + GENIVI_ENHANCEDPOSITIONSERVICE_SBAS_GAGAN = 0x00200000, + GENIVI_ENHANCEDPOSITIONSERVICE_MAP_MATCHED_FEEDBACK = 0x00000001, + GENIVI_ENHANCEDPOSITIONSERVICE_TEST_FEEDBACK = 0x00000002, + GENIVI_ENHANCEDPOSITIONSERVICE_TIME_SCALE_UTC = 0, + GENIVI_ENHANCEDPOSITIONSERVICE_TIME_SCALE_GPS = 1, +}; +
\ No newline at end of file diff --git a/test/html-based-panel/node-cpp-lbs-modules/package.json b/test/html-based-panel/node-cpp-lbs-modules/package.json new file mode 100644 index 0000000..5f47c07 --- /dev/null +++ b/test/html-based-panel/node-cpp-lbs-modules/package.json @@ -0,0 +1,29 @@ +{ + "name": "node-cpp-lbs-modules", + "version": "0.1.0", + "description": "C++ modules used by the HTML test panel for the FSA", + "keywords": [ + "npm", + "GENIVI", + "W3C", + "LBS-EG" + ], + "author": "Philippe Colliot <philippe.colliot@mpsa.com>", + "contributors": [""], + "main": "", + "license": "MPL V.2.0", + "dependencies": { + "http": "0.0.0", + "url": "0.11.0", + "fs": "0.0.2", + "path": "", + "webidl2": "2.0.11", + "escodegen": "1.8.0", + "socket.io": "1.4.5", + "gcontext": "0.0.2" + }, + "devDependencies": { + "chai": "~3.5.0", + "mocha": "~2.4.5" + } +} diff --git a/test/html-based-panel/server.js b/test/html-based-panel/server.js new file mode 100644 index 0000000..af22c60 --- /dev/null +++ b/test/html-based-panel/server.js @@ -0,0 +1,162 @@ +/** +* @licence app begin@ +* SPDX-License-Identifier: MPL-2.0 +* +* \copyright Copyright (C) 2016, PCA Peugeot Citroen +* +* \file main.cpp +* +* \brief This file is part of the Navigation Web API proof of concept. +* +* \author Philippe Colliot <philippe.colliot@mpsa.com> +* +* \version 0.1 +* +* This Source Code Form is subject to the terms of the +* Mozilla Public License (MPL), v. 2.0. +* If a copy of the MPL was not distributed with this file, +* You can obtain one at http://mozilla.org/MPL/2.0/. +* +* For further information see http://www.genivi.org/. +* +* List of changes: +* <date>, <name>, <description of change> +* +* @licence end@ +*/ +// Requirement of external JS files +var resource = require('./js/resource.js'); + +// Requirements of nodejs modules +var http = require('http'); +var url = require('url'); +var fs = require('fs'); +var path = require('path'); +var gcontext = require('gcontext'); + +// Requirements of LBS add-on modules +var positioningEnhancedPositionWrapper = require(resource.generatedNodejsModulePath+'/PositioningEnhancedPositionWrapper'); +var fuelStopAdvisorWrapper = require(resource.generatedNodejsModulePath+'/FuelStopAdvisorWrapper'); + +// Create instances +var i_positioningEnhancedPositionWrapper = new positioningEnhancedPositionWrapper.PositioningEnhancedPositionWrapper(); +var i_fuelStopAdvisorWrapper = new fuelStopAdvisorWrapper.FuelStopAdvisorWrapper(); + +// Create and init server +var port = 8080; +var hostname = '127.0.0.1'; +var server = http.createServer(function(req, res) { + var page = url.parse(req.url).pathname; + var full_path = path.join(process.cwd(),page); + // Check if page exists (for the moment only index.html) + fs.exists(full_path,function(exists){ + if(!exists){ + res.writeHeader(404, {"Content-Type": "text/plain"}); + res.write("404 Not Found\n"); + res.end(); + } + else{ + fs.readFile(full_path, "binary", function(err, file) { + if(err) { + res.writeHeader(500, {"Content-Type": "text/plain"}); + res.write(err + "\n"); + res.end(); + + } + else{ + res.writeHeader(200); + res.write(file, "binary"); + res.end(); + } + }); + } + }); +}); + +// Launch server +server.listen(port); + +// Load socket.io and connect it to the server +var io = require('socket.io').listen(server); + +// Manage socket for the namespace /simulation +var socket_simulation = io.of('/simulation'); +// signals +function positionUpdate(changedValues) { + console.log('positionUpdate: ' + changedValues); + socket_simulation.emit('positioning_signal', {signal: 'positionUpdate', data: changedValues}); +} +var setPositionUpdateListener = i_positioningEnhancedPositionWrapper.setPositionUpdateListener(positionUpdate); +function tripDataUpdated(changedValues) { + console.log('tripDataUpdated: ' + changedValues); + socket_simulation.emit('demonstrator_signal', {signal: 'tripDataUpdated', data: changedValues}); +} +var setTripDataUpdatedListener = i_fuelStopAdvisorWrapper.setTripDataUpdatedListener(tripDataUpdated); +function fuelStopAdvisorWarning(changedValues) { + console.log('fuelStopAdvisorWarning: ' + changedValues); + socket_simulation.emit('demonstrator_signal', {signal: 'fuelStopAdvisorWarning', data: changedValues}); +} +var setFuelStopAdvisorWarningListener = i_fuelStopAdvisorWrapper.setFuelStopAdvisorWarningListener(fuelStopAdvisorWarning); +function tripDataResetted(changedValues) { + console.log('tripDataResetted: ' + changedValues); + socket_simulation.emit('demonstrator_signal', {signal: 'tripDataResetted', data: changedValues}); +} +var setTripDataResettedListener = i_fuelStopAdvisorWrapper.setTripDataResettedListener(tripDataResetted); + +// Start the gmainloop (to be done after the initialisation of listeners ! +gcontext.init(); + +// connection +socket_simulation.on('connection', function (client) { + console.log('Client connected'); + client.on('positioning_request', function (message) { + switch(message.interface) { + case "PositioningEnhancedPosition": + console.log('Message received: Interface-->' + message.interface +' Method-->', message.method +' Parameters-->' + message.parameters); + if (message.method in i_positioningEnhancedPositionWrapper && typeof i_positioningEnhancedPositionWrapper[message.method] === "function") { + var data = i_positioningEnhancedPositionWrapper[message.method](message.parameters); + if(data) { + client.emit('positioning_answer', {request: message.method, answer: data}); + } + } + else { + console.log("Could not find " + message.method + " function"); + client.emit('feedback', "Could not find " + message.method + " function"); + } + break; + default: + console.log("Could not find " + message.interface); + client.emit('feedback', "Could not find " + message.interface); + } + }); + client.on('demonstrator_request', function (message) { + switch(message.interface) { + case "FuelStopAdvisor": + console.log('Message received: Interface-->' + message.interface +' Method-->', message.method +' Parameters-->' + message.parameters); + if (message.method in i_fuelStopAdvisorWrapper && typeof i_fuelStopAdvisorWrapper[message.method] === "function") { + var data = i_fuelStopAdvisorWrapper[message.method](message.parameters); + if(data) { + console.log('data' + data); + client.emit('demonstrator_answer', {request: message.method, answer: data}); + } + } + else { + console.log("Could not find " + message.method + " function"); + client.emit('feedback', "Could not find " + message.method + " function"); + } + break; + default: + console.log("Could not find " + message.interface); + client.emit('feedback', "Could not find " + message.interface); + } + }); +}); + +// Timer +setInterval(function(){ +//console.log('tick'); +}, 1000); + +// Log info +console.log('Server listening at: %s', server.address().port); + diff --git a/test/html-based-panel/simulation-panel.html b/test/html-based-panel/simulation-panel.html new file mode 100644 index 0000000..c9c8575 --- /dev/null +++ b/test/html-based-panel/simulation-panel.html @@ -0,0 +1,188 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="utf-8" /> +<title>Simulation panel for the FSA (draft)</title> +<link rel="stylesheet" href="style-sheets/stylesheet.css"> +<!-- to be fixed, use relative paths --> +<script type="text/javascript" src="./node_modules/socket.io/node_modules/socket.io-client/socket.io.js"></script> +<script type="text/javascript" src="./node_modules/webidl2/lib/webidl2.js"></script> +</head> +<body> +<header> +<h1>Fuel Stop Advisor</h1> +</header> + +<section> +START TIME: <h id="start_time"></h><br> +VERSION: <h id="version"></h><br> +</section> + +<section> +STEP: <p id="step"></p> +<div style="float: left; width: 360px;"> +<table style="width:100%"> + <caption>Inputs</caption> + <col width="200"> + <col width="100"> + <col width="60"> + <tr> + <td>Engine speed</td> + <td id=engine_speed></td> + <td>RPM</td> + </tr> + <tr> + <td>Tank</td> + <td id=tank></td> + <td>L</td> + </tr> + <tr> + <td>Fuel instant</td> + <td id=fuel_instant></td> + <td>L/H</td> + </tr> + <tr> + <td>Vehicle speed</td> + <td id=vehicle_speed></td> + <td>KM/H</td> + </tr> + <tr> + <td>Latitude</td> + <td id=latitude></td> + <td>deg</td> + </tr> + <tr> + <td>Longitude</td> + <td id=longitude></td> + <td>deg</td> + </tr> +</table> +</div> +<div style="float: left; width: 300px; padding:10px;"> +<table style="width:100%"> + <caption>Status</caption> + <col width="200"> + <col width="100"> + <tr> + <td>Guidance</td> + <td id=guidance_status></td> + </tr> + <tr> + <td>Simulation</td> + <td id=simulation_status></td> + </tr> + <tr> + <td>FSA warning</td> + <td id=warning_status></td> + </tr> + <tr> + <td>Tank distance</td> + <td id=tank_distance></td> + </tr> + <tr> + <td>Enhanced tank distance</td> + <td id=enhanced_tank_distance></td> + </tr> +</table> +</div> +</section> + +<footer> +Copyright © PCA Peugeot Citroen +</footer> + +<script type="text/javascript"> + +<!-- sockets management --> +var socket_simulation = io.connect('http://localhost:8080/simulation'); //namespace simulation +socket_simulation.on('feedback', function(message) { + alert('Message received from the server : ' + message); +}) + +socket_simulation.on('positioning_answer', function(message) { + if(message.request === 'getPositionInfo') + { + getPositionInfoReturn(message.answer); + } +}) + +socket_simulation.on('positioning_signal', function(message) { + if(message.signal === 'positionUpdate') + { + positionUpdate(message.data); + } +}) + +socket_simulation.on('demonstrator_answer', function(message) { + if(message.request === 'getVersion') + { + getVersionReturn(message.answer); + } else { + if(message.request === 'getPositionInfo') + { + getPositionInfoReturn(message.answer); + } + } +}) + +socket_simulation.on('demonstrator_signal', function(message) { + if(message.signal === 'tripDataUpdated') + { + tripDataUpdated(message.data); + } +}) + + +<!-- initialization --> +var today=new Date(); +document.getElementById("start_time").innerHTML=today; + +getVersion(); + +<!-- getters --> +function getVersion() { + socket_simulation.emit('demonstrator_request', {interface: 'FuelStopAdvisor', method: 'getVersion', parameters: []}); +} +function getVersionReturn(answer) { + document.getElementById("version").innerHTML=answer[3]; +} +function getPositionInfo() { + socket_simulation.emit('positioning_request', {interface: 'PositioningEnhancedPosition', method: 'getPositionInfo', parameters: [0,27]}); +} +function getPositionInfoReturn(answer) { + for ( var i=1; i<answer.length; i++ ) { + //nb: first entry is the timestamp + switch(answer[i].key_lsb) + { + case 1: + document.getElementById("latitude").innerHTML=answer[i].value; + break; + case 2: + document.getElementById("longitude").innerHTML=answer[i].value; + break; + } + } +} +function getInstantData() { + socket_simulation.emit('demonstrator_request', {interface: 'FuelStopAdvisor', method: 'getInstantData', parameters: []}); +} +function getInstantDataReturn(answer) { +alert('Message received from the server : ' + answer); +} + +<!-- setters --> + +<!-- signals --> +function positionUpdate(changedValues) { + getPositionInfo(); +} + +function tripDataUpdated(number) { + getInstantData(); +} + +<!-- some other functions --> + +</script> +</body> +</html> diff --git a/test/html-based-panel/style-sheets/stylesheet.css b/test/html-based-panel/style-sheets/stylesheet.css new file mode 100644 index 0000000..97bbdfa --- /dev/null +++ b/test/html-based-panel/style-sheets/stylesheet.css @@ -0,0 +1,66 @@ +body { + position:relative; + width: 800px; + height: 480px; + max-width: 800px; + max-height: 480px; + min-width: 800px; + min-height: 480px; + margin: 0; + padding: 0; + background-color: lightblue; + font-size: 1em; + border:double 2px black; +} +header { + width: 800px; + height: 50px; + color:white; + text-align:center; + padding:5px; +} +section { + color:white; + width:800px; + float:left; + padding:10px; +} +footer { + position:absolute; + bottom:0; + width: 800px; + height: 20px; + background-color:black; + color:white; + clear:both; + text-align:center; +} +h1 { + color: navy; + margin-left: 20px; + font-size: 1.5em; +} +h { + color: black; + margin-left: 5px; +} + +p { + font-family: verdana; + color: grey; +} + +localeListButtons { + color: yellow; +} +table { + table-layout: fixed; +} +table, th, td { + border: 1px solid black; + border-collapse: collapse; +} +th, td { + padding: 5px; + text-align: left; +} |