1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
24 * This file defines basic interface of Soft Sensor Manager.
27 #ifndef _SSMInterface_H_
28 #define _SSMInterface_H_
51 * @brief This class represents context model data package
58 * Get affected DataId. ContextModel has plenty of data so \n
59 * returned data is matched from given condition
61 * @return int - the affected DataId
63 virtual int getDataId() = 0;
66 * ContextModel has at least one property that contains data \n
67 * property is described from its specification.
69 * @return int - number of properties
71 virtual int getPropertyCount() = 0;
74 * Retrieve propertyName
76 * @param propertyIndex - index of property to read
78 * @return std::string - property name
80 virtual std::string getPropertyName(int propertyIndex) = 0;
83 * Retrieve propertyValue
85 * @param propertyIndex index of property to read
87 * @return std::string - property value
89 virtual std::string getPropertyValue(int propertyIndex) = 0;
92 * Retrieve propertyValue using given name
94 * @param propertyName - property name looking for
96 * @return std::string - property name
98 virtual std::string getPropertyValueByName(std::string propertyName) = 0;
100 virtual ~IModelData() {};
105 * @brief This class represents context model data package's reader
113 * Get affected ContextModels. The query can specify multiple ContextModels for retrieving data.
115 * @param pAffectedModels - affected ContextModel list
117 * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
119 virtual SSMRESULT getAffectedModels(std::vector<std::string> *pAffectedModels) = 0;
122 * Get affected data count. There are multiple data can exist from given condition.
124 * @param modelName - affected ContextModel name
126 * @param pDataCount - affected dataId count
128 * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
130 virtual SSMRESULT getModelDataCount(std::string modelName, int *pDataCount) = 0;
133 * Get actual Context Model data
135 * @param modelName - affected ContextModel name
137 * @param dataIndex - affected dataId index
139 * @param ppModelData - affected ContextModel data reader
141 * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
143 virtual SSMRESULT getModelData(std::string modelName, int dataIndex, IModelData **ppModelData) = 0;
145 virtual ~IDataReader() {};
149 * @class IQueryEngineEvent
150 * @brief This class represents Query Engine's event that contains results
154 class IQueryEngineEvent
158 * Transmit result of SSMCore to Application layer
160 * @param cqid - entered ContextQuery ID
162 * @param pResult - result of SSMCore
164 * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
166 virtual SSMRESULT onQueryEngineEvent(int cqid, IDataReader *pResult) = 0;
168 virtual ~IQueryEngineEvent() {};
172 * Initialize Soft sensor manager using given configuration information.
174 * @param xmlDescription - specification described in XML
176 * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
178 SSMRESULT InitializeSSM(std::string xmlDescription);
181 * Terminates Soft sensor manager
183 * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
185 SSMRESULT TerminateSSM();
188 * Execute query and return ContextQuery ID
190 * @param queryString - query for requesting data
192 * @param listener - listener for receiving data related to query
194 * @param cqid - ID of ContextQuery
196 * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
198 SSMRESULT RegisterQuery(std::string queryString, IQueryEngineEvent *listener, int &cqid);
201 * Unregister registered query according to cqid
203 * @param cqid - Query corresponding to the cqid will be terminated
205 * @return SSMRESULT - return value of the API. Returns SSM_S_OK if success
207 SSMRESULT UnregisterQuery(int cqid);