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 ******************************************************************/
20 #ifndef _InternalInterface_H_
21 #define _InternalInterface_H_
23 #include "SSMInterface/SSMModelDefinition.h"
24 #include "Common/PlatformLayer.h"
29 TypeofEvent m_callType;
31 IEvent *m_pCallbackEvent;
34 m_callType = SSM_ONCE;
35 m_pCallbackEvent = NULL;
38 CallbackData(TypeofEvent type, std::string name, IEvent *pCallbackEvent)
41 m_pCallbackEvent = pCallbackEvent;
49 std::vector<std::map<std::string, std::string> > attributeProperty;
50 std::vector<std::map<std::string, std::string> > outputProperty;
51 std::vector<std::string> appInputs;
52 std::vector<std::string> inputs;
53 std::string attributePropertyCount;
54 std::string outputPropertyCount;
55 std::string inputCount;
56 std::string appInputCount;
57 std::vector<std::vector<std::string> > enterConditions;
60 enum PARSE_TYPE {SSM_UNKNOWN, SSM_ROOT_NAME, SSM_HIGH_CONTEXT_NAME, SSM_ATTRIBUTE, SSM_OUTPUT, SSM_APP_INPUTS, SSM_INPUTS, SSM_INPUT, SSM_ENTER_CONDITIONS};
61 enum DICTIONARY_TYPE {LOW, HIGH, SENSOR, USER};
63 static const OID OID_IContextRepository = { 0x611144b0, 0xf036, 0x44a1, { 0xba, 0xe6, 0x6a, 0x92, 0xe1, 0xf0, 0xcc, 0x53 } };
65 * @class IContextRepository
66 * @brief Interface for context manifest
67 * parse, get, set context manifest. provide device information
71 class IContextRepository : public IBase
75 * @fn getSoftSensorList
76 * @brief Get high level context resource list
78 * @param [out] std::vector<ISSMResource*> *pSoftSensorList - High level context list
92 virtual SSMRESULT getSoftSensorList(OUT std::vector<ISSMResource *> *pSoftSensorList) = 0 ;
95 * @fn getPrimitiveSensorList
96 * @brief Get low level context resource list
98 * @param [out] std::vector<ISSMResource*> *pPrimitiveSensorList - Low level context list
103 * , SSM_E_OUTOFMEMORY
105 * , SSM_E_NOINTERFACE
112 virtual SSMRESULT getPrimitiveSensorList(OUT std::vector<ISSMResource *> *pPrimitiveSensorList) = 0
117 * @brief initialize repository using given info
119 * @param [in] std::string name - Device name
120 * @param [in] std::string type - Device Type
121 * @param [in] std::string pathSoftSensors - SoftSensors Repository path
122 * @param [in] std::string pathDescription - SoftSensors Description path
129 virtual SSMRESULT initRepository(IN std::string name, IN std::string type,
130 IN std::string pathSoftSensors, IN std::string pathDescription) = 0;
132 virtual SSMRESULT registerResourceFinderEvent(IN IResourceEvent *pResourceEvent) = 0;
133 virtual SSMRESULT startResourceFinder() = 0;
134 virtual SSMRESULT onResourceFound(IN ISSMResource *pSensor) = 0;
135 virtual SSMRESULT onResourceLost(IN ISSMResource *pSensor) = 0;
137 virtual SSMRESULT startObserveResource(IN ISSMResource *pSensor, IN IEvent *pEvent) = 0;
138 virtual SSMRESULT stopObserveResource(IN ISSMResource *pSensor) = 0;
140 virtual SSMRESULT loadSoftSensor(IN std::string softSensorName, IN ICtxDelegate *pDelegate,
141 OUT void **hSoftSensor) = 0;
142 virtual SSMRESULT unloadSoftSensor(IN void *hSoftSensor) = 0;
147 enum Type {TYPE_NUMERIC, TYPE_INTEGER, TYPE_REAL, TYPE_TEXT};
148 std::string propertyName;
149 std::string propertyValue;
153 typedef std::vector<ModelProperty> ModelPropertyVec;
155 struct ModelCondition
157 enum Predicate {PREDICATE_EQ, PREDICATE_NEQ, PREDICATE_GT, PREDICATE_LT, PREDICATE_GTE, PREDICATE_LTE};
158 ModelProperty modelProperty;
162 typedef std::vector<ModelCondition> ModelConditionVec;
165 * @class IEvaluationEngineEvent
166 * @brief IEvaluationEngineEvent Interface
167 * This class represents event interface that listening IEvaluationEngine's results
171 class IEvaluationEngineEvent : public IBase
175 * @fn onWatchModelData
176 * @brief Called when Model data meets given conditions.
178 * @param [in] int triggerId - Trigger id.
179 * @param [in] int dataId - Affected data's Id
186 virtual SSMRESULT onWatchModelData(IN int triggerId, IN int dataId) = 0;
189 static const OID OID_IEvaluationEngine = { 0x5a59a9f3, 0x7506, 0x4a3a, { 0xb9, 0x34, 0xcb, 0x51, 0xd, 0xb4, 0xed, 0x53 } };
191 * @class IEvaluationEngine
192 * @brief IEvaluationEngine Interface
193 * This class represents Evaluation Engine
197 class IEvaluationEngine : public IBase
201 * @fn initializeEngine
202 * @brief Initialize EvaluationEngine with database
211 virtual SSMRESULT initializeEngine() = 0;
214 * @fn terminateEngine
215 * @brief Terminate engine and dump to file if required
224 virtual void terminateEngine() = 0;
228 * @brief Create new context model
230 * @param [in] int parentModelId - Parent Context Model id that related to Model hierarchy.
231 * @param [in] const char *newModelName - Represent model's name
232 * @param [in] ModelPropertyVec *pModelProperties - Represent model's properties that exposed to CQL
233 * @param [out] int *pModelId - Created model's id
240 virtual SSMRESULT createModel(IN int parentModelId, IN const char *newModelName,
241 IN ModelPropertyVec *pModelDescs, OUT int *pModelId) = 0;
242 //virtual SSMRESULT GetModelSchema(IN int modelId, OUT ModelPropertyVec *pModelProperties) = 0;
246 * @brief Add model data to Context Model
248 * @param [in] int modelId - model id that created CreateModel's execution.
249 * @param [in] int parentModelId - parent model id that created CreateModel's execution.
250 * @param [in] int parentDataId - Specify current model's parent Context Model's dataId
251 * @param [in] ModelPropertyVec *pData - Packed data for adding
252 * @param [out] int *pDataId - Returned dataId that newly added
259 virtual SSMRESULT addModelData(IN int modelId, IN int parentModelId, IN int parentDataId,
260 IN ModelPropertyVec *pModelValues, OUT int *pDataId) = 0;
263 * @fn updateModelData
264 * @brief Update model data to Context Model
266 * @param [in] int modelId - model id that created CreateModel's execution.
267 * @param [in] int dataId - DataId that provided AddModelData's execution
268 * @param [in] ModelPropertyVec *pData - Packed data for updating
275 virtual SSMRESULT updateModelData(IN int modelId, IN int dataId,
276 IN ModelPropertyVec *pModelValues) = 0;
278 //virtual SSMRESULT DeleteModel(IN int modelId) = 0;
281 * @fn deleteModelData
282 * @brief Delete model data using given index
284 * @param [in] int modelId - model id that created CreateModel's execution.
285 * @param [in] int dataId - DataId that provided AddModelData's execution
292 virtual SSMRESULT deleteModelData(IN int modelId, IN int dataId) = 0;
294 //virtual SSMRESULT GetModelId(IN const char *modelName, OUT int *pModelId) = 0;
298 * @brief Get model data
300 * @param [in] int modelId - model id that created CreateModel's execution.
301 * @param [in] int dataId - DataId that provided AddModelData's execution
302 * @param [out] ModelPropertyVec *pData - Packed data
309 virtual SSMRESULT getModelData(IN int modelId, IN int dataId,
310 OUT ModelPropertyVec *pModelProperties) = 0;
313 * @fn getModelDataSet
314 * @brief Get model data set
316 * @param [in] int modelId - model id that created CreateModel's execution.
317 * @param [in] int startIndex - Starting index of model data
318 * @param [in] int count - Number of data to retrieve
319 * @param [out] vector<ModelPropertyVec> *pData - Packed data
320 * @param [out] int *pLastIndex - Index of last data
327 virtual SSMRESULT getModelDataSet(IN int modelId, IN int startIndex, IN int count,
328 OUT std::vector<ModelPropertyVec> *pDataSet, OUT int *pLastIndex) = 0;
331 * @fn getConditionedModelData
332 * @brief Get affected data from given conditions
334 * @param [in] int modelId - model id that created CreateModel's execution.
335 * @param [in] ModelConditionVec *pModelConditions - Conditions for data retrieving
336 * @param [out] IntVec *pDataIds - Searched dataId sets.
343 virtual SSMRESULT getConditionedModelData(IN int modelId, IN ModelConditionVec *pModelConditions,
344 OUT IntVec *pDataIds) = 0;
348 * @brief Watching data from given conditions
350 * @param [in] int modelId - model id that created CreateModel's execution.
351 * @param [in] ModelConditionVec *pModelConditions - Conditions for data triggering
352 * @param [in] IEvaluationEngineEvent *pEvaluationEngineEvent - Event interface where triggered event listening
353 * @param [out] int *pTriggerId - Identifier which trigger is activated
360 virtual SSMRESULT watchModelData(IN int modelId, IN ModelConditionVec *pModelConditions,
361 IN IEvaluationEngineEvent *pEvaluationEngineEvent, OUT int *pTriggerId) = 0;
364 * @fn dropWatchModelData
365 * @brief Stop watching data
367 * @param [in] int triggerId - Identifier which trigger to drop
374 virtual SSMRESULT dropWatchModelData(IN int triggerId) = 0;
377 * @fn getParentDataId
378 * @brief Get parent dataId related to model hierarchy
380 * @param [in] int modelId - model id that created CreateModel's execution.
381 * @param [in] int dataId - DataId that current model's
382 * @param [in] int parentModelId - Designated parent Context Model's id
383 * @param [out] int *pParentDataId - Designated parent Context Model's data's Id
390 virtual SSMRESULT getParentDataId(IN int modelId, IN int dataId, IN int parentModelId,
391 OUT int *pParentDataId) = 0;
395 * @brief Get child dataId related to model hierarchy
397 * @param [in] int modelId - model id that created CreateModel's execution.
398 * @param [in] int dataId - DataId that current model's
399 * @param [in] int childModelId - Designated child Context Model's id
400 * @param [out] IntVec *pChildDataIds - Designated child Context Model's data's Id
407 virtual SSMRESULT getChildDataId(IN int modelId, IN int dataId, IN int childModelId,
408 OUT IntVec *pChildDataIds) = 0;
411 //virtual SSMRESULT GetPathToRoot(IN int currentModelId, OUT IntVec *pPath) = 0;
412 //virtual SSMRESULT GetModelHierarchy(IN int rootModelId, OUT StringVec *pPath) = 0;
413 //virtual SSMRESULT GetDataHierarchy(IN int rootModelId, IN int dataId, OUT StringVec *pPath) = 0;
417 * @class IConditionedModelEvent
418 * @brief IConditionedModelEvent Interface
419 * This class represents event interface that listening IConditionedModel's results
423 class IConditionedModelEvent
427 * @fn onConditionedModelTriggered
428 * @brief Called when each Conditioned Model meets the conditions
430 * @param [in] int triggerId - trigger id that which Conditioned Model triggered
437 virtual SSMRESULT onConditionedModelTriggered(IN int triggerId) = 0;
438 virtual ~IConditionedModelEvent() {};
443 static const OID OID_IConditionedModel = { 0xdc71abc7, 0x5a02, 0x418a, { 0xad, 0x1e, 0xc0, 0x1, 0x9, 0x6b, 0x32, 0x6d } };
445 * @class IConditionedModel
446 * @brief IConditionedModel Interface
447 * This class represents Context Model's data search from given conditions
451 class IConditionedModel : public IBase
455 * @fn getBaseContextModel
456 * @brief Get base Context Model interface
458 * @param [out] IContextModel **ppBaseContextModel - Interface pointer for retrieving base Context Model interface.
465 virtual SSMRESULT getBaseContextModel(OUT IContextModel **ppBaseContextModel) = 0;
468 * @fn registerConditionedModelEvent
469 * @brief Register for receiving triggered event from given conditions
471 * @param [in] IConditionedModelEvent *pConditionedModelEvent - Interface for listening events.
478 virtual SSMRESULT registerConditionedModelEvent(IN IConditionedModelEvent *pConditionedModelEvent) =
482 * @fn activateTrigger
483 * @brief Activate trigger using given conditions
485 * @param [out] int *pTriggerId - Activated trigger id.
492 virtual SSMRESULT activateTrigger(OUT int *pTriggerId) = 0;
495 * @fn deactivateTrigger
496 * @brief Deactivate trigger that activated
505 virtual SSMRESULT deactivateTrigger() = 0;
508 * @fn hasAffectedData
509 * @brief Quries if current Conditioned Model has affected data
518 virtual bool hasAffectedData() = 0;
521 * @fn getAffectedData
522 * @brief Get affected data from given conditions includes triggered data
524 * @param [out] IntVec *pDataIds - Affected dataId sets.
531 virtual SSMRESULT getAffectedData(OUT IntVec *pDataIds) = 0;
534 * @fn getWatchCondition
535 * @brief Get watching conditions created from Context Model
537 * @param [out] ModelConditionVec *pModelConditions - Affected dataId sets.
544 virtual SSMRESULT getWatchCondition(OUT ModelConditionVec *pModelConditions) = 0;
547 static const OID OID_IConditionedQueryResult = { 0x4a24e85b, 0x8903, 0x4cf5, { 0x88, 0x7b, 0x65, 0xc2, 0xc3, 0x9e, 0x42, 0xfd } };
549 * @class IConditionedQueryResult
550 * @brief IConditionedQueryResult Interface
551 * This class represents executed CQL's result data
555 class IConditionedQueryResult : public IBase
559 * @fn getConditionedModelCount
560 * @brief Get conditioned model count
564 * @return unsigned int
569 virtual unsigned int getConditionedModelCount() = 0;
572 * @fn getConditionedContextModel
573 * @brief Get conditioned model by index
575 * @param [in] unsigned int conditionedModelIndex - Index of Conditioned Model interface for retrieving
576 * @param [out] IConditionedModel *pConditionedModel - Conditioned Model interface that contains results
583 virtual SSMRESULT getConditionedContextModel(IN unsigned int conditionedModelIndex,
584 OUT IConditionedModel **ppConditionedModel) = 0;
588 * @class IConditionedQueryEvent
589 * @brief IConditionedQueryEvent Interface
590 * This class represents event interface that listening IConditionedQuery's results
594 class IConditionedQueryEvent
598 * @fn onConditionedQueryEvent
599 * @brief IConditionedQueryEvent interface's event callbacks for receiving query results
601 * @param [in] std::string ContextQuery - Entered ContetxQuery
602 * @param [out] int* cqid - ID of ContextQuery
608 virtual SSMRESULT onConditionedQueryEvent(IN int userTriggerId,
609 IN IConditionedQueryResult *pConditionedQueryResult) = 0;
610 virtual ~IConditionedQueryEvent() {};
613 static const OID OID_IConditionedQuery = { 0xd61373d1, 0x9727, 0x4a84, { 0x98, 0x14, 0x4c, 0xf, 0xed, 0x25, 0x52, 0xe3 } };
615 * @class IConditionedQuery
616 * @brief IConditionedQuery Interface
617 * This class represents parsed CQL for data retrieving
621 class IConditionedQuery : public IBase
625 * @fn registerConditionedModel
626 * @brief Register Conditioned Model for tracking triggers
628 * @param [in] IConditionedModel *pConditionedModel - Interface of Conditioned Model
635 virtual SSMRESULT registerConditionedModel(IN IConditionedModel *pConditionedModel) = 0;
638 * @fn activateTriggers
639 * @brief Activate triggers for data evaluating. This changed related ContextModel's status to running
641 * @param [in] int userTriggerId - Specify TriggerId for event listening
648 virtual SSMRESULT activateTriggers(IN int userTriggerId) = 0;
651 * @fn deactivateTriggers
652 * @brief Deactivate triggers for data evaluating.
654 * @param [in] int userTriggerId - Specify TriggerId for event listening
661 virtual SSMRESULT deactivateTriggers() = 0;
664 * @fn getConditionedQueryResult
665 * @brief Retrieves conditioned data from current cached data
667 * @param [out] IConditionedQueryResult **ppConditionedQueryResult - Interface of result reader
674 virtual SSMRESULT getConditionedQueryResult(OUT IConditionedQueryResult **ppConditionedQueryResult)
678 * @fn hasAllConditionedModels
679 * @brief Retrieves current conditioned query has all Conditioned ContextModels for evaluating
688 virtual bool hasAllConditionedModels() = 0;
691 static const OID OID_IContextModel = { 0xcc56003c, 0xa036, 0x4f27, { 0x9c, 0xb3, 0xdc, 0xaf, 0x1f, 0xb0, 0x81, 0x58 } };
693 * @class IContextModel
694 * @brief IContextModel Interface
695 * This class represents Context Model
699 class IContextModel : public IBase
702 enum Status {STATUS_ACTIVATE, STATUS_DEACTIVATE, STATUS_START_READ_VALUE, STATUS_STOP_READ_VALUE};
703 enum ActivationType {ACTIVATION_TYPE_GET, ACTIVATION_TYPE_SUBSCRIBE};
704 enum ConstructionType {CONSTRUCTION_TYPE_INTERNAL, CONSTRUCTION_TYPE_EXTERNAL, CONSTRUCTION_TYPE_REMOTE};
708 * @brief Get current model's id used for Evaluation Engine
717 virtual int getModelId() = 0;
721 * @brief Get current model's name
725 * @return std::string
730 virtual std::string getModelName() = 0;
733 * @fn getConstructionType
734 * @brief Get current model's constructionType defined when created
738 * @return IContextModel::ConstructionType
743 virtual ConstructionType getConstructionType() = 0;
746 * @fn getParentDataId
747 * @brief Get parent dataId related to model hierarchy
749 * @param [in] int dataId - DataId that current model's
750 * @param [in] IContextModel *pParentModel - Designated parent Context Model
751 * @param [out] int *pParentDataId - Designated parent Context Model's data's Id
758 virtual SSMRESULT getParentDataId(IN int dataId, IN IContextModel *pParentModel,
759 OUT int *pParentDataId) = 0;
763 * @brief Get child dataId related to model hierarchy
765 * @param [in] int dataId - DataId that current model's
766 * @param [in] IContextModel *pChildModel - Designated child Context Model
767 * @param [out] int *pParentDataId - Designated child Context Model's data's Id
774 virtual SSMRESULT getChildDataId(IN int dataId, IN IContextModel *pChildModel,
775 OUT IntVec *pPath) = 0;
779 * @brief Activate current model's working. Each call to activate will increase internal reference counter
781 * @param [in] ActivationType activationType - Specify current model's working type
782 * @param [in] int targetDeviceDataId - Specify target device's dataId
789 virtual SSMRESULT activate(IN ActivationType activationType, IN int targetDeviceDataId) = 0;
793 * @brief Deactivate current model's working. Each call to deactivate will decrease internal reference counter\n
794 * and finally deactivated when counter is 0
796 * @param [in] ActivationType activationType - Specify current model's working type
797 * @param [in] int targetDeviceDataId - Specify target device's dataId
804 virtual SSMRESULT deactivate(IN ActivationType activationType, IN int targetDeviceDataId) = 0;
805 //virtual SSMRESULT GetModelSchema(OUT ModelPropertyVec *pModelProperties) = 0;
809 * @brief Add model data to Context Model
811 * @param [in] int parentDataId - Specify current model's parent Context Model's dataId
812 * @param [in] ModelPropertyVec *pData - Packed data for adding
813 * @param [out] int *pDataId - Returned dataId that newly added
820 virtual SSMRESULT addModelData(IN int parentDataId, IN ModelPropertyVec *pData,
821 OUT int *pDataId) = 0;
824 * @fn updateModelData
825 * @brief Update model data to Context Model
827 * @param [in] int dataId - DataId that provided AddModelData's execution
828 * @param [in] ModelPropertyVec *pData - Packed data for updating
835 virtual SSMRESULT updateModelData(IN int dataId, IN ModelPropertyVec *pData) = 0;
838 * @fn deleteModelData
839 * @brief Delete model data using given index
841 * @param [in] int dataId - DataId that provided AddModelData's execution
848 virtual SSMRESULT deleteModelData(IN int dataId) = 0;
852 * @brief Get model data
854 * @param [in] int dataId - DataId that provided AddModelData's execution
855 * @param [out] ModelPropertyVec *pData - Packed data
862 virtual SSMRESULT getModelData(IN int dataId, OUT ModelPropertyVec *pData) = 0;
865 * @fn getModelDataSet
866 * @brief Get model data set
868 * @param [in] int startIndex - Starting index of model data
869 * @param [in] int count - Number of data to retrieve
870 * @param [out] vector<ModelPropertyVec> *pData - Packed data
871 * @param [out] int *pLastIndex - Index of last data
878 virtual SSMRESULT getModelDataSet(IN int startIndex, IN int count,
879 OUT std::vector<ModelPropertyVec> *pDataSet, OUT int *pLastIndex) = 0;
882 * @fn createConditionedModel
883 * @brief Create Conditioned Model for data searching or triggering
885 * @param [in] ModelConditionVec *pModelConditionVec - Conditions that searching or triggering
886 * @param [out] IConditionedModel **ppConditionedModel - Created Conditioned Model interface
893 virtual SSMRESULT createConditionedModel(IN ModelConditionVec *pModelConditionVec,
894 OUT IConditionedModel **ppConditionedModel) = 0;
895 //virtual SSMRESULT CleanUpModelData() = 0;
899 * @brief Sets current model data's lifeTime
901 * @param [in] int seconds - model data's lifeTime
908 virtual void setLifeTime(std::string seconds) = 0;
912 * @class IContextModelEvent
913 * @brief IContextModelEvent Interface
914 * This class represents event interface for tracking IContextModel events
918 * Copyright 2013 by Samsung Electronics, Inc.,
920 * This software is the confidential and proprietary information
921 * of Samsung Electronics, Inc. ("Confidential Information"). You
922 * shall not disclose such Confidential Information and shall use
923 * it only in accordance with the terms of the license agreement
924 * you entered into with Samsung.
926 class IContextModelEvent
930 * @fn onModelStatusChange
931 * @brief Called when ContextModel wants to activate or deactivate
933 * @param [in] IContextModel::Status newStatus - Context Model's new status
934 * @param [in] ISSMResource *pSSMResource - Instance of actual resource
935 * @param [in] IContextModel *pModel - Affected Context Model
942 virtual SSMRESULT onModelStatusChange(IN IContextModel::Status newStatus,
943 IN ISSMResource *pSSMResource, IN IContextModel *pModel) = 0;
944 virtual ~IContextModelEvent() {}
948 * @class IContextModelAccessor
949 * @brief IContextModelAccessor Interface
950 * This class represents context model accessors
954 class IContextModelAccessor
958 * @fn onQueryContextModel
959 * @brief Called when ContextModelAccessor wants to query installed ContextModel
961 * @param [in] std::string modelName - ContextModel name to find out
962 * @param [out] IContextModel **ppContextModel - Interface of quried ContextModel
969 virtual SSMRESULT onQueryContextModel(IN std::string modelName,
970 OUT IContextModel **ppContextModel) = 0;
971 virtual ~IContextModelAccessor() {}
974 static const OID OID_IContextDataReader = { 0x65ce481, 0xc5dd, 0x41dc, { 0xa3, 0xc1, 0xa4, 0x98, 0xc9, 0xa8, 0xcc, 0xd5 } };
976 * @class IContextDataReader
977 * @brief IContextDataReader Interface
978 * This class represents context model database reader for context model developers
982 class IContextDataReader : public IBase
986 * @fn registerContextModelAccessor
987 * @brief Called when ContextModelAccessor wants to query installed ContextModel
989 * @param [in] IContextModelAccessor *pContextModelAccessor - Instance of implemented IContextModelAccessor interface
996 virtual SSMRESULT registerContextModelAccessor(IN IContextModelAccessor *pContextModelAccessor) = 0;
1000 * @brief Retrieve ContextData using given ContextModel name and dataId
1002 * @param [in] std::string modelName - ContextModel name
1003 * @param [in] int startIndex - Starting index of model data
1004 * @param [in] int count - Number of data to retrieve
1005 * @param [out] std::vector<ContextData> *data - ContextData set
1006 * @param [out] int *pLastIndex - Index of last data
1013 virtual SSMRESULT getContextData(IN std::string modelName, IN int startIndex, IN int count,
1014 OUT std::vector<ContextData> *data, OUT int *pLastIndex) = 0;
1017 typedef std::vector<std::pair<std::string, ModelConditionVec> > QueryCondition;
1019 static const OID OID_IPropagationEngine = { 0xeb7e3d6c, 0x2cae, 0x43b3, { 0xb9, 0xae, 0x1b, 0xa, 0x6c, 0xdd, 0x9, 0xeb } };
1021 * @class IPropagationEngine
1022 * @brief IPropagationEngine Interface
1023 * This class represents propagation engine that manages ContextModel's automation
1027 class IPropagationEngine : public IBase
1031 * @fn getContextModel
1032 * @brief Retrieve ContextModel interface specified name
1034 * @param [in] std::string modelName - ContextModel's name that looking for
1035 * @param [out] IContextModel **ppContextModel - Interface pointer for retrieving
1042 virtual SSMRESULT getContextModel(IN std:: string modelName,
1043 OUT IContextModel **ppContextModel) = 0;
1046 * @fn createConditionedQuery
1047 * @brief Create Conditioned Query using conditions
1049 * @param [in] IContextModel::ActivationType activationType - ActivationType for ContextModel's working strategy
1050 * @param [in] QueryCondition *pQueryCondition - Conditions for data retrieving
1051 * @param [in] IConditionedQueryEvent *pEvent - Event interface for Conditioned Result listening
1052 * @param [out] IConditionedQuery **ppConditionedQuery - Interface for retrieving Conditioned Query
1059 virtual SSMRESULT createConditionedQuery(IN IContextModel::ActivationType activationType,
1060 IN QueryCondition *pQueryCondition,
1061 IN IConditionedQueryEvent *pEvent, OUT IConditionedQuery **ppConditionedQuery) = 0;
1064 static const OID OID_IQueryEngineInternal = { 0x6eabf1a9, 0xe884, 0x4562, { 0x8b, 0x90, 0x1e, 0xe8, 0xba, 0xbf, 0xbe, 0x1a } };
1066 * @class IQueryEngineInternal
1067 * @brief IQueryEngineInternal Interface
1068 * This class manages ContextQuery at backend side.
1071 * CObject<CQueryEngine> *pQueryEngine;
1072 * CreateInstance(OID_IQueryEngineInternal, (IBase**)&pQueryEngine);
1073 * pQeuryEngine->ExecuteContextQuery(contextquery,cqid);
1075 class IQueryEngineInternal : public IBase
1076 , public IQueryEngine
1080 static const OID OID_IContextExecutor = { 0x92dcc900, 0xdc8a, 0x474b, { 0x87, 0x45, 0x4d, 0x0, 0xe4, 0xd1, 0x52, 0x2b } };
1082 * @class IContextExecutor
1083 * @brief Interface for execute context model.
1084 * Delegate requested context to lower layer.
1085 * Execute context model.
1089 class IContextExecutor : public IBase
1091 , public ICtxDelegate
1095 * @fn registerContext
1096 * @brief Register Context for receiving values
1098 * @param [in] TypeofEvent callType - Call types of Context data request, stream or current
1099 * @param [in] ISSMResource *pSSMResouce - Requested Context model
1100 * @param [in] IEvent *pEvent - Event interface for receiving data
1107 virtual void registerContext(TypeofEvent callType, ISSMResource *pSSMResouce, IEvent *pEvent) = 0;
1110 * @fn unregisterContext
1111 * @brief Unregister Context for receiving values
1113 * @param [in] TypeofEvent callType - Call types of Context data request, stream or current
1114 * @param [in] ISSMResource *pSSMResouce - Requested Context model
1115 * @param [in] IEvent *pEvent - Event interface for receiving data
1122 virtual void unregisterContext(TypeofEvent callType, ISSMResource *pSSMResource,
1123 IEvent *pEvent) = 0;
1126 static const OID OID_ISensingEngine = { 0x3140a3dc, 0xf912, 0x4d88, { 0x97, 0x3c, 0x86, 0xe8, 0x35, 0x69, 0xa7, 0xf8 } };
1128 * @class ISensingEngine
1129 * @brief Class for implementing main abstration of SensorProcessor
1134 class ISensingEngine : public IBase
1139 * @fn registerContext
1140 * @brief Register Context for receiving values
1142 * @param [in] TypeofEvent callType - Call types of Context data request, stream or current
1143 * @param [in] ISSMResource *pSSMResouce - Requested Context model
1144 * @param [in] IEvent *pEvent - Event interface for receiving data
1151 virtual SSMRESULT registerContext(TypeofEvent callType, ISSMResource *pSSMResouce,
1152 IEvent *pEvent) = 0;
1155 * @fn unregisterContext
1156 * @brief Unregister Context for receiving values
1158 * @param [in] TypeofEvent callType - Call types of Context data request, stream or current
1159 * @param [in] ISSMResource *pSSMResouce - Requested Context model
1160 * @param [in] IEvent *pEvent - Event interface for receiving data
1167 virtual SSMRESULT unregisterContext(TypeofEvent callType, ISSMResource *pSSMResource,
1168 IEvent *pEvent) = 0;
1172 * @brief Get all available context models
1174 * @param [out] std::vector<ISSMResource*> *pList - List of available context model
1181 virtual SSMRESULT getList(std::vector<ISSMResource *> *pList) = 0;
1184 class IResourceFinderEvent
1187 virtual SSMRESULT onResourceFound(IN ISSMResource *pSensor) = 0;
1188 virtual SSMRESULT onResourceLost(IN ISSMResource *pSensor) = 0;
1189 virtual ~IResourceFinderEvent() {}
1192 static const OID OID_IResourceFinder = { 0x8f52a31f, 0x51d5, 0x462b, { 0xa9, 0x8d, 0x40, 0x70, 0xa3, 0xf6, 0xb5, 0x6f } };
1193 class IResourceFinder : public IBase
1196 virtual SSMRESULT registerResourceFinderEvent(IN IResourceFinderEvent *pEvent) = 0;
1197 virtual SSMRESULT startResourceFinder() = 0;
1198 virtual SSMRESULT startObserveResource(IN ISSMResource *pSensor, IN IEvent *pEvent) = 0;
1199 virtual SSMRESULT stopObserveResource(IN ISSMResource *pSensor) = 0;
1203 * @class ISoftSensorManager
1204 * @brief ISoftSensorManager Interface
1205 * This class represents main interface of SSM.
1208 * static ISoftSensorManager *g_pSoftSensorManager = NULL;
1209 * CreateInstance(OID_ISoftSensorManager, (IBase**)&g_pSoftSensorManager);
1210 * g_pSoftSensorManager->TerminateCore();
1211 * g_pSoftSensorManager->Release();
1213 static const OID OID_ISoftSensorManager = { 0x6b9ce4cb, 0x31fe, 0x4b05, { 0xb4, 0xca, 0x10, 0x3d, 0x82, 0x59, 0x4f, 0x4d } };
1214 class ISoftSensorManager : public IBase
1218 * @fn initializeCore
1219 * @brief Initialize core using given configuration information.
1222 * <UDN>windows7-31f8-11b4-a222-08002b34c003</UDN>
1228 * @param [in] std::string xmlDescription - specification described in XML
1229 * @param [out] IBase** ppvObject - reference pointer to get instance pointer
1235 virtual SSMRESULT initializeCore(IN std::string xmlDescription) = 0;
1239 * @brief Start Core.
1240 * This enables network capability that can discover and discovered.
1248 virtual SSMRESULT startCore() = 0;
1253 * This disables network capability that can discover and discovered.
1261 virtual SSMRESULT stopCore() = 0;
1265 * @brief Terminates Core.
1266 * Free all allocated resources
1274 virtual SSMRESULT terminateCore(IN bool factoryResetFlag) = 0;
1277 * @fn createQueryEngine
1278 * @brief Create new Query Engine instance.
1279 * Each engine instance has it's own event thread
1280 * we recommend each application should creates only one instance.
1282 * @param [out] IQueryEngine **ppQueryEngine - instance pointer of new Query Engine
1288 virtual SSMRESULT createQueryEngine(OUT IQueryEngine **ppQueryEngine) = 0;
1291 * @fn releaseQueryEngine
1292 * @brief Release exists Query Engine instance.
1294 * @param [in] IQueryEngine *pQueryEngine - instance pointer of exists Query Engine
1300 virtual unsigned long releaseQueryEngine(IN IQueryEngine *pQueryEngine) = 0;
1303 * @fn getInstalledModelList
1304 * @brief Gets all installed models from local and remote
1306 * @param [out] std::vector<ISSMResource*> *pList - List of installed context model
1313 virtual SSMRESULT getInstalledModelList(OUT std::vector<ISSMResource *> *pList) = 0;