only export dbus properties that are supported
[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 TirePressureProperty: public DBusSink
40 {
41 public:
42         TirePressureProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
43                 :DBusSink("org.automotive.tirePressure","/org/automotive/maintainance/tirePressure", re, connection, map<string, string>())
44         {
45                 wantProperty<uint16_t>(VehicleProperty::TirePressureLeftFront,"LeftFront", "q", AbstractProperty::Read);
46                 wantProperty<uint16_t>(VehicleProperty::TirePressureRightFront,"RightFront", "q", AbstractProperty::Read);
47                 wantProperty<uint16_t>(VehicleProperty::TirePressureLeftRear,"LeftRear", "q", AbstractProperty::Read);
48                 wantProperty<uint16_t>(VehicleProperty::TirePressureRightRear,"RightRear", "q", AbstractProperty::Read);
49                 supportedChanged(re->supported());
50         }
51 };
52
53 class VehiclePowerModeProperty: public DBusSink
54 {
55 public:
56         VehiclePowerModeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
57                 :DBusSink("org.automotive.vehiclePowerMode","/org/automotive/runningstatus/vehiclePowerMode", re, connection, map<string, string>())
58         {
59                 wantProperty<uint16_t>(VehicleProperty::VehiclePowerMode, "VehiclePowerMode","b",AbstractProperty::Read);
60                 supportedChanged(re->supported());
61         }
62 };
63
64 class TripMeterProperty: public DBusSink
65 {
66 public:
67         TripMeterProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
68         :DBusSink("org.automotive.tripMeter","/org/automotive/runningstatus/tripMeter", re, connection, map<string, string>())
69         {
70                 wantProperty<uint16_t>(VehicleProperty::TripMeterA, "A", "q", AbstractProperty::ReadWrite);
71                 wantProperty<uint16_t>(VehicleProperty::TripMeterB, "B", "q", AbstractProperty::ReadWrite);
72                 wantProperty<uint16_t>(VehicleProperty::TripMeterC, "C", "q", AbstractProperty::ReadWrite);
73                 supportedChanged(re->supported());
74         }
75 };
76
77 class AccelerationProperty: public DBusSink
78 {
79 public:
80         AccelerationProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
81         :DBusSink("org.automotive.acceleration","/org/automotive/runningstatus/acceleration", re, connection, map<string, string>())
82         {
83                 wantProperty<uint16_t>(VehicleProperty::AccelerationX, "X", "q", AbstractProperty::Read);
84                 wantProperty<uint16_t>(VehicleProperty::AccelerationY, "Y", "q", AbstractProperty::Read);
85                 wantProperty<uint16_t>(VehicleProperty::AccelerationZ, "Z", "q", AbstractProperty::Read);
86                 supportedChanged(re->supported());
87         }
88 };
89
90 class TransmissionProperty: public DBusSink
91 {
92 public:
93         TransmissionProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
94         :DBusSink("org.automotive.transmission","/org/automotive/runningstatus/transmission", re, connection, map<string, string>())
95         {
96                 wantProperty<Transmission::TransmissionPositions>(VehicleProperty::TransmissionShiftPosition,
97                                                                                                                   "ShiftPosition", "y", AbstractProperty::Read);
98                 wantProperty<Transmission::TransmissionPositions>(VehicleProperty::TransmissionGearPosition,
99                                                                                                                   "GearPosition", "y", AbstractProperty::Read);
100                 wantProperty<Transmission::TransmissionPositions>(VehicleProperty::TransmissionMode,
101                                                                                                                   "Mode", "y", AbstractProperty::Read);
102
103                 supportedChanged(re->supported());
104         }
105 };
106
107 #endif