3 Copyright (C) 2012 Intel Corporation
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <abstractsource.h>
28 #include <sys/types.h>
56 propertyPidMap[VehicleProperty::VehicleSpeed] = "010D1\r";
57 propertyPidMap[VehicleProperty::EngineSpeed] = "010C1\r";
58 propertyPidMap[VehicleProperty::MassAirFlow] = "01101\r";
59 propertyPidMap[VehicleProperty::AirIntakeTemperature] = "010F1\r";
60 propertyPidMap[VehicleProperty::ThrottlePosition] = "01111\r";
61 propertyPidMap[VehicleProperty::BatteryVoltage] = "ATRV\r"; propertyPidMap[VehicleProperty::EngineCoolantTemperature] = "0105a\r";
62 propertyPidMap[VehicleProperty::EngineLoad] = "01041/r";
63 propertyPidMap[VehicleProperty::VIN] = "0902/r";
64 propertyPidMap[VehicleProperty::WMI] = "0902/r";
65 propertyPidMap[VehicleProperty::EngineOilTemperature] = "015C1\r";
66 propertyPidMap[VehicleProperty::InteriorTemperature] = "01461\r";
69 map<VehicleProperty::Property, std::string> propertyPidMap;
72 class OBD2Source : public AbstractSource
76 OBD2Source(AbstractRoutingEngine* re, map<string, string> config);
79 void getPropertyAsync(AsyncPropertyReply *reply);
80 void getRangePropertyAsync(AsyncRangePropertyReply *reply){}
81 AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
82 void subscribeToPropertyChanges(VehicleProperty::Property property);
83 void unsubscribeToPropertyChanges(VehicleProperty::Property property);
84 PropertyList supported();
85 PropertyList queuedRequests;
87 PropertyList activeRequests;
88 void engineSpeed(double speed);
89 void vehicleSpeed(int speed);
90 void mafValue(double maf);
91 void engineCoolantTemp(int temp);
92 PropertyList removeRequests;
93 void setSupported(PropertyList list);
94 void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
95 void supportedChanged(PropertyList) {}
96 GAsyncQueue* commandQueue;
97 GAsyncQueue* subscriptionAddQueue;
98 GAsyncQueue* subscriptionRemoveQueue;
99 GAsyncQueue* singleShotQueue;
100 GAsyncQueue* responseQueue;
101 void setConfiguration(map<string, string> config);
102 //void randomizeProperties();
104 map<VehicleProperty::Property,AsyncPropertyReply*> propertyReplyMap;
105 void updateProperty(VehicleProperty::Property property,AbstractPropertyType *value);
107 PropertyList m_supportedProperties;
108 GMutex *threadQueueMutex;
113 #endif // OBD2SOURCE_H