Merge branch 'master' of github.com:otcshare/automotive-message-broker
[profile/ivi/automotive-message-broker.git] / plugins / dbus / runningstatus.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 VehiclePowerModeProperty: public DBusSink
53 {
54 public:
55         VehiclePowerModeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
56                 :DBusSink("org.automotive.vehiclePowerMode","/org/automotive/runningstatus/vehiclePowerMode", re, connection, map<string, string>())
57         {
58                 wantProperty<Power::PowerModes>(VehicleProperty::VehiclePowerMode, "VehiclePowerMode","b",AbstractProperty::Read);
59                 supportedChanged(re->supported());
60         }
61 };
62
63 class TripMeterProperty: public DBusSink
64 {
65 public:
66         TripMeterProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
67         :DBusSink("org.automotive.tripMeter","/org/automotive/runningstatus/tripMeter", re, connection, map<string, string>())
68         {
69                 wantProperty<uint16_t>(VehicleProperty::TripMeterA, "A", "q", AbstractProperty::ReadWrite);
70                 wantProperty<uint16_t>(VehicleProperty::TripMeterB, "B", "q", AbstractProperty::ReadWrite);
71                 wantProperty<uint16_t>(VehicleProperty::TripMeterC, "C", "q", AbstractProperty::ReadWrite);
72                 supportedChanged(re->supported());
73         }
74 };
75
76 class AccelerationProperty: public DBusSink
77 {
78 public:
79         AccelerationProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
80         :DBusSink("org.automotive.acceleration","/org/automotive/runningstatus/acceleration", re, connection, map<string, string>())
81         {
82                 wantProperty<uint16_t>(VehicleProperty::AccelerationX, "X", "q", AbstractProperty::Read);
83                 wantProperty<uint16_t>(VehicleProperty::AccelerationY, "Y", "q", AbstractProperty::Read);
84                 wantProperty<uint16_t>(VehicleProperty::AccelerationZ, "Z", "q", AbstractProperty::Read);
85                 supportedChanged(re->supported());
86         }
87 };
88
89 class TransmissionProperty: public DBusSink
90 {
91 public:
92         TransmissionProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
93         :DBusSink("org.automotive.transmission","/org/automotive/runningstatus/transmission", re, connection, map<string, string>())
94         {
95                 wantProperty<Transmission::TransmissionPositions>(VehicleProperty::TransmissionShiftPosition,
96                                                                                                                   "ShiftPosition", "y", AbstractProperty::Read);
97                 wantProperty<Transmission::TransmissionPositions>(VehicleProperty::TransmissionGearPosition,
98                                                                                                                   "GearPosition", "y", AbstractProperty::Read);
99                 wantProperty<Transmission::Mode>(VehicleProperty::TransmissionMode,
100                                                                                                                   "Mode", "y", AbstractProperty::Read);
101
102                 supportedChanged(re->supported());
103         }
104 };
105
106
107 class CruiseControlProperty: public DBusSink
108 {
109 public:
110         CruiseControlProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
111         :DBusSink("org.automotive.cruiseControlStatus","/org/automotive/runningstatus/cruiseControlStatus", re, connection, map<string, string>())
112         {
113                 wantProperty<bool>(VehicleProperty::CruiseControlActive, "Activated", "b", AbstractProperty::Read);
114                 wantProperty<uint16_t>(VehicleProperty::CruiseControlSpeed, "Speed", "q", AbstractProperty::Read);
115                 supportedChanged(re->supported());
116         }
117 };
118
119 class WheelBrakeProperty: public DBusSink
120 {
121 public:
122         WheelBrakeProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
123                 :DBusSink("org.automotive.wheelBrake","/org/automotive/runningstatus/wheelBrake", re, connection, map<string, string>())
124         {
125                 wantProperty<bool>(VehicleProperty::WheelBrake, "Engaged", "b", AbstractProperty::Read);
126                 supportedChanged(re->supported());
127         }
128 };
129 class LightStatusProperty: public DBusSink
130 {
131 public:
132         LightStatusProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
133                 :DBusSink("org.automotive.lightStatus","/org/automotive/runningstatus/lightStatus", re, connection, map<string, string>())
134         {
135                 wantProperty<bool>(VehicleProperty::LightHead, "Head", "b", AbstractProperty::Read);
136                 wantProperty<bool>(VehicleProperty::LightRightTurn, "RightTurn", "b", AbstractProperty::Read);
137                 wantProperty<bool>(VehicleProperty::LightLeftTurn, "LeftTurn", "b", AbstractProperty::Read);
138                 wantProperty<bool>(VehicleProperty::LightBrake, "Brake", "b", AbstractProperty::Read);
139                 wantProperty<bool>(VehicleProperty::LightFog, "Fog", "b", AbstractProperty::Read);
140                 wantProperty<bool>(VehicleProperty::LightHazard, "Hazard", "b", AbstractProperty::Read);
141                 wantProperty<bool>(VehicleProperty::LightParking, "Parking", "b", AbstractProperty::Read);
142                 wantProperty<bool>(VehicleProperty::LightHighBeam, "HighBeam", "b", AbstractProperty::Read);
143                 supportedChanged(re->supported());
144         }
145 };
146
147 class InteriorLightStatusProperty: public DBusSink
148 {
149 public:
150         InteriorLightStatusProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
151                 :DBusSink("org.automotive.interiorLightStatus","/org/automotive/runningstatus/interiorLightStatus", re, connection, map<string, string>())
152         {
153                 wantProperty<bool>(VehicleProperty::InteriorLightPassenger, "Passenger", "b", AbstractProperty::Read);
154                 wantProperty<bool>(VehicleProperty::InteriorLightPassenger, "Driver", "b", AbstractProperty::Read);
155                 wantProperty<bool>(VehicleProperty::InteriorLightCenter, "Center", "b", AbstractProperty::Read);
156                 supportedChanged(re->supported());
157         }
158 };
159
160 class HornProperty: public DBusSink
161 {
162 public:
163         HornProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
164                 :DBusSink("org.automotive.horn","/org/automotive/runningstatus/horn", re, connection, map<string, string>())
165         {
166                 wantProperty<bool>(VehicleProperty::Horn,"On","b",AbstractProperty::Read);
167                 supportedChanged(re->supported());
168         }
169 };
170
171 class FuelProperty: public DBusSink
172 {
173 public:
174         FuelProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
175                 :DBusSink("org.automotive.fuel", "/org/automotive/runningstatus/fuel", re, connection, map<string, string>())
176         {
177                 wantProperty<uint16_t>(VehicleProperty::FuelLevel,"Level", "y", AbstractProperty::Read);
178                 wantProperty<uint16_t>(VehicleProperty::FuelRange,"Range", "q", AbstractProperty::Read);
179                 wantProperty<uint16_t>(VehicleProperty::FuelConsumption,"InstantConsumption", "q", AbstractProperty::Read);
180                 wantProperty<uint16_t>(VehicleProperty::FuelEconomy,"InstantEconomy", "q", AbstractProperty::Read);
181                 wantProperty<uint16_t>(VehicleProperty::FuelAverageEconomy,"AverageEconomy", "q", AbstractProperty::ReadWrite);
182                 supportedChanged(re->supported());
183         }
184 };
185
186 class EngineOilProperty: public DBusSink
187 {
188 public:
189         EngineOilProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
190                         :DBusSink("org.automotive.engineOil", "/org/automotive/runningstatus/engineOil", re, connection, map<string, string>())
191         {
192                 wantProperty<uint16_t>(VehicleProperty::EngineOilRemaining, "Remaining", "y", AbstractProperty::Read);
193                 wantProperty<int>(VehicleProperty::EngineOilTemperature, "Temperature", "i", AbstractProperty::Read);
194                 wantProperty<uint16_t>(VehicleProperty::EngineOilPressure, "Pressure", "y", AbstractProperty::Read);
195                 supportedChanged(re->supported());
196         }
197 };
198
199 class LocationProperty: public DBusSink
200 {
201 public:
202         LocationProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
203                         :DBusSink("org.automotive.location", "/org/automotive/runningstatus/location", re, connection, map<string, string>())
204         {
205                 wantProperty<double>(VehicleProperty::Latitude, "Latitude", "d", AbstractProperty::Read);
206                 wantProperty<double>(VehicleProperty::Longitude, "Longitude", "d", AbstractProperty::Read);
207                 wantProperty<double>(VehicleProperty::Altitude, "Altitude", "d", AbstractProperty::Read);
208                 wantProperty<uint>(VehicleProperty::Direction, "Direction", "y", AbstractProperty::Read);
209                 supportedChanged(re->supported());
210         }
211 };
212
213 #endif