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* Seat::W3C::Vacant = "vacant";
68 const char* Seat::W3C::Child = "child";
69 const char* Seat::W3C::Adult = "adult";
71 const char* Seat::W3C::Pin = "pin";
72 const char* Seat::W3C::Keyfob = "keyfob";
73 const char* Seat::W3C::Bluetooth = "Bluetooth";
74 const char* Seat::W3C::NFC = "NFC";
75 const char* Seat::W3C::Fingerprint = "fingerprint";
76 const char* Seat::W3C::Camera = "camera";
77 const char* Seat::W3C::Voice = "voice";
79 const char* HVAC::W3C::FloorPanel = "floorpanel";
80 const char* HVAC::W3C::FloorDuct = "floorduct";
81 const char* HVAC::W3C::Bilevel = "bilevel";
82 const char* HVAC::W3C::DefrostFloor = "defrostfloor";
84 const char* Drive::W3C::Auto = "auto";
85 const char* Drive::W3C::Comfort = "comfort";
86 const char* Drive::W3C::Sport = "sport";
87 const char* Drive::W3C::Eco = "eco";
88 const char* Drive::W3C::Manual = "manual";
89 const char* Drive::W3C::Winter = "winter";
91 const char * WiperSpeedSetting::W3C::Off = "off";
92 const char * WiperSpeedSetting::W3C::Once = "once";
93 const char * WiperSpeedSetting::W3C::Slowest = "slowest";
94 const char * WiperSpeedSetting::W3C::Slow = "slow";
95 const char * WiperSpeedSetting::W3C::Middle = "middle";
96 const char * WiperSpeedSetting::W3C::Fast = "fast";
97 const char * WiperSpeedSetting::W3C::Fastest = "fastest";
98 const char * WiperSpeedSetting::W3C::Auto = "auto";
100 const char * ConvertibleRoofW3C::Closed = "closed";
101 const char * ConvertibleRoofW3C::Closing = "closing";
102 const char * ConvertibleRoofW3C::Opened = "opened";
103 const char * ConvertibleRoofW3C::Opening = "opening";
105 const char * LaneDeparture::W3C::Off = "off";
106 const char * LaneDeparture::W3C::Pause = "pause";
107 const char * LaneDeparture::W3C::Running = "running";
109 const char * Security::W3C::Alarmed = "alarmed";
110 const char * Security::W3C::Armed = "armed";
111 const char * Security::W3C::Disarmed = "disarmed";
112 const char * Security::W3C::Prearmed = "prearmed";
114 const char * ParkingBrake::W3C::Inactive = "inactive";
115 const char * ParkingBrake::W3C::Active = "active";
116 const char * ParkingBrake::W3C::Error = "error";
118 const VehicleProperty::Property VehicleProperty::NoValue = "NoValue";
119 const VehicleProperty::Property VehicleProperty::VehicleSpeed = "VehicleSpeed";
120 const VehicleProperty::Property VehicleProperty::EngineSpeed = "EngineSpeed";
121 const VehicleProperty::Property VehicleProperty::TransmissionShiftPosition = "TransmissionShiftPosition";
122 const VehicleProperty::Property VehicleProperty::TransmissionGearPosition = "TransmissionGearPostion";
123 const VehicleProperty::Property VehicleProperty::TransmissionMode = "TransmissionMode";
124 const VehicleProperty::Property VehicleProperty::TransmissionModeW3C = "TransmissionModeW3C";
125 const VehicleProperty::Property VehicleProperty::ThrottlePosition = "ThrottlePosition";
126 const VehicleProperty::Property VehicleProperty::WheelBrake = "WheelBrake";
127 const VehicleProperty::Property VehicleProperty::WheelBrakePressure = "WheelBrakePressure";
128 const VehicleProperty::Property VehicleProperty::SteeringWheelAngle = "SteeringWheelAngle";
129 const VehicleProperty::Property VehicleProperty::SteeringWheelAngleW3C = "SteeringWheelAngleW3C";
130 const VehicleProperty::Property VehicleProperty::TurnSignal = "TurnSignal";
131 const VehicleProperty::Property VehicleProperty::ClutchStatus = "ClutchStatus";
132 const VehicleProperty::Property VehicleProperty::EngineOilPressure = "EngineOilPressure";
133 const VehicleProperty::Property VehicleProperty::EngineCoolantTemperature = "EngineCoolantTemperature";
134 const VehicleProperty::Property VehicleProperty::EngineCoolantLevel = "EngineCoolantLevel";
135 const VehicleProperty::Property VehicleProperty::MachineGunTurretStatus = "MachineGunTurretStatus";
136 const VehicleProperty::Property VehicleProperty::AccelerationX = "AccelerationX";
137 const VehicleProperty::Property VehicleProperty::AccelerationY = "AccelerationY";
138 const VehicleProperty::Property VehicleProperty::AccelerationZ = "AccelerationZ";
139 const VehicleProperty::Property VehicleProperty::MassAirFlow = "MassAirFlow";
140 [[deprecated("Deprecated in 0.14. Use ButtonEventW3C")]]
141 const VehicleProperty::Property VehicleProperty::ButtonEvent = "ButtonEvent";
142 const VehicleProperty::Property VehicleProperty::AirIntakeTemperature = "AirIntakeTemperature";
143 const VehicleProperty::Property VehicleProperty::BatteryVoltage = "BatteryVoltage";
144 const VehicleProperty::Property VehicleProperty::BatteryCurrent = "BatteryCurrent";
145 const VehicleProperty::Property VehicleProperty::BatteryChargeLevel = "BatteryChargeLevel";
146 const VehicleProperty::Property VehicleProperty::InteriorTemperature = "InteriorTemperature";
147 const VehicleProperty::Property VehicleProperty::ExteriorTemperature = "ExteriorTemperature";
148 const VehicleProperty::Property VehicleProperty::EngineOilTemperature = "EngineOilTemperature";
149 const VehicleProperty::Property VehicleProperty::EngineOilLifeRemaining = "EngineOilLifeRemaining";
150 const VehicleProperty::Property VehicleProperty::EngineOilChangeIndicator= "EngineOilChangeIndicator";
151 const VehicleProperty::Property VehicleProperty::VIN = "VIN";
152 const VehicleProperty::Property VehicleProperty::WMI = "WMI";
153 const VehicleProperty::Property VehicleProperty::TirePressure = "TirePressure";
154 const VehicleProperty::Property VehicleProperty::TirePressureLow = "TirePressureLow";
155 const VehicleProperty::Property VehicleProperty::TireTemperature = "TireTemperature";
156 const VehicleProperty::Property VehicleProperty::VehiclePowerMode = "VehiclePowerMode";
157 const VehicleProperty::Property VehicleProperty::TripMeters = "TripMeters";
158 const VehicleProperty::Property VehicleProperty::CruiseControlActive = "CruiseControlActive";
159 const VehicleProperty::Property VehicleProperty::CruiseControlSpeed = "CruiseControlSpeed";
160 const VehicleProperty::Property VehicleProperty::LightHead = "LightHead";
161 const VehicleProperty::Property VehicleProperty::LightLeftTurn = "LightLeftTurn";
162 const VehicleProperty::Property VehicleProperty::LightRightTurn = "LightRightTurn";
163 const VehicleProperty::Property VehicleProperty::LightParking = "LightParking";
164 const VehicleProperty::Property VehicleProperty::LightFog = "LightFog";
165 const VehicleProperty::Property VehicleProperty::LightHazard= "LightHazard";
166 const VehicleProperty::Property VehicleProperty::LightHighBeam = "LightHighBeam";
167 const VehicleProperty::Property VehicleProperty::LightBrake= "LightBrake";
168 const VehicleProperty::Property VehicleProperty::LightAutomatic= "LightAutomatic";
169 const VehicleProperty::Property VehicleProperty::LightDynamicHighBeam= "LightDynamicHighBeam";
170 const VehicleProperty::Property VehicleProperty::InteriorLightDriver = "InteriorLightDriver";
171 const VehicleProperty::Property VehicleProperty::InteriorLightCenter = "InteriorLightCenter";
172 const VehicleProperty::Property VehicleProperty::InteriorLightPassenger = "InteriorLightPassenger";
173 const VehicleProperty::Property VehicleProperty::InteriorLightStatus = "InteriorLightStatus";
174 const VehicleProperty::Property VehicleProperty::EngineLoad = "EngineLoad";
175 const VehicleProperty::Property VehicleProperty::Horn = "Horn";
176 const VehicleProperty::Property VehicleProperty::FuelLevel = "FuelLevel";
177 const VehicleProperty::Property VehicleProperty::FuelConsumption = "FuelConsumption";
178 const VehicleProperty::Property VehicleProperty::FuelRange = "FuelRange";
179 const VehicleProperty::Property VehicleProperty::FuelEconomy = "FuelEconomy";
180 const VehicleProperty::Property VehicleProperty::FuelAverageEconomy = "FuelAverageEconomy";
181 const VehicleProperty::Property VehicleProperty::FuelAverageConsumption = "FuelAverageConsumption";
182 const VehicleProperty::Property VehicleProperty::FuelConsumptionSinceRestart = "FuelConsumptionSinceRestart";
183 const VehicleProperty::Property VehicleProperty::FuelTimeSinceRestart = "FuelTimeSinceRestart";
184 const VehicleProperty::Property VehicleProperty::FuelType = "FuelType";
185 const VehicleProperty::Property VehicleProperty::FuelPositionSide = "FuelPositionSide";
186 const VehicleProperty::Property VehicleProperty::EngineOilRemaining = "EngineOilRemaining";
187 const VehicleProperty::Property VehicleProperty::ExteriorBrightness = "ExteriorBrightness";
188 const VehicleProperty::Property VehicleProperty::Latitude = "Latitude";
189 const VehicleProperty::Property VehicleProperty::Longitude = "Longitude";
190 const VehicleProperty::Property VehicleProperty::Direction = "Direction";
191 const VehicleProperty::Property VehicleProperty::Altitude = "Altitude";
192 const VehicleProperty::Property VehicleProperty::VehicleWidth = "VehicleWidth";
193 const VehicleProperty::Property VehicleProperty::VehicleHeight = "VehicleHeight";
194 const VehicleProperty::Property VehicleProperty::VehicleLength = "VehicleLength";
195 const VehicleProperty::Property VehicleProperty::VehicleType = "VehicleType";
196 const VehicleProperty::Property VehicleProperty::DoorsPerRow = "DoorsPerRow";
197 const VehicleProperty::Property VehicleProperty::TransmissionGearType = "TransmissionGearType";
198 const VehicleProperty::Property VehicleProperty::FrontWheelRadius = "FrontWheelRadius";
199 const VehicleProperty::Property VehicleProperty::RearWheelRadius = "RearWheelRadius";
200 const VehicleProperty::Property VehicleProperty::WheelTrack = "WheelTrack";
201 const VehicleProperty::Property VehicleProperty::BrakePressure = "BrakePressure";
202 const VehicleProperty::Property VehicleProperty::Odometer = "Odometer";
203 const VehicleProperty::Property VehicleProperty::DistanceTotal = "DistanceTotal";
204 const VehicleProperty::Property VehicleProperty::DistanceSinceStart = "DistanceSinceStart";
205 const VehicleProperty::Property VehicleProperty::TransmissionFluidLevel = "TransmissionFluidLevel";
206 const VehicleProperty::Property VehicleProperty::BrakeFluidLevel = "BrakeFluidLevel";
207 const VehicleProperty::Property VehicleProperty::WasherFluidLevel = "WasherFluidLevel";
208 const VehicleProperty::Property VehicleProperty::WasherFluidLevelLow = "WasherFluidLevelLow";
209 const VehicleProperty::Property VehicleProperty::SecurityAlertStatus = "SecurityAlertStatus";
210 const VehicleProperty::Property VehicleProperty::ParkingBrakeStatus = "ParkingBrakeStatus";
211 const VehicleProperty::Property VehicleProperty::ParkingBrakeStatusW3C = "ParkingBrakeStatusW3C";
212 const VehicleProperty::Property VehicleProperty::ParkingLightStatus = "ParkingLightStatus";
213 const VehicleProperty::Property VehicleProperty::HazardLightStatus = "HazardLightStatus";
214 const VehicleProperty::Property VehicleProperty::AirbagStatus = "AirbagStatus";
215 const VehicleProperty::Property VehicleProperty::AirbagDeployed = "AirbagDeployed";
216 const VehicleProperty::Property VehicleProperty::AirbagActivated = "AirbagActivated";
217 const VehicleProperty::Property VehicleProperty::AntilockBrakingSystem = "AntilockBrakingSystem";
218 const VehicleProperty::Property VehicleProperty::AntilockBrakingSystemEnabled = "AntilockBrakingSystemEnabled";
219 const VehicleProperty::Property VehicleProperty::TractionControlSystem = "TractionControlSystem";
220 const VehicleProperty::Property VehicleProperty::TractionControlSystemEnabled = "TractionControlSystemEnabled";
221 const VehicleProperty::Property VehicleProperty::VehicleTopSpeedLimit = "VehicleTopSpeedLimit";
222 const VehicleProperty::Property VehicleProperty::DoorStatus = "DoorStatus";
223 const VehicleProperty::Property VehicleProperty::DoorStatusW3C = "DoorStatusW3C";
224 const VehicleProperty::Property VehicleProperty::DoorLockStatus = "DoorLockStatus";
225 const VehicleProperty::Property VehicleProperty::ChildLockStatus = "ChildLockStatus";
226 const VehicleProperty::Property VehicleProperty::SeatBeltStatus = "SeatBeltStatus";
227 const VehicleProperty::Property VehicleProperty::WindowLockStatus = "WindowLockStatus";
228 const VehicleProperty::Property VehicleProperty::OccupantStatus = "OccupantStatus";
229 const VehicleProperty::Property VehicleProperty::OccupantStatusW3C = "OccupantStatusW3C";
230 const VehicleProperty::Property VehicleProperty::ObstacleDistance = "ObstacleDistance";
231 const VehicleProperty::Property VehicleProperty::RainSensor = "RainSensor";
232 const VehicleProperty::Property VehicleProperty::WindshieldWiper = "WindshieldWiper";
233 const VehicleProperty::Property VehicleProperty::WindshieldWiperSpeed = "WindshieldWiperSpeed";
234 const VehicleProperty::Property VehicleProperty::WindshieldWiperSetting = "WindshieldWiperSetting";
235 const VehicleProperty::Property VehicleProperty::AirflowDirection = "AirflowDirection";
236 const VehicleProperty::Property VehicleProperty::AirflowDirectionW3C = "AirflowDirectionW3C";
237 const VehicleProperty::Property VehicleProperty::FanSpeed = "FanSpeed";
238 const VehicleProperty::Property VehicleProperty::TargetTemperature = "TargetTemperature";
239 const VehicleProperty::Property VehicleProperty::AirConditioning = "AirConditioning";
240 const VehicleProperty::Property VehicleProperty::AirRecirculation = "AirRecirculation";
241 const VehicleProperty::Property VehicleProperty::Heater = "Heater";
242 const VehicleProperty::Property VehicleProperty::Defrost = "Defrost";
243 const VehicleProperty::Property VehicleProperty::DefrostWindow = "DefrostWindow";
244 const VehicleProperty::Property VehicleProperty::DefrostMirror = "DefrostMirror";
245 const VehicleProperty::Property VehicleProperty::SteeringWheelHeater = "SteeringWheelHeater";
246 const VehicleProperty::Property VehicleProperty::SeatHeater = "SeatHeater";
247 const VehicleProperty::Property VehicleProperty::SeatCooler = "SeatCooler";
248 const VehicleProperty::Property VehicleProperty::WindowStatus = "WindowStatus";
249 const VehicleProperty::Property VehicleProperty::Sunroof = "Sunroof";
250 const VehicleProperty::Property VehicleProperty::SunroofTilt = "SunroofTilt";
251 const VehicleProperty::Property VehicleProperty::ConvertibleRoof = "ConvertibleRoof";
252 const VehicleProperty::Property VehicleProperty::ConvertibleRoofStatus = "ConvertibleRoofStatus";
253 const VehicleProperty::Property VehicleProperty::NightMode = "NightMode";
254 const VehicleProperty::Property VehicleProperty::DrivingMode = "DrivingMode";
255 const VehicleProperty::Property VehicleProperty::DrivingModeW3C = "DrivingModeW3C";
256 const VehicleProperty::Property VehicleProperty::KeyId = "KeyId";
257 const VehicleProperty::Property VehicleProperty::Language = "Language";
258 const VehicleProperty::Property VehicleProperty::MeasurementSystem = "MeasurementSystem";
259 const VehicleProperty::Property VehicleProperty::MirrorSettingPan = "MirrorSettingPan";
260 const VehicleProperty::Property VehicleProperty::MirrorSettingTilt= "MirrorSettingTilt";
261 const VehicleProperty::Property VehicleProperty::SteeringWheelPositionSlide = "SteeringWheelPositionSlide";
262 const VehicleProperty::Property VehicleProperty::SteeringWheelPositionTilt = "SteeringWheelPositionTilt";
263 const VehicleProperty::Property VehicleProperty::SeatPositionRecline = "SeatPositionRecline";
264 const VehicleProperty::Property VehicleProperty::SeatPositionSlide = "SeatPositionSlide";
265 const VehicleProperty::Property VehicleProperty::SeatPositionCushionHeight = "SeatPositionCushionHeight";
266 const VehicleProperty::Property VehicleProperty::SeatPositionHeadrest = "SeatPositionHeadrest";
267 const VehicleProperty::Property VehicleProperty::SeatPositionBackCushion = "SeatPositionBackCushion";
268 const VehicleProperty::Property VehicleProperty::SeatPositionSideCushion = "SeatPositionSideCushion";
269 const VehicleProperty::Property VehicleProperty::DashboardIllumination = "DashboardIllumination";
270 const VehicleProperty::Property VehicleProperty::GeneratedVehicleSoundMode = "GeneratedVehicleSoundMode";
271 const VehicleProperty::Property VehicleProperty::DriverId = "DriverId";
272 const VehicleProperty::Property VehicleProperty::PowertrainTorque = "PowertrainTorque";
273 const VehicleProperty::Property VehicleProperty::AcceleratorPedalPosition = "AcceleratorPedalPosition";
274 const VehicleProperty::Property VehicleProperty::Chime = "Chime";
275 const VehicleProperty::Property VehicleProperty::WheelTick = "WheelTick";
276 const VehicleProperty::Property VehicleProperty::IgnitionTimeOn = "IgnitionTimeOn";
277 const VehicleProperty::Property VehicleProperty::IgnitionTimeOff = "IgnitionTimeOff";
278 const VehicleProperty::Property VehicleProperty::YawRate = "YawRate";
279 const VehicleProperty::Property VehicleProperty::ButtonEventW3C = "ButtonEventW3C";
280 const VehicleProperty::Property VehicleProperty::TransmissionOilWear = "TransmissionOilWear";
281 const VehicleProperty::Property VehicleProperty::TransmissionOilTemperature = "TransmissionOilTemperature";
282 const VehicleProperty::Property VehicleProperty::TransmissionClutchWear = "TransmissionClutchWear";
283 const VehicleProperty::Property VehicleProperty::BrakePadWear = "BrakePadWear";
284 const VehicleProperty::Property VehicleProperty::BrakeFluidLevelLow = "BrakeFluidLevelLow";
285 const VehicleProperty::Property VehicleProperty::MalfunctionIndicatorOn = "MalfunctionIndicatorOn";
286 const VehicleProperty::Property VehicleProperty::AccumulatedEngineRuntime = "AccumulatedEngineRuntime";
287 const VehicleProperty::Property VehicleProperty::DistanceSinceCodeCleared = "DistanceSinceCodeCleared";
288 const VehicleProperty::Property VehicleProperty::DistanceWithMILOn = "DistanceWithMILOn";
289 const VehicleProperty::Property VehicleProperty::TimeRunMILOn = "TimeRunMILOn";
290 const VehicleProperty::Property VehicleProperty::TimeTroubleCodeClear = "TimeTroubleCodeClear";
291 const VehicleProperty::Property VehicleProperty::VehicleDriveMode = "VehicleDriveMode";
292 const VehicleProperty::Property VehicleProperty::ActiveNoiseControlMode = "ActiveNoiseControlMode";
293 const VehicleProperty::Property VehicleProperty::AvailableSounds = "AvailableSounds";
294 const VehicleProperty::Property VehicleProperty::EngineSoundEnhancementMode = "EngineSoundEnhancementMode";
295 const VehicleProperty::Property VehicleProperty::ElectronicStabilityControlEnabled = "ElectronicStabilityControlEnabled";
296 const VehicleProperty::Property VehicleProperty::ElectronicStabilityControlEngaged = "ElectronicStabilityControlEngaged";
297 const VehicleProperty::Property VehicleProperty::OccupantIdentificationType = "OccupantIdentificationType";
298 const VehicleProperty::Property VehicleProperty::OccupantName = "OccupantName";
299 const VehicleProperty::Property VehicleProperty::AtmosphericPressure = "AtmosphericPressure";
300 const VehicleProperty::Property VehicleProperty::LaneDepartureStatus = "LaneDepartureStatus";
301 const VehicleProperty::Property VehicleProperty::AlarmStatus = "AlarmStatus";
303 PropertyList VehicleProperty::mCapabilities;
304 PropertyList VehicleProperty::mCustomProperties;
306 VehicleProperty::VehicleProperty()
308 REGISTERPROPERTY( VehicleSpeed, 0);
309 REGISTERPROPERTY(EngineSpeed, 0);
310 REGISTERPROPERTY(TransmissionShiftPosition, Transmission::Neutral);
311 REGISTERPROPERTY(TransmissionGearPosition, Transmission::Neutral);
312 REGISTERPROPERTY(TransmissionMode, Transmission::Normal);
313 REGISTERPROPERTY(TransmissionModeW3C, "neutral");
314 REGISTERPROPERTY(ThrottlePosition, 0);
315 REGISTERPROPERTY(WheelBrake, false);
316 REGISTERPROPERTY(WheelBrakePressure, 0);
317 REGISTERPROPERTY(SteeringWheelAngle, 0);
318 REGISTERPROPERTY(SteeringWheelAngleW3C, 0);
319 REGISTERPROPERTY(TurnSignal, TurnSignals::Off);
320 REGISTERPROPERTY(ClutchStatus, false);
321 REGISTERPROPERTY(EngineOilPressure, 0);
322 REGISTERPROPERTY(EngineOilTemperature, 0);
323 REGISTERPROPERTY(EngineOilRemaining, 0);
324 REGISTERPROPERTY(EngineOilLifeRemaining, 0);
325 REGISTERPROPERTY(EngineOilChangeIndicator, false);
326 REGISTERPROPERTY(EngineCoolantTemperature, 0);
327 REGISTERPROPERTY(EngineCoolantLevel, 0);
328 REGISTERPROPERTY(MachineGunTurretStatus, false);
329 REGISTERPROPERTY(AccelerationX, 0);
330 REGISTERPROPERTY(AccelerationY, 0);
331 REGISTERPROPERTY(AccelerationZ, 0);
332 REGISTERPROPERTY(MassAirFlow, 0);
333 REGISTERPROPERTY(ButtonEvent, ButtonEvents::NoButton);
334 REGISTERPROPERTY(AirIntakeTemperature, 0)
335 REGISTERPROPERTY(BatteryVoltage, 0);
336 REGISTERPROPERTY(BatteryCurrent, 0);
337 REGISTERPROPERTY(BatteryChargeLevel, 0);
338 REGISTERPROPERTY(InteriorTemperature, 0);
339 REGISTERPROPERTY(ExteriorTemperature, 0);
340 REGISTERPROPERTY(VIN, "");
341 REGISTERPROPERTY(WMI, "");
342 REGISTERPROPERTY(TirePressure, 0);
343 REGISTERPROPERTY(TirePressureLow, false);
344 REGISTERPROPERTY(TireTemperature, 0);
345 REGISTERPROPERTY( VehiclePowerMode, Power::Off);
346 registerPropertyPriv(TripMeters, [](){
347 TripMetersType* t = new TripMetersType();
352 REGISTERPROPERTY(CruiseControlActive, false);
353 REGISTERPROPERTY(CruiseControlSpeed, 0);
354 REGISTERPROPERTY(LightHead, false);
355 REGISTERPROPERTY(LightLeftTurn, false);
356 REGISTERPROPERTY(LightRightTurn, false);
357 REGISTERPROPERTY(LightParking, false);
358 REGISTERPROPERTY(LightFog, false);
359 REGISTERPROPERTY(LightHazard, false);
360 REGISTERPROPERTY(LightHighBeam, false);
361 REGISTERPROPERTY(LightBrake, false);
362 REGISTERPROPERTY(LightAutomatic, false);
363 REGISTERPROPERTY(LightDynamicHighBeam, false);
364 REGISTERPROPERTY(InteriorLightDriver, false);
365 REGISTERPROPERTY(InteriorLightPassenger, false);
366 REGISTERPROPERTY(InteriorLightCenter, false);
367 REGISTERPROPERTY(InteriorLightStatus, false);
368 REGISTERPROPERTY(EngineLoad, 0);
369 REGISTERPROPERTY(Horn, false);
370 REGISTERPROPERTY(FuelLevel, 0);
371 REGISTERPROPERTY(FuelRange, 0);
372 REGISTERPROPERTY(FuelConsumption, 0);
373 REGISTERPROPERTY(FuelEconomy, 0);
374 REGISTERPROPERTY(FuelAverageEconomy, 0);
375 REGISTERPROPERTY(FuelAverageConsumption, 0);
376 REGISTERPROPERTY(FuelConsumptionSinceRestart, 0);
377 REGISTERPROPERTY(FuelTimeSinceRestart, 0);
378 REGISTERPROPERTY(FuelType, Fuel::Unknown);
379 REGISTERPROPERTY(FuelPositionSide, Fuel::UnknownPosition);
380 REGISTERPROPERTY(ExteriorBrightness, 0);
381 REGISTERPROPERTY(VehicleWidth, 0);
382 REGISTERPROPERTY(VehicleHeight, 0);
383 REGISTERPROPERTY(VehicleLength, 0);
384 REGISTERPROPERTY(Latitude, 0);
385 REGISTERPROPERTY(Longitude, 0);
386 REGISTERPROPERTY(Altitude, 0);
387 REGISTERPROPERTY(Direction, 0);
388 REGISTERPROPERTY(VehicleType, Vehicle::Unknown);
389 registerPropertyPriv(DoorsPerRow, []() {
390 DoorsPerRowType* doors = new DoorsPerRowType();
394 REGISTERPROPERTY(TransmissionGearType, Transmission::Unknown);
395 REGISTERPROPERTY(FrontWheelRadius, 0);
396 REGISTERPROPERTY(RearWheelRadius, 0);
397 REGISTERPROPERTY(WheelTrack, 0);
398 REGISTERPROPERTY(BrakePressure, 0);
399 REGISTERPROPERTY(Odometer, 0);
400 REGISTERPROPERTY(DistanceTotal, 0);
401 REGISTERPROPERTY(DistanceSinceStart, 0);
402 REGISTERPROPERTY(TransmissionFluidLevel, 0);
403 REGISTERPROPERTY(BrakeFluidLevel, 0);
404 REGISTERPROPERTY(WasherFluidLevel, 0);
405 REGISTERPROPERTY(WasherFluidLevelLow, false);
406 REGISTERPROPERTY(SecurityAlertStatus, Security::Idle);
407 REGISTERPROPERTY(ParkingBrakeStatus, false);
408 REGISTERPROPERTY(ParkingBrakeStatusW3C, "");
409 REGISTERPROPERTY(ParkingLightStatus, false);
410 REGISTERPROPERTY(HazardLightStatus, false);
411 /// TODO: deprecated in 0.14
412 REGISTERPROPERTY(AirbagStatus, Airbag::Inactive);
413 REGISTERPROPERTY(AirbagActivated, false);
414 REGISTERPROPERTY(AirbagDeployed, false);
416 REGISTERPROPERTY(AntilockBrakingSystem, false);
417 REGISTERPROPERTY(AntilockBrakingSystemEnabled, false);
418 REGISTERPROPERTY(TractionControlSystem, false);
419 REGISTERPROPERTY(TractionControlSystemEnabled, false);
420 REGISTERPROPERTY(VehicleTopSpeedLimit, 0);
422 REGISTERPROPERTY(DoorStatus, Door::Closed);
423 REGISTERPROPERTY(DoorStatusW3C, Door::W3C::Closed);
424 REGISTERPROPERTY(DoorLockStatus, false);
425 REGISTERPROPERTY(ChildLockStatus, false);
426 REGISTERPROPERTY(SeatBeltStatus, false);
427 /// TODO: deprecated in 0.14
428 REGISTERPROPERTY(OccupantStatus, Seat::Vacant);
429 REGISTERPROPERTY(OccupantStatusW3C, Seat::W3C::Vacant);
430 REGISTERPROPERTY(WindowLockStatus, false);
431 REGISTERPROPERTY(ObstacleDistance, 0);
433 REGISTERPROPERTY(RainSensor, 0);
434 REGISTERPROPERTY(WindshieldWiper, Window::Off);
435 REGISTERPROPERTY(WindshieldWiperSpeed, WiperSpeedSetting::W3C::Off);
436 REGISTERPROPERTY(WindshieldWiperSetting, WiperSpeedSetting::W3C::Off);
437 REGISTERPROPERTY(AirflowDirection, HVAC::Front);
438 REGISTERPROPERTY(AirflowDirectionW3C, HVAC::W3C::FloorPanel);
439 REGISTERPROPERTY(FanSpeed, 0);
440 REGISTERPROPERTY(TargetTemperature, 0);
441 REGISTERPROPERTY(AirConditioning, false);
442 REGISTERPROPERTY(AirRecirculation, false);
443 REGISTERPROPERTY(Heater, false);
445 REGISTERPROPERTY(Defrost, false);
446 REGISTERPROPERTY(DefrostWindow, false);
447 REGISTERPROPERTY(DefrostMirror, false);
449 REGISTERPROPERTY(SteeringWheelHeater, false);
450 REGISTERPROPERTY(SeatHeater, 0);
451 REGISTERPROPERTY(SeatCooler, false);
452 REGISTERPROPERTY(WindowStatus, 100);
453 REGISTERPROPERTY(Sunroof, 0);
454 REGISTERPROPERTY(SunroofTilt, 0);
455 REGISTERPROPERTY(ConvertibleRoof, false);
456 REGISTERPROPERTY(ConvertibleRoofStatus, "");
458 REGISTERPROPERTY(NightMode, false);
459 REGISTERPROPERTY(DrivingMode, Driving::None);
460 REGISTERPROPERTY(DrivingModeW3C, false);
461 REGISTERPROPERTY(KeyId, "");
462 REGISTERPROPERTY(Language, "");
463 REGISTERPROPERTY(MeasurementSystem, Measurement::Metric);
464 REGISTERPROPERTY(MirrorSettingPan, 0);
465 REGISTERPROPERTY(MirrorSettingTilt, 0);
466 REGISTERPROPERTY(SteeringWheelPositionSlide, 0);
467 REGISTERPROPERTY(SteeringWheelPositionTilt, 0);
468 REGISTERPROPERTY(SeatPositionRecline, 0);
469 REGISTERPROPERTY(SeatPositionSlide, 0);
470 REGISTERPROPERTY(SeatPositionCushionHeight, 0);
471 REGISTERPROPERTY(SeatPositionHeadrest, 0);
472 REGISTERPROPERTY(SeatPositionBackCushion, 0);
473 REGISTERPROPERTY(SeatPositionSideCushion, 0);
474 REGISTERPROPERTY(DashboardIllumination, 0);
475 REGISTERPROPERTY(GeneratedVehicleSoundMode, Vehicle::Normal);
476 REGISTERPROPERTY(DriverId, "");
477 REGISTERPROPERTY(PowertrainTorque, 0);
478 REGISTERPROPERTY(AcceleratorPedalPosition, 0);
479 REGISTERPROPERTY(Chime, false);
480 REGISTERPROPERTY(WheelTick, 0);
481 REGISTERPROPERTY(IgnitionTimeOff, 0);
482 REGISTERPROPERTY(IgnitionTimeOn, 0);
483 REGISTERPROPERTY(YawRate, 0);
484 registerPropertyPriv(ButtonEventW3C, [](){
485 ButtonEventW3CType* t = new ButtonEventW3CType();
487 StringPropertyType v;
491 REGISTERPROPERTY(TransmissionOilWear, 0);
492 REGISTERPROPERTY(TransmissionOilTemperature, 0);
493 REGISTERPROPERTY(TransmissionClutchWear, 0);
494 REGISTERPROPERTY(BrakePadWear, 0);
495 REGISTERPROPERTY(BrakeFluidLevelLow, false);
496 REGISTERPROPERTY(MalfunctionIndicatorOn, false);
497 REGISTERPROPERTY(AccumulatedEngineRuntime, 0);
498 REGISTERPROPERTY(DistanceSinceCodeCleared, 0);
499 REGISTERPROPERTY(DistanceWithMILOn, 0);
500 REGISTERPROPERTY(TimeRunMILOn, 0);
501 REGISTERPROPERTY(TimeTroubleCodeClear, 0);
502 REGISTERPROPERTY(VehicleDriveMode, "");
503 REGISTERPROPERTY(ActiveNoiseControlMode, false);
504 registerPropertyPriv(AvailableSounds, [](){
505 AvailableSoundsType* t = new AvailableSoundsType();
509 REGISTERPROPERTY(EngineSoundEnhancementMode, "");
510 REGISTERPROPERTY(ElectronicStabilityControlEnabled, false);
511 REGISTERPROPERTY(ElectronicStabilityControlEngaged, false);
512 REGISTERPROPERTY(OccupantIdentificationType, Seat::W3C::Pin);
513 REGISTERPROPERTY(OccupantName, "");
514 REGISTERPROPERTY(AtmosphericPressure, 0);
515 REGISTERPROPERTY(LaneDepartureStatus, "");
516 REGISTERPROPERTY(AlarmStatus, "");
519 void VehicleProperty::factory()
521 if(!thereCanOnlyBeOne)
522 thereCanOnlyBeOne = amb::make_unique(new VehicleProperty());
525 PropertyList VehicleProperty::capabilities()
527 return mCapabilities;
530 PropertyList VehicleProperty::customProperties()
532 return mCustomProperties;
535 AbstractPropertyType* VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::Property name, std::string value)
537 if(registeredPropertyFactoryMap.count(name) > 0)
539 VehicleProperty::PropertyTypeFactoryCallback cb = registeredPropertyFactoryMap[name];
542 AbstractPropertyType* type = cb();
545 throw std::runtime_error("Cannot return NULL in a PropertyTypeFactory");
550 type->fromString(value);
557 DebugOut(DebugOut::Warning) << "Property not found: " << name << endl;
562 bool VehicleProperty::registerProperty(VehicleProperty::Property name, VehicleProperty::PropertyTypeFactoryCallback factory)
564 if(!contains(mCustomProperties,name))
566 mCustomProperties.push_back(name);
568 return registerPropertyPriv(name, factory);
574 bool VehicleProperty::registerPropertyPriv(VehicleProperty::Property name, VehicleProperty::PropertyTypeFactoryCallback factory)
576 if(contains(mCapabilities,name))
578 DebugOut(0)<<__FUNCTION__<<" ERROR: property '"<<name<<"' already registered."<<endl;
582 registeredPropertyFactoryMap[name] = factory;
583 mCapabilities.push_back(name);