Added tests into testplugin, fixed Core issues found using added tests
[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 OBD2SOURCE_H
22 #define OBD2SOURCE_H
23
24
25
26 #include <abstractsource.h>
27 #include <string>
28 #include <sstream>
29 #include <sys/types.h>
30 #include <sys/stat.h>
31 #include <fcntl.h>
32 #include <termios.h>
33 #include <glib.h>
34
35
36
37
38 class TestPlugin : public AbstractSource
39 {
40
41 public:
42         TestPlugin(AbstractRoutingEngine* re, map<string, string> config);
43         ~TestPlugin();
44         const string uuid();
45         int portHandle;
46         void getPropertyAsync(AsyncPropertyReply *reply);
47         void getRangePropertyAsync(AsyncRangePropertyReply *reply){}
48         AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
49         void subscribeToPropertyChanges(VehicleProperty::Property property);
50         void unsubscribeToPropertyChanges(VehicleProperty::Property property);
51         PropertyList supported();
52
53         int supportedOperations();
54
55         void supportedChanged(PropertyList) {}
56         void setConfiguration(map<string, string> config);
57         //void randomizeProperties();
58         void updateProperty(VehicleProperty::Property property,AbstractPropertyType *value);
59
60         PropertyInfo getPropertyInfo(VehicleProperty::Property property);
61         void propertyChanged(AbstractPropertyType *value);
62
63 private:
64         bool testCoreSetSupported();
65         bool testCoreUpdateSupported();
66         bool testSetAndGet();
67         bool testSubscription();
68
69         PropertyList m_supportedProperties;
70         int subscriptionsToSupportedCounter;
71         int subscriptionsToUnsupportedCounter;
72         int unsubscriptionsToSupportedCounter;
73         int unsubscriptionsToUnsupportedCounter;
74         int propertyChanges;
75         int supportedPropertyChanges;
76 };
77
78 #endif // OBD2SOURCE_H