remove hard coded path into CMake files
[profile/ivi/ico-vic-amb-plugin.git] / src / ambconfig.h
1 /*
2  * Copyright (c) 2013 TOYOTA MOTOR CORPORATION.
3  *
4  * Contact: shibata@mac.tec.toyota.co.jp
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #ifndef AMBCONFIG_H_
19 #define AMBCONFIG_H_
20 #include <stdint.h>
21
22 #include <vector>
23
24 #include <abstractpropertytype.h>
25
26 #include "abstractconfig.h"
27 #include "common.h"
28
29 /**
30  * Table of vehicle information that is described in the configuration file.
31  * 04-18 Add String
32  */
33 struct VehicleInfoDefine {
34     struct Status {
35         std::string ambPropertyName;
36         DataType type;
37         int typesize;
38         std::string accessControl;
39         std::string defaultvalue;
40         std::string dbusPropertyName;
41         std::string dbusObjectName;
42         Zone::Type zone;
43     };
44     /* ToDo */
45     //undefine data structure;
46     struct Sense {
47         int temp;
48     };
49     /* ToDo */
50     //undefine data structure;
51     struct EventMask {
52         int temp;
53     };
54
55     char KeyEventType[64];
56     std::vector<Status> status;
57     std::vector<Sense> sense;
58     std::vector<EventMask> event_mask;
59     int priority;
60     std::string dbusInterface;
61     std::string dbusObject;
62 };
63
64 /**
65  * Information Websocket port.
66  */
67 struct PortInfo {
68     struct {
69         int dataPort;
70         int controlPort;
71     } standard;
72
73     struct {
74         int dataPort;
75         int controlPort;
76     } custom;
77 };
78
79 /**
80  * Reading VehiclePlugin's config file.
81  */
82 class AMBConfig : public AbstractConfig {
83 public:
84     /**
85      * Constructor.
86      */
87     AMBConfig();
88
89     /**
90      * Destructor.
91      */
92     ~AMBConfig();
93
94     /**
95      * This function will return a table of vehicle information read from the configuration file.
96      *
97      * @return Vehicle information defined by the configuration file.(Failure NULL)
98      */
99     std::vector<VehicleInfoDefine>
100     getVehicleInfoConfig();
101
102     /**
103      * This function returns the socket port used to Websocket.
104      */
105     PortInfo
106     getPort();
107 private:
108     bool
109     parseJson(std::string config);
110
111     DataType
112     getType(char *type, int *size);
113
114     Zone::Type
115     getZone(const std::string& zonestr);
116
117     std::vector<VehicleInfoDefine> vehicleinfoList;
118     PortInfo portinfo;
119 };
120 #endif //  AMBCONFIG_H_