8baa1231fe9d4f528893ff4f90c3edaff7228e81
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SSMCore / src / SSMInterface / SoftSensorManager.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 _SoftSensorManager_H_
21 #define _SoftSensorManager_H_
22
23 #include "SSMInterface/SSMCore.h"
24 #include "Common/PlatformLayer.h"
25 #include "Common/InternalInterface.h"
26 #include "Common/rapidxml.hpp"
27
28 /**
29 * @class    CSoftSensorManager
30 * @brief    CSoftSensorManager Interface
31 *            This class represents main class of SSM.
32 *
33 * @see
34 *           static ISoftSensorManager       *g_pSoftSensorManager = NULL;
35 *           CreateInstance(OID_ISoftSensorManager, (IBase**)&g_pSoftSensorManager);
36 *           g_pSoftSensorManager->TerminateCore();
37 *           g_pSoftSensorManager->Release();
38 */
39
40 class CSoftSensorManager :
41     public CObjectRoot<CObjectMultiThreadModel>
42     , public ISoftSensorManager
43 {
44     private:
45         CObjectPtr<IContextRepository>      m_pContextRepository;
46         CObjectPtr<IPropagationEngine>      m_pPropagationEngine;
47         CObjectPtr<ISensingEngine>          m_pSensingEngine;
48
49     public:
50         SSMRESULT finalConstruct();
51
52         void finalRelease();
53
54         SSMRESULT queryInterface(const OID &objectID, IBase **ppObject)
55         {
56             if (ppObject == NULL)
57                 return SSM_E_POINTER;
58
59             if (IsEqualOID(objectID, OID_ISoftSensorManager))
60             {
61                 IBase *pBase = this;
62                 pBase->addRef();
63                 *ppObject = pBase;
64                 return SSM_S_OK;
65             }
66
67             return SSM_E_NOINTERFACE;
68         }
69
70         /**
71         * @fn initializeCore
72         * @brief Initialize core using given configuration information.
73         *           <SSMCore>
74         *               <Device>
75         *                   <UDN>windows7-31f8-11b4-a222-08002b34c003</UDN>
76         *                   <Name>MyPC</Name>
77         *                   <Type>PC</Type>
78         *               </Device>
79         *           </SSMCore>
80         *
81         * @param [in] std::string xmlDescription - specification described in XML
82         * @param [out] IBase** ppvObject - reference pointer to get instance pointer
83         * @return SSMRESULT
84         * @warning
85         * @exception
86         * @see
87         */
88         SSMRESULT initializeCore(IN std::string xmlDescription);
89
90         /**
91         * @fn startCore
92         * @brief Start Core.
93         *         This enables network capability that can discover and discovered.
94         *
95         * @param None
96         * @return SSMRESULT
97         * @warning
98         * @exception
99         * @see
100         */
101         SSMRESULT startCore();
102
103         /**
104         * @fn stopCore
105         * @brief Stop Core.
106         *         This disables network capability that can discover and discovered.
107         *
108         * @param None
109         * @return SSMRESULT
110         * @warning
111         * @exception
112         * @see
113         */
114         SSMRESULT stopCore();
115
116         /**
117         * @fn TerminateCore
118         * @brief Terminates Core.
119         *         Free all allocated resources
120         *
121         * @param None
122         * @return SSMRESULT
123         * @warning
124         * @exception
125         * @see
126         */
127         SSMRESULT terminateCore(IN bool factoryResetFlag);
128
129         /**
130         * @fn createQueryEngine
131         * @brief Create new Query Engine instance.
132         *         Each engine instance has it's own event thread
133         *         we recommend each application should creates only one instance.
134         *
135         * @param [out] IQueryEngine **ppQueryEngine - instance pointer of new Query Engine
136         * @return SSMRESULT
137         * @warning
138         * @exception
139         * @see
140         */
141         SSMRESULT createQueryEngine(OUT IQueryEngine **ppQueryEngine);
142
143         /**
144         * @fn releaseQueryEngine
145         * @brief Release exists Query Engine instance.
146         *
147         * @param [in] IQueryEngine *pQueryEngine - instance pointer of exists Query Engine
148         * @return SSMRESULT
149         * @warning
150         * @exception
151         * @see
152         */
153         unsigned long releaseQueryEngine(IN IQueryEngine *pQueryEngine);
154
155         /**
156         * @fn getInstalledModelList
157         * @brief Gets all installed models from local and remote
158         *
159         * @param [out] std::vector<ISSMResource*> *pList - List of installed context model
160         *
161         * @return SSMRESULT
162         * @warning
163         * @exception
164         * @see
165         */
166         SSMRESULT getInstalledModelList(OUT std::vector<ISSMResource *> *pList);
167 };
168
169 #endif