Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SSMCore / src / SSMInterface / SSMCore.h
1 /******************************************************************
2 *
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
4 *
5 *
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ******************************************************************/
20 #ifndef _SSMCore_H_
21 #define _SSMCore_H_
22
23 #include "SSMInterface.h"
24
25 using namespace OIC;
26
27 #include "SSMModelDefinition.h"
28
29 #define IN
30 #define OUT
31
32 /**
33 * @class    IQueryEngine
34 * @brief    IQueryEngine Interface
35 *            This class represents main interface of Query Engine
36 *
37 * @see
38 */
39 class IQueryEngine
40 {
41     public:
42         /**
43         * @fn     executeContextQuery
44         * @brief Execute ContextQuery and return ContextQuery ID
45         *
46         * @param [in] std::string ContextQuery - Entered ContetxQuery
47         *
48         * @param [out] int *cqid - ID of ContextQuery
49         *
50         * @return SSMRESULT
51         * @warning
52         * @exception
53         * @see
54         */
55         virtual SSMRESULT executeContextQuery(std::string contextQuery, int *cqid) = 0;
56
57         /**
58         * @fn     registerQueryEvent
59         * @brief Register QueryEngineEvent to QueryEngine.
60         *
61         * @param [in] IQueryEngineEvent *pQueryEngineEvent - Register QueryEngineEvent
62         *
63         * @return SSMRESULT
64         * @warning
65         * @exception
66         * @see
67         */
68         virtual SSMRESULT registerQueryEvent(IQueryEngineEvent *pQueryEngineEvent) = 0;
69
70         /**
71         * @fn     unregisterQueryEvent
72         * @brief Unregister QueryEngineEvent to QueryEngine.
73         *
74         * @param [in] IQueryEngineEvent *pQueryEngineEvent - Unregister QueryEngineEvent
75         *
76         * @return SSMRESULT
77         * @warning
78         * @exception
79         * @see
80         */
81         virtual SSMRESULT unregisterQueryEvent(IQueryEngineEvent *pQueryEngineEvent) = 0;
82
83         /**
84         * @fn    killContextQuery
85         * @brief Kill registered ContextQuery according to cqid
86         *
87         * @param [in] int cqid - Context query corresponding to the cqid will be terminated
88         *
89         * @return SSMRESULT
90         * @warning
91         * @exception
92         * @see
93         */
94         virtual SSMRESULT killContextQuery(int cqid) = 0;
95     protected:
96         virtual ~IQueryEngine() {};
97 };
98
99 #ifdef __cplusplus
100 extern "C"
101 {
102 #endif // __cplusplus
103
104 /**
105 * @fn    CreateQueryEngine
106 * @brief Create QueryEngine instance.
107 *
108 * @param [out] IQueryEngine **ppQueryEngine - address of QueryEngine
109 *
110 * @return SSMRESULT
111 * @warning
112 * @exception
113 * @see
114 */
115 INTERFACE_DECLSPEC SSMRESULT CreateQueryEngine(IQueryEngine **ppQueryEngine);
116
117 /**
118 * @fn    ReleaseQueryEngine
119 * @brief Release QueryEngine instance.
120 *
121 * @param [in] IQueryEngine *pQueryEngine - Address of QueryEngine
122 *
123 * @return unsigned long
124 * @warning
125 * @exception
126 * @see
127 */
128 INTERFACE_DECLSPEC unsigned long ReleaseQueryEngine(IQueryEngine *pQueryEngine);
129
130
131 /**
132 * @fn    InitializeSSMCore
133 * @brief Initialize framework using given configuration
134 *
135 * @param [in] std::string xmlDescription - Framework specification described in XML
136 *
137 *
138 * @return SSMRESULT
139 * @warning
140 * @exception
141 * @see
142 */
143 INTERFACE_DECLSPEC SSMRESULT InitializeSSMCore(std::string xmlDescription);
144
145 /**
146 * @fn    StartSSMCore
147 * @brief Start framework that allows other devices discover and communication
148 *
149 * @param None
150 *
151 * @return SSMRESULT
152 * @warning
153 * @exception
154 * @see
155 */
156 INTERFACE_DECLSPEC SSMRESULT StartSSMCore();
157
158 /**
159 * @fn    StopSSMCore
160 * @brief Stop framework
161 *
162 * @param None
163 *
164 * @return SSMRESULT
165 * @warning
166 * @exception
167 * @see
168 */
169 INTERFACE_DECLSPEC SSMRESULT StopSSMCore();
170
171 /**
172 * @fn    TerminateSSMCore
173 * @brief Terminate framework, return all allocated resources
174 *
175 * @param [in] bool factoryResetFlag - Set true if framework needs to reset
176 *
177 * @return SSMRESULT
178 * @warning
179 * @exception
180 * @see
181 */
182 INTERFACE_DECLSPEC SSMRESULT TerminateSSMCore(bool factoryResetFlag = false);
183
184 /**
185 * @fn    GetErrorMessage
186 * @brief Prints Error message from SSMRESULT error code
187 *
188 * @param [in] SSMRESULT res - return code
189 *
190 * @return const char *
191 * @warning
192 * @exception
193 * @see
194 */
195 INTERFACE_DECLSPEC const char *GetSSMError(SSMRESULT res);
196
197 /**
198 * @fn    GetInstalledModelList
199 * @brief Gets all installed models from local and remote
200 *
201 * @param [out] std::vector<ISSMResource> *pList - List of installed context model
202 *
203 * @return SSMRESULT
204 * @warning
205 * @exception
206 * @see
207 */
208 INTERFACE_DECLSPEC SSMRESULT GetInstalledModelList(std::vector<ISSMResource *> *pList);
209
210 #ifdef __cplusplus
211 }
212 #endif // __cplusplus
213
214 #endif