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 #ifndef VEHICLEPROPERTY_H
21 #define VEHICLEPROPERTY_H
30 #include <abstractpropertytype.h>
32 namespace ButtonEvents {
33 enum ButtonEventType {
39 Preset1Button = 1 << 4,
40 Preset2Button = 1 << 5,
41 Preset3Button = 1 << 6,
42 Preset4Button = 1 << 7,
44 NavigateUpButton = 1 << 9,
45 NavigateDownButton = 1 << 10,
46 NavigateLeftButton = 1 << 11,
47 NavigateRightButton = 1 << 12
51 namespace TurnSignals {
61 namespace Transmission {
62 enum TransmissionPositions
100 class VehicleProperty
108 typedef std::string Property;
109 typedef std::function<AbstractPropertyType* (void)> PropertyTypeFactoryCallback;
111 /// Various property types:
113 static const Property NoValue;
115 /**< Vehicle Velocity in km/h */
116 static const Property VehicleSpeed;
117 typedef BasicPropertyType<uint16_t> VehicleSpeedType;
119 /**< Engine Speed in rotations per minute */
120 static const Property EngineSpeed;
121 typedef BasicPropertyType<uint16_t> EngineSpeedType;
123 /**< Transmission Shift Position
132 static const Property TransmissionShiftPosition;
133 typedef BasicPropertyType<Transmission::TransmissionPositions> TransmissionShiftPositionType;
135 /**< Transmission Gear Position
143 static const Property TransmissionGearPosition;
144 typedef BasicPropertyType<Transmission::TransmissionPositions> TransmissionGearPositionType;
146 static const Property TransmissionMode;
147 typedef BasicPropertyType<Transmission::Mode> TransmissionModeType;
149 /**< Throttle position 0-100% */
150 static const Property ThrottlePosition;
151 typedef BasicPropertyType<uint16_t> ThrottlePositionType;
153 /**< Wheel brake position. Engaged = true, Idle = false */
154 static const Property WheelBrake;
155 typedef BasicPropertyType<bool> WheelBrakeType;
157 /**< Steering wheel angle (0-359) */
158 static const Property SteeringWheelAngle;
159 typedef BasicPropertyType<uint16_t> SteeringWheelAngleType;
161 /**< 0=off, 1=right, 2=left, 3=hazard */
162 static const Property TurnSignal;
163 typedef BasicPropertyType<TurnSignals::TurnSignalType> TurnSignalType;
165 /**< Clutch pedal status 0=off, 1=on */
166 static const Property ClutchStatus;
167 typedef BasicPropertyType<bool> ClutchStatusType;
169 /**< Oil pressure TODO: units */
170 static const Property EngineOilPressure;
171 typedef BasicPropertyType<uint16_t> EngineOilPressureType;
173 /**< Engine coolant temperature in degrees celcius **/
174 static const Property EngineCoolantTemperature;
175 typedef BasicPropertyType<int> EngineCoolantTemperatureType;
178 static const Property MachineGunTurretStatus;
179 typedef BasicPropertyType<bool> MachineGunTurretStatusType;
181 /**< Acceleration on the 'x' axis in 1/1000 gravitational acceleration "g-force" */
182 static const Property AccelerationX;
183 typedef BasicPropertyType<uint16_t> AccelerationType;
185 /**< Acceleration on the 'y' axis in 1/1000 gravitational acceleration "g-force" */
186 static const Property AccelerationY;
188 /**< Acceleration on the 'z' axis in 1/1000 gravitational acceleration "g-force" */
189 static const Property AccelerationZ;
191 /**< Mass Air Flow. TODO: units */
192 static const Property MassAirFlow;
193 typedef BasicPropertyType<uint16_t> MassAirFlowType;
195 /**< Button Event @see ButtonEvents::ButtonEventType */
196 static const Property ButtonEvent;
197 typedef BasicPropertyType<ButtonEvents::ButtonEventType> ButtonEventType;
199 /**< Air intake temperature in degrees celcius */
200 static const Property AirIntakeTemperature;
201 typedef BasicPropertyType<int> AirIntakeTemperatureType;
203 /**< Battery voltage in volts */
204 static const Property BatteryVoltage;
205 typedef BasicPropertyType<double> BatteryVoltageType;
207 /**< Interior Air Temperature in degrees celcius */
208 static const Property InteriorTemperature;
209 typedef BasicPropertyType<int> InteriorTemperatureType;
211 /**< Engine Oil Temperature in degrees celcius */
212 static const Property EngineOilTemperature;
213 typedef BasicPropertyType<int> EngineOilTemperatureType;
215 /**< Vehicle Identification Number (ISO 3779) 17 chars**/
216 static const Property VIN;
217 typedef StringPropertyType VINType;
219 /**< World Manufacturer Identifier (SAE) 3 characters. */
220 static const Property WMI;
221 typedef StringPropertyType WMIType;
223 /**< Tire pressure in kPa */
224 static const Property TirePressureLeftFront;
225 static const Property TirePressureRightFront;
226 static const Property TirePressureLeftRear;
227 static const Property TirePressureRightRear;
228 typedef BasicPropertyType<uint16_t> TirePressureType;
230 static const Property VehiclePowerMode;
231 typedef BasicPropertyType<Power::PowerModes> VehiclePowerModeType;
233 static const Property TripMeterA;
234 static const Property TripMeterB;
235 static const Property TripMeterC;
236 typedef BasicPropertyType<uint16_t> TripMeterType;
238 static std::list<VehicleProperty::Property> capabilities();
240 /*! getPropertyTypeForPropertyNameValue returns an AbstractPropertyType* for the property name
241 * with the value specified by 'value'. Ownership of the returned AbstractPropertyType* is
242 * transfered to the caller.
244 static AbstractPropertyType* getPropertyTypeForPropertyNameValue(Property name, std::string value);
246 static void registerProperty(Property name, PropertyTypeFactoryCallback factory);
250 static std::map<Property, PropertyTypeFactoryCallback> registeredPropertyFactoryMap;
251 static std::list<VehicleProperty::Property> mCapabilities;
254 typedef std::list<VehicleProperty::Property> PropertyList;
255 typedef std::set<VehicleProperty::Property> PropertySet;
257 #endif // VEHICLEPROPERTY_H