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