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))
72 return SSM_E_NOINTERFACE;
77 * @brief Register context model request.
79 * @param [in] TypeofEvent callType - Type of event. SSM_ONCE or SSM_REPEAT
80 * @param [in] ISSMResource *pSSMResource - Requested context model resource.
81 * @param [in] IEvent *pEvent - IEvent class for callback.
89 SSMRESULT registerContext(IN TypeofEvent callType, IN ISSMResource *pSSMResource,
93 * @fn unregisterContext
94 * @brief Unregister context model request.
96 * @param [in] TypeofEvent callType - Type of event. SSM_ONCE or SSM_REPEAT
97 * @param [in] ISSMResource *pSSMResource - Requested context model resource.
98 * @param [in] IEvent *pEvent - IEvent class for callback.
106 SSMRESULT unregisterContext(IN TypeofEvent callType, IN ISSMResource *pSSMResource,
111 * @brief Get context model list
113 * @param [out] std::vector<ISSMResource> *pList - ISSMResource vector of low level context models or high level context models.
121 SSMRESULT getList(OUT std::vector<ISSMResource *> *pList);
125 * @brief IEvent Interface.
126 * Call from executor when context model data generated.
128 * @param [in] std::string name - caller Resource name.
129 * @param [in] TypeofEvent callType - context event type.
130 * @param [in] std::vector<ContextData> ctxData - context data
132 * @return int - function result status
138 int onEvent(IN std::string name, IN TypeofEvent callType, IN std::vector<ContextData> ctxData);