From c7a26132f8ff6ff19e8f6203f949b2977c72b095 Mon Sep 17 00:00:00 2001 From: Kevron Rees Date: Fri, 26 Oct 2012 16:50:53 -0700 Subject: [PATCH] updated tpms plugin so it compiles --- CMakeLists.txt | 1 + lib/abstractroutingengine.h | 18 ++++++++---------- lib/vehicleproperty.cpp | 13 ++++--------- plugins/tpms/tpmsplugin.cpp | 10 ++++++++-- plugins/tpms/tpmsplugin.h | 3 ++- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cc1e69..e0d3098 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ set (DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}" CACHE P option(use_qtcore "Use QCoreApplication mainloop " OFF) option(tpms_plugin "TPMS plugin " OFF) +option(obd2_plugin "OBD-II plugin" OFF) find_library(libtool_LIBRARY ltdl DOC "Libtool libraries") find_path(libtool_INCLUDE_DIR ltdl.h DOC "Libtool headers") diff --git a/lib/abstractroutingengine.h b/lib/abstractroutingengine.h index b558f40..f39503e 100644 --- a/lib/abstractroutingengine.h +++ b/lib/abstractroutingengine.h @@ -32,9 +32,11 @@ class AbstractSink; class AbstractSource; class AsyncPropertyReply; +class AsyncRangePropertyReply; typedef std::function GetPropertyCompletedSignal; +typedef std::function GetRangedPropertyCompletedSignal; class PropertyValueTime { public: @@ -100,7 +102,7 @@ public: AbstractPropertyType* value; }; -class AsyncRangePropertyRequest: public AsyncPropertyRequest +class AsyncRangePropertyRequest { public: AsyncRangePropertyRequest() @@ -109,15 +111,8 @@ public: } - AsyncRangePropertyRequest(const AsyncPropertyRequest &request) - :AsyncPropertyRequest(request), begin(0), end(0) - { - this->property = request.property; - this->completed = request.completed; - } - AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request) - :AsyncPropertyRequest(request) + { this->property = request.property; this->completed = request.completed; @@ -125,6 +120,8 @@ public: this->end = request.end; } + VehicleProperty::Property property; + GetRangedPropertyCompletedSignal completed; time_t begin; time_t end; }; @@ -133,12 +130,13 @@ class AsyncRangePropertyReply: public AsyncRangePropertyRequest { public: AsyncRangePropertyReply(AsyncRangePropertyRequest request) - :AsyncRangePropertyRequest(request) + :AsyncRangePropertyRequest(request), success(false) { } std::list values; + bool success; }; class AbstractRoutingEngine diff --git a/lib/vehicleproperty.cpp b/lib/vehicleproperty.cpp index 063f11b..4ffae17 100644 --- a/lib/vehicleproperty.cpp +++ b/lib/vehicleproperty.cpp @@ -113,6 +113,10 @@ VehicleProperty::VehicleProperty() REGISTERPROPERTYWITHTYPE(TirePressureRightFront, TirePressureType, 0); REGISTERPROPERTYWITHTYPE(TirePressureLeftRear, TirePressureType, 0); REGISTERPROPERTYWITHTYPE(TirePressureRightRear, TirePressureType, 0); + REGISTERPROPERTYWITHTYPE(TireTemperatureLeftFront,TireTemperatureType,0); + REGISTERPROPERTYWITHTYPE(TireTemperatureRightFront,TireTemperatureType,0); + REGISTERPROPERTYWITHTYPE(TireTemperatureLeftRear,TireTemperatureType,0); + REGISTERPROPERTYWITHTYPE(TireTemperatureRightRear,TireTemperatureType,0); registerProperty( VehiclePowerMode,[](){ return new VehiclePowerModeType(Power::Off); } ); REGISTERPROPERTYWITHTYPE(TripMeterA,TripMeterType,0); REGISTERPROPERTYWITHTYPE(TripMeterB,TripMeterType,0); @@ -136,19 +140,10 @@ VehicleProperty::VehicleProperty() std::list VehicleProperty::capabilities() { return mCapabilities; - mProperties.push_back(TireTemperatureLeftFront); - mProperties.push_back(TireTemperatureRightFront); - mProperties.push_back(TireTemperatureLeftRear); - mProperties.push_back(TireTemperatureRightRear); } AbstractPropertyType* VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::Property name, std::string value) { - - else if(name == TireTemperatureLeftFront) return new TireTemperatureType(value); - else if(name == TireTemperatureRightFront) return new TireTemperatureType(value); - else if(name == TireTemperatureLeftRear) return new TireTemperatureType(value); - else if(name == TireTemperatureRightRear) return new TireTemperatureType(value); if(registeredPropertyFactoryMap.count(name) > 0) { VehicleProperty::PropertyTypeFactoryCallback cb = registeredPropertyFactoryMap[name]; diff --git a/plugins/tpms/tpmsplugin.cpp b/plugins/tpms/tpmsplugin.cpp index 3be4ff3..01cb444 100644 --- a/plugins/tpms/tpmsplugin.cpp +++ b/plugins/tpms/tpmsplugin.cpp @@ -156,12 +156,18 @@ void TpmsPlugin::getPropertyAsync(AsyncPropertyReply *reply) DebugOut() << "TPMS: no such getProperty type: " << reply->property << endl; reply->value = nullptr; reply->completed(reply); - } + } } -void TpmsPlugin::setProperty(VehicleProperty::Property , AbstractPropertyType *) +void TpmsPlugin::getRangePropertyAsync(AsyncRangePropertyReply *reply) { + ///not supported + reply->completed(reply); +} +AsyncPropertyReply *TpmsPlugin::setProperty(AsyncSetPropertyRequest request ) +{ + return NULL; } void TpmsPlugin::subscribeToPropertyChanges(VehicleProperty::Property property) diff --git a/plugins/tpms/tpmsplugin.h b/plugins/tpms/tpmsplugin.h index 85bdfbe..189c91b 100644 --- a/plugins/tpms/tpmsplugin.h +++ b/plugins/tpms/tpmsplugin.h @@ -32,7 +32,8 @@ public: string uuid(); void getPropertyAsync(AsyncPropertyReply *reply); - void setProperty(VehicleProperty::Property, AbstractPropertyType*); + void getRangePropertyAsync(AsyncRangePropertyReply *reply); + AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request); void subscribeToPropertyChanges(VehicleProperty::Property property); void unsubscribeToPropertyChanges(VehicleProperty::Property property); PropertyList supported(); -- 2.7.4