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 "exampleplugin.h"
22 #include <boost/assert.hpp>
26 #include "enginespeedproperty.h"
27 #include "vehiclepowermodeproperty.h"
28 #include "fueleconomyproperty.h"
29 #include "tripmeterproperty.h"
30 #include "transmissiongearstatus.h"
31 #include "cruisecontrolstatus.h"
32 #include "wheelbrakeproperty.h"
33 #include "lightstatusproperty.h"
34 #include "interiorlightstatusproperty.h"
35 #include "hornproperty.h"
37 #include "fuellevelproperty.h"
38 #include "fuelrangeproperty.h"
39 #include "engineoilproperty.h"
40 #include "enginecoolantproperty.h"
41 #include "accelerationproperty.h"
42 #include "steeringwheelangleproperty.h"
46 ExamplePlugin::ExamplePlugin()
48 uint16_t velocity = 5;
50 VehicleSpeedProperty* speed = new VehicleSpeedProperty();
53 EngineSpeedProperty* engineSpeed = new EngineSpeedProperty();
54 engineSpeed->setValue(2000);
56 VehiclePowerModeProperty* vehiclePowerMode = new VehiclePowerModeProperty();
57 *vehiclePowerMode = VehiclePowerModeProperty::Run;
59 FuelEconomyProperty* fueleconomyproperty = new FuelEconomyProperty();
60 *fueleconomyproperty = 42;
63 trips.push_back(1500);
64 trips.push_back(1000);
66 TripMeterProperty* tripmeterproperty = new TripMeterProperty();
67 *tripmeterproperty = trips;
69 TransmissionGearStatusProperty* transmissiongearstatus = new TransmissionGearStatusProperty();
70 transmissiongearstatus->setValue(TransmissionGearStatusProperty::First);
72 CruiseControlStatus cruisecontrolstatus = CruiseControlStatus(true, velocity);
74 CruiseControlStatusProperty * cruisecontrolstatusproperty = new CruiseControlStatusProperty();
75 *cruisecontrolstatusproperty = cruisecontrolstatus;
77 WheelBrakeProperty *wheelbrakeproperty = new WheelBrakeProperty();
78 *wheelbrakeproperty = false;
80 LightStatusProperty::LightStatus lights;
81 lights[LightStatusProperty::Brake] = wheelbrakeproperty->value();
82 lights[LightStatusProperty::Fog] = true;
83 lights[LightStatusProperty::Head] = true;
84 lights[LightStatusProperty::HighBeam] = false;
85 lights[LightStatusProperty::Hazard] = false;
86 lights[LightStatusProperty::LeftTurn] = false;
87 lights[LightStatusProperty::RightTurn] = false;
88 lights[LightStatusProperty::Parking] = false;
90 LightStatusProperty *lightstatusproperty = new LightStatusProperty();
91 *lightstatusproperty = lights;
93 InteriorLightStatusProperty::InteriorLightStatus interiorLights;
94 interiorLights[InteriorLightStatusProperty::Driver] = false;
95 interiorLights[InteriorLightStatusProperty::Passenger] = true;
96 interiorLights[InteriorLightStatusProperty::Center] = false;
98 InteriorLightStatusProperty* interiorlightstatusproperty = new InteriorLightStatusProperty();
99 *interiorlightstatusproperty = interiorLights;
101 HornProperty *hornProperty = new HornProperty();
102 *hornProperty = false;
104 Chime * chime = new Chime();
109 BOOST_ASSERT(val == false);
111 FuelLevelProperty *fuelLevel = new FuelLevelProperty();
112 *fuelLevel = (uint8_t)95;
114 uint8_t fl = *fuelLevel;
116 BOOST_ASSERT(fl == 95);
118 FuelRangeProperty* fuelRange = new FuelRangeProperty();
122 uint16_t fr = *fuelRange;
124 BOOST_ASSERT(fr == 321);
126 EngineOilProperty *oilproperty = new EngineOilProperty();
129 oil.temperature = 32;
135 EngineOil ol = *oilproperty;
137 BOOST_ASSERT(ol == oil);
139 EngineCoolant coolant;
141 coolant.temperature = 44;
143 EngineCoolantProperty *coolantProp = new EngineCoolantProperty();
144 *coolantProp = coolant;
146 EngineCoolant ec = *coolantProp;
148 BOOST_ASSERT(ec == coolant);
150 AccelerationProperty* accelerationProp = new AccelerationProperty();
156 *accelerationProp = accel;
158 SteeringWheelAngleProperty * steeringWheelAngle = new SteeringWheelAngleProperty();
160 *steeringWheelAngle = 100;
163 extern "C" void create()