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
101 typedef std::string Property;
102 typedef std::function<AbstractPropertyType* (void)> PropertyTypeFactoryCallback;
104 /// Various property types:
106 static const Property NoValue;
108 /**< Vehicle Velocity in km/h */
109 static const Property VehicleSpeed;
110 typedef BasicPropertyType<uint16_t> VehicleSpeedType;
112 /**< Engine Speed in rotations per minute */
113 static const Property EngineSpeed;
114 typedef BasicPropertyType<uint16_t> EngineSpeedType;
116 /**< Transmission Shift Position
125 static const Property TransmissionShiftPosition;
126 typedef BasicPropertyType<Transmission::TransmissionPositions> TransmissionShiftPositionType;
128 /**< Transmission Gear Position
136 static const Property TransmissionGearPosition;
137 typedef BasicPropertyType<Transmission::TransmissionPositions> TransmissionGearPositionType;
139 /**< Throttle position 0-100% */
140 static const Property ThrottlePosition;
141 typedef BasicPropertyType<uint16_t> ThrottlePositionType;
143 /**< Wheel brake position. Engaged = true, Idle = false */
144 static const Property WheelBrake;
145 typedef BasicPropertyType<bool> WheelBrakeType;
147 /**< Steering wheel angle (0-359) */
148 static const Property SteeringWheelAngle;
149 typedef BasicPropertyType<uint16_t> SteeringWheelAngleType;
151 /**< 0=off, 1=right, 2=left, 3=hazard */
152 static const Property TurnSignal;
153 typedef BasicPropertyType<TurnSignals::TurnSignalType> TurnSignalType;
155 /**< Clutch pedal status 0=off, 1=on */
156 static const Property ClutchStatus;
157 typedef BasicPropertyType<bool> ClutchStatusType;
159 /**< Oil pressure TODO: units */
160 static const Property EngineOilPressure;
161 typedef BasicPropertyType<uint16_t> EngineOilPressureType;
163 /**< Engine coolant temperature in degrees celcius **/
164 static const Property EngineCoolantTemperature;
165 typedef BasicPropertyType<int> EngineCoolantTemperatureType;
168 static const Property MachineGunTurretStatus;
169 typedef BasicPropertyType<bool> MachineGunTurretStatusType;
171 /**< Acceleration on the 'x' axis in 1/1000 gravitational acceleration "g-force" */
172 static const Property AccelerationX;
173 typedef BasicPropertyType<uint16_t> AccelerationType;
175 /**< Acceleration on the 'y' axis in 1/1000 gravitational acceleration "g-force" */
176 static const Property AccelerationY;
178 /**< Acceleration on the 'z' axis in 1/1000 gravitational acceleration "g-force" */
179 static const Property AccelerationZ;
181 /**< Mass Air Flow. TODO: units */
182 static const Property MassAirFlow;
183 typedef BasicPropertyType<uint16_t> MassAirFlowType;
185 /**< Button Event @see ButtonEvents::ButtonEventType */
186 static const Property ButtonEvent;
187 typedef BasicPropertyType<ButtonEvents::ButtonEventType> ButtonEventType;
189 /**< Air intake temperature in degrees celcius */
190 static const Property AirIntakeTemperature;
191 typedef BasicPropertyType<int> AirIntakeTemperatureType;
193 /**< Battery voltage in volts */
194 static const Property BatteryVoltage;
195 typedef BasicPropertyType<double> BatteryVoltageType;
197 /**< Interior Air Temperature in degrees celcius */
198 static const Property InteriorTemperature;
199 typedef BasicPropertyType<int> InteriorTemperatureType;
201 /**< Engine Oil Temperature in degrees celcius */
202 static const Property EngineOilTemperature;
203 typedef BasicPropertyType<int> EngineOilTemperatureType;
205 /**< Vehicle Identification Number (ISO 3779) 17 chars**/
206 static const Property VIN;
207 typedef StringPropertyType VINType;
209 /**< World Manufacturer Identifier (SAE) 3 characters. */
210 static const Property WMI;
211 typedef StringPropertyType WMIType;
213 /**< Tire pressure in kPa */
214 static const Property TirePressureLeftFront;
215 static const Property TirePressureRightFront;
216 static const Property TirePressureLeftRear;
217 static const Property TirePressureRightRear;
218 typedef BasicPropertyType<uint16_t> TirePressureType;
220 static const Property VehiclePowerMode;
221 typedef BasicPropertyType<Power::PowerModes> VehiclePowerModeType;
223 static const Property TripMeterA;
224 static const Property TripMeterB;
225 static const Property TripMeterC;
226 typedef BasicPropertyType<uint16_t> TripMeterType;
228 static std::list<VehicleProperty::Property> capabilities();
230 /*! getPropertyTypeForPropertyNameValue returns an AbstractPropertyType* for the property name
231 * with the value specified by 'value'. Ownership of the returned AbstractPropertyType* is
232 * transfered to the caller.
234 static AbstractPropertyType* getPropertyTypeForPropertyNameValue(Property name, std::string value);
236 static void registerProperty(Property name, PropertyTypeFactoryCallback factory);
240 static std::map<Property, PropertyTypeFactoryCallback> registeredPropertyFactoryMap;
241 static std::list<VehicleProperty::Property> mCapabilities;
244 typedef std::list<VehicleProperty::Property> PropertyList;
245 typedef std::set<VehicleProperty::Property> PropertySet;
247 #endif // VEHICLEPROPERTY_H