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
20 #include "vehicleproperty.h"
21 #include "listplusplus.h"
23 #include "mappropertytype.hpp"
24 #include "superptr.hpp"
28 #define REGISTERPROPERTY(property, defaultValue) \
29 registerPropertyPriv(property, []() { return new property ## Type(defaultValue); });
31 #define REGISTERPROPERTYWITHTYPE(property, type, defaultValue) \
32 registerPropertyPriv(property, []() { return new type(property, defaultValue); });
36 std::map<VehicleProperty::Property, VehicleProperty::PropertyTypeFactoryCallback> VehicleProperty::registeredPropertyFactoryMap;
38 std::unique_ptr<VehicleProperty> VehicleProperty::thereCanOnlyBeOne(nullptr);
40 const char* ButtonEvents::W3C::Home = "home";
41 const char* ButtonEvents::W3C::Back = "back";
42 const char* ButtonEvents::W3C::Search = "search";
43 const char* ButtonEvents::W3C::Call = "call";
44 const char* ButtonEvents::W3C::EndCall = "end_call";
45 const char* ButtonEvents::W3C::MediaPlay = "media_play";
46 const char* ButtonEvents::W3C::MediaPause = "media_pause";
47 const char* ButtonEvents::W3C::MediaPrevious = "media_previous";
48 const char* ButtonEvents::W3C::MediaNext = "media_next";
49 const char* ButtonEvents::W3C::VoiceRecognize = "voice_regocnize";
50 const char* ButtonEvents::W3C::Enter = "enter";
51 const char* ButtonEvents::W3C::Left = "left";
52 const char* ButtonEvents::W3C::Right = "right";
53 const char* ButtonEvents::W3C::Up = "up";
54 const char* ButtonEvents::W3C::Down = "down";
56 const char* Transmission::W3C::Park = "park";
57 const char* Transmission::W3C::Reverse = "reverse";
58 const char* Transmission::W3C::Neutral = "neutral";
59 const char* Transmission::W3C::Low = "low";
60 const char* Transmission::W3C::Drive = "drive";
61 const char* Transmission::W3C::Overdrive = "overdrive";
63 const char* Door::W3C::Closed = "closed";
64 const char* Door::W3C::Open = "open";
65 const char* Door::W3C::Ajar = "ajar";
67 const char* HVAC::W3C::FloorPanel = "floorpanel";
68 const char* HVAC::W3C::FloorDuct = "floorduct";
69 const char* HVAC::W3C::Bilevel = "bilevel";
70 const char* HVAC::W3C::DefrostFloor = "defrostfloor";
72 const VehicleProperty::Property VehicleProperty::NoValue = "NoValue";
73 const VehicleProperty::Property VehicleProperty::VehicleSpeed = "VehicleSpeed";
74 const VehicleProperty::Property VehicleProperty::EngineSpeed = "EngineSpeed";
75 const VehicleProperty::Property VehicleProperty::TransmissionShiftPosition = "TransmissionShiftPosition";
76 const VehicleProperty::Property VehicleProperty::TransmissionGearPosition = "TransmissionGearPostion";
77 const VehicleProperty::Property VehicleProperty::TransmissionMode = "TransmissionMode";
78 const VehicleProperty::Property VehicleProperty::TransmissionModeW3C = "TransmissionModeW3C";
79 const VehicleProperty::Property VehicleProperty::ThrottlePosition = "ThrottlePosition";
80 const VehicleProperty::Property VehicleProperty::WheelBrake = "WheelBrake";
81 const VehicleProperty::Property VehicleProperty::WheelBrakePressure = "WheelBrakePressure";
82 const VehicleProperty::Property VehicleProperty::SteeringWheelAngle = "SteeringWheelAngle";
83 const VehicleProperty::Property VehicleProperty::SteeringWheelAngleW3C = "SteeringWheelAngleW3C";
84 const VehicleProperty::Property VehicleProperty::TurnSignal = "TurnSignal";
85 const VehicleProperty::Property VehicleProperty::ClutchStatus = "ClutchStatus";
86 const VehicleProperty::Property VehicleProperty::EngineOilPressure = "EngineOilPressure";
87 const VehicleProperty::Property VehicleProperty::EngineCoolantTemperature = "EngineCoolantTemperature";
88 const VehicleProperty::Property VehicleProperty::EngineCoolantLevel = "EngineCoolantLevel";
89 const VehicleProperty::Property VehicleProperty::MachineGunTurretStatus = "MachineGunTurretStatus";
90 const VehicleProperty::Property VehicleProperty::AccelerationX = "AccelerationX";
91 const VehicleProperty::Property VehicleProperty::AccelerationY = "AccelerationY";
92 const VehicleProperty::Property VehicleProperty::AccelerationZ = "AccelerationZ";
93 const VehicleProperty::Property VehicleProperty::MassAirFlow = "MassAirFlow";
94 const VehicleProperty::Property VehicleProperty::ButtonEvent = "ButtonEvent";
95 const VehicleProperty::Property VehicleProperty::AirIntakeTemperature = "AirIntakeTemperature";
96 const VehicleProperty::Property VehicleProperty::BatteryVoltage = "BatteryVoltage";
97 const VehicleProperty::Property VehicleProperty::BatteryCurrent = "BatteryCurrent";
98 const VehicleProperty::Property VehicleProperty::BatteryChargeLevel = "BatteryChargeLevel";
99 const VehicleProperty::Property VehicleProperty::InteriorTemperature = "InteriorTemperature";
100 const VehicleProperty::Property VehicleProperty::ExteriorTemperature = "ExteriorTemperature";
101 const VehicleProperty::Property VehicleProperty::EngineOilTemperature = "EngineOilTemperature";
102 const VehicleProperty::Property VehicleProperty::EngineOilLifeRemaining = "EngineOilLifeRemaining";
103 const VehicleProperty::Property VehicleProperty::EngineOilChangeIndicator= "EngineOilChangeIndicator";
104 const VehicleProperty::Property VehicleProperty::VIN = "VIN";
105 const VehicleProperty::Property VehicleProperty::WMI = "WMI";
106 const VehicleProperty::Property VehicleProperty::TirePressure = "TirePressure";
107 const VehicleProperty::Property VehicleProperty::TirePressureLow = "TirePressureLow";
108 const VehicleProperty::Property VehicleProperty::TireTemperature = "TireTemperature";
109 const VehicleProperty::Property VehicleProperty::VehiclePowerMode = "VehiclePowerMode";
110 const VehicleProperty::Property VehicleProperty::TripMeters = "TripMeters";
111 const VehicleProperty::Property VehicleProperty::CruiseControlActive = "CruiseControlActive";
112 const VehicleProperty::Property VehicleProperty::CruiseControlSpeed = "CruiseControlSpeed";
113 const VehicleProperty::Property VehicleProperty::LightHead = "LightHead";
114 const VehicleProperty::Property VehicleProperty::LightLeftTurn = "LightLeftTurn";
115 const VehicleProperty::Property VehicleProperty::LightRightTurn = "LightRightTurn";
116 const VehicleProperty::Property VehicleProperty::LightParking = "LightParking";
117 const VehicleProperty::Property VehicleProperty::LightFog = "LightFog";
118 const VehicleProperty::Property VehicleProperty::LightHazard= "LightHazard";
119 const VehicleProperty::Property VehicleProperty::LightHighBeam = "LightHighBeam";
120 const VehicleProperty::Property VehicleProperty::LightBrake= "LightBrake";
121 const VehicleProperty::Property VehicleProperty::LightAutomatic= "LightAutomatic";
122 const VehicleProperty::Property VehicleProperty::LightDynamicHighBeam= "LightDynamicHighBeam";
123 const VehicleProperty::Property VehicleProperty::InteriorLightDriver = "InteriorLightDriver";
124 const VehicleProperty::Property VehicleProperty::InteriorLightCenter = "InteriorLightCenter";
125 const VehicleProperty::Property VehicleProperty::InteriorLightPassenger = "InteriorLightPassenger";
126 const VehicleProperty::Property VehicleProperty::InteriorLightStatus = "InteriorLightStatus";
127 const VehicleProperty::Property VehicleProperty::EngineLoad = "EngineLoad";
128 const VehicleProperty::Property VehicleProperty::Horn = "Horn";
129 const VehicleProperty::Property VehicleProperty::FuelLevel = "FuelLevel";
130 const VehicleProperty::Property VehicleProperty::FuelConsumption = "FuelConsumption";
131 const VehicleProperty::Property VehicleProperty::FuelRange = "FuelRange";
132 const VehicleProperty::Property VehicleProperty::FuelEconomy = "FuelEconomy";
133 const VehicleProperty::Property VehicleProperty::FuelAverageEconomy = "FuelAverageEconomy";
134 const VehicleProperty::Property VehicleProperty::FuelAverageConsumption = "FuelAverageConsumption";
135 const VehicleProperty::Property VehicleProperty::FuelConsumptionSinceRestart = "FuelConsumptionSinceRestart";
136 const VehicleProperty::Property VehicleProperty::FuelTimeSinceRestart = "FuelTimeSinceRestart";
137 const VehicleProperty::Property VehicleProperty::FuelType = "FuelType";
138 const VehicleProperty::Property VehicleProperty::FuelPositionSide = "FuelPositionSide";
139 const VehicleProperty::Property VehicleProperty::EngineOilRemaining = "EngineOilRemaining";
140 const VehicleProperty::Property VehicleProperty::ExteriorBrightness = "ExteriorBrightness";
141 const VehicleProperty::Property VehicleProperty::Latitude = "Latitude";
142 const VehicleProperty::Property VehicleProperty::Longitude = "Longitude";
143 const VehicleProperty::Property VehicleProperty::Direction = "Direction";
144 const VehicleProperty::Property VehicleProperty::Altitude = "Altitude";
145 const VehicleProperty::Property VehicleProperty::VehicleWidth = "VehicleWidth";
146 const VehicleProperty::Property VehicleProperty::VehicleHeight = "VehicleHeight";
147 const VehicleProperty::Property VehicleProperty::VehicleLength = "VehicleLength";
148 const VehicleProperty::Property VehicleProperty::VehicleType = "VehicleType";
149 const VehicleProperty::Property VehicleProperty::DoorsPerRow = "DoorsPerRow";
150 const VehicleProperty::Property VehicleProperty::TransmissionGearType = "TransmissionGearType";
151 const VehicleProperty::Property VehicleProperty::FrontWheelRadius = "FrontWheelRadius";
152 const VehicleProperty::Property VehicleProperty::RearWheelRadius = "RearWheelRadius";
153 const VehicleProperty::Property VehicleProperty::WheelTrack = "WheelTrack";
154 const VehicleProperty::Property VehicleProperty::BrakePressure = "BrakePressure";
155 const VehicleProperty::Property VehicleProperty::Odometer = "Odometer";
156 const VehicleProperty::Property VehicleProperty::DistanceTotal = "DistanceTotal";
157 const VehicleProperty::Property VehicleProperty::DistanceSinceStart = "DistanceSinceStart";
158 const VehicleProperty::Property VehicleProperty::TransmissionFluidLevel = "TransmissionFluidLevel";
159 const VehicleProperty::Property VehicleProperty::BrakeFluidLevel = "BrakeFluidLevel";
160 const VehicleProperty::Property VehicleProperty::WasherFluidLevel = "WasherFluidLevel";
161 const VehicleProperty::Property VehicleProperty::SecurityAlertStatus = "SecurityAlertStatus";
162 const VehicleProperty::Property VehicleProperty::ParkingBrakeStatus = "ParkingBrakeStatus";
163 const VehicleProperty::Property VehicleProperty::ParkingLightStatus = "ParkingLightStatus";
164 const VehicleProperty::Property VehicleProperty::HazardLightStatus = "HazardLightStatus";
165 const VehicleProperty::Property VehicleProperty::AirbagStatus = "AirbagStatus";
166 const VehicleProperty::Property VehicleProperty::AntilockBrakingSystem = "AntilockBrakingSystem";
167 const VehicleProperty::Property VehicleProperty::TractionControlSystem = "TractionControlSystem";
168 const VehicleProperty::Property VehicleProperty::VehicleTopSpeedLimit = "VehicleTopSpeedLimit";
169 const VehicleProperty::Property VehicleProperty::DoorStatus = "DoorStatus";
170 const VehicleProperty::Property VehicleProperty::DoorStatusW3C = "DoorStatusW3C";
171 const VehicleProperty::Property VehicleProperty::DoorLockStatus = "DoorLockStatus";
172 const VehicleProperty::Property VehicleProperty::ChildLockStatus = "ChildLockStatus";
173 const VehicleProperty::Property VehicleProperty::SeatBeltStatus = "SeatBeltStatus";
174 const VehicleProperty::Property VehicleProperty::WindowLockStatus = "WindowLockStatus";
175 const VehicleProperty::Property VehicleProperty::OccupantStatus = "OccupantStatus";
176 const VehicleProperty::Property VehicleProperty::ObstacleDistance = "ObstacleDistance";
177 const VehicleProperty::Property VehicleProperty::RainSensor = "RainSensor";
178 const VehicleProperty::Property VehicleProperty::WindshieldWiper = "WindshieldWiper";
179 const VehicleProperty::Property VehicleProperty::AirflowDirection = "AirflowDirection";
180 const VehicleProperty::Property VehicleProperty::AirflowDirectionW3C = "AirflowDirectionW3C";
181 const VehicleProperty::Property VehicleProperty::FanSpeed = "FanSpeed";
182 const VehicleProperty::Property VehicleProperty::TargetTemperature = "TargetTemperature";
183 const VehicleProperty::Property VehicleProperty::AirConditioning = "AirConditioning";
184 const VehicleProperty::Property VehicleProperty::AirRecirculation = "AirRecirculation";
185 const VehicleProperty::Property VehicleProperty::Heater = "Heater";
186 const VehicleProperty::Property VehicleProperty::Defrost = "Defrost";
187 const VehicleProperty::Property VehicleProperty::DefrostWindow = "DefrostWindow";
188 const VehicleProperty::Property VehicleProperty::DefrostMirror = "DefrostMirror";
189 const VehicleProperty::Property VehicleProperty::SteeringWheelHeater = "SteeringWheelHeater";
190 const VehicleProperty::Property VehicleProperty::SeatHeater = "SeatHeater";
191 const VehicleProperty::Property VehicleProperty::SeatCooler = "SeatCooler";
192 const VehicleProperty::Property VehicleProperty::WindowStatus = "WindowStatus";
193 const VehicleProperty::Property VehicleProperty::Sunroof = "Sunroof";
194 const VehicleProperty::Property VehicleProperty::SunroofTilt = "SunroofTilt";
195 const VehicleProperty::Property VehicleProperty::ConvertibleRoof = "ConvertibleRoof";
196 const VehicleProperty::Property VehicleProperty::NightMode = "NightMode";
197 const VehicleProperty::Property VehicleProperty::DrivingMode = "DrivingMode";
198 const VehicleProperty::Property VehicleProperty::DrivingModeW3C = "DrivingModeW3C";
199 const VehicleProperty::Property VehicleProperty::KeyId = "KeyId";
200 const VehicleProperty::Property VehicleProperty::Language = "Language";
201 const VehicleProperty::Property VehicleProperty::MeasurementSystem = "MeasurementSystem";
202 const VehicleProperty::Property VehicleProperty::MirrorSettingPan = "MirrorPanSetting";
203 const VehicleProperty::Property VehicleProperty::MirrorSettingTilt= "MirrorTiltSetting";
204 const VehicleProperty::Property VehicleProperty::SteeringWheelPositionSlide = "SteeringWheelPositionSlide";
205 const VehicleProperty::Property VehicleProperty::SteeringWheelPositionTilt = "SteeringWheelPositionTilt";
206 const VehicleProperty::Property VehicleProperty::SeatPositionRecline = "SeatPositionRecline";
207 const VehicleProperty::Property VehicleProperty::SeatPositionSlide = "SeatPositionSlide";
208 const VehicleProperty::Property VehicleProperty::SeatPositionCushionHeight = "SeatPositionCushionHeight";
209 const VehicleProperty::Property VehicleProperty::SeatPositionHeadrest = "SeatPositionHeadrest";
210 const VehicleProperty::Property VehicleProperty::SeatPositionBackCushion = "SeatPositionBackCushion";
211 const VehicleProperty::Property VehicleProperty::SeatPositionSideCushion = "SeatPositionSideCushion";
212 const VehicleProperty::Property VehicleProperty::DashboardIllumination = "DashboardIllumination";
213 const VehicleProperty::Property VehicleProperty::GeneratedVehicleSoundMode = "GeneratedVehicleSoundMode";
214 const VehicleProperty::Property VehicleProperty::DriverId = "DriverId";
215 const VehicleProperty::Property VehicleProperty::PowertrainTorque = "PowertrainTorque";
216 const VehicleProperty::Property VehicleProperty::AcceleratorPedalPosition = "AcceleratorPedalPosition";
217 const VehicleProperty::Property VehicleProperty::Chime = "Chime";
218 const VehicleProperty::Property VehicleProperty::WheelTick = "WheelTick";
219 const VehicleProperty::Property VehicleProperty::IgnitionTimeOn = "IgnitionTimeOn";
220 const VehicleProperty::Property VehicleProperty::IgnitionTimeOff = "IgnitionTimeOff";
221 const VehicleProperty::Property VehicleProperty::YawRate = "YawRate";
222 const VehicleProperty::Property VehicleProperty::ButtonEventW3C = "ButtonEventW3C";
224 PropertyList VehicleProperty::mCapabilities;
225 PropertyList VehicleProperty::mCustomProperties;
227 VehicleProperty::VehicleProperty()
229 REGISTERPROPERTY( VehicleSpeed, 0);
230 REGISTERPROPERTY(EngineSpeed, 0);
231 REGISTERPROPERTY(TransmissionShiftPosition, Transmission::Neutral);
232 REGISTERPROPERTY(TransmissionGearPosition, Transmission::Neutral);
233 REGISTERPROPERTY(TransmissionMode, Transmission::Normal);
234 REGISTERPROPERTY(TransmissionModeW3C, "neutral");
235 REGISTERPROPERTY(ThrottlePosition, 0);
236 REGISTERPROPERTY(WheelBrake, false);
237 REGISTERPROPERTY(WheelBrakePressure, 0);
238 REGISTERPROPERTY(SteeringWheelAngle, 0);
239 REGISTERPROPERTY(SteeringWheelAngleW3C, 0);
240 REGISTERPROPERTY(TurnSignal, TurnSignals::Off);
241 REGISTERPROPERTY(ClutchStatus, false);
242 REGISTERPROPERTY(EngineOilPressure, 0);
243 REGISTERPROPERTY(EngineOilTemperature, 0);
244 REGISTERPROPERTY(EngineOilRemaining, 0);
245 REGISTERPROPERTY(EngineOilLifeRemaining, 0);
246 REGISTERPROPERTY(EngineOilChangeIndicator, false);
247 REGISTERPROPERTY(EngineCoolantTemperature, 0);
248 REGISTERPROPERTY(EngineCoolantLevel, 0);
249 REGISTERPROPERTY(MachineGunTurretStatus, false);
250 REGISTERPROPERTY(AccelerationX, 0);
251 REGISTERPROPERTY(AccelerationY, 0);
252 REGISTERPROPERTY(AccelerationZ, 0);
253 REGISTERPROPERTY(MassAirFlow, 0);
254 REGISTERPROPERTY(ButtonEvent, ButtonEvents::NoButton);
255 REGISTERPROPERTY(AirIntakeTemperature, 0)
256 REGISTERPROPERTY(BatteryVoltage, 0);
257 REGISTERPROPERTY(BatteryCurrent, 0);
258 REGISTERPROPERTY(BatteryChargeLevel, 0);
259 REGISTERPROPERTY(InteriorTemperature, 0);
260 REGISTERPROPERTY(ExteriorTemperature, 0);
261 REGISTERPROPERTY(VIN, "");
262 REGISTERPROPERTY(WMI, "");
263 REGISTERPROPERTY(TirePressure, 0);
264 REGISTERPROPERTY(TirePressureLow, false);
265 REGISTERPROPERTY(TireTemperature, 0);
266 REGISTERPROPERTY( VehiclePowerMode, Power::Off);
267 registerPropertyPriv(TripMeters, [](){
268 TripMetersType* t = new TripMetersType();
269 BasicPropertyType<uint16_t> v(0);
274 REGISTERPROPERTY(CruiseControlActive, false);
275 REGISTERPROPERTY(CruiseControlSpeed, 0);
276 REGISTERPROPERTY(LightHead, false);
277 REGISTERPROPERTY(LightLeftTurn, false);
278 REGISTERPROPERTY(LightRightTurn, false);
279 REGISTERPROPERTY(LightParking, false);
280 REGISTERPROPERTY(LightFog, false);
281 REGISTERPROPERTY(LightHazard, false);
282 REGISTERPROPERTY(LightHighBeam, false);
283 REGISTERPROPERTY(LightBrake, false);
284 REGISTERPROPERTY(LightAutomatic, false);
285 REGISTERPROPERTY(LightDynamicHighBeam, false);
286 REGISTERPROPERTY(InteriorLightDriver, false);
287 REGISTERPROPERTY(InteriorLightPassenger, false);
288 REGISTERPROPERTY(InteriorLightCenter, false);
289 REGISTERPROPERTY(InteriorLightStatus, false);
290 REGISTERPROPERTY(EngineLoad, 0);
291 REGISTERPROPERTY(Horn, false);
292 REGISTERPROPERTY(FuelLevel, 0);
293 REGISTERPROPERTY(FuelRange, 0);
294 REGISTERPROPERTY(FuelConsumption, 0);
295 REGISTERPROPERTY(FuelEconomy, 0);
296 REGISTERPROPERTY(FuelAverageEconomy, 0);
297 REGISTERPROPERTY(FuelAverageConsumption, 0);
298 REGISTERPROPERTY(FuelConsumptionSinceRestart, 0);
299 REGISTERPROPERTY(FuelTimeSinceRestart, 0);
300 REGISTERPROPERTY(FuelType, Fuel::Unknown);
301 REGISTERPROPERTY(FuelPositionSide, Fuel::UnknownPosition);
302 REGISTERPROPERTY(ExteriorBrightness, 0);
303 REGISTERPROPERTY(VehicleWidth, 0);
304 REGISTERPROPERTY(VehicleHeight, 0);
305 REGISTERPROPERTY(VehicleLength, 0);
306 REGISTERPROPERTY(Latitude, 0);
307 REGISTERPROPERTY(Longitude, 0);
308 REGISTERPROPERTY(Altitude, 0);
309 REGISTERPROPERTY(Direction, 0);
310 REGISTERPROPERTY(VehicleType, Vehicle::Unknown);
311 registerPropertyPriv(DoorsPerRow, []() { BasicPropertyType<uint16_t> d(0); return new DoorsPerRowType(&d); });
312 REGISTERPROPERTY(TransmissionGearType, Transmission::Unknown);
313 REGISTERPROPERTY(FrontWheelRadius, 0);
314 REGISTERPROPERTY(RearWheelRadius, 0);
315 REGISTERPROPERTY(WheelTrack, 0);
316 REGISTERPROPERTY(BrakePressure, 0);
317 REGISTERPROPERTY(Odometer, 0);
318 REGISTERPROPERTY(DistanceTotal, 0);
319 REGISTERPROPERTY(DistanceSinceStart, 0);
320 REGISTERPROPERTY(TransmissionFluidLevel, 0);
321 REGISTERPROPERTY(BrakeFluidLevel, 0);
322 REGISTERPROPERTY(WasherFluidLevel, 0);
323 REGISTERPROPERTY(SecurityAlertStatus, Security::Idle);
324 REGISTERPROPERTY(ParkingBrakeStatus, false);
325 REGISTERPROPERTY(ParkingLightStatus, false);
326 REGISTERPROPERTY(HazardLightStatus, false);
327 REGISTERPROPERTY(AirbagStatus, Airbag::Inactive);
329 REGISTERPROPERTY(AntilockBrakingSystem, false);
330 REGISTERPROPERTY(TractionControlSystem, false);
331 REGISTERPROPERTY(VehicleTopSpeedLimit, 0);
333 REGISTERPROPERTY(DoorStatus, Door::Closed);
334 REGISTERPROPERTY(DoorStatusW3C, Door::W3C::Closed);
335 REGISTERPROPERTY(DoorLockStatus, false);
336 REGISTERPROPERTY(ChildLockStatus, false);
337 REGISTERPROPERTY(SeatBeltStatus, false);
338 REGISTERPROPERTY(OccupantStatus, Seat::Vacant);
339 REGISTERPROPERTY(WindowLockStatus, false);
340 REGISTERPROPERTY(ObstacleDistance, 0);
342 REGISTERPROPERTY(RainSensor, 0);
343 REGISTERPROPERTY(WindshieldWiper, Window::Off);
344 REGISTERPROPERTY(AirflowDirection, HVAC::Front);
345 REGISTERPROPERTY(AirflowDirectionW3C, HVAC::W3C::FloorPanel);
346 REGISTERPROPERTY(FanSpeed, 0);
347 REGISTERPROPERTY(TargetTemperature, 0);
348 REGISTERPROPERTY(AirConditioning, false);
349 REGISTERPROPERTY(AirRecirculation, false);
350 REGISTERPROPERTY(Heater, false);
352 REGISTERPROPERTY(Defrost, false);
353 REGISTERPROPERTY(DefrostWindow, false);
354 REGISTERPROPERTY(DefrostMirror, false);
356 REGISTERPROPERTY(SteeringWheelHeater, false);
357 REGISTERPROPERTY(SeatHeater, 0);
358 REGISTERPROPERTY(SeatCooler, false);
359 REGISTERPROPERTY(WindowStatus, 100);
360 REGISTERPROPERTY(Sunroof, 0);
361 REGISTERPROPERTY(SunroofTilt, 0);
362 REGISTERPROPERTY(ConvertibleRoof, false);
363 REGISTERPROPERTY(NightMode, false);
364 REGISTERPROPERTY(DrivingMode, Driving::None);
365 REGISTERPROPERTY(DrivingModeW3C, false);
366 REGISTERPROPERTY(KeyId, "");
367 REGISTERPROPERTY(Language, "");
368 REGISTERPROPERTY(MeasurementSystem, Measurement::Metric);
369 REGISTERPROPERTY(MirrorSettingPan, 0);
370 REGISTERPROPERTY(MirrorSettingTilt, 0);
371 REGISTERPROPERTY(SteeringWheelPositionSlide, 0);
372 REGISTERPROPERTY(SteeringWheelPositionTilt, 0);
373 REGISTERPROPERTY(SeatPositionRecline, 0);
374 REGISTERPROPERTY(SeatPositionSlide, 0);
375 REGISTERPROPERTY(SeatPositionCushionHeight, 0);
376 REGISTERPROPERTY(SeatPositionHeadrest, 0);
377 REGISTERPROPERTY(SeatPositionBackCushion, 0);
378 REGISTERPROPERTY(SeatPositionSideCushion, 0);
379 REGISTERPROPERTY(DashboardIllumination, 0);
380 REGISTERPROPERTY(GeneratedVehicleSoundMode, Vehicle::Normal);
381 REGISTERPROPERTY(DriverId, "");
382 REGISTERPROPERTY(PowertrainTorque, 0);
383 REGISTERPROPERTY(AcceleratorPedalPosition, 0);
384 REGISTERPROPERTY(Chime, false);
385 REGISTERPROPERTY(WheelTick, 0);
386 REGISTERPROPERTY(IgnitionTimeOff, 0);
387 REGISTERPROPERTY(IgnitionTimeOn, 0);
388 REGISTERPROPERTY(YawRate, 0);
389 REGISTERPROPERTY(ButtonEventW3C, "");
392 void VehicleProperty::factory()
394 if(!thereCanOnlyBeOne)
395 thereCanOnlyBeOne = amb::make_unique(new VehicleProperty());
398 PropertyList VehicleProperty::capabilities()
400 return mCapabilities;
403 PropertyList VehicleProperty::customProperties()
405 return mCustomProperties;
408 AbstractPropertyType* VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::Property name, std::string value)
410 if(registeredPropertyFactoryMap.count(name) > 0)
412 VehicleProperty::PropertyTypeFactoryCallback cb = registeredPropertyFactoryMap[name];
415 AbstractPropertyType* type = cb();
417 throw std::runtime_error("Cannot return NULL in a PropertyTypeFactory");
420 type->fromString(value);
426 DebugOut(DebugOut::Error)<<"Property not found"<<endl;
431 bool VehicleProperty::registerProperty(VehicleProperty::Property name, VehicleProperty::PropertyTypeFactoryCallback factory)
433 if(!contains(mCustomProperties,name))
435 mCustomProperties.push_back(name);
437 return registerPropertyPriv(name, factory);
443 bool VehicleProperty::registerPropertyPriv(VehicleProperty::Property name, VehicleProperty::PropertyTypeFactoryCallback factory)
445 if(contains(mCapabilities,name))
447 DebugOut(0)<<__FUNCTION__<<" ERROR: property '"<<name<<"' already registered."<<endl;
451 registeredPropertyFactoryMap[name] = factory;
452 mCapabilities.push_back(name);