Merge branch 'master' of github.com:otcshare/automotive-message-broker
[profile/ivi/automotive-message-broker.git] / plugins / dbus / properties.h
1 /*
2         Copyright (C) 2012  Intel Corporation
3
4         This library is free software; you can redistribute it and/or
5         modify it under the terms of the GNU Lesser General Public
6         License as published by the Free Software Foundation; either
7         version 2.1 of the License, or (at your option) any later version.
8
9         This library is distributed in the hope that it will be useful,
10         but WITHOUT ANY WARRANTY; without even the implied warranty of
11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12         Lesser General Public License for more details.
13
14         You should have received a copy of the GNU Lesser General Public
15         License along with this library; if not, write to the Free Software
16         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #ifndef _PROPERTIES_H_H_H_
20 #define _PROPERTIES_H_H_H_
21
22 #include "dbusplugin.h"
23 #include "abstractdbusinterface.h"
24 #include "abstractroutingengine.h"
25
26 class VehicleSpeedProperty: public DBusSink
27 {
28 public:
29         VehicleSpeedProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
30                 :DBusSink("org.automotive.vehicleSpeed","/org/automotive/runningstatus/vehicleSpeed", re, connection, map<string, string>())
31         {
32                 wantProperty<uint16_t>(VehicleProperty::VehicleSpeed,"VehicleSpeed", "i", AbstractProperty::Read);
33                 supportedChanged(re->supported());
34         }
35
36
37 };
38
39 class EngineSpeedProperty: public DBusSink
40 {
41 public:
42         EngineSpeedProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
43                 :DBusSink("org.automotive.engineSpeed","/org/automotive/runningstatus/engineSpeed", re, connection, map<string, string>())
44         {
45                 wantProperty<uint16_t>(VehicleProperty::EngineSpeed,"EngineSpeed", "i", AbstractProperty::Read);
46                 supportedChanged(re->supported());
47         }
48
49
50 };
51
52 class TirePressureProperty: public DBusSink
53 {
54 public:
55         TirePressureProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
56                 :DBusSink("org.automotive.tirePressure","/org/automotive/maintainance/tirePressure", re, connection, map<string, string>())
57         {
58                 wantProperty<double>(VehicleProperty::TirePressureLeftFront,"LeftFront", "d", AbstractProperty::Read);
59                 wantProperty<double>(VehicleProperty::TirePressureRightFront,"RightFront", "d", AbstractProperty::Read);
60                 wantProperty<double>(VehicleProperty::TirePressureLeftRear,"LeftRear", "d", AbstractProperty::Read);
61                 wantProperty<double>(VehicleProperty::TirePressureRightRear,"RightRear", "d", AbstractProperty::Read);
62                 supportedChanged(re->supported());
63         }
64 };
65
66 class VehiclePowerModeProperty: public DBusSink
67 {
68 public:
69         VehiclePowerModeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
70                 :DBusSink("org.automotive.vehiclePowerMode","/org/automotive/runningstatus/vehiclePowerMode", re, connection, map<string, string>())
71         {
72                 wantProperty<Power::PowerModes>(VehicleProperty::VehiclePowerMode, "VehiclePowerMode","b",AbstractProperty::Read);
73                 supportedChanged(re->supported());
74         }
75 };
76
77 class TripMeterProperty: public DBusSink
78 {
79 public:
80         TripMeterProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
81         :DBusSink("org.automotive.tripMeter","/org/automotive/runningstatus/tripMeter", re, connection, map<string, string>())
82         {
83                 wantProperty<uint16_t>(VehicleProperty::TripMeterA, "A", "q", AbstractProperty::ReadWrite);
84                 wantProperty<uint16_t>(VehicleProperty::TripMeterB, "B", "q", AbstractProperty::ReadWrite);
85                 wantProperty<uint16_t>(VehicleProperty::TripMeterC, "C", "q", AbstractProperty::ReadWrite);
86                 supportedChanged(re->supported());
87         }
88 };
89
90 class AccelerationProperty: public DBusSink
91 {
92 public:
93         AccelerationProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
94         :DBusSink("org.automotive.acceleration","/org/automotive/runningstatus/acceleration", re, connection, map<string, string>())
95         {
96                 wantProperty<uint16_t>(VehicleProperty::AccelerationX, "X", "q", AbstractProperty::Read);
97                 wantProperty<uint16_t>(VehicleProperty::AccelerationY, "Y", "q", AbstractProperty::Read);
98                 wantProperty<uint16_t>(VehicleProperty::AccelerationZ, "Z", "q", AbstractProperty::Read);
99                 supportedChanged(re->supported());
100         }
101 };
102
103 class TransmissionProperty: public DBusSink
104 {
105 public:
106         TransmissionProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
107         :DBusSink("org.automotive.transmission","/org/automotive/runningstatus/transmission", re, connection, map<string, string>())
108         {
109                 wantProperty<Transmission::TransmissionPositions>(VehicleProperty::TransmissionShiftPosition,
110                                                                                                                   "ShiftPosition", "y", AbstractProperty::Read);
111                 wantProperty<Transmission::TransmissionPositions>(VehicleProperty::TransmissionGearPosition,
112                                                                                                                   "GearPosition", "y", AbstractProperty::Read);
113                 wantProperty<Transmission::Mode>(VehicleProperty::TransmissionMode,
114                                                                                                                   "Mode", "y", AbstractProperty::Read);
115
116                 supportedChanged(re->supported());
117         }
118 };
119
120 class TireTemperatureProperty: public DBusSink
121 {
122 public:
123         TireTemperatureProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
124                 :DBusSink("org.automotive.tireTemperature","/org/automotive/maintainance/tireTemperature", re, connection, map<string, string>())
125         {
126                 wantProperty<double>(VehicleProperty::TireTemperatureLeftFront,"LeftFront", "d", AbstractProperty::Read);
127                 wantProperty<double>(VehicleProperty::TireTemperatureRightFront,"RightFront", "d", AbstractProperty::Read);
128                 wantProperty<double>(VehicleProperty::TireTemperatureLeftRear,"LeftRear", "d", AbstractProperty::Read);
129                 wantProperty<double>(VehicleProperty::TireTemperatureRightRear,"RightRear", "d", AbstractProperty::Read);
130                 supportedChanged(re->supported());
131         }
132 };
133
134
135 class CruiseControlProperty: public DBusSink
136 {
137 public:
138         CruiseControlProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
139         :DBusSink("org.automotive.cruiseControlStatus","/org/automotive/runningstatus/cruiseControlStatus", re, connection, map<string, string>())
140         {
141                 wantProperty<bool>(VehicleProperty::CruiseControlActive, "Activated", "b", AbstractProperty::Read);
142                 wantProperty<uint16_t>(VehicleProperty::CruiseControlSpeed, "Speed", "q", AbstractProperty::Read);
143                 supportedChanged(re->supported());
144         }
145 };
146
147 class WheelBrakeProperty: public DBusSink
148 {
149 public:
150         WheelBrakeProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
151                 :DBusSink("org.automotive.wheelBrake","/org/automotive/runningstatus/wheelBrake", re, connection, map<string, string>())
152         {
153                 wantProperty<bool>(VehicleProperty::WheelBrake, "Engaged", "b", AbstractProperty::Read);
154                 supportedChanged(re->supported());
155         }
156 };
157 class LightStatusProperty: public DBusSink
158 {
159 public:
160         LightStatusProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
161                 :DBusSink("org.automotive.lightStatus","/org/automotive/runningstatus/lightStatus", re, connection, map<string, string>())
162         {
163                 wantProperty<bool>(VehicleProperty::LightHead, "Head", "b", AbstractProperty::Read);
164                 wantProperty<bool>(VehicleProperty::LightRightTurn, "RightTurn", "b", AbstractProperty::Read);
165                 wantProperty<bool>(VehicleProperty::LightLeftTurn, "LeftTurn", "b", AbstractProperty::Read);
166                 wantProperty<bool>(VehicleProperty::LightBrake, "Brake", "b", AbstractProperty::Read);
167                 wantProperty<bool>(VehicleProperty::LightFog, "Fog", "b", AbstractProperty::Read);
168                 wantProperty<bool>(VehicleProperty::LightHazard, "Hazard", "b", AbstractProperty::Read);
169                 wantProperty<bool>(VehicleProperty::LightParking, "Parking", "b", AbstractProperty::Read);
170                 wantProperty<bool>(VehicleProperty::LightHighBeam, "HighBeam", "b", AbstractProperty::Read);
171                 supportedChanged(re->supported());
172         }
173 };
174
175 class InteriorLightStatusProperty: public DBusSink
176 {
177 public:
178         InteriorLightStatusProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
179                 :DBusSink("org.automotive.interiorLightStatus","/org/automotive/runningstatus/interiorLightStatus", re, connection, map<string, string>())
180         {
181                 wantProperty<bool>(VehicleProperty::InteriorLightPassenger, "Passenger", "b", AbstractProperty::Read);
182                 wantProperty<bool>(VehicleProperty::InteriorLightPassenger, "Driver", "b", AbstractProperty::Read);
183                 wantProperty<bool>(VehicleProperty::InteriorLightCenter, "Center", "b", AbstractProperty::Read);
184                 supportedChanged(re->supported());
185         }
186 };
187
188 class HornProperty: public DBusSink
189 {
190 public:
191         HornProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
192                 :DBusSink("org.automotive.horn","/org/automotive/runningstatus/horn", re, connection, map<string, string>())
193         {
194                 wantProperty<bool>(VehicleProperty::Horn,"On","b",AbstractProperty::Read);
195                 supportedChanged(re->supported());
196         }
197 };
198
199 class FuelProperty: public DBusSink
200 {
201 public:
202         FuelProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
203                 :DBusSink("org.automotive.fuel", "/org/automotive/runningstatus/fuel", re, connection, map<string, string>())
204         {
205                 wantProperty<uint16_t>(VehicleProperty::FuelLevel,"Level", "y", AbstractProperty::Read);
206                 wantProperty<uint16_t>(VehicleProperty::FuelRange,"Range", "q", AbstractProperty::Read);
207                 wantProperty<uint16_t>(VehicleProperty::FuelConsumption,"InstantConsumption", "q", AbstractProperty::Read);
208                 wantProperty<uint16_t>(VehicleProperty::FuelEconomy,"InstantEconomy", "q", AbstractProperty::Read);
209                 wantProperty<uint16_t>(VehicleProperty::FuelAverageEconomy,"AverageEconomy", "q", AbstractProperty::ReadWrite);
210                 supportedChanged(re->supported());
211         }
212 };
213
214 class EngineOilProperty: public DBusSink
215 {
216 public:
217         EngineOilProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
218                         :DBusSink("org.automotive.engineOil", "/org/automotive/runningstatus/engineOil", re, connection, map<string, string>())
219         {
220                 wantProperty<uint16_t>(VehicleProperty::EngineOilRemaining, "Remaining", "y", AbstractProperty::Read);
221                 wantProperty<int>(VehicleProperty::EngineOilTemperature, "Temperature", "i", AbstractProperty::Read);
222                 wantProperty<uint16_t>(VehicleProperty::EngineOilPressure, "Pressure", "y", AbstractProperty::Read);
223                 supportedChanged(re->supported());
224         }
225 };
226
227 class LocationProperty: public DBusSink
228 {
229 public:
230         LocationProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
231                         :DBusSink("org.automotive.location", "/org/automotive/runningstatus/location", re, connection, map<string, string>())
232         {
233                 wantProperty<double>(VehicleProperty::Latitude, "Latitude", "d", AbstractProperty::Read);
234                 wantProperty<double>(VehicleProperty::Longitude, "Longitude", "d", AbstractProperty::Read);
235                 wantProperty<double>(VehicleProperty::Altitude, "Altitude", "d", AbstractProperty::Read);
236                 wantProperty<uint>(VehicleProperty::Direction, "Direction", "y", AbstractProperty::Read);
237                 supportedChanged(re->supported());
238         }
239 };
240
241 #endif