4c690d4f426b73f0ba1a278802191eae1b0a3e25
[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 #if defined(WIN32) && defined(SSMCORE_WINDOWS_EXPORTS)
33 #define INTERFACE_DECLSPEC    __declspec(dllexport)
34 #elif defined(WIN32)
35 #define INTERFACE_DECLSPEC    __declspec(dllimport)
36 #pragma comment(lib, "SSMCore_Windows.lib")
37 #else
38 #define INTERFACE_DECLSPEC
39 #endif
40 */
41 #define INTERFACE_DECLSPEC
42
43 /**
44 * @class    IQueryEngine
45 * @brief    IQueryEngine Interface
46 *            This class represents main interface of Query Engine
47 *
48 * @see
49 */
50 class IQueryEngine
51 {
52     public:
53         /**
54         * @fn     executeContextQuery
55         * @brief Execute ContextQuery and return ContextQuery ID
56         *
57         * @param [in] std::string ContextQuery - Entered ContetxQuery
58         *
59         * @param [out] int *cqid - ID of ContextQuery
60         *
61         * @return SSMRESULT
62         * @warning
63         * @exception
64         * @see
65         */
66         virtual SSMRESULT executeContextQuery(IN std::string contextQuery, OUT int *cqid) = 0;
67
68         /**
69         * @fn     registerQueryEvent
70         * @brief Register QueryEngineEvent to QueryEngine.
71         *
72         * @param [in] IQueryEngineEvent *pQueryEngineEvent - Register QueryEngineEvent
73         *
74         * @return SSMRESULT
75         * @warning
76         * @exception
77         * @see
78         */
79         virtual SSMRESULT registerQueryEvent(IN IQueryEngineEvent *pQueryEngineEvent) = 0;
80
81         /**
82         * @fn     unregisterQueryEvent
83         * @brief Unregister QueryEngineEvent to QueryEngine.
84         *
85         * @param [in] IQueryEngineEvent *pQueryEngineEvent - Unregister QueryEngineEvent
86         *
87         * @return SSMRESULT
88         * @warning
89         * @exception
90         * @see
91         */
92         virtual SSMRESULT unregisterQueryEvent(IN IQueryEngineEvent *pQueryEngineEvent) = 0;
93
94         /**
95         * @fn    killContextQuery
96         * @brief Kill registered ContextQuery according to cqid
97         *
98         * @param [in] int cqid - Context query corresponding to the cqid will be terminated
99         *
100         * @return SSMRESULT
101         * @warning
102         * @exception
103         * @see
104         */
105         virtual SSMRESULT killContextQuery(IN int cqid) = 0;
106     protected:
107         virtual ~IQueryEngine() {};
108 };
109
110 #ifdef __cplusplus
111 extern "C"
112 {
113 #endif // __cplusplus
114
115 /**
116 * @fn    CreateQueryEngine
117 * @brief Create QueryEngine instance.
118 *
119 * @param [out] IQueryEngine **ppQueryEngine - address of QueryEngine
120 *
121 * @return SSMRESULT
122 * @warning
123 * @exception
124 * @see
125 */
126 INTERFACE_DECLSPEC SSMRESULT CreateQueryEngine(OUT IQueryEngine **ppQueryEngine);
127
128 /**
129 * @fn    ReleaseQueryEngine
130 * @brief Release QueryEngine instance.
131 *
132 * @param [in] IQueryEngine *pQueryEngine - Address of QueryEngine
133 *
134 * @return unsigned long
135 * @warning
136 * @exception
137 * @see
138 */
139 INTERFACE_DECLSPEC unsigned long ReleaseQueryEngine(IN IQueryEngine *pQueryEngine);
140
141
142 /**
143 * @fn    InitializeSSMCore
144 * @brief Initialize framework using given configuration
145 *
146 * @param [in] std::string xmlDescription - Framework specification described in XML
147 *
148 *
149 * @return SSMRESULT
150 * @warning
151 * @exception
152 * @see
153 */
154 INTERFACE_DECLSPEC SSMRESULT InitializeSSMCore(IN std::string xmlDescription);
155
156 /**
157 * @fn    StartSSMCore
158 * @brief Start framework that allows other devices discover and communication
159 *
160 * @param None
161 *
162 * @return SSMRESULT
163 * @warning
164 * @exception
165 * @see
166 */
167 INTERFACE_DECLSPEC SSMRESULT StartSSMCore();
168
169 /**
170 * @fn    StopSSMCore
171 * @brief Stop framework
172 *
173 * @param None
174 *
175 * @return SSMRESULT
176 * @warning
177 * @exception
178 * @see
179 */
180 INTERFACE_DECLSPEC SSMRESULT StopSSMCore();
181
182 /**
183 * @fn    TerminateSSMCore
184 * @brief Terminate framework, return all allocated resources
185 *
186 * @param [in] bool factoryResetFlag - Set true if framework needs to reset
187 *
188 * @return SSMRESULT
189 * @warning
190 * @exception
191 * @see
192 */
193 INTERFACE_DECLSPEC SSMRESULT TerminateSSMCore(IN bool factoryResetFlag = false);
194
195 /**
196 * @fn    GetErrorMessage
197 * @brief Prints Error message from SSMRESULT error code
198 *
199 * @param [in] SSMRESULT res - return code
200 *
201 * @return const char *
202 * @warning
203 * @exception
204 * @see
205 */
206 INTERFACE_DECLSPEC const char *GetSSMError(IN SSMRESULT res);
207
208 /**
209 * @fn    GetInstalledModelList
210 * @brief Gets all installed models from local and remote
211 *
212 * @param [out] std::vector<ISSMResource> *pList - List of installed context model
213 *
214 * @return SSMRESULT
215 * @warning
216 * @exception
217 * @see
218 */
219 INTERFACE_DECLSPEC SSMRESULT GetInstalledModelList(OUT std::vector<ISSMResource *> *pList);
220
221 #ifdef __cplusplus
222 }
223 #endif // __cplusplus
224
225 #endif