From fa2741d828b92f981641b0f13d2d7c75be01f041 Mon Sep 17 00:00:00 2001 From: Kevron Rees Date: Wed, 3 Apr 2013 09:25:45 -0700 Subject: more additions to dbus interface --- docs/environment.txt | 39 ++++-- lib/vehicleproperty.cpp | 49 +++++++ lib/vehicleproperty.h | 76 ++++++++++- plugins/dbus/environmentproperties.h | 244 +++++++++++++++++++++++++++++++++++ plugins/dbus/parking.h | 1 + 5 files changed, 396 insertions(+), 13 deletions(-) diff --git a/docs/environment.txt b/docs/environment.txt index 1d15b587..526479e4 100644 --- a/docs/environment.txt +++ b/docs/environment.txt @@ -1,4 +1,4 @@ -Environment hierarchy + Environment hierarchy ================= Service org.automotive @@ -47,19 +47,16 @@ Properties Fastest = 5, Auto = 10 -Interface org.automotive.HVACFan -Object path /org/automotive/environment/HVACFan +Interface org.automotive.HVAC +Object path /org/automotive/environment/HVAC Properties - - struct{ byte, byte, byte } HVACFan [readwrite] - + byte AirflowDirection [readwrite] Front Panel = 0, Floor Duct = 1, - Front + Floor = 2, - Front = 3, - Defroster + Floor = 4 + Front = 0x02, + Defroster = 0x04 byte FanSpeed [readwrite] @@ -102,6 +99,11 @@ Properties bool SeatCooler [readwrite] Seat cooler on (true) / off (false) + + +Interface org.automotive.WindowStatus +Object path /org/automotive/environment/WindowStatus +Properties dict{ byte, byte } WindowStatus [readwrite] @@ -112,12 +114,25 @@ Properties Driver = 0, Passenger = 1, LeftRear = 2, - RightRear = 3 + RightRear = 3, + Rear = 4 + +Interface org.automotive.Sunroof +Object path /org/automotive/environment/Sunroof +Properties - struct{ byte, byte } Sunroof [readwrite] + byte Openness [readwrite] - Percent of sunroof openness (0: Closed - 100: Fully Opened) (byte) and percent of tilt (0: Closed - 100: Maximum Tilt) (byte) + Percent of sunroof openness (0: Closed - 100: Fully Opened). + + byte Tilt [readwrite] + + Percent of tilt (0: Closed - 100: Maximum Tilt). +Interface org.automotive.ConvertibleRoof +Object path /org/automotive/environment/ConvertibleRoof +Properties + bool ConvertibleRoof [readwrite] Convertible roof on (true) / off (false) diff --git a/lib/vehicleproperty.cpp b/lib/vehicleproperty.cpp index d8b20358..e4162451 100644 --- a/lib/vehicleproperty.cpp +++ b/lib/vehicleproperty.cpp @@ -60,6 +60,7 @@ const VehicleProperty::Property VehicleProperty::AirIntakeTemperature = "AirInta const VehicleProperty::Property VehicleProperty::BatteryVoltage = "BatteryVoltage"; const VehicleProperty::Property VehicleProperty::BatteryCurrent = "BatteryCurrent"; const VehicleProperty::Property VehicleProperty::InteriorTemperature = "InteriorTemperature"; +const VehicleProperty::Property VehicleProperty::ExteriorTemperature = "ExteriorTemperature"; const VehicleProperty::Property VehicleProperty::EngineOilTemperature = "EngineOilTemperature"; const VehicleProperty::Property VehicleProperty::VIN = "VIN"; const VehicleProperty::Property VehicleProperty::WMI = "WMI"; @@ -130,6 +131,22 @@ const VehicleProperty::Property VehicleProperty::SeatBeltStatus = "SeatBeltStatu const VehicleProperty::Property VehicleProperty::WindowLockStatus = "WindowLockStatus"; const VehicleProperty::Property VehicleProperty::OccupantStatus = "OccupantStatus"; const VehicleProperty::Property VehicleProperty::ObstacleDistance = "ObstacleDistance"; +const VehicleProperty::Property VehicleProperty::RainSensor = "RainSensor"; +const VehicleProperty::Property VehicleProperty::WindshieldWiper = "WindshieldWiper"; +const VehicleProperty::Property VehicleProperty::AirflowDirection = "AirflowDirection"; +const VehicleProperty::Property VehicleProperty::FanSpeed = "FanSpeed"; +const VehicleProperty::Property VehicleProperty::TargetTemperature = "TargetTemperature"; +const VehicleProperty::Property VehicleProperty::AirConditioning = "AirConditioning"; +const VehicleProperty::Property VehicleProperty::AirRecirculation = "AirRecirculation"; +const VehicleProperty::Property VehicleProperty::Heater = "Heater"; +const VehicleProperty::Property VehicleProperty::Defrost = "Defrost"; +const VehicleProperty::Property VehicleProperty::SteeringWheelHeater = "SteeringWheelHeater"; +const VehicleProperty::Property VehicleProperty::SeatHeater = "SeatHeater"; +const VehicleProperty::Property VehicleProperty::SeatCooler = "SeatCooler"; +const VehicleProperty::Property VehicleProperty::WindowStatus = "WindowStatus"; +const VehicleProperty::Property VehicleProperty::Sunroof = "Sunroof"; +const VehicleProperty::Property VehicleProperty::SunroofTilt = "SunroofTilt"; +const VehicleProperty::Property VehicleProperty::ConvertibleRoof = "ConvertibleRoof"; std::list VehicleProperty::mCapabilities; @@ -162,6 +179,7 @@ VehicleProperty::VehicleProperty() registerPropertyPriv(BatteryVoltage, [](){ return new BatteryVoltageType(0); }); REGISTERPROPERTY(BatteryCurrent,0); registerPropertyPriv(InteriorTemperature, [](){ return new InteriorTemperatureType(0); }); + REGISTERPROPERTY(ExteriorTemperature,0); registerPropertyPriv(VIN, [](){ return new VINType(""); }); registerPropertyPriv(WMI, [](){ return new WMIType(""); }); REGISTERPROPERTYWITHTYPE(TirePressureLeftFront, TirePressureType, 0); @@ -282,6 +300,37 @@ VehicleProperty::VehicleProperty() return t; }); + REGISTERPROPERTY(RainSensor,0); + REGISTERPROPERTY(WindshieldWiper,Window::Off); + REGISTERPROPERTY(AirflowDirection,HVAC::Front); + REGISTERPROPERTY(FanSpeed,0); + REGISTERPROPERTY(TargetTemperature,0); + REGISTERPROPERTY(AirConditioning,false); + REGISTERPROPERTY(AirRecirculation,false); + REGISTERPROPERTY(Heater,false); + + registerPropertyPriv(Defrost, []() + { + DefrostType *d = new DefrostType(); + d->append(Window::Windshield,false); + + return d; + }); + + REGISTERPROPERTY(SteeringWheelHeater,false); + REGISTERPROPERTY(SeatHeater, false); + REGISTERPROPERTY(SeatCooler, false); + registerPropertyPriv(WindowStatus, []() + { + WindowStatusType* d = new WindowStatusType(); + d->append(Window::Driver,100); + + return d; + }); + REGISTERPROPERTY(Sunroof,0); + REGISTERPROPERTY(SunroofTilt,0); + REGISTERPROPERTY(ConvertibleRoof,false); + } void VehicleProperty::factory() diff --git a/lib/vehicleproperty.h b/lib/vehicleproperty.h index 9f95b3f7..fcc32b76 100644 --- a/lib/vehicleproperty.h +++ b/lib/vehicleproperty.h @@ -221,8 +221,20 @@ enum Location Passenger, LeftRear, RightRear, - Sunroof + Sunroof, + Windshield, + SideMirrorLeft, + SideMirrorRight }; + +enum WiperSpeed +{ + Off = 0, + Slowest = 1, + Fastest = 5, + Auto = 10 +}; + } namespace DistanceSensor @@ -239,6 +251,18 @@ enum Location }; } +namespace HVAC +{ +enum AirflowDirection +{ + FrontPanel=0, + FloorDuct = 1, + Front = 1 << 1, + Defroster = 1 << 2 + +}; +} + class VehicleProperty { @@ -356,6 +380,9 @@ public: static const Property InteriorTemperature; typedef BasicPropertyType InteriorTemperatureType; + static const Property ExteriorTemperature; + typedef BasicPropertyType ExteriorTemperatureType; + /**< Engine Oil Temperature in degrees celcius */ static const Property EngineOilTemperature; typedef BasicPropertyType EngineOilTemperatureType; @@ -552,6 +579,53 @@ public: static const Property ObstacleDistance; typedef MapPropertyType, BasicPropertyType > ObstacleDistanceType; + static const Property RainSensor; + typedef BasicPropertyType RainSensorType; + + static const Property WindshieldWiper; + typedef BasicPropertyType WindshieldWiperType; + + static const Property AirflowDirection; + typedef BasicPropertyType AirflowDirectionType; + + static const Property FanSpeed; + typedef BasicPropertyType FanSpeedType; + + static const Property TargetTemperature; + typedef BasicPropertyType TargetTemperatureType; + + static const Property AirConditioning; + typedef BasicPropertyType AirConditioningType; + + static const Property AirRecirculation; + typedef BasicPropertyType AirRecirculationType; + + static const Property Heater; + typedef BasicPropertyType HeaterType; + + static const Property Defrost; + typedef MapPropertyType, BasicPropertyType > DefrostType; + + static const Property SteeringWheelHeater; + typedef BasicPropertyType SteeringWheelHeaterType; + + static const Property SeatHeater; + typedef BasicPropertyType SeatHeaterType; + + static const Property SeatCooler; + typedef BasicPropertyType SeatCoolerType; + + static const Property WindowStatus; + typedef MapPropertyType, BasicPropertyType > WindowStatusType; + + static const Property Sunroof; + typedef BasicPropertyType SunroofType; + + static const Property SunroofTilt; + typedef BasicPropertyType SunroofTiltType; + + static const Property ConvertibleRoof; + typedef BasicPropertyType ConvertibleRoofType; /** END PROPERTIES **/ diff --git a/plugins/dbus/environmentproperties.h b/plugins/dbus/environmentproperties.h index 79d9fac4..07859d88 100644 --- a/plugins/dbus/environmentproperties.h +++ b/plugins/dbus/environmentproperties.h @@ -23,4 +23,248 @@ public: } }; +/** @interface Temperature : VehiclePropertyType **/ +class Temperature: public DBusSink +{ +public: + Temperature(AbstractRoutingEngine* re, GDBusConnection* connection) + :DBusSink("org.automotive.InteriorTemperature","/org/automotive/environment/InteriorTemperature", re, connection, map()) + { + /** + * @attributeName Interior + * @type signed long + * @access readonly + * @attributeComment \brief Must return the temperature of the interior of the vehicle in celcius. + */ + wantProperty(VehicleProperty::InteriorTemperature, "Interior", "i", AbstractProperty::Read); + + /** + * @attributeName Exterior + * @type signed long + * @access readonly + * @attributeComment \brief Must return the temperature of the exterior of the vehicle in celcius. + */ + wantProperty(VehicleProperty::ExteriorTemperature, "Exterior", "i", AbstractProperty::Read); + + supportedChanged(re->supported()); + } +}; + +/** @interface RainSensor : VehiclePropertyType **/ +class RainSensor: public DBusSink +{ +public: + RainSensor(AbstractRoutingEngine* re, GDBusConnection* connection) + :DBusSink("org.automotive.InteriorTemperature","/org/automotive/environment/InteriorTemperature", re, connection, map()) + { + /** + * @attributeName RainSensor + * @type unsigned short + * @access readonly + * @attributeComment \brief Must return level of rain intensity 0: No Rain - 10: Heaviest Rain. + */ + wantProperty(VehicleProperty::RainSensor, "RainSensor", "q", AbstractProperty::Read); + supportedChanged(re->supported()); + } +}; + +/** @interface WindshieldWiper : VehiclePropertyType **/ +class WindshieldWiper: public DBusSink +{ +public: + WindshieldWiper(AbstractRoutingEngine* re, GDBusConnection* connection) + :DBusSink("org.automotive.WindshieldWiper","/org/automotive/environment/WindshieldWiper", re, connection, map()) + { + /** + * @enum const unsigned short WIPERSPEED_OFF = 0; + * @enum const unsigned short WIPERSPEED_SLOWEST= 1; + * @enum const unsigned short WIPERSPEED_FASTEST = 5; + * @enum const unsigned short WIPERSPEED_AUTO = 10; + **/ + + /** + * @attributeName WindshieldWiper + * @type unsigned short + * @access readonly + * @attributeComment \brief Must return Level of windshield whiper speed (see WIPERSPEED_*) + */ + wantProperty(VehicleProperty::RainSensor, "WindshieldWiper", "y", AbstractProperty::ReadWrite); + supportedChanged(re->supported()); + } +}; + +/** @interface HVAC : VehiclePropertyType **/ +class HVACProperty: public DBusSink +{ +public: + HVACProperty(AbstractRoutingEngine* re, GDBusConnection* connection) + :DBusSink("org.automotive.HVAC","/org/automotive/environment/HVAC", re, connection, map()) + { + /** + * @enum const unsigned short AIRFLOWDIRECTION_FRONTPANEL = 0; + * @enum const unsigned short AIRFLOWDIRECTION_FLOORDUCT= 1; + * @enum const unsigned short AIRFLOWDIRECTION_FRONT = 0x02; + * @enum const unsigned short AIRFLOWDIRECTION_DEFROSTER = 0x04; + **/ + + /** + * @attributeName AirflowDirection + * @type unsigned short + * @access readwrite + * @attributeComment \brief Must return airflow direction. See AIRFLOWDIRECTION_*. + */ + wantProperty(VehicleProperty::AirflowDirection, "AirflowDirection", "y", AbstractProperty::ReadWrite); + + /** + * @attributeName FanSpeed + * @type unsigned short + * @access readwrite + * @attributeComment \brief Must return speed of the fan (0-7) + */ + wantProperty(VehicleProperty::FanSpeed, "FanSpeed", "y", AbstractProperty::ReadWrite); + + /** + * @attributeName TargetTemperature + * @type unsigned short + * @access readwrite + * @attributeComment \brief Must return target desired temperature in celcius. + */ + wantProperty(VehicleProperty::TargetTemperature, "TargetTemperature", "y", AbstractProperty::ReadWrite); + + /** + * @attributeName AirConditioning + * @type boolean + * @access readwrite + * @attributeComment \brief Must return air conditioning on (true) / off (false). + */ + wantProperty(VehicleProperty::AirConditioning, "AirConditioning", "b", AbstractProperty::ReadWrite); + + /** + * @attributeName AirRecirculation + * @type boolean + * @access readwrite + * @attributeComment \brief Must return air recirculation on (true) / off (false). + */ + wantProperty(VehicleProperty::AirRecirculation, "AirRecirculation", "b", AbstractProperty::ReadWrite); + + /** + * @attributeName Heater + * @type boolean + * @access readwrite + * @attributeComment \brief Must return heater on (true) / off (false). + */ + wantProperty(VehicleProperty::Heater, "Heater", "b", AbstractProperty::ReadWrite); + + /** + * @attributeName Defrost + * @type boolean + * @access readwrite + * @attributeComment \brief Must return air recirculation on (true) / off (false). + */ + wantProperty(VehicleProperty::AirRecirculation, "AirRecirculation", "b", AbstractProperty::ReadWrite); + + /** + * @attributeName Defrost + * @type object + * @access readwrite + * @attributeComment \brief Must return the defrost status of all windows equiped with defrosters. This will return a dictionary of { unsigned short, boolean } that represents + * @attributeComment \brief each window and its defrost status. + */ + wantPropertyVariant(VehicleProperty::Defrost, "Defrost", "a(y,b)", AbstractProperty::ReadWrite); + + /** + * @attributeName SteeringWheelHeater + * @type boolean + * @access readwrite + * @attributeComment \brief Must return air recirculation on (true) / off (false). + */ + wantProperty(VehicleProperty::SteeringWheelHeater, "SteeringWheelHeater", "b", AbstractProperty::ReadWrite); + + /** + * @attributeName SeatHeater + * @type boolean + * @access readwrite + * @attributeComment \brief Must return seat heater status: on (true) / off (false). + */ + wantProperty(VehicleProperty::SeatHeater, "SeatHeater", "b", AbstractProperty::ReadWrite); + + /** + * @attributeName SeatCooler + * @type boolean + * @access readwrite + * @attributeComment \brief Must return seat heater status: on (true) / off (false). + */ + wantProperty(VehicleProperty::SeatCooler, "SeatCooler", "b", AbstractProperty::ReadWrite); + + supportedChanged(re->supported()); + } +}; + +/** @interface WindowStatus : VehiclePropertyType **/ +class WindowStatus: public DBusSink +{ +public: + WindowStatus(AbstractRoutingEngine* re, GDBusConnection* connection) + :DBusSink("org.automotive.WindowStatus","/org/automotive/environment/WindowStatus", re, connection, map()) + { + /** + * @enum const unsigned short WINDOWLOCATION_DRIVER= 0; + * @enum const unsigned short WINDOWLOCATION_PASSENGER = 1; + * @enum const unsigned short WINDOWLOCATION_LEFTREAR = 2; + * @enum const unsigned short WINDOWLOCATION_RIGHTREAR = 3; + * @enum const unsigned short WINDOWLOCATION_REAR = 4; + **/ + + /** + * @attributeName WindowStatus + * @type object + * @access readwrite + * @attributeComment \brief Must return window status for each window location. object returned is a dictionary { unsigned short windowlocation, unsigned short percentage opened } + */ + wantPropertyVariant(VehicleProperty::WindowStatus,"WindowStatus","a(b,b)", AbstractProperty::ReadWrite); + } +}; + +/** @interface Sunroof : VehiclePropertyType **/ +class Sunroof: public DBusSink +{ +public: + Sunroof(AbstractRoutingEngine* re, GDBusConnection* connection) + :DBusSink("org.automotive.Sunroof","/org/automotive/environment/Sunroof", re, connection, map()) + { + /** + * @attributeName Openness + * @type unsigned short + * @access readwrite + * @attributeComment \brief Must return window status for sunroof openness percentage. + */ + wantPropertyVariant(VehicleProperty::Sunroof, "Openness", "y", AbstractProperty::ReadWrite); + + /** + * @attributeName Tilt + * @type unsigned short + * @access readwrite + * @attributeComment \brief Must return tilt status for sunroof percentage. + */ + wantPropertyVariant(VehicleProperty::SunroofTilt, "Tilt", "y", AbstractProperty::ReadWrite); + + } +}; + +/** @interface ConvertibleRoof : VehiclePropertyType **/ +class ConvertibleRoof: public DBusSink +{ +public: + ConvertibleRoof(AbstractRoutingEngine* re, GDBusConnection* connection) + :DBusSink("org.automotive.ConvertibleRoof","/org/automotive/environment/ConvertibleRoof", re, connection, map()) + { + /** + * @attributeName Openness + * @type unsigned short + * @access readwrite + * @attributeComment \brief Must return window status for sunroof openness percentage. + */ + wantPropertyVariant(VehicleProperty::ConvertibleRoof, "ConvertibleRoof", "b", AbstractProperty::ReadWrite); + } +}; #endif diff --git a/plugins/dbus/parking.h b/plugins/dbus/parking.h index b438750a..da5c5e3d 100644 --- a/plugins/dbus/parking.h +++ b/plugins/dbus/parking.h @@ -17,6 +17,7 @@ public: /** @attributeName SecurityAlert * @type boolean * @access readonly + * @attributeComment \brief MUST return **/ wantProperty(VehicleProperty::SecurityAlertStatus,"SecurityAlert", "i", AbstractProperty::Read); -- cgit v1.2.1