added driving safety attributes
[profile/ivi/automotive-message-broker.git] / plugins / tpms / tpmsplugin.h
1 /*
2 Copyright (C) 2012 Tim Trampedach
3
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.
8
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.
13
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
17 */
18
19 #ifndef TPMSPLUGIN_H
20 #define TPMSPLUGIN_H
21
22 #include <abstractsource.h>
23 #include <string>
24
25 using namespace std;
26
27 class TpmsPlugin: public AbstractSource
28 {
29
30 public:
31         TpmsPlugin(AbstractRoutingEngine* re, map<string, string> config);
32         
33         const string uuid();
34         void getPropertyAsync(AsyncPropertyReply *reply);
35         void getRangePropertyAsync(AsyncRangePropertyReply *reply);
36         AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
37         void subscribeToPropertyChanges(VehicleProperty::Property property);
38         void unsubscribeToPropertyChanges(VehicleProperty::Property property);
39         PropertyList supported();
40         
41         void supportedChanged(PropertyList) {}
42
43     int readValues();
44
45         int supportedOperations() { return Get; }
46         
47 private:
48         PropertyList mRequests;
49     float lfPressure, rfPressure, lrPressure, rrPressure;
50     float lfTemperature, rfTemperature, lrTemperature, rrTemperature;
51     struct libusb_device_handle *mDeviceHandle;
52
53     int findDevice();
54     int detachDevice();
55     int exitClean(int deinit);
56
57     int readUsbSensor(int sid, unsigned char *buf);
58
59     string sensorNumberToString(int snid);
60 };
61
62 #endif // TPMSPLUGIN_H