From 047d17b55433dc092a008aab90a92dd62e2ca3cf Mon Sep 17 00:00:00 2001 From: Kevron Rees Date: Fri, 12 Dec 2014 13:22:34 -0800 Subject: [PATCH 1/1] fixed docs; fixed test plugin --- CMakeLists.txt | 2 +- docs/amb.in.idl | 29 ++++++++++++++++++----------- docs/dbus.idl | 4 ++-- lib/vehicleproperty.h | 1 + plugins/bluemonkey/config.js | 15 +++++++-------- plugins/testplugin/testplugin.cpp | 28 ++++++++++++---------------- 6 files changed, 41 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b4402f..d62d340 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ set(XWALK_EXTENSION_PATH "/automotive-message-broker/xwalk" CACHE PATH "director #turn on -fpic/-fpie: set(CMAKE_POSITION_INDEPENDENT_CODE ON) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++11") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -pie -std=c++1y") if(opencvlux_plugin) message(STATUS "OpenCV Lux plugin enabled") diff --git a/docs/amb.in.idl b/docs/amb.in.idl index 41e9871..0d57e83 100644 --- a/docs/amb.in.idl +++ b/docs/amb.in.idl @@ -112,7 +112,8 @@ interface org.automotive.Manager { * except that it takes an addition zone argument and only return the path for that zone. * \arg String property is the requested property to be retrieved. * \arg Zone zone is the zone which the object - * \return string representing the DBus Object path. Possible errors: + * \return string representing the DBus Object path. + * Possible errors: * "org.automotive.Manager.InvalidZone" * "org.automotive.Manager.ObjectNotFound" */ @@ -581,7 +582,7 @@ interface org.automotive.WindshieldWiper extends VehiclePropertyType { } -enum WiperControl { +enumeration WiperControl { off = "off", once = "once", slowest = "slowest", @@ -772,7 +773,7 @@ interface org.automotive.Sunroof extends VehiclePropertyType { } -enum ConvertibleRoofStatus { +enumeration ConvertibleRoofStatus { closed = "closed", closing = "closing", opening = "opening", @@ -1450,7 +1451,7 @@ interface org.automotive.BrakeOperation extends VehiclePropertyType { attribute Boolean BrakePedalDepressed readonly } -enum Button { +enumeration Button { home = "home", back = "back", search = "search", @@ -1468,7 +1469,7 @@ enum Button { down = "down" } -enum ButtonEventType { +enumeration ButtonEventType { press = "press", long_press = "long_press", release = "release" @@ -1633,7 +1634,7 @@ interface org.automotive.SeatAdjustment extends VehiclePropertyType { attribute UInt8 SeatSideCushion; } -enum DriveModeType { +enumeration DriveModeType { comfort = "comfort", auto = "auto", sport = "sport", @@ -1699,13 +1700,13 @@ interface org.automotive.ChildSafetyLock extends VehiclePropertyType { attribute Boolean Lock; } -enum OccupantStatus { +enumeration OccupantStatus { adult = "adult", child = "child", vacant = "vacant" }; -enum IdentificationTypeEnum { +enumeration IdentificationTypeEnum { pin = "pin", keyfob = "keyfob", Bluetooth = "Bluetooth", @@ -1744,7 +1745,7 @@ interface org.automotive.AtmosphericPressure extends VehiclePropertyType { attribute UInt16 Pressure; } -enum LaneDepartureStatus { +enumeration LaneDepartureStatus { off = "off", pause = "pause", running = "running" @@ -1757,7 +1758,7 @@ interface org.automotive.LaneDepartureDetection extends VehiclePropertyType { attribute LaneDepartureStatus Status readonly; } -enum AlarmStatus { +enumeration AlarmStatus { disarmed = "disarmed", prearmed = "prearmed", armed = "armed", @@ -1771,9 +1772,15 @@ interface org.automotive.Alarm extends VehiclePropertyType { attribute AlarmStatus Status; } -enum ParkingBrakeStatus { +enumeration ParkingBrakeStatus { inactive = "inactive", active = "active", error = "error" }; +interface org.automotive.ParkingBrake extends VehiclePropertyType { + /*! + * \brief MUST return the current status of vehicle Alarm System. + */ + attribute ParkingBrakeStatus Status readonly; +} diff --git a/docs/dbus.idl b/docs/dbus.idl index e73c583..29cb468 100644 --- a/docs/dbus.idl +++ b/docs/dbus.idl @@ -15,9 +15,9 @@ * * \section basic_usage Basic Recommended Usage * -* It is recomended that the Manager interface be used to find the DBus Object that contains the +* It is recommended that the Manager interface be used to find the DBus Object that contains the * data type you need. This is done through the FindObject() call. It is expected that DBus -* Object Paths may change and so it is not appropriate to hard code DBus Object Paths. +* Object Paths may change and so it is not appropriate to hard code DBus Object Paths. * * \section example Usage Example * Here is a pseudo-code example of how the api is to be used: diff --git a/lib/vehicleproperty.h b/lib/vehicleproperty.h index 3effde1..08792cd 100644 --- a/lib/vehicleproperty.h +++ b/lib/vehicleproperty.h @@ -541,6 +541,7 @@ public: /**< Button Event @see ButtonEvents::ButtonEventType */ ///TODO: deprecated. Use ButtonEventW3C. Remove in 0.14 + [[deprecated("Depricated in 0.14. Use ButtonEventW3C")]] static const Property ButtonEvent; PROPERTYTYPE(ButtonEvent, ButtonEventType, BasicPropertyType, ButtonEvents::ButtonEventType) diff --git a/plugins/bluemonkey/config.js b/plugins/bluemonkey/config.js index e223c59..a1dfd57 100644 --- a/plugins/bluemonkey/config.js +++ b/plugins/bluemonkey/config.js @@ -188,23 +188,20 @@ bluemonkey.createCustomProperty("OccupantIdentificationType", "pin", Zone.Rear | bluemonkey.createCustomProperty("OccupantIdentificationType", "pin", Zone.Rear | Zone.Left); bluemonkey.createCustomProperty("TargetTemperature", 20); +bluemonkey.createCustomProperty("FanSpeed", 1); +bluemonkey.createCustomProperty("AirConditioning", false); +bluemonkey.createCustomProperty("Heater", false); +bluemonkey.createCustomProperty("AirflowDirection", 0); +bluemonkey.createCustomProperty("AirRecirculation", false); -bluemonkey.createCustomProperty("AirflowDirection", 0, Zone.Front | Zone.Left); -bluemonkey.createCustomProperty("FanSpeed", 1, Zone.Front | Zone.Left); bluemonkey.createCustomProperty("TargetTemperature", 20, Zone.Front | Zone.Left); -bluemonkey.createCustomProperty("AirConditioning", false, Zone.Front | Zone.Left); bluemonkey.createCustomProperty("AirRecirculation", false, Zone.Front | Zone.Left); -bluemonkey.createCustomProperty("Heater", false, Zone.Front | Zone.Left); bluemonkey.createCustomProperty("SteeringWheelHeater", 0, Zone.Front | Zone.Left); bluemonkey.createCustomProperty("SeatHeater", 0, Zone.Front | Zone.Left); bluemonkey.createCustomProperty("SeatCooler", 0, Zone.Front | Zone.Left); bluemonkey.createCustomProperty("AirflowDirection", 0, Zone.Front | Zone.Right); -bluemonkey.createCustomProperty("FanSpeed", 1, Zone.Front | Zone.Right); bluemonkey.createCustomProperty("TargetTemperature", 25, Zone.Front | Zone.Right); -bluemonkey.createCustomProperty("AirConditioning", false, Zone.Front | Zone.Right); -bluemonkey.createCustomProperty("AirRecirculation", false, Zone.Front | Zone.Right); -bluemonkey.createCustomProperty("Heater", false, Zone.Front | Zone.Right); bluemonkey.createCustomProperty("SeatHeater", 0, Zone.Front | Zone.Right); bluemonkey.createCustomProperty("SeatCooler", 0, Zone.Front | Zone.Right); @@ -251,3 +248,5 @@ var testTimer = bluemonkey.createTimer(); //VehicleSpeed speedProperty.value = Math.floor((Math.random() * 100) + 1); }); + +//testTimer.start(); diff --git a/plugins/testplugin/testplugin.cpp b/plugins/testplugin/testplugin.cpp index bcc5b39..58f3515 100644 --- a/plugins/testplugin/testplugin.cpp +++ b/plugins/testplugin/testplugin.cpp @@ -64,37 +64,30 @@ bool beginsWith(std::string a, std::string b) bool TestPlugin::testCoreSetSupported() { PropertyList supported(routingEngine->supported()); - TEST(contains(supported,TestProptertyName1) == false); - std::vector sources(routingEngine->sourcesForProperty(TestProptertyName1)); - TEST(contains(sources,uuid()) == false); - - // if we were registered in Core, it will ask us and we will return it valid, but we haven't registered yet - TEST(routingEngine->getPropertyInfo(TestProptertyName1, uuid()).isValid() == false); + TEST(contains(supported, TestProptertyName1) == false); // // CALL setSupported // - routingEngine->updateSupported(m_supportedProperties, PropertyList(), nullptr);// invalid input - TEST(routingEngine->getPropertyInfo(TestProptertyName1, uuid()).isValid() == false); // valid call - routingEngine->updateSupported(m_supportedProperties, PropertyList(), this);// we are register as source from now + routingEngine->updateSupported(m_supportedProperties, PropertyList(), this); TEST(routingEngine->getPropertyInfo(TestProptertyName1, uuid()).isValid() == true); Zone::ZoneList zones(routingEngine->getPropertyInfo(TestProptertyName1, uuid()).zones()); TEST(contains(zones, Zone::LeftSide) == true); supported = routingEngine->supported(); - TEST(contains(supported,TestProptertyName1) == true); - TEST(contains(supported,TestProptertyName2) == true); - TEST(contains(supported,VehicleProperty::ClutchStatus) == false); + TEST(contains(supported, TestProptertyName1) == true); + TEST(contains(supported, TestProptertyName2) == true); + TEST(contains(supported, VehicleProperty::ClutchStatus) == false); - sources = routingEngine->sourcesForProperty(TestProptertyName1); + std::vector sources = routingEngine->sourcesForProperty(TestProptertyName1); TEST(contains(sources,uuid()) == true); TEST(routingEngine->getPropertyInfo(TestProptertyName2, uuid()).isValid() == true); zones = routingEngine->getPropertyInfo(TestProptertyName2, uuid()).zones(); - TEST(contains(zones,Zone::FrontSide) == true); + TEST(contains(zones, Zone::FrontSide) == true); return true; } @@ -351,11 +344,14 @@ TestPlugin::TestPlugin(AbstractRoutingEngine *re, map config) tfirst->append(v3); tsecond->fromVariant(tfirst->toVariant()); - g_assert (tfirst->toString() == tsecond->toString()); + GVariant* testGVSVariant = g_variant_new("i", 9); + TEST(GVS::value(testGVSVariant) == 9); + + TEST (tfirst->toString() == tsecond->toString()); testBooleanToStringFromString(); - g_assert (testCoreUpdateSupported()); + TEST (testCoreUpdateSupported()); testSubscription(); -- 2.7.4