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 #include "SSMInterface/SSMCore.h"
21 #include "SSMInterface/SoftSensorManager.h"
22 #include "Common/InternalInterface.h"
24 static ISoftSensorManager *g_pSoftSensorManager = NULL;
26 SSMRESULT CreateQueryEngine(OUT IQueryEngine **ppQueryEngine)
28 SSMRESULT res = SSM_E_FAIL;
30 SSM_CLEANUP_NULL_ASSERT(g_pSoftSensorManager);
31 SSM_CLEANUP_ASSERT(g_pSoftSensorManager->createQueryEngine(ppQueryEngine));
37 unsigned long ReleaseQueryEngine(IN IQueryEngine *pQueryEngine)
39 if (pQueryEngine == NULL)
44 if (g_pSoftSensorManager == NULL)
49 return g_pSoftSensorManager->releaseQueryEngine(pQueryEngine);
52 SSMRESULT InitializeSSMCore(IN std::string xmlDescription)
54 SSMRESULT res = SSM_E_FAIL;
56 SSM_CLEANUP_ASSERT(CreateGlobalInstanceRepo());
57 SSM_CLEANUP_ASSERT(CreateInstance(OID_ISoftSensorManager, (IBase **)&g_pSoftSensorManager));
58 SSM_CLEANUP_ASSERT(g_pSoftSensorManager->initializeCore(xmlDescription));
63 SAFE_RELEASE(g_pSoftSensorManager);
68 SSMRESULT StartSSMCore()
70 SSMRESULT res = SSM_E_FAIL;
72 SSM_CLEANUP_NULL_ASSERT(g_pSoftSensorManager);
73 SSM_CLEANUP_ASSERT(g_pSoftSensorManager->startCore());
79 SSMRESULT StopSSMCore()
81 SSMRESULT res = SSM_E_FAIL;
83 SSM_CLEANUP_NULL_ASSERT(g_pSoftSensorManager);
84 SSM_CLEANUP_ASSERT(g_pSoftSensorManager->stopCore());
90 SSMRESULT TerminateSSMCore(bool factoryResetFlag)
92 SSMRESULT res = SSM_E_FAIL;
94 SSM_CLEANUP_NULL_ASSERT(g_pSoftSensorManager);
95 SSM_CLEANUP_ASSERT(g_pSoftSensorManager->terminateCore(factoryResetFlag));
98 SAFE_RELEASE(g_pSoftSensorManager);
99 DestroyGlobalInstanceRepo();
103 const char *GetSSMError(SSMRESULT res)
105 const char *msg = NULL;
114 msg = "SSM_E_POINTER";
117 case SSM_E_OUTOFMEMORY:
118 msg = "SSM_E_OUTOFMEMORY";
125 case SSM_E_NOINTERFACE:
126 msg = "SSM_E_NOINTERFACE";
130 msg = "SSM_E_NOTIMPL";
141 SSMRESULT GetInstalledModelList(OUT std::vector<ISSMResource *> *pList)
143 SSMRESULT res = SSM_E_FAIL;
145 SSM_CLEANUP_NULL_ASSERT(g_pSoftSensorManager);
146 g_pSoftSensorManager->getInstalledModelList(pList);