25 #include <abstractsource.h>
28 #include <sys/types.h>
40 VehicleProperty::Property property;
50 std::vector<std::string> arglist;
55 std::string statusStr;
56 VehicleProperty::Property property;
61 VehicleProperty::Property property;
72 typedef function<std::string (std::string)> ConversionFunction;
74 typedef std::vector<unsigned char> ByteArray;
80 supportedPidsList.push_back(
new VinPid());
81 supportedPidsList.push_back(
new WmiPid());
92 for(
auto itr = supportedPidsList.begin(); itr != supportedPidsList.end(); itr++)
98 ObdPid* createPidFromReply(ByteArray replyVector)
100 ByteArray replyVectorClean = ObdPid::cleanup(replyVector);
101 ByteArray replyVectorCompressed = ObdPid::compress(replyVectorClean);
103 for(
auto itr = supportedPidsList.begin(); itr != supportedPidsList.end(); itr++)
107 if(p->needsCompress())
109 replyVector = replyVectorCompressed;
111 else replyVector = replyVectorClean;
113 if (!p->tryParse(replyVector))
118 ObdPid* pid = (*itr)->create();
125 for(
auto itr = supportedPidsList.begin(); itr != supportedPidsList.end(); itr++)
127 VehicleProperty::Property p = (*itr)->property;
131 return obj->create();
137 std::list<ObdPid*> supportedPidsList;
159 PropertyList queuedRequests;
160 bool clientConnected;
161 PropertyList activeRequests;
162 void engineSpeed(
double speed);
163 void vehicleSpeed(
int speed);
164 void mafValue(
double maf);
165 void engineCoolantTemp(
int temp);
166 PropertyList removeRequests;
167 void setSupported(PropertyList list);
170 GAsyncQueue* commandQueue;
171 GAsyncQueue* statusQueue;
172 GAsyncQueue* subscriptionAddQueue;
173 GAsyncQueue* subscriptionRemoveQueue;
174 GAsyncQueue* singleShotQueue;
175 GAsyncQueue* responseQueue;
176 std::list<std::string> m_blacklistPidList;
177 std::map<std::string,int> m_blacklistPidCountMap;
178 void setConfiguration(map<string, string> config);
183 std::string m_btDeviceAddress;
184 std::string m_btAdapterAddress;
185 std::vector<AsyncPropertyReply*> propertyReplyList;
192 Obd2ConnectType obd2Connected;
195 PropertyList m_supportedProperties;
196 std::map<VehicleProperty::Property, AbstractPropertyType*> oldValueMap;
197 GMutex *threadQueueMutex;
202 #endif // OBD2SOURCE_H