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 _ResponseReactor_H_
21 #define _ResponseReactor_H_
23 #include "SSMInterface/SSMCore.h"
24 #include "Common/PlatformLayer.h"
25 #include "Common/InternalInterface.h"
28 * @class CSensingEngine
29 * @brief Class for implementing main abstration of SensorProcessor
34 class CSensingEngine :
35 public CObjectRoot<CObjectMultiThreadModel>
36 , public ISensingEngine
39 CObjectPtr<IContextRepository> m_pContextRepository;
40 CObjectPtr<IContextExecutor> m_pContextExecutor;
43 * @brief requested high layer's callback data.(IEvent instance, deviceId, call type)
45 std::map<std::string, CallbackData > m_requestedCallbackData;
48 * @brief Context model data from lower layer(OnEvent Callback)
50 std::map<std::string, std::vector<ContextData> > m_storedLowerContextData;
52 CSimpleMutex m_mtxRequestedContextData;
53 CSimpleMutex m_mtxUnregisterContext;
56 SSMRESULT finalConstruct();
59 SSMRESULT queryInterface(const OID &objectID, IBase **ppObject)
64 if (IsEqualOID(objectID, OID_ISensingEngine))
71 else if (IsEqualOID(objectID, OID_IContextRepository))
75 *ppObject = m_pContextRepository;
79 return SSM_E_NOINTERFACE;
84 * @brief Register context model request.
86 * @param [in] TypeofEvent callType - Type of event. SSM_ONCE or SSM_REPEAT
87 * @param [in] ISSMResource *pSSMResource - Requested context model resource.
88 * @param [in] IEvent *pEvent - IEvent class for callback.
96 SSMRESULT registerContext(TypeofEvent callType, ISSMResource *pSSMResource,
100 * @fn unregisterContext
101 * @brief Unregister context model request.
103 * @param [in] TypeofEvent callType - Type of event. SSM_ONCE or SSM_REPEAT
104 * @param [in] ISSMResource *pSSMResource - Requested context model resource.
105 * @param [in] IEvent *pEvent - IEvent class for callback.
113 SSMRESULT unregisterContext(TypeofEvent callType, ISSMResource *pSSMResource,
118 * @brief Get context model list
120 * @param [out] std::vector<ISSMResource> *pList - ISSMResource vector of low level context models or high level context models.
128 SSMRESULT getList(std::vector<ISSMResource *> *pList);
132 * @brief IEvent Interface.
133 * Call from executor when context model data generated.
135 * @param [in] std::string name - caller Resource name.
136 * @param [in] TypeofEvent callType - context event type.
137 * @param [in] std::vector<ContextData> ctxData - context data
139 * @return int - function result status
145 int onEvent(std::string name, TypeofEvent callType, std::vector<ContextData> ctxData);