[AMBClient] - somewhat working json protocol engine
[profile/ivi/automotive-message-broker.git] / plugins / testplugin / testplugin.h
1
2 /*
3 Copyright (C) 2012 Intel Corporation
4
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.
9
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.
14
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
18 */
19
20
21 #ifndef TESTSOURCE_H
22 #define TESTSOURCE_H
23
24 #include <abstractsource.h>
25 #include <string>
26 #include <sstream>
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <fcntl.h>
30 #include <termios.h>
31 #include <glib.h>
32
33 class TestPlugin : public AbstractSource
34 {
35
36 public:
37         TestPlugin(AbstractRoutingEngine* re, map<string, string> config);
38         ~TestPlugin();
39         const string uuid();
40         int portHandle;
41         void getPropertyAsync(AsyncPropertyReply *reply);
42         void getRangePropertyAsync(AsyncRangePropertyReply *reply){}
43         AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
44         void subscribeToPropertyChanges(VehicleProperty::Property property);
45         void unsubscribeToPropertyChanges(VehicleProperty::Property property);
46         PropertyList supported();
47
48         int supportedOperations();
49
50         void supportedChanged(const PropertyList &) {}
51         void setConfiguration(map<string, string> config);
52         //void randomizeProperties();
53         void updateProperty(VehicleProperty::Property property, AbstractPropertyType *value);
54
55         PropertyInfo getPropertyInfo(const VehicleProperty::Property & property);
56         void propertyChanged(AbstractPropertyType *value);
57
58 private:
59         bool testCoreSetSupported();
60         bool testCoreUpdateSupported();
61         bool testSetAndGet();
62         bool testSubscription();
63
64         PropertyList m_supportedProperties;
65         int subscriptionsToSupportedCounter;
66         int subscriptionsToUnsupportedCounter;
67         int unsubscriptionsToSupportedCounter;
68         int unsubscriptionsToUnsupportedCounter;
69         int propertyChanges;
70         int supportedPropertyChanges;
71 };
72
73 #endif // OBD2SOURCE_H