Merge pull request #69 from fredcadete/master
[profile/ivi/automotive-message-broker.git] / plugins / gpsnmea / gpsnmea.h
1 /*
2 Copyright (C) 2012 Intel Corporation
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 GPSNMEAPLUGIN_H
20 #define GPSNMEAPLUGIN_H
21
22 #include <abstractsource.h>
23
24 #include <string>
25
26 #include <abstractio.hpp>
27 #include <ambpluginimpl.h>
28
29 using namespace std;
30
31 class Location;
32 class Bluetooth5;
33 class BluetoothDevice;
34
35 class GpsNmeaSource: public AmbPluginImpl
36 {
37
38 public:
39         GpsNmeaSource(AbstractRoutingEngine* re, map<string, string> config, AbstractSource &parent);
40         ~GpsNmeaSource();
41
42         const string uuid() const;
43
44         void canHasData();
45
46         void test();
47
48         int supportedOperations() const;
49
50         void init();
51
52 private:
53         bool tryParse(std::string data);
54
55         bool checksum(string sentence);
56
57         PropertyList mRequests;
58         PropertyList mSupported;
59
60         AbstractIo* device;
61         Location *location;
62
63         std::string mUuid;
64
65         std::string buffer;
66
67         std::shared_ptr<AbstractPropertyType> rawNmea;
68
69 #ifdef USE_BLUEZ5
70         Bluetooth5 * bt;
71 #else
72         BluetoothDevice *bt;
73 #endif
74 };
75
76 #endif // EXAMPLEPLUGIN_H