2 Copyright (C) 2012 Intel Corporation
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.
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.
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
19 #include "dbusinterfacemanager.h"
26 #include "accelerationproperty.h"
27 #include "runningstatus.h"
28 #include "custompropertyinterface.h"
29 #include "environmentproperties.h"
30 #include "vehicleinfo.h"
31 #include "maintenance.h"
34 #define ConstructProperty(property) \
35 new property(iface->re, connection);
40 on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
42 DBusInterfaceManager* iface = static_cast<DBusInterfaceManager*>(user_data);
44 AbstractDBusInterface* acceleration = new AccelerationProperty(iface->re, connection);
45 AbstractDBusInterface* vehicleSpeed = new VehicleSpeedProperty(iface->re, connection);
46 AbstractDBusInterface* tirePressure = new TirePressureProperty(iface->re, connection);
47 AbstractDBusInterface* engineSpeed = new EngineSpeedProperty(iface->re, connection);
48 ConstructProperty(VehiclePowerModeProperty);
49 ConstructProperty(TripMeterProperty);
50 ConstructProperty(TransmissionProperty);
51 ConstructProperty(TireTemperatureProperty);
52 ConstructProperty(CruiseControlProperty);
53 ConstructProperty(WheelBrakeProperty);
54 ConstructProperty(LightStatusProperty);
55 ConstructProperty(HornProperty);
56 ConstructProperty(FuelProperty);
57 ConstructProperty(EngineOilProperty);
58 ConstructProperty(ExteriorBrightnessProperty);
59 ConstructProperty(VehicleId);
60 ConstructProperty(TransmissionInfoProperty);
61 ConstructProperty(VehicleTypeProperty);
62 ConstructProperty(FuelInfoProperty);
63 ConstructProperty(SizeProperty);
64 ConstructProperty(DoorsProperty);
65 ConstructProperty(WheelInformationProperty);
66 ConstructProperty(OdometerProperty);
67 ConstructProperty(BatteryProperty);
68 ConstructProperty(SecurityAlertProperty);
69 ConstructProperty(ParkingBrakeProperty);
70 ConstructProperty(ParkingLightProperty);
71 ConstructProperty(HazardLightProperty);
73 PropertyList list = VehicleProperty::customProperties();
75 for (auto itr = list.begin(); itr != list.end(); itr++)
77 VehicleProperty::Property prop = *itr;
79 new CustomPropertyInterface(prop,iface->re,connection);
86 on_name_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
92 on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data)
99 DBusInterfaceManager::DBusInterfaceManager(AbstractRoutingEngine* engine)
104 ownerId = g_bus_own_name(G_BUS_TYPE_SYSTEM,
106 G_BUS_NAME_OWNER_FLAGS_NONE,
115 DBusInterfaceManager::~DBusInterfaceManager()
117 g_bus_unown_name(ownerId);