-
+-include ../../../build/linux/root_path.inc
-include ../../../build/linux/environment.mk
BOOST=${BOOST_BASE}
INC_PATH=../../include
RST_NAME=release
+GAR=ar
+
# Insert your project name.
-TARGET=SDKlib
+TARGET=${SSM_LIB}
CXX=g++
CXX_FLAGS=-std=c++0x -Wall -pthread -DLINUX
-CXX_INC=-I../../ -I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
+CXX_INC=-I../../ -I${INC_PATH}/ -I${FD_SSMCORE}/include -I${FD_SSMCORE}/src -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
CXX_LIB=
SRCLIST=${wildcard ${SRC_PATH}/*.cpp}
@echo " "
${TARGET}: ${OBJLIST}
- @cp -Rdp ./*.o ./${RST_NAME}/
+ ${GAR} -r ./${RST_NAME}/$@ ./*.o
@cp -Rdp ${INC_PATH}/*.h ./${RST_NAME}/
@echo " "
{
private:
SSMReturn m_retResponse;
- OCPlatform *m_pPlatform;
CSemaphore m_sem;
/**
* @brief SoftSensorManager Resource.
// friend option. for callback from SSMResource
void onFoundResource(std::shared_ptr< OCResource > resource);
- void onCreateQueryEngine(const OCRepresentation &rep, const int eCode);
- void onReleaseQueryEngine(const OCRepresentation &rep, const int eCode);
- void onRegisterQuery(const OCRepresentation &rep, const int eCode);
- void onUnregisterQuery(const OCRepresentation &rep, const int eCode);
- void onObserve(const OCRepresentation &rep, const int &eCode);
+ void onCreateQueryEngine(const HeaderOptions &headerOptions, const OCRepresentation &rep,
+ const int eCode);
+ void onReleaseQueryEngine(const HeaderOptions &headerOptions, const OCRepresentation &rep,
+ const int eCode);
+ void onRegisterQuery(const HeaderOptions &headerOptions, const OCRepresentation &rep,
+ const int eCode);
+ void onUnregisterQuery(const HeaderOptions &headerOptions, const OCRepresentation &rep,
+ const int eCode);
+ void onObserve(const HeaderOptions &headerOptions, const OCRepresentation &rep, const int &eCode,
+ const int &sequenceNumber);
};
#endif /* RESOURCECLIENT_H_ */
#define SSM_RESOURCE_TYPE = "core.SoftSensorManager"
-#define COAP_IP "134.134.161.33"
-#define COAP_PORT 5683
-#define COAP_MODE ModeType::Client
-#define COAP_SRVTYPE ServiceType::InProc
-
#define COAP_SERVER_ADDR "coap://224.0.1.187/oc/core?rt=core.SoftSensorManager"
SSMClient::SSMClient()
{
m_sem.create(100000);
- m_pPlatform = NULL;
m_appListener = NULL;
m_retResponse = SSM_ERROR;
_findResource();
SSMClient::~SSMClient()
{
_releaseQueryEngine(m_queryEngineId);
- if (m_pPlatform)
- {
- delete m_pPlatform;
- m_pPlatform = NULL;
- }
}
void SSMClient::_findResource()
{
// Create PlatformConfig object
- PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, QualityOfService::NonConfirmable);
+ PlatformConfig cfg(OC::ServiceType::InProc, OC::ModeType::Both,
+ "0.0.0.0", 0, OC::QualityOfService::LowQos);
// Create a OCPlatform instance.
// Note: Platform creation is synchronous call.
try
{
- m_pPlatform = new OCPlatform(cfg);
+ OCPlatform::Configure(cfg);
// Find all resources
OCStackResult result;
- if ((result = m_pPlatform->findResource("", COAP_SERVER_ADDR,
- std::bind(&SSMClient::onFoundResource, this, std::placeholders::_1)))
+ if ((result = OCPlatform::findResource("", COAP_SERVER_ADDR,
+ std::bind(&SSMClient::onFoundResource, this, std::placeholders::_1)))
!= OC_STACK_OK)
{
- delete m_pPlatform;
- m_pPlatform = NULL;
+ std::cout << "Faile to Find Resource... " << std::endl;
return;
}
+ std::cout << "Find Resource... " << std::endl;
m_sem.wait();
{
OCRepresentation rep;
- AttributeMap requestAttributeMap;
- AttributeValues commandValue;
-
QueryParamsMap queryParamsMap;
- commandValue.push_back("CreateQueryEngine");
-
- requestAttributeMap["command"] = commandValue;
-
- rep.setAttributeMap(requestAttributeMap);
+ rep.setValue("command", std::string("CreateQueryEngine"));
if (m_SSMResource->put(rep, queryParamsMap,
std::bind(&SSMClient::onCreateQueryEngine, this, std::placeholders::_1,
- std::placeholders::_2)) != OC_STACK_OK)
+ std::placeholders::_2, std::placeholders::_3)) != OC_STACK_OK)
{
return;
}
{
OCRepresentation rep;
- AttributeMap requestAttributeMap;
- AttributeValues commandValue;
- AttributeValues queryEngineIdValue;
-
QueryParamsMap queryParamsMap;
- commandValue.push_back("ReleaseQueryEngine");
-
- requestAttributeMap["command"] = commandValue;
-
- queryEngineIdValue.push_back(queryEngineId);
-
- requestAttributeMap["queryEngineId"] = queryEngineIdValue;
-
- rep.setAttributeMap(requestAttributeMap);
+ rep.setValue("command", std::string("ReleaseQueryEngine"));
+ rep.setValue("queryEngineId", queryEngineId);
m_SSMResource->put(rep, queryParamsMap,
std::bind(&SSMClient::onReleaseQueryEngine, this, std::placeholders::_1,
- std::placeholders::_2));
+ std::placeholders::_2, std::placeholders::_3));
m_sem.wait();
}
{
OCRepresentation rep;
- AttributeMap requestAttributeMap;
- AttributeValues commandValue;
- AttributeValues queryEngineIdValue;
- AttributeValues contextQueryValue;
-
QueryParamsMap queryParamsMap;
- commandValue.push_back("ExecuteContextQuery");
-
- requestAttributeMap["command"] = commandValue;
- queryEngineIdValue.push_back(m_queryEngineId);
-
- requestAttributeMap["queryEngineId"] = queryEngineIdValue;
-
- contextQueryValue.push_back(queryString);
-
- requestAttributeMap["contextQuery"] = contextQueryValue;
+ rep.setValue("command", std::string("ExecuteContextQuery"));
+ rep.setValue("queryEngineId", m_queryEngineId);
+ rep.setValue("contextQuery", queryString);
m_appListener = listener;
- rep.setAttributeMap(requestAttributeMap);
-
if (m_SSMResource->put(rep, queryParamsMap,
std::bind(&SSMClient::onRegisterQuery, this, std::placeholders::_1,
- std::placeholders::_2)) != OC_STACK_OK)
+ std::placeholders::_2, std::placeholders::_3)) != OC_STACK_OK)
return SSM_ERROR_NETWORK;
m_sem.wait();
if (m_retResponse == SSM_SUCCESS)
{
- cqid = m_responseAttributeMap["CQID"].back();
+ cqid = m_responseAttributeMap["CQID"];
}
return m_retResponse;
{
OCRepresentation rep;
- AttributeMap requestAttributeMap;
- AttributeValues commandValue;
- AttributeValues queryEngineIdValue;
- AttributeValues cqidValue;
-
QueryParamsMap queryParamsMap;
- commandValue.push_back("KillContextQuery");
-
- requestAttributeMap["command"] = commandValue;
-
- queryEngineIdValue.push_back(m_queryEngineId);
-
- requestAttributeMap["queryEngineId"] = queryEngineIdValue;
-
- cqidValue.push_back(cqid);
-
- requestAttributeMap["CQID"] = cqidValue;
-
- rep.setAttributeMap(requestAttributeMap);
+ rep.setValue("command", std::string("KillContextQuery"));
+ rep.setValue("queryEngineId", m_queryEngineId);
+ rep.setValue("CQID", cqid);
if (m_SSMResource->put(rep, queryParamsMap,
std::bind(&SSMClient::onUnregisterQuery, this, std::placeholders::_1,
- std::placeholders::_2)) != OC_STACK_OK)
+ std::placeholders::_2, std::placeholders::_3)) != OC_STACK_OK)
return SSM_ERROR_NETWORK;
m_sem.wait();
m_sem.release();
}
-void SSMClient::onCreateQueryEngine(const OCRepresentation &rep, const int eCode)
+void SSMClient::onCreateQueryEngine(const HeaderOptions &headerOptions, const OCRepresentation &rep,
+ const int eCode)
{
if (eCode != 0)
{
goto CLEANUP;
}
- m_responseAttributeMap = rep.getAttributeMap();
- m_queryEngineId = m_responseAttributeMap["queryEngineId"].back();
- m_responseAttributeMap["queryEngineId"].pop_back();
+ m_queryEngineId = rep.getValue<std::string>("queryEngineId");
m_retResponse = SSM_SUCCESS;
CLEANUP: m_sem.release();
}
-void SSMClient::onRegisterQuery(const OCRepresentation &rep, const int eCode)
+void SSMClient::onRegisterQuery(const HeaderOptions &headerOptions, const OCRepresentation &rep,
+ const int eCode)
{
QueryParamsMap queryParamsMap;
}
m_SSMResource->observe(ObserveType::Observe, queryParamsMap,
- std::bind(&SSMClient::onObserve, this, std::placeholders::_1, std::placeholders::_2));
+ std::bind(&SSMClient::onObserve, this, std::placeholders::_1,
+ std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
m_retResponse = SSM_SUCCESS;
CLEANUP: m_sem.release();
}
-void SSMClient::onUnregisterQuery(const OCRepresentation &rep, const int eCode)
+void SSMClient::onUnregisterQuery(const HeaderOptions &headerOptions, const OCRepresentation &rep,
+ const int eCode)
{
if (eCode != 0)
{
CLEANUP: m_sem.release();
}
-void SSMClient::onReleaseQueryEngine(const OCRepresentation &rep, const int eCode)
+void SSMClient::onReleaseQueryEngine(const HeaderOptions &headerOptions,
+ const OCRepresentation &rep, const int eCode)
{
if (eCode != 0)
{
CLEANUP: m_sem.release();
}
-void SSMClient::onObserve(const OCRepresentation &rep, const int &eCode)
+void SSMClient::onObserve(const HeaderOptions &headerOptions, const OCRepresentation &rep,
+ const int &eCode, const int &sequenceNumber)
{
SSMReturn ret = SSM_SUCCESS;
-
+-include ../../../build/linux/root_path.inc
-include ../../../build/linux/environment.mk
BOOST=${BOOST_BASE}
RST_NAME=release
# Insert your project name.
-TARGET=SSMCoreUbuntu
+TARGET=${SSMCORE_LIB}
EXCLUDE_LIST=SSMCore_JNI.cpp
# C++ type Compile Flag define.
CXX=g++
-CXX_FLAGS=-std=c++0x -Wall -pthread -DLINUX -DMODEL_DIRECTORY=${MODEL_DIR} -DHIGH_LOCATION=${HIGH_LOCATION} -ldl
-CXX_INC=-I../../ -I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST} -I${SRC_PATH} -I${SRC_PATH}/Common -I${SRC_PATH}/QueryProcessor -I${SRC_PATH}/SensorProcessor -I${SRC_PATH}/SSMInterface
+CXX_FLAGS=-std=c++0x -Wall -pthread -DLINUX -ldl
+CXX_INC=-I${INC_PATH}/ -I${SRC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
CXX_LIB=-L""
CXX_SRCPATH=${wildcard ${SRC_PATH}/**/*.cpp}
# Linker FLAGS define.
LD_FLAGS=-std=c++0x -Wall -DLINUX
-# GAR=ar
-LD_LIB=${IOT_RELEASE}/${IOT_LIB} ${IOT_CSDK_RELEASE}/${IOT_CSDK_LIB} -lpthread -ldl
+GAR=ar
+# LD_LIB=${IOT_RELEASE}/${IOT_LIB} ${IOT_CSDK_RELEASE}/${IOT_CSDK_LIB} ${IOT_LOG_DIR}/lib/${IOT_LOG_LIB} -lpthread -ldl
# Force metatargets to build:
@echo "${MODEL_DIR}"
${TARGET}: ${GCC_OBJLIST} ${CXX_OBJLIST}
- $(CXX) $(LD_FLAGS) -o ./${RST_NAME}/$@ $^ ${LD_LIB}
- # ${GAR} -r ./${RST_NAME}/$@ ./*.o
+ # $(CXX) $(LD_FLAGS) -o ./${RST_NAME}/$@ $^ ${LD_LIB}
+ ${GAR} -r ./${RST_NAME}/$@ ./*.o
@echo " "
%.o : ${SRC_PATH}/**/%.c
post_job:
@echo " "
cp -Rdp ./${RST_NAME}/${TARGET} ${OUTPUTS_DIR}/
+ cp -Rdp ${INC_PATH}/SSMInterface.h ${OUTPUTS_DIR}/
cp -Rdp ${SRC_PATH}/SSMInterface/SSMModelDefinition.h ${OUTPUTS_DIR}/
@echo "---------------- SSMCore Build Successful. ---------------"
@echo "Enter to ${RST_NAME} folder."
;
/**
- * @fn setCurrentDeviceInfo
- * @brief set device information
+ * @fn initRepository
+ * @brief initialize repository using given info
*
* @param [in] std::string name - Device name
* @param [in] std::string type - Device Type
* @param [in] std::string pathSoftSensors - SoftSensors Repository path
* @param [in] std::string pathDescription - SoftSensors Description path
- * @return void
+ * @return SSMRESULT
*
* @warning
* @exception
* @see
*/
- virtual void setCurrentDeviceInfo(IN std::string name, IN std::string type,
- IN std::string pathSoftSensors, IN std::string pathDescription) = 0;
+ virtual SSMRESULT initRepository(IN std::string name, IN std::string type,
+ IN std::string pathSoftSensors, IN std::string pathDescription) = 0;
virtual SSMRESULT registerResourceFinderEvent(IN IResourceEvent *pResourceEvent) = 0;
virtual SSMRESULT startResourceFinder() = 0;
IEvent *pEvent) = 0;
};
-static const OID OID_IResponseReactor = { 0x3140a3dc, 0xf912, 0x4d88, { 0x97, 0x3c, 0x86, 0xe8, 0x35, 0x69, 0xa7, 0xf8 } };
+static const OID OID_ISensingEngine = { 0x3140a3dc, 0xf912, 0x4d88, { 0x97, 0x3c, 0x86, 0xe8, 0x35, 0x69, 0xa7, 0xf8 } };
/**
- * @class IResponseReactor
- * @brief Interface for implement of reactor pattern
- * Delegate requested context to context executor layer.
+ * @class ISensingEngine
+ * @brief Class for implementing main abstration of SensorProcessor
*
*
* @see
*/
-class IResponseReactor : public IBase
+class ISensingEngine : public IBase
, public IEvent
{
public:
* @exception
* @see
*/
- virtual void registerContext(TypeofEvent callType, ISSMResource *pSSMResouce, IEvent *pEvent) = 0;
+ virtual SSMRESULT registerContext(TypeofEvent callType, ISSMResource *pSSMResouce,
+ IEvent *pEvent) = 0;
/**
* @fn unregisterContext
* @exception
* @see
*/
- virtual void unregisterContext(TypeofEvent callType, ISSMResource *pSSMResource,
- IEvent *pEvent) = 0;
+ virtual SSMRESULT unregisterContext(TypeofEvent callType, ISSMResource *pSSMResource,
+ IEvent *pEvent) = 0;
/**
* @fn getList
* @exception
* @see
*/
- virtual void getList(std::vector<ISSMResource *> *pList) = 0;
+ virtual SSMRESULT getList(std::vector<ISSMResource *> *pList) = 0;
};
class IResourceFinderEvent
virtual SSMRESULT stopObserveResource(IN ISSMResource *pSensor) = 0;
};
-static const OID OID_IResourceConnectivity = { 0x8e42b098, 0x9aa5, 0x43f3, { 0x84, 0xa, 0x21, 0x44, 0xc9, 0x4c, 0xc7, 0x99 } };
-class IResourceConnectivity : public IBase
-{
- public:
- virtual void *getPlatform() = 0;
-};
-
/**
* @class ISoftSensorManager
* @brief ISoftSensorManager Interface
+/******************************************************************
+*
+* Copyright 2014 Samsung Electronics All Rights Reserved.
+*
+*
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+******************************************************************/
#include "ThreadManager.h"
CSimpleMutex::CSimpleMutex()
SSM_CLEANUP_ASSERT(m_pContextRepository->registerResourceFinderEvent(this));
- SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_IResponseReactor, (IBase **)&m_pResponseReactor));
+ SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_ISensingEngine, (IBase **)&m_pSensingEngine));
SSM_CLEANUP_ASSERT(initializeEngine());
std::vector<ISSMResource *> contextModelList;
std::stringstream sstream;
- m_pResponseReactor->getList(&contextModelList);
+ m_pSensingEngine->getList(&contextModelList);
for (std::vector<ISSMResource *>::iterator itor = contextModelList.begin();
itor != contextModelList.end(); ++itor)
{
return res;
}
-SSMRESULT CPropagationEngine::installResponseReactor(IN IResponseReactor *pResponseReactor)
+SSMRESULT CPropagationEngine::installCurrentSensors()
{
SSMRESULT res = SSM_E_FAIL;
std::vector<ISSMResource *> contextModelList;
- pResponseReactor->getList(&contextModelList);
+ m_pSensingEngine->getList(&contextModelList);
for (std::vector<ISSMResource *>::iterator itor = contextModelList.begin();
itor != contextModelList.end(); ++itor)
SSM_CLEANUP_ASSERT(updateDeviceInfo(&ssmResource, NULL));
- SSM_CLEANUP_ASSERT(installResponseReactor(m_pResponseReactor));
+ SSM_CLEANUP_ASSERT(installCurrentSensors());
CLEANUP:
SAFE_RELEASE(pRootModel);
{
case IContextModel::STATUS_ACTIVATE:
pModel->addRef();
- m_pResponseReactor->registerContext(SSM_REPEAT, pSSMResource, (CContextModel *)pModel);
+ m_pSensingEngine->registerContext(SSM_REPEAT, pSSMResource, (CContextModel *)pModel);
break;
case IContextModel::STATUS_DEACTIVATE:
- m_pResponseReactor->unregisterContext(SSM_REPEAT, pSSMResource, (CContextModel *)pModel);
+ m_pSensingEngine->unregisterContext(SSM_REPEAT, pSSMResource, (CContextModel *)pModel);
//pModel->CleanUpModelData();
pModel->release();
break;
case IContextModel::STATUS_START_READ_VALUE:
//Model must be released from OnEvent callType
pModel->addRef();
- m_pResponseReactor->registerContext(SSM_ONCE, pSSMResource, (CContextModel *)pModel);
+ m_pSensingEngine->registerContext(SSM_ONCE, pSSMResource, (CContextModel *)pModel);
break;
case IContextModel::STATUS_STOP_READ_VALUE:
CSimpleMutex m_mtxContextModelList;
CSimpleMutex m_mtxLookUpList;
- CObjectPtr<IResponseReactor> m_pResponseReactor;
+ CObjectPtr<ISensingEngine> m_pSensingEngine;
CObjectPtr<IContextModel> m_pDeviceModel;
SSMRESULT addResourceFromGetList();
//TODO: Install Context model from SSMResource
- SSMRESULT installContextModelFromISSMResource(IN ISSMResource *pSSMResource);
+ SSMRESULT installCurrentSensors();
- SSMRESULT installResponseReactor(IN IResponseReactor *pResponseReactor);
+ SSMRESULT installContextModelFromISSMResource(IN ISSMResource *pSSMResource);
SSMRESULT installContextModel(IN IContextModel *pParentModel,
IN IContextModel::ConstructionType constructionType,
std::stringstream sstream;
// QueryEngine Id
- queryEventResult["queryEngineId"].push_back(m_queryEngineId);
+ queryEventResult["queryEngineId"] = m_queryEngineId;
// CQID
sstream << cqid;
- queryEventResult["CQID"].push_back(sstream.str());
+ queryEventResult["CQID"] = sstream.str();
sstream.str("");
pResult->getAffectedModels(&affectedModels);
// Affected Model Count
sstream << affectedModels.size();
- queryEventResult["modelCount"].push_back(sstream.str());
+ queryEventResult["modelCount"] = sstream.str();
sstream.str("");
//TODO: we assume that contains only one model at time
{
// Model Name
sstream << (*itor);
- queryEventResult["modelName"].push_back(sstream.str());
+ queryEventResult["modelName"] = sstream.str();
sstream.str("");
pResult->getModelDataCount(*itor, &dataCount);
// Data Count
sstream << dataCount;
- queryEventResult["dataCount"].push_back(sstream.str());
+ queryEventResult["dataCount"] = sstream.str();
sstream.str("");
//FixME: we have to support multiple data count
// Data Id
sstream << pModelData->getDataId();
- queryEventResult["dataId"].push_back(sstream.str());
+ queryEventResult["dataId"] = sstream.str();
sstream.str("");
// Property Count
sstream << pModelData->getPropertyCount();
- queryEventResult["propertyCount"].push_back(sstream.str());
+ queryEventResult["propertyCount"] = sstream.str();
sstream.str("");
for (int j = 0; j < pModelData->getPropertyCount(); j++)
{
// Property Name & Value
sstream << pModelData->getPropertyValue(j).c_str();
- queryEventResult[pModelData->getPropertyName(j).c_str()].push_back(sstream.str());
+ queryEventResult[pModelData->getPropertyName(j).c_str()] = sstream.str();
sstream.str("");
}
}
}
g_vecQueryEventResults.push_back(queryEventResult);
- OCPlatform::notifyObservers(m_hSSMResource);
+
+ //TODO: need to modify for notifying proper clients
+ OCPlatform::notifyAllObservers(m_hSSMResource);
return SSM_S_OK;
}
SSMResourceServer::SSMResourceServer()
{
- m_pPlatform = NULL;
m_hSSMResource = NULL;
}
int SSMResourceServer::initializeManager(std::string &xmlDescription)
{
SSMRESULT res = SSM_E_FAIL;
- CObjectPtr < IResourceConnectivity > pResourceConnectivity;
SSM_CLEANUP_ASSERT(InitializeSSMCore(xmlDescription));
SSM_CLEANUP_ASSERT(StartSSMCore());
- SSM_CLEANUP_ASSERT(
- CreateGlobalInstance(OID_IResourceConnectivity, (IBase **) &pResourceConnectivity));
-
- m_pPlatform = (OC::OCPlatform *) pResourceConnectivity->getPlatform();
-
if (createResource() != 0)
{
SSM_CLEANUP_ASSERT (SSM_E_FAIL);
int SSMResourceServer::createResource()
{
std::string resourceURI = "/service/SoftSensorManager"; // URI of the resource
- std::string resourceTypeName =
- "core.SoftSensorManager"; // resource type name. In this case, it is light
+ std::string resourceTypeName = "core.SoftSensorManager"; // resource type name.
std::string resourceInterface = DEFAULT_INTERFACE; // resource interface.
// OCResourceProperty is defined ocstack.h
uint8_t resourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
// This will internally create and register the resource.
- OCStackResult result = m_pPlatform->registerResource(m_hSSMResource, resourceURI,
+ OCStackResult result = OCPlatform::registerResource(m_hSSMResource, resourceURI,
resourceTypeName, resourceInterface,
std::bind(&SSMResourceServer::entityHandler, this, std::placeholders::_1,
std::placeholders::_2), resourceProperty);
return 0;
}
-void SSMResourceServer::entityHandler(std::shared_ptr< OCResourceRequest > request,
- std::shared_ptr< OCResourceResponse > response)
+OCEntityHandlerResult SSMResourceServer::entityHandler(std::shared_ptr< OCResourceRequest > request,
+ std::shared_ptr< OCResourceResponse > response)
{
SSMRESULT res = SSM_E_FAIL;
{
// Get the request type and request flag
std::string requestType = request->getRequestType();
- RequestHandlerFlag requestFlag = request->getRequestHandlerFlag();
+ int requestFlag = request->getRequestHandlerFlag();
- if (requestFlag == RequestHandlerFlag::InitFlag)
+ if (requestFlag & RequestHandlerFlag::InitFlag)
{
// entity handler to perform resource initialization operations
}
- else if (requestFlag == RequestHandlerFlag::RequestFlag)
+
+ if (requestFlag & RequestHandlerFlag::RequestFlag)
{
+ cout << "\t\trequestFlag : Request\n";
+
// If the request type is GET
if (requestType == "GET")
{
AttributeMap responseAttributeMap;
// Process query params and do required operations ..
- if (requestAttributeMap["command"].back() == "CreateQueryEngine")
+ if (requestAttributeMap["command"] == "CreateQueryEngine")
{
CQueryEngineEvent *queryEngineEvent = NULL;
if (res != SSM_S_OK)
{
- responseAttributeMap["error"].push_back("CreateQueryEngine failed");
+ responseAttributeMap["error"] = "CreateQueryEngine failed";
goto CLEANUP;
}
if (queryEngineEvent == NULL)
{
- responseAttributeMap["error"].push_back(
- "QueryEngineEvent create failed");
+ responseAttributeMap["error"] =
+ "QueryEngineEvent create failed";
goto CLEANUP;
}
if (res != SSM_S_OK)
{
- responseAttributeMap["error"].push_back("RegisterQueryEvent failed");
+ responseAttributeMap["error"] = "RegisterQueryEvent failed";
goto CLEANUP;
}
- responseAttributeMap["queryEngineId"].push_back(sstream.str());
+ responseAttributeMap["queryEngineId"] = sstream.str();
}
- else if (requestAttributeMap["command"].back() == "ReleaseQueryEngine")
+ else if (requestAttributeMap["command"] == "ReleaseQueryEngine")
{
pQueryEngine = (IQueryEngine *) stoi(
- requestAttributeMap["queryEngineId"].back());
+ requestAttributeMap["queryEngineId"]);
ReleaseQueryEngine(pQueryEngine);
}
- else if (requestAttributeMap["command"].back() == "ExecuteContextQuery")
+ else if (requestAttributeMap["command"] == "ExecuteContextQuery")
{
int CQID = 0;
pQueryEngine = (IQueryEngine *) stoi(
- requestAttributeMap["queryEngineId"].back());
+ requestAttributeMap["queryEngineId"]);
res = pQueryEngine->executeContextQuery(
- requestAttributeMap["contextQuery"].back(), &CQID);
+ requestAttributeMap["contextQuery"], &CQID);
if (res != SSM_S_OK)
{
- responseAttributeMap["error"].push_back("ExecuteContextQuery failed");
+ responseAttributeMap["error"] = "ExecuteContextQuery failed";
goto CLEANUP;
}
sstream << CQID;
- responseAttributeMap["CQID"].push_back(sstream.str());
+ responseAttributeMap["CQID"] = sstream.str();
}
- else if (requestAttributeMap["command"].back() == "KillContextQuery")
+ else if (requestAttributeMap["command"] == "KillContextQuery")
{
pQueryEngine = (IQueryEngine *) stoi(
- requestAttributeMap["queryEngineId"].back());
+ requestAttributeMap["queryEngineId"]);
- res = pQueryEngine->killContextQuery(stoi(requestAttributeMap["CQID"].back()));
+ res = pQueryEngine->killContextQuery(stoi(requestAttributeMap["CQID"]));
if (res != SSM_S_OK)
{
- responseAttributeMap["error"].push_back("KillContextQuery failed");
+ responseAttributeMap["error"] = "KillContextQuery failed";
goto CLEANUP;
}
}
// DELETE request operations
}
}
- else if (requestFlag == RequestHandlerFlag::ObserverFlag)
+
+ if (requestFlag & RequestHandlerFlag::ObserverFlag)
{
// perform observe related operations on the resource.
}
}
- else
- {
- }
+
+ return OC_EH_OK;
}
int initializeManager(std::string &xmlDescription);
int terminateManager();
- void entityHandler(std::shared_ptr< OC::OCResourceRequest > request,
- std::shared_ptr< OC::OCResourceResponse > response);
+ OCEntityHandlerResult entityHandler(std::shared_ptr< OC::OCResourceRequest > request,
+ std::shared_ptr< OC::OCResourceResponse > response);
private:
- OC::OCPlatform *m_pPlatform;
OCResourceHandle m_hSSMResource;
int createResource();
};
#include "QueryProcessor/ConditionedModel.h"
#include "QueryProcessor/EvaluationEngine.h"
#include "QueryProcessor/PropagationEngine.h"
-#include "SensorProcessor/ResponseReactor.h"
+#include "SensorProcessor/SensingEngine.h"
#include "SensorProcessor/ContextExecutor.h"
#include "SensorProcessor/ContextDataReader.h"
#include "SensorProcessor/ResourceFinder.h"
-#include "SensorProcessor/ResourceConnectivity.h"
inline bool operator<( const OID &lhs, const OID &rhs )
{
}
SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_IContextRepository, (IBase **)&m_pContextRepository));
- SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_IResponseReactor, (IBase **)&m_pResponseReactor));
- m_pContextRepository->setCurrentDeviceInfo(name, type, pathSoftSensors, pathDescription);
+ SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_ISensingEngine, (IBase **)&m_pSensingEngine));
+ SSM_CLEANUP_ASSERT(m_pContextRepository->initRepository(name, type, pathSoftSensors,
+ pathDescription));
SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_IPropagationEngine, (IBase **)&m_pPropagationEngine));
SSMRESULT CSoftSensorManager::getInstalledModelList(OUT std::vector<ISSMResource *> *pList)
{
- m_pResponseReactor->getList(pList);
+ m_pSensingEngine->getList(pList);
return SSM_S_OK;
}
SSM_CLEANUP_ASSERT(CreateInstance(OID_IContextDataReader, ppvObject));
}
}
- else if (IsEqualOID(OID_IResponseReactor, objectID))
+ else if (IsEqualOID(OID_ISensingEngine, objectID))
{
- if (g_globalInstance->find(OID_IResponseReactor) == g_globalInstance->end())
+ if (g_globalInstance->find(OID_ISensingEngine) == g_globalInstance->end())
{
- SSM_CLEANUP_ASSERT(CreateInstance(OID_IResponseReactor, ppvObject));
- }
- }
- else if (IsEqualOID(OID_IResourceConnectivity, objectID))
- {
- if (g_globalInstance->find(OID_IResourceConnectivity) == g_globalInstance->end())
- {
- SSM_CLEANUP_ASSERT(CreateInstance(OID_IResourceConnectivity, ppvObject));
+ SSM_CLEANUP_ASSERT(CreateInstance(OID_ISensingEngine, ppvObject));
}
}
else
{
SSM_CLEANUP_ASSERT(CreateNewObject<CContextRepository>(objectID, ppObject));
}
- else if (IsEqualOID(OID_IResponseReactor, objectID))
+ else if (IsEqualOID(OID_ISensingEngine, objectID))
{
- SSM_CLEANUP_ASSERT(CreateNewObject<CResponseReactor>(objectID, ppObject));
+ SSM_CLEANUP_ASSERT(CreateNewObject<CSensingEngine>(objectID, ppObject));
}
else if (IsEqualOID(OID_IContextExecutor, objectID))
{
{
SSM_CLEANUP_ASSERT(CreateNewObject<CContextDataReader>(objectID, ppObject));
}
- else if (IsEqualOID(OID_IResourceConnectivity, objectID))
- {
- SSM_CLEANUP_ASSERT(CreateNewObject<CResourceConnectivity>(objectID, ppObject));
- }
CLEANUP:
return res;
private:
CObjectPtr<IContextRepository> m_pContextRepository;
CObjectPtr<IPropagationEngine> m_pPropagationEngine;
- CObjectPtr<IResponseReactor> m_pResponseReactor;
+ CObjectPtr<ISensingEngine> m_pSensingEngine;
public:
SSMRESULT finalConstruct();
m_pContextDataReader->getContextData(modelName, startIndex, count, data, pLastIndex);
}
-std::string CContextExecutor::checkError(std::vector<ContextData> data)
-{
- std::string errorMsg = "OK";
-
- for (unsigned int i = 0 ; i < data.size() ; ++i)
- {
- if (data[i].outputProperty[0].find("error") != data[i].outputProperty[0].end())
- {
- errorMsg = data[i].outputProperty[0].find("error")->second ;
- break;
- }
- }
-
- return errorMsg;
-}
-
void CContextExecutor::registerContext(TypeofEvent callType, ISSMResource *pSSMResource,
IEvent *pEvent)
{
std::string primitiveSensor)
{
//check m_relatedSoftSensor / apply timestamp
- std::map<std::string, std::vector<ContextData> > returnData;
SSMRESULT ret = SSM_E_FAIL;
+ std::map<std::string, std::vector<ContextData> > returnData;
+ std::vector<ContextData> contextDataList;
+
for (unsigned int i = 0; i < m_relatedSoftSensor[primitiveSensor].size(); ++i)
{
std::string softSensorName = m_relatedSoftSensor[primitiveSensor][i];
{
ret = SSM_S_OK;
std::vector<std::string> inputList = m_registeredResources[softSensorName]->inputList;
- std::vector<ContextData> contextDataList;
for (unsigned int j = 0; j < inputList.size(); j++) //check all "inputlist" arrived or not
{
if (m_storedPrimitiveSensorData.find(inputList[j]) == m_storedPrimitiveSensorData.end())
{
+ //Still we have partial data
ret = SSM_E_FAIL;
break;
}
else
{
- std::vector<ContextData> primitiveSensorData = m_storedPrimitiveSensorData[inputList[j]];
- for (unsigned k = 0; k < primitiveSensorData.size(); k++)
+ //Copy all properties of current primitiveSensor data to outputs
+ for (std::vector<ContextData>::iterator itor = m_storedPrimitiveSensorData[inputList[j]].begin();
+ itor != m_storedPrimitiveSensorData[inputList[j]].end(); ++itor)
{
- contextDataList.push_back(primitiveSensorData[k]);
+ contextDataList.push_back(*itor);
}
}
}
+ //We have all inputs
if (ret == SSM_S_OK)
{
returnData.insert(std::make_pair(softSensorName, contextDataList));
//find soft sensor
std::map<std::string, std::vector<ContextData> > readyContextList = getPreparedContextList(type);
- if (readyContextList.size() > 0)
+ //Run SoftSensor! readyContextList has all data for run
+ std::map<std::string, std::vector<ContextData> >::iterator iter;
+ for (iter = readyContextList.begin(); iter != readyContextList.end(); ++iter)
{
- //Run SoftSensor! readyContextList has all data for run
- std::map<std::string, std::vector<ContextData> >::iterator iter = readyContextList.begin();
- for (; iter != readyContextList.end(); ++iter)
- {
- std::string softSensorName = iter->first;
- std::vector<ContextData> inputData = iter->second;
- std::string errorMsg = checkError(inputData);
+ std::string softSensorName = iter->first;
+ std::vector<ContextData> inputData = iter->second;
- if (!errorMsg.compare("OK"))
- {
- runLogic(inputData, softSensorName);
- }
- else
- {
- inputData.clear();
- inputData.push_back(makeErrorContextData(softSensorName, errorMsg));
- addOutput(inputData);
- }
- }
+ runLogic(inputData, softSensorName);
}
}
else //This data is primitive
m_ctxEventList[softSensor]->onCtxEvent(SPF_START, inputData);
}
m_mtxLibraryIO.unlock();
-}
-
-ContextData CContextExecutor::makeErrorContextData(std::string rootName, std::string errMsg)
-{
- std::map<std::string, std::string> errorMap;
- ContextData errorContextData;
-
- errorMap.insert(std::make_pair("error", errMsg));
- errorMap.insert(std::make_pair("available", "false"));
- errorContextData.rootName = rootName;
- errorContextData.outputPropertyCount = 2;
- errorContextData.outputProperty.push_back(errorMap);
-
- return errorContextData;
}
\ No newline at end of file
std::map<std::string, std::vector<ContextData> > getPreparedContextList(
IN std::string primitiveSensor);
void runLogic(IN std::vector<ContextData> inputData, IN std::string softSensor);
- ContextData makeErrorContextData(IN std::string rootName, IN std::string errMsg);
- std::string checkError(IN std::vector<ContextData> data);
-
};
#endif
{
}
-void CContextRepository::setCurrentDeviceInfo(IN std::string name, IN std::string type,
+SSMRESULT CContextRepository::initRepository(IN std::string name, IN std::string type,
IN std::string pathSoftSensors, IN std::string pathDescription)
{
- //TODO: Someone need to provides a way to generate permanent uuid function
- /*
- m_currentDeviceInfo.friendlyName = name;
- //m_currentDeviceInfo.ID="2fac1234-31f8-11b4-a222-08002b34c003";
- m_currentDeviceInfo.ID = udn;
- m_currentDeviceInfo.IPAddress = "127.0.0.1";
- m_currentDeviceInfo.tp = tp;
- //m_currentDeviceInfo.type = SSM_DEVICE_MOBILE;
- m_currentDeviceInfo.type = td;
- */
+ SSMRESULT res = SSM_E_FAIL;
+
+ std::vector<DictionaryData> dict;
+
m_name = name;
m_type = type;
m_pathSoftSensors = pathSoftSensors;
m_pathSoftSensorsDescription = pathDescription;
+
+ SSM_CLEANUP_ASSERT(loadXMLFromFile(m_pathSoftSensorsDescription.c_str(), &dict));
+ SSM_CLEANUP_ASSERT(makeSSMResourceListForDictionaryData(dict, &m_lstSoftSensor));
+
+CLEANUP:
+ return res;
}
SSMRESULT CContextRepository::loadXMLFromString(char *xmlData,
keyStr = subItem->name(); // key
valueStr = subItem->value(); // value
- if (!keyStr.compare("root_name"))
+ if (!keyStr.compare("name"))
{
dictionaryData.rootName = trim_both(valueStr);
}
keyStr = subItem2->name(); // key
valueStr = subItem2->value(); // value
- if (!keyStr.compare("attribute_property_count"))
- {
- dictionaryData.attributePropertyCount = trim_both(valueStr);
- }
- else if (!keyStr.compare("output_property_count"))
- {
- dictionaryData.outputPropertyCount = trim_both(valueStr);
- }
- if (!keyStr.compare("inputs_count"))
- {
- dictionaryData.inputCount = trim_both(valueStr);
- }
- else if (!keyStr.compare("app_inputs_count"))
- {
- dictionaryData.appInputCount = trim_both(valueStr);
- }
- else if (!keyStr.compare("app_input"))
- {
- dictionaryData.appInputs.push_back(trim_both(valueStr));
- }
- else if (!keyStr.compare("input"))
+ if (!keyStr.compare("input"))
{
dictionaryData.inputs.push_back(trim_both(valueStr));
}
////std::cout<<name << " :: " << subItem2->value() <<std::endl<<std::endl;
for (subItem3 = subItem2->first_node(); subItem3 ; subItem3 = subItem3->next_sibling())
{
-
std::string newKeyStr = subItem3->name(); // key
valueStr = subItem3->value(); // value
- if (!keyStr.compare("attribute_property") || !keyStr.compare("output_property") )
- {
- propertyMap.insert(std::make_pair(trim_both(newKeyStr), trim_both(valueStr))) ;
- }
- else if (!keyStr.compare("enter_condition"))
+ if (!keyStr.compare("attribute") || !keyStr.compare("output") )
{
- enterconditionVector.push_back(trim_both(valueStr));
+ propertyMap.insert(std::make_pair(trim_both(newKeyStr), trim_both(valueStr)));
}
}
- if (!keyStr.compare("attribute_property"))
+ if (!keyStr.compare("attribute"))
{
dictionaryData.attributeProperty.push_back(propertyMap);
}
- else if (!keyStr.compare("output_property"))
+ else if (!keyStr.compare("output"))
{
dictionaryData.outputProperty.push_back(propertyMap);
}
- else if (!keyStr.compare("enter_condition"))
- {
- dictionaryData.enterConditions.push_back(enterconditionVector);
- }
}
}
//for accurate data.
SSMRESULT CContextRepository::getSoftSensorList(OUT std::vector<ISSMResource *> *pSoftSensorList)
{
- SSMRESULT res = SSM_E_FAIL;
- std::vector<DictionaryData> dict;
-
- SSM_CLEANUP_ASSERT(loadXMLFromFile(m_pathSoftSensorsDescription.c_str(), &dict));
-
- SSM_CLEANUP_ASSERT(makeSSMResourceListForDictionaryData(dict, pSoftSensorList));
+ for (size_t i = 0; i < m_lstSoftSensor.size(); i++)
+ {
+ pSoftSensorList->push_back(m_lstSoftSensor.at(i));
+ }
-CLEANUP:
- return res;
+ return SSM_S_OK;
}
SSMRESULT CContextRepository::getPrimitiveSensorList(OUT std::vector<ISSMResource *>
*pPrimitiveSensorList)
{
- for (size_t i = 0; i < m_lstSensor.size(); i++)
+ for (size_t i = 0; i < m_lstPrimitiveSensor.size(); i++)
{
- pPrimitiveSensorList->push_back(m_lstSensor.at(i));
+ pPrimitiveSensorList->push_back(m_lstPrimitiveSensor.at(i));
}
return SSM_S_OK;
SSMRESULT CContextRepository::onResourceFound(IN ISSMResource *pSensor)
{
- m_lstSensor.push_back(pSensor);
+ m_lstPrimitiveSensor.push_back(pSensor);
for (size_t i = 0; i < m_resourceEvents.size(); i++)
{
SSMRESULT CContextRepository::onResourceLost(IN ISSMResource *pSensor)
{
std::vector<ISSMResource *>::iterator itor;
- itor = std::find(m_lstSensor.begin(), m_lstSensor.end(), pSensor);
+ itor = std::find(m_lstPrimitiveSensor.begin(), m_lstPrimitiveSensor.end(), pSensor);
- if (itor != m_lstSensor.end())
+ if (itor != m_lstPrimitiveSensor.end())
{
- m_lstSensor.erase(itor);
+ m_lstPrimitiveSensor.erase(itor);
return SSM_S_OK;
}
{
private:
CSimpleMutex m_mtxFileIO;
- std::vector<ISSMResource *> m_lstSensor;
+ std::vector<ISSMResource *> m_lstPrimitiveSensor;
+ std::vector<ISSMResource *> m_lstSoftSensor;
CObjectPtr<IResourceFinder> m_resourceFinder;
std::string m_name;
std::string m_type;
/**
- * @fn setCurrentDeviceInfo
- * @brief set device information
+ * @fn initRepository
+ * @brief initialize repository using given info
*
* @param [in] std::string name - Device name
* @param [in] std::string type - Device Type
* @param [in] std::string pathSoftSensors - SoftSensors Repository path
* @param [in] std::string pathDescription - SoftSensors Description path
- * @return void
+ * @return SSMRESULT
*
* @warning
* @exception
* @see
*/
- void setCurrentDeviceInfo(IN std::string name, IN std::string type, IN std::string pathSoftSensors,
- IN std::string pathDescription);
+ SSMRESULT initRepository(IN std::string name, IN std::string type, IN std::string pathSoftSensors,
+ IN std::string pathDescription);
/**
* @fn getSoftSensorList
+++ /dev/null
-/******************************************************************
-*
-* Copyright 2014 Samsung Electronics All Rights Reserved.
-*
-*
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-******************************************************************/
-#include "ResourceConnectivity.h"
-
-SSMRESULT CResourceConnectivity::finalConstruct()
-{
- SSMRESULT res = SSM_E_FAIL;
- OC::PlatformConfig cfg(OC::ServiceType::InProc, OC::ModeType::Both,
- "134.134.161.33", 56831, OC::QualityOfService::NonConfirmable);
-
- m_pPlatform = new OC::OCPlatform(cfg);
-
- SSM_CLEANUP_NULL_ASSERT(m_pPlatform);
-
- res = SSM_S_OK;
-
-CLEANUP:
- return res;
-}
-
-void CResourceConnectivity::finalRelease()
-{
- SAFE_DELETE(m_pPlatform);
-}
-
-void *CResourceConnectivity::getPlatform()
-{
- return m_pPlatform;
-}
+++ /dev/null
-/******************************************************************
-*
-* Copyright 2014 Samsung Electronics All Rights Reserved.
-*
-*
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*
-******************************************************************/
-#ifndef _ResourceConnectivity_H_
-#define _ResourceConnectivity_H_
-
-#include "SSMInterface/SSMCore.h"
-#include "Common/PlatformLayer.h"
-#include "Common/InternalInterface.h"
-#include "OCPlatform.h"
-
-class CResourceConnectivity :
- public CObjectRoot<CObjectMultiThreadModel>
- , public IResourceConnectivity
-{
- public:
- SSMRESULT queryInterface(const OID &objectID, IBase **ppObject)
- {
- if (ppObject == NULL)
- return SSM_E_POINTER;
-
- if (IsEqualOID(objectID, OID_IResourceConnectivity))
- {
- IBase *pBase = (IResourceConnectivity *)this;
- pBase->addRef();
- *ppObject = pBase;
- return SSM_S_OK;
- }
-
- return SSM_E_NOINTERFACE;
- }
-
- SSMRESULT finalConstruct();
- void finalRelease();
-
- void *getPlatform();
-
- private:
- OC::OCPlatform *m_pPlatform;
-};
-
-#endif
{
SSMRESULT res = SSM_E_FAIL;
+ OC::PlatformConfig cfg(OC::ServiceType::InProc, OC::ModeType::Both,
+ "0.0.0.0", 0, OC::QualityOfService::LowQos);
+
SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_ITasker, (IBase **)&m_pTasker));
- SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_IResourceConnectivity,
- (IBase **)&m_pResourceConnectivity));
+
+ OC::OCPlatform::Configure(cfg);
m_pResourceFinderEvent = NULL;
- m_pPlatform = (OC::OCPlatform *)m_pResourceConnectivity->getPlatform();
CLEANUP:
return res;
pMessage[0] = RESOURCE_DISCOVER_REQUESTPROFILE;
pMessage[1] = (int)new std::shared_ptr<OC::OCResource>(resource);
+ std::string path = resource->host() + resource->uri();
+
m_pTasker->addTask(this, pMessage);
}
}
SSMRESULT CResourceFinder::startResourceFinder()
{
- //m_pPlatform->findResource("", "oc/core/service/SoftSensorManager/SoftSensor",
- m_pPlatform->findResource("", "coap://224.0.1.187/oc/core?rt=SoftSensorManager.Sensor",
- std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
+ OCStackResult res = OC_STACK_ERROR;
+
+ res = OC::OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=SoftSensorManager.Sensor",
+ std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
+
+ if (res != OC_STACK_OK)
+ return SSM_E_FAIL;
return SSM_S_OK;
}
SSM_CLEANUP_ASSERT(pResourceHandler->initHandler(*pResource, this));
m_mapResourceHandler[pResource->get()->host() + pResource->get()->uri()] = pResourceHandler;
pResource->get()->get(queryParams, std::bind(&OICResourceHandler::onGetResourceProfile,
- pResourceHandler, std::placeholders::_1, std::placeholders::_2));
+ pResourceHandler, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
break;
case RESOURCE_DISCOVER_SETUP_RESOURCE:
#include "Common/PlatformLayer.h"
#include "Common/InternalInterface.h"
#include "OCPlatform.h"
+#include "OCApi.h"
class CResourceFinder :
public CObjectRoot<CObjectMultiThreadModel>
m_pResource.get()->observe(OC::ObserveType::Observe, queryParams,
std::bind(&OICResourceHandler::onResourceDataReceived,
- this, std::placeholders::_1, std::placeholders::_2));
+ this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
return SSM_S_OK;
}
return SSM_S_OK;
}
- void onResourceDataReceived(const OC::OCRepresentation &representation, const int &eCode)
+ void onResourceDataReceived(const OC::HeaderOptions headerOptions,
+ const OC::OCRepresentation &representation,
+ const int &eCode, const int &sequenceNumber)
{
if (eCode == 0)
{
{
for (size_t i = 0; i < attributeMap.size() / 3; i++)
{
- outputProperty["name"] = attributeMap.find(std::to_string(i * 3))->second.front();
- outputProperty["type"] = attributeMap.find(std::to_string(i * 3 + 1))->second.front();
- outputProperty["value"] = attributeMap.find(std::to_string(i * 3 + 2))->second.front();
+ outputProperty["name"] = attributeMap.find(std::to_string(i * 3))->second;
+ outputProperty["type"] = attributeMap.find(std::to_string(i * 3 + 1))->second;
+ outputProperty["value"] = attributeMap.find(std::to_string(i * 3 + 2))->second;
ctxData.outputProperty.push_back(outputProperty);
}
}
}
- void onGetResourceProfile(const OC::OCRepresentation &representation, const int &eCode)
+ void onGetResourceProfile(const OC::HeaderOptions &headerOptions,
+ const OC::OCRepresentation &representation, const int &eCode)
{
//unpack attributeMap
};
enum RESOURCE_DISCOVER_STATE {RESOURCE_DISCOVER_REQUESTPROFILE, RESOURCE_DISCOVER_SETUP_RESOURCE};
- OC::OCPlatform *m_pPlatform;
- CObjectPtr<IResourceConnectivity> m_pResourceConnectivity;
IResourceFinderEvent *m_pResourceFinderEvent;
CObjectPtr<ITasker> m_pTasker;
std::map<std::string , OICResourceHandler *> m_mapResourceHandler;
* limitations under the License.
*
******************************************************************/
-#include "ResponseReactor.h"
+#include "SensingEngine.h"
-SSMRESULT CResponseReactor::finalConstruct()
+SSMRESULT CSensingEngine::finalConstruct()
{
SSMRESULT res = SSM_S_OK;
return res;
}
-void CResponseReactor::finalRelease()
+void CSensingEngine::finalRelease()
{
}
-void CResponseReactor::registerContext(TypeofEvent callType, ISSMResource *pSSMResource,
- IEvent *pEvent)
+SSMRESULT CSensingEngine::registerContext(TypeofEvent callType, ISSMResource *pSSMResource,
+ IEvent *pEvent)
{
m_mtxRequestedContextData.lock();
// if already exists
m_pContextExecutor->registerContext(callType, pSSMResource, this);
m_mtxRequestedContextData.unlock();
+
+ return SSM_S_OK;
}
-void CResponseReactor::unregisterContext(TypeofEvent callType, ISSMResource *pSSMResource,
+SSMRESULT CSensingEngine::unregisterContext(TypeofEvent callType, ISSMResource *pSSMResource,
IEvent *pEvent)
{
m_mtxUnregisterContext.lock();
}
m_mtxUnregisterContext.unlock();
+
+ return SSM_S_OK;
}
-void CResponseReactor::getList(std::vector<ISSMResource *> *pList)
+SSMRESULT CSensingEngine::getList(std::vector<ISSMResource *> *pList)
{
pList->clear();
m_pContextRepository->getSoftSensorList(pList);
m_pContextRepository->getPrimitiveSensorList(pList);
+
+ return SSM_S_OK;
}
//Dispatch to upper layer
-int CResponseReactor::onEvent(std::string type, TypeofEvent callType,
- std::vector<ContextData> ctxData)
+int CSensingEngine::onEvent(std::string type, TypeofEvent callType,
+ std::vector<ContextData> ctxData)
{
std::map<std::string, CallbackData >::iterator itor;
#include "SSMInterface/SSMCore.h"
#include "Common/PlatformLayer.h"
-
-//temp include
-#include "ContextRepository.h"
-#include "ContextExecutor.h"
+#include "Common/InternalInterface.h"
/**
- * @class CResponseReactor
- * @brief Class for implement of reactor pattern
- * Delegate requested context to context executor layer.
+ * @class CSensingEngine
+ * @brief Class for implementing main abstration of SensorProcessor
*
*
* @see
*/
-class CResponseReactor :
+class CSensingEngine :
public CObjectRoot<CObjectMultiThreadModel>
- , public IResponseReactor
+ , public ISensingEngine
{
private:
CObjectPtr<IContextRepository> m_pContextRepository;
CSimpleMutex m_mtxUnregisterContext;
public:
-
SSMRESULT finalConstruct();
void finalRelease();
if (ppObject == NULL)
return SSM_E_POINTER;
- if (IsEqualOID(objectID, OID_IResponseReactor))
+ if (IsEqualOID(objectID, OID_ISensingEngine))
{
IBase *pBase = this;
pBase->addRef();
* @param [in] ISSMResource *pSSMResource - Requested context model resource.
* @param [in] IEvent *pEvent - IEvent class for callback.
*
- * @return void
+ * @return SSMRESULT
*
* @warning
* @exception
* @see
*/
- void registerContext(IN TypeofEvent callType, IN ISSMResource *pSSMResource, IN IEvent *pEvent);
+ SSMRESULT registerContext(IN TypeofEvent callType, IN ISSMResource *pSSMResource,
+ IN IEvent *pEvent);
/**
* @fn unregisterContext
* @param [in] ISSMResource *pSSMResource - Requested context model resource.
* @param [in] IEvent *pEvent - IEvent class for callback.
*
- * @return void
+ * @return SSMRESULT
*
* @warning
* @exception
* @see
*/
- void unregisterContext(IN TypeofEvent callType, IN ISSMResource *pSSMResource, IN IEvent *pEvent);
+ SSMRESULT unregisterContext(IN TypeofEvent callType, IN ISSMResource *pSSMResource,
+ IN IEvent *pEvent);
/**
* @fn getList
*
* @param [out] std::vector<ISSMResource> *pList - ISSMResource vector of low level context models or high level context models.
*
- * @return void
+ * @return SSMRESULT
*
* @warning
* @exception
* @see
*/
- virtual void getList(OUT std::vector<ISSMResource *> *pList);
+ SSMRESULT getList(OUT std::vector<ISSMResource *> *pList);
/**
* @fn onEvent
*/
int onEvent(IN std::string name, IN TypeofEvent callType, IN std::vector<ContextData> ctxData);
};
-
-
-#endif
+#endif
\ No newline at end of file
-
+-include ../../build/linux/root_path.inc
-include ../../build/linux/environment.mk
MAKE=make
-
+-include ../../../../build/linux/root_path.inc
-include ../../../../build/linux/environment.mk
BOOST=${BOOST_BASE}
RST_NAME=release
# Insert your project name.
-TARGET=ClientApp
+TARGET=SSMTesterApp
CXX=g++
CXX_FLAGS=-std=c++0x -Wall -DLINUX
-CXX_INC=-I${SRC_PATH}/ -I${INC_PATH}/ -I${OUTPUTS_DIR} -I${IOT_BASE}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
+CXX_INC=-I${SRC_PATH}/ -I${INC_PATH}/ -I${OUTPUTS_DIR} -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
+
+CXX_LIB+=${OUTPUTS_DIR}/${SSM_LIB}
+CXX_LIB+=${OUTPUTS_DIR}/${SSMCORE_LIB}
CXX_LIB+=${IOT_RELEASE}/${IOT_LIB}
CXX_LIB+=${IOT_CSDK_RELEASE}/${IOT_CSDK_LIB}
-CXX_LIB+=-lpthread
+CXX_LIB+=${IOT_LOG_DIR}/lib/${IOT_LOG_LIB}
+CXX_LIB+=-lpthread -ldl
SRCLIST=${wildcard ${SRC_PATH}/*.cpp}
OBJPATH=${SRCLIST:.cpp=.o}
pre_job:
@echo " "
- @echo "--------- ClientApp Build Begin. -----------"
+ @echo "--------- ${TARGET} Build Begin. -----------"
@mkdir -p ${RST_NAME}
@echo " "
-${TARGET}: ${OBJLIST} ${OUTPUTS_DIR}/SSMClient.o
+${TARGET}: ${OBJLIST}
$(CXX) $(CXX_FLAGS) -o ./${RST_NAME}/$@ $^ ${CXX_LIB}
@echo " "
post_job:
@echo " "
cp -Rdp ./${RST_NAME}/${TARGET} ${OUTPUTS_DIR}/
- @echo "----------- ClientApp Build Successful. ------------"
+ @echo "----------- ${TARGET} Build Successful. ------------"
@echo "Enter to ${RST_NAME} folder."
@echo " "
{
if (strcmp(itor->first.c_str(), "temperature") == 0)
{
- std::cout << "* Temperature : " << itor->second.front().c_str() << "℃" << std::endl;
+ std::cout << "* Temperature : " << itor->second.c_str() << "℃" << std::endl;
}
else if (strcmp(itor->first.c_str(), "humidity") == 0)
{
- std::cout << "* Humidity : " << itor->second.front().c_str() << "%" << std::endl;
+ std::cout << "* Humidity : " << itor->second.c_str() << "%" << std::endl;
}
else if (strcmp(itor->first.c_str(), "discomfortIndex") == 0)
{
- int DI = std::stoi(itor->second.front().c_str());
+ int DI = std::stoi(itor->second.c_str());
std::cout << "* DiscomfortIndex : " << DI << "%" << std::endl;
-
+-include ../../../../build/linux/root_path.inc
-include ../../../../build/linux/environment.mk
BOOST=${BOOST_BASE}
CXX=g++
CXX_FLAGS=-std=c++0x -Wall -DLINUX
-CXX_INC=-I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
+CXX_INC=-I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
CXX_LIB+=${IOT_RELEASE}/${IOT_LIB}
CXX_LIB+=${IOT_CSDK_RELEASE}/${IOT_CSDK_LIB}
+CXX_LIB+=${IOT_LOG_DIR}/lib/${IOT_LOG_LIB}
CXX_LIB+=-lpthread
SRCLIST=${wildcard ${SRC_PATH}/*.cpp}
pre_job:
@echo " "
- @echo "---------- THSensorApp Build Begin. ------------"
+ @echo "---------- ${TARGET} Build Begin. ------------"
@mkdir -p ${RST_NAME}
@echo " "
post_job:
@echo " "
cp -Rdp ./${RST_NAME}/* ${OUTPUTS_DIR}/
- @echo "----------- THSensorApp Build Successful. -------------"
+ @echo "----------- ${TARGET} Build Successful. -------------"
@echo "Enter to ${RST_NAME} folder."
@echo " "
#include <string>
#include <cstdlib>
-#define COAP_IP "134.134.161.33"
-#define COAP_PORT 56830
+#define COAP_IP "0.0.0.0"
+#define COAP_PORT 0
#define COAP_MODE ModeType::Server
#define COAP_SRVTYPE ServiceType::InProc
/// Access this property from a TB client
int m_humid;
int m_temp;
- string m_resourceUri;
+ std::string m_resourceUri;
+ std::vector<std::string> m_resourceTypes;
+ std::vector<std::string> m_resourceInterfaces;
OCResourceHandle m_resourceHandle;
+ OCRepresentation m_resourceRep;
+ ObservationIds m_interestedObservers;
public:
/// Constructor
TemphumidResource() :
- m_humid(0), m_temp(0), m_resourceUri("/Thing_TempHumSensor"), m_resourceHandle(NULL)
+ m_humid(0), m_temp(0)
{
+ m_resourceUri = "/Thing_TempHumSensor";
+ m_resourceTypes.push_back(COAP_TYPE_NAME);
+ m_resourceInterfaces.push_back(DEFAULT_INTERFACE);
+
+ printf("Running thing as %s\n", m_resourceUri.c_str());
+ m_resourceRep.setUri(m_resourceUri);
+ m_resourceRep.setResourceTypes(m_resourceTypes);
+ m_resourceRep.setResourceInterfaces(m_resourceInterfaces);
}
~TemphumidResource()
{
}
- void registerResource(OC::OCPlatform &platform);
+ void registerResource();
OCResourceHandle getHandle();
- void setRepresentation(AttributeMap &attributeMap);
+ void setResourceRepresentation(OCRepresentation &rep);
- void getRepresentation(AttributeMap &attributeMap);
+ OCRepresentation getResourceRepresentation();
};
#endif /* THINGRESOURCESERVER_H_ */
int g_Observation = 0;
-void entityHandler(std::shared_ptr< OCResourceRequest > request,
- std::shared_ptr< OCResourceResponse > response);
+OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request,
+ std::shared_ptr< OCResourceResponse > response);
/*
* TempResourceFunctions
*/
-void TemphumidResource::registerResource(OC::OCPlatform &platform)
+void TemphumidResource::registerResource()
{
- string resourceURI = m_resourceUri; // URI of the resource
- string resourceTypeName = COAP_TYPE_NAME; // resource type name.
- string resourceInterface = DEFAULT_INTERFACE; // resource interface.
-
uint8_t resourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
// This will internally create and register the resource.
- OCStackResult result = platform.registerResource(m_resourceHandle, resourceURI,
- resourceTypeName, resourceInterface, &entityHandler, resourceProperty);
+ OCStackResult result = OC::OCPlatform::registerResource(m_resourceHandle, m_resourceUri,
+ m_resourceTypes[0], m_resourceInterfaces[0], &entityHandler, resourceProperty);
if (OC_STACK_OK != result)
{
return m_resourceHandle;
}
-void TemphumidResource::setRepresentation(AttributeMap &attributeMap)
+void TemphumidResource::setResourceRepresentation(OCRepresentation &rep)
{
- cout << "\t\t\t" << "Received representation: " << endl;
- cout << "\t\t\t\t" << "temp: " << attributeMap["temp"][0] << endl;
- cout << "\t\t\t\t" << "humid: " << attributeMap["humid"][0] << endl;
+ int tempHumid;
+ int tempTemp;
+
+ rep.getValue("2", tempTemp);
+ rep.getValue("5", tempHumid);
- m_temp = std::stoi(attributeMap["temp"][0]);
- m_humid = std::stoi(attributeMap["humid"][0]);
+ m_humid = tempHumid;
+ m_temp = tempTemp;
+
+ cout << "\t\t\t" << "Received representation: " << endl;
+ cout << "\t\t\t\t" << "temp: " << m_humid << endl;
+ cout << "\t\t\t\t" << "humid: " << m_temp << endl;
}
-void TemphumidResource::getRepresentation(AttributeMap &attributeMap)
+OCRepresentation TemphumidResource::getResourceRepresentation()
{
- attributeMap["0"].push_back("temperature");
- attributeMap["1"].push_back("int");
-
- attributeMap["2"].push_back(to_string(m_temp));
- attributeMap["3"].push_back("humidity");
- attributeMap["4"].push_back("int");
+ // This representation is temporaily for soft-sensor-management - name, type, vale
+ m_resourceRep.setValue("0", std::string("temperature"));
+ m_resourceRep.setValue("1", std::string("int"));
+ m_resourceRep.setValue("2", std::to_string(m_temp));
+ m_resourceRep.setValue("3", std::string("humidity"));
+ m_resourceRep.setValue("4", std::string("int"));
+ m_resourceRep.setValue("5", std::to_string(m_humid));
- attributeMap["5"].push_back(to_string(m_humid));
+ return m_resourceRep;
}
+// Create the instance of the TemphumidResource class
TemphumidResource g_myResource;
void *TestSensorVal(void *param)
cout << "Notifying observers with resource handle: " << g_myResource.getHandle()
<< endl;
- OCStackResult result = OCPlatform::notifyObservers(g_myResource.getHandle());
+ OCStackResult result = OCPlatform::notifyAllObservers(g_myResource.getHandle());
if (OC_STACK_NO_OBSERVERS == result)
{
return NULL;
}
-void entityHandler(std::shared_ptr< OCResourceRequest > request,
- std::shared_ptr< OCResourceResponse > response)
+OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request,
+ std::shared_ptr< OCResourceResponse > response)
{
cout << "\tIn Server CPP entity handler:\n";
{
// Get the request type and request flag
std::string requestType = request->getRequestType();
- RequestHandlerFlag requestFlag = request->getRequestHandlerFlag();
+ int requestFlag = request->getRequestHandlerFlag();
- if (requestFlag == RequestHandlerFlag::InitFlag)
+ if (requestFlag & RequestHandlerFlag::InitFlag)
{
cout << "\t\trequestFlag : Init\n";
// entity handler to perform resource initialization operations
}
- else if (requestFlag == RequestHandlerFlag::RequestFlag)
+
+ if (requestFlag & RequestHandlerFlag::RequestFlag)
{
cout << "\t\trequestFlag : Request\n";
cout << "\t\t\trequestType : GET\n";
// Check for query params (if any)
- QueryParamsMap queryParamsMap = request->getQueryParameters();
-
// Process query params and do required operations ..
// Get the representation of this resource at this point and send it as response
- OCRepresentation rep = request->getResourceRepresentation();
- AttributeMap attributeMap;
-
- g_myResource.getRepresentation(attributeMap);
+ OCRepresentation rep = g_myResource.getResourceRepresentation();
if (response)
{
// TODO Error Code
- rep.setAttributeMap(attributeMap);
response->setErrorCode(200);
response->setResourceRepresentation(rep, DEFAULT_INTERFACE);
}
// DELETE request operations
}
}
- else if (requestFlag == RequestHandlerFlag::ObserverFlag)
+
+ if (requestFlag & RequestHandlerFlag::ObserverFlag)
{
pthread_t threadId;
{
std::cout << "Request invalid" << std::endl;
}
+
+ return OC_EH_OK;
}
int main()
{
// Create PlatformConfig object
- PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, QualityOfService::NonConfirmable);
+ PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, OC::QualityOfService::LowQos);
try
{
- OCPlatform platform(cfg);
+ OC::OCPlatform::Configure(cfg);
- g_myResource.registerResource(platform);
+ g_myResource.registerResource();
int input = 0;
cout << "Type any key to terminate" << endl;
-
+-include ../../../../build/linux/root_path.inc
-include ../../../../build/linux/environment.mk
BOOST=${BOOST_BASE}
CXX=g++
CXX_FLAGS=-std=c++0x -Wall -DLINUX
-CXX_INC=-I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
+CXX_INC=-I${INC_PATH}/ -I${IOT_BASE}/include/ -I${IOT_LOG_DIR}/include/ -I${IOT_BASE}/csdk/stack/include -I${IOT_BASE}/csdk/ocsocket/include -I${IOT_BASE}/csdk/ocrandom/include -I${IOT_BASE}/csdk/logger/include -I${BOOST}
CXX_LIB+=${IOT_RELEASE}/${IOT_LIB}
CXX_LIB+=${IOT_CSDK_RELEASE}/${IOT_CSDK_LIB}
+CXX_LIB+=${IOT_LOG_DIR}/lib/${IOT_LOG_LIB}
CXX_LIB+=-lpthread
SRCLIST=${wildcard ${SRC_PATH}/*.cpp}
pre_job:
@echo " "
- @echo "---------- THSensorApp Build Begin. ------------"
+ @echo "---------- ${TARGET} Build Begin. ------------"
@mkdir -p ${RST_NAME}
@echo " "
post_job:
@echo " "
cp -Rdp ./${RST_NAME}/* ${OUTPUTS_DIR}/
- @echo "----------- THSensorApp Build Successful. -------------"
+ @echo "----------- ${TARGET} Build Successful. -------------"
@echo "Enter to ${RST_NAME} folder."
@echo " "
#include <string>
#include <cstdlib>
-#define COAP_IP "134.134.161.33"
-#define COAP_PORT 56838
+#define COAP_IP "0.0.0.0"
+#define COAP_PORT 0
#define COAP_MODE ModeType::Server
#define COAP_SRVTYPE ServiceType::InProc
/// Access this property from a TB client
int m_humid;
int m_temp;
- string m_resourceUri;
+ std::string m_resourceUri;
+ std::vector<std::string> m_resourceTypes;
+ std::vector<std::string> m_resourceInterfaces;
OCResourceHandle m_resourceHandle;
+ OCRepresentation m_resourceRep;
+ ObservationIds m_interestedObservers;
public:
/// Constructor
TemphumidResource() :
- m_humid(0), m_temp(0), m_resourceUri("/Thing_TempHumSensor1"), m_resourceHandle(NULL)
+ m_humid(0), m_temp(0)
{
+ m_resourceUri = "/Thing_TempHumSensor1";
+ m_resourceTypes.push_back(COAP_TYPE_NAME);
+ m_resourceInterfaces.push_back(DEFAULT_INTERFACE);
+
+ printf("Running thing as %s\n", m_resourceUri.c_str());
+ m_resourceRep.setUri(m_resourceUri);
+ m_resourceRep.setResourceTypes(m_resourceTypes);
+ m_resourceRep.setResourceInterfaces(m_resourceInterfaces);
}
~TemphumidResource()
{
}
- void registerResource(OC::OCPlatform &platform);
+ void registerResource();
OCResourceHandle getHandle();
- void setRepresentation(AttributeMap &attributeMap);
+ void setResourceRepresentation(OCRepresentation &rep);
- void getRepresentation(AttributeMap &attributeMap);
+ OCRepresentation getResourceRepresentation();
};
#endif /* THINGRESOURCESERVER_H_ */
int g_Observation = 0;
-void entityHandler(std::shared_ptr< OCResourceRequest > request,
- std::shared_ptr< OCResourceResponse > response);
+OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request,
+ std::shared_ptr< OCResourceResponse > response);
/*
- * TempResourceFunctions
- */
+* TempResourceFunctions
+*/
-void TemphumidResource::registerResource(OC::OCPlatform &platform)
+void TemphumidResource::registerResource()
{
- string resourceURI = m_resourceUri; // URI of the resource
- string resourceTypeName = COAP_TYPE_NAME; // resource type name.
- string resourceInterface = DEFAULT_INTERFACE; // resource interface.
-
uint8_t resourceProperty = OC_DISCOVERABLE | OC_OBSERVABLE;
// This will internally create and register the resource.
- OCStackResult result = platform.registerResource(m_resourceHandle, resourceURI,
- resourceTypeName, resourceInterface, &entityHandler, resourceProperty);
+ OCStackResult result = OC::OCPlatform::registerResource(m_resourceHandle, m_resourceUri,
+ m_resourceTypes[0], m_resourceInterfaces[0], &entityHandler, resourceProperty);
if (OC_STACK_OK != result)
{
return m_resourceHandle;
}
-void TemphumidResource::setRepresentation(AttributeMap &attributeMap)
+void TemphumidResource::setResourceRepresentation(OCRepresentation &rep)
{
- cout << "\t\t\t" << "Received representation: " << endl;
- cout << "\t\t\t\t" << "temp: " << attributeMap["temp"][0] << endl;
- cout << "\t\t\t\t" << "humid: " << attributeMap["humid"][0] << endl;
+ int tempHumid;
+ int tempTemp;
+
+ rep.getValue("2", tempTemp);
+ rep.getValue("5", tempHumid);
- m_temp = std::stoi(attributeMap["temp"][0]);
- m_humid = std::stoi(attributeMap["humid"][0]);
+ m_humid = tempHumid;
+ m_temp = tempTemp;
+
+ cout << "\t\t\t" << "Received representation: " << endl;
+ cout << "\t\t\t\t" << "temp: " << m_humid << endl;
+ cout << "\t\t\t\t" << "humid: " << m_temp << endl;
}
-void TemphumidResource::getRepresentation(AttributeMap &attributeMap)
+OCRepresentation TemphumidResource::getResourceRepresentation()
{
- attributeMap["0"].push_back("temperature");
- attributeMap["1"].push_back("int");
-
- attributeMap["2"].push_back(to_string(m_temp));
- attributeMap["3"].push_back("humidity");
- attributeMap["4"].push_back("int");
+ // This representation is temporaily for soft-sensor-management - name, type, vale
+ m_resourceRep.setValue("0", std::string("temperature"));
+ m_resourceRep.setValue("1", std::string("int"));
+ m_resourceRep.setValue("2", std::to_string(m_temp));
+ m_resourceRep.setValue("3", std::string("humidity"));
+ m_resourceRep.setValue("4", std::string("int"));
+ m_resourceRep.setValue("5", std::to_string(m_humid));
- attributeMap["5"].push_back(to_string(m_humid));
+ return m_resourceRep;
}
+// Create the instance of the TemphumidResource class
TemphumidResource g_myResource;
void *TestSensorVal(void *param)
cout << "Notifying observers with resource handle: " << g_myResource.getHandle()
<< endl;
- OCStackResult result = OCPlatform::notifyObservers(g_myResource.getHandle());
+ OCStackResult result = OCPlatform::notifyAllObservers(g_myResource.getHandle());
if (OC_STACK_NO_OBSERVERS == result)
{
return NULL;
}
-void entityHandler(std::shared_ptr< OCResourceRequest > request,
- std::shared_ptr< OCResourceResponse > response)
+OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request,
+ std::shared_ptr< OCResourceResponse > response)
{
cout << "\tIn Server CPP entity handler:\n";
{
// Get the request type and request flag
std::string requestType = request->getRequestType();
- RequestHandlerFlag requestFlag = request->getRequestHandlerFlag();
+ int requestFlag = request->getRequestHandlerFlag();
- if (requestFlag == RequestHandlerFlag::InitFlag)
+ if (requestFlag & RequestHandlerFlag::InitFlag)
{
cout << "\t\trequestFlag : Init\n";
// entity handler to perform resource initialization operations
}
- else if (requestFlag == RequestHandlerFlag::RequestFlag)
+
+ if (requestFlag & RequestHandlerFlag::RequestFlag)
{
cout << "\t\trequestFlag : Request\n";
cout << "\t\t\trequestType : GET\n";
// Check for query params (if any)
- QueryParamsMap queryParamsMap = request->getQueryParameters();
-
// Process query params and do required operations ..
// Get the representation of this resource at this point and send it as response
- OCRepresentation rep = request->getResourceRepresentation();
- AttributeMap attributeMap;
-
- g_myResource.getRepresentation(attributeMap);
+ OCRepresentation rep = g_myResource.getResourceRepresentation();
if (response)
{
// TODO Error Code
- rep.setAttributeMap(attributeMap);
response->setErrorCode(200);
response->setResourceRepresentation(rep, DEFAULT_INTERFACE);
}
// DELETE request operations
}
}
- else if (requestFlag == RequestHandlerFlag::ObserverFlag)
+
+ if (requestFlag & RequestHandlerFlag::ObserverFlag)
{
pthread_t threadId;
if (!startedThread)
{
- pthread_create(&threadId, NULL, TestSensorVal, (void *) NULL);
+ pthread_create(&threadId, NULL, TestSensorVal, (void *)NULL);
startedThread = 1;
}
}
{
std::cout << "Request invalid" << std::endl;
}
+
+ return OC_EH_OK;
}
int main()
{
// Create PlatformConfig object
-
- PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, QualityOfService::NonConfirmable);
+ PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, OC::QualityOfService::LowQos);
try
{
- OCPlatform platform(cfg);
+ OC::OCPlatform::Configure(cfg);
- g_myResource.registerResource(platform);
+ g_myResource.registerResource();
int input = 0;
cout << "Type any key to terminate" << endl;
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(oic)
-
-SET(CMAKE_SHARED_LINKER_FLAGS " -Wl,--as-needed")
-SET(CMAKE_EXE_LINKER_FLAGS " -Wl,--as-needed -Wl,--hash-style=both")
-SET(EX_SERVER "simpleserver")
-SET(EX_CLIENT "simpleclient")
-SET(EX_CLIENTSERVER "simpleclientserver")
-SET(OCTBSTACK "octbstack")
-
-INCLUDE_DIRECTORIES(include)
-INCLUDE_DIRECTORIES(csdk/stack/include)
-INCLUDE_DIRECTORIES(csdk/ocsocket/include)
-INCLUDE_DIRECTORIES(csdk/ocrandom/include)
-INCLUDE_DIRECTORIES(csdk/logger/include)
-INCLUDE_DIRECTORIES(csdk/libcoap-4.1.1)
-INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/boost)
-LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-
-#SET(EXTRA_CXXFLAGS "-std=c++11")
-SET(EXTRA_CXXFLAGS "-g3 -std=c++0x")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
-
-SET(SRCS
- OCLib/OCReflect.cpp
- OCLib/OCPlatform.cpp
- OCLib/OCResource.cpp
- OCLib/OCUtilities.cpp
- OCLib/InProcServerWrapper.cpp
- OCLib/InProcClientWrapper.cpp)
-ADD_LIBRARY(${PROJECT_NAME} STATIC ${SRCS})
-
-ADD_EXECUTABLE(${EX_SERVER} examples/simpleserver.cpp)
-TARGET_LINK_LIBRARIES(${EX_SERVER} ${PROJECT_NAME} ${OCTBSTACK} pthread)
-INSTALL(TARGETS ${EX_SERVER} DESTINATION ${BIN_INSTALL_DIR})
-
-ADD_EXECUTABLE(${EX_CLIENT} examples/simpleclient.cpp)
-TARGET_LINK_LIBRARIES(${EX_CLIENT} ${PROJECT_NAME} ${OCTBSTACK} pthread)
-INSTALL(TARGETS ${EX_CLIENT} DESTINATION ${BIN_INSTALL_DIR})
-
-ADD_EXECUTABLE(${EX_CLIENTSERVER} examples/simpleclientserver.cpp)
-TARGET_LINK_LIBRARIES(${EX_CLIENTSERVER} ${PROJECT_NAME} ${OCTBSTACK} pthread)
-INSTALL(TARGETS ${EX_CLIENTSERVER} DESTINATION ${BIN_INSTALL_DIR})
-
-ADD_SUBDIRECTORY(csdk)
-#ADD_SUBDIRECTORY(examples)
-ADD_SUBDIRECTORY(oic-sample)
+++ /dev/null
-#!/bin/bash
-
-# Prevent Support Tool(Defect analysis and commit) Execution Batch File!!
-
-# variables
-SDBPATH=/home/iotivity/tizen-sdk/tools/sdb
-GBSRPMPATH=/home/iotivity/GBS-ROOT/rsa/local/repos/rsa/armv7l/RPMS
-PACKAGE=oic-0.0.1-0.armv7l.rpm
-
-gbs build -A armv7l --include-all --ccache
-
-$SDBPATH root on
-
-$SDBPATH push $GBSRPMPATH/$PACKAGE /root/
-
-$SDBPATH shell rpm -Uvh --force /root/oic-0.0.1-0.armv7l.rpm
-
-$SDBPATH shell /usr/apps/com.samsung.oicapp-test/bin/oicapp-test
+++ /dev/null
-com.samsung.oicapp-test system::use_internet r
-
-system::use_internet com.samsung.oicapp-test r
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="com.samsung.oicapp-test" version="0.1.0" install-location="internal-only">
- <label>OIC tset</label>
- <author email="email@samsung.com" href="www.samsung.com">Name</author>
- <description>OIC test Application</description>
- <ui-application appid="com.samsung.oicapp-test" exec="/usr/apps/com.samsung.oicapp-test/bin/oicapp-test" nodisplay="false" multiple="false" type="capp" taskmanage="true" mainapp="true">
- <icon>com.samsung.oicapp-test.png</icon>
- <label>OIC test</label>
- </ui-application>
-</manifest>
+++ /dev/null
-/******************************************************************
- *
- * Copyright 2014 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
-
-/**
- * @file ISSMClientListener.h
- * @brief This file contains client listener interfaces.
- */
-
-#ifndef ISSMCLIENTLISTENER_H_
-#define ISSMCLIENTLISTENER_H_
-#include <string>
-#include "OCPlatform.h"
-
-/**
- * @brief This enum defines Soft Sensor return types
- */
-typedef enum
-{
- SSM_SUCCESS, SSM_ERROR, SSM_ERROR_QUERY_PARSING, SSM_ERROR_NO_QUERY, SSM_ERROR_NETWORK
-} SSMReturn;
-
-using namespace OC;
-/**
- * @brief ISSMClientListener is a listener interface from which application is derived to get callback from SoftSensorManager service
- */
-class ISSMClientListener
-{
- public:
- /**
- * @brief onRegisterQuery is a pure virtual operation which should be implemented in applications to get callback messages.
- * @param [in] attributeMap - A data map in which SoftSensorManager service sends sensor data with cqid.
- * @param [in] eCode - The address of listener class. When an application which inherits the ISSMClientListener calls this operation, it sends its address for the listener so that
- * SSMClient can callback message to the appication.
- * @param [out] cqid - A query id generated from SoftSensorManager service for the queryString request.
- * @return SSMReturn
-
- */
- virtual void onRegisterQuery(const AttributeMap &attributeMap, SSMReturn &eCode) = 0;
- virtual ~ISSMClientListener()
- {
- }
-};
-
-#endif /* ISSMCLIENTLISTENER_H_ */
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2014 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-#include <iostream>
-#include <string>
-
-#include "SSMClient.h"
-#include "OCPlatform.h"
-#include "OCApi.h"
-
-const char *SSM_RESOURCE_URI = "/service/SoftSensorManager";
-
-#define SSM_RESOURCE_TYPE = "core.SoftSensorManager"
-
-#define COAP_IP "134.134.161.33"
-#define COAP_PORT 5683
-#define COAP_MODE ModeType::Client
-#define COAP_SRVTYPE ServiceType::InProc
-
-#define COAP_SERVER_ADDR "coap://224.0.1.187/oc/core?rt=core.SoftSensorManager"
-
-SSMClient::SSMClient()
-{
- m_sem.create(100000);
- m_pPlatform = NULL;
- m_appListener = NULL;
- m_retResponse = SSM_ERROR;
- _findResource();
- _createQueryEngine();
-}
-
-SSMClient::~SSMClient()
-{
- _releaseQueryEngine(m_queryEngineId);
- if (m_pPlatform)
- {
- delete m_pPlatform;
- m_pPlatform = NULL;
- }
-}
-
-void SSMClient::_findResource()
-{
- // Create PlatformConfig object
- PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, QualityOfService::Confirmable);
-
- // Create a OCPlatform instance.
- // Note: Platform creation is synchronous call.
- try
- {
- m_pPlatform = new OCPlatform(cfg);
-
- // Find all resources
- OCStackResult result;
- if ((result = m_pPlatform->findResource("", COAP_SERVER_ADDR,
- std::bind(&SSMClient::onFoundResource, this, std::placeholders::_1)))
- != OC_STACK_OK)
- {
- delete m_pPlatform;
- m_pPlatform = NULL;
- return;
- }
-
- m_sem.wait();
-
- }
- catch (OCException e)
- {
- //log(e.what());
- }
-}
-
-void SSMClient::_createQueryEngine(void)
-{
- OCRepresentation rep;
-
- AttributeMap requestAttributeMap;
- AttributeValues commandValue;
-
- QueryParamsMap queryParamsMap;
-
- commandValue.push_back("CreateQueryEngine");
-
- requestAttributeMap["command"] = commandValue;
-
- rep.setAttributeMap(requestAttributeMap);
-
- if (m_SSMResource->put(rep, queryParamsMap,
- std::bind(&SSMClient::onCreateQueryEngine, this, std::placeholders::_1,
- std::placeholders::_2)) != OC_STACK_OK)
- {
- return;
- }
-
- m_sem.wait();
-}
-
-void SSMClient::_releaseQueryEngine(std::string queryEngineId)
-{
- OCRepresentation rep;
-
- AttributeMap requestAttributeMap;
- AttributeValues commandValue;
- AttributeValues queryEngineIdValue;
-
- QueryParamsMap queryParamsMap;
-
- commandValue.push_back("ReleaseQueryEngine");
-
- requestAttributeMap["command"] = commandValue;
-
- queryEngineIdValue.push_back(queryEngineId);
-
- requestAttributeMap["queryEngineId"] = queryEngineIdValue;
-
- rep.setAttributeMap(requestAttributeMap);
-
- m_SSMResource->put(rep, queryParamsMap,
- std::bind(&SSMClient::onReleaseQueryEngine, this, std::placeholders::_1,
- std::placeholders::_2));
-
- m_sem.wait();
-}
-
-SSMReturn SSMClient::registerQuery(std::string queryString, ISSMClientListener *listener,
- std::string &cqid)
-{
- OCRepresentation rep;
-
- AttributeMap requestAttributeMap;
- AttributeValues commandValue;
- AttributeValues queryEngineIdValue;
- AttributeValues contextQueryValue;
-
- QueryParamsMap queryParamsMap;
-
- commandValue.push_back("ExecuteContextQuery");
-
- requestAttributeMap["command"] = commandValue;
-
- queryEngineIdValue.push_back(m_queryEngineId);
-
- requestAttributeMap["queryEngineId"] = queryEngineIdValue;
-
- contextQueryValue.push_back(queryString);
-
- requestAttributeMap["contextQuery"] = contextQueryValue;
-
- m_appListener = listener;
-
- rep.setAttributeMap(requestAttributeMap);
-
- if (m_SSMResource->put(rep, queryParamsMap,
- std::bind(&SSMClient::onRegisterQuery, this, std::placeholders::_1,
- std::placeholders::_2)) != OC_STACK_OK)
- return SSM_ERROR_NETWORK;
-
- m_sem.wait();
-
- if (m_retResponse == SSM_SUCCESS)
- {
- cqid = m_responseAttributeMap["CQID"].back();
- }
-
- return m_retResponse;
-}
-
-SSMReturn SSMClient::unregisterQuery(std::string cqid)
-{
- OCRepresentation rep;
-
- AttributeMap requestAttributeMap;
- AttributeValues commandValue;
- AttributeValues queryEngineIdValue;
- AttributeValues cqidValue;
-
- QueryParamsMap queryParamsMap;
-
- commandValue.push_back("KillContextQuery");
-
- requestAttributeMap["command"] = commandValue;
-
- queryEngineIdValue.push_back(m_queryEngineId);
-
- requestAttributeMap["queryEngineId"] = queryEngineIdValue;
-
- cqidValue.push_back(cqid);
-
- requestAttributeMap["CQID"] = cqidValue;
-
- rep.setAttributeMap(requestAttributeMap);
-
- if (m_SSMResource->put(rep, queryParamsMap,
- std::bind(&SSMClient::onUnregisterQuery, this, std::placeholders::_1,
- std::placeholders::_2)) != OC_STACK_OK)
- return SSM_ERROR_NETWORK;
-
- m_sem.wait();
-
- return m_retResponse;
-}
-
-/**
- * Callback Function List.
- */
-// Callback to found resources
-void SSMClient::onFoundResource(std::shared_ptr< OCResource > resource)
-{
- std::string resourceURI;
- try
- {
- // Do some operations with resource object.
- if (resource)
- {
- // Get the resource URI
- resourceURI = resource->uri();
-
- if (resourceURI.compare(SSM_RESOURCE_URI) == 0)
- {
- m_SSMResource = resource;
- }
- }
- }
- catch (std::exception &e)
- {
- //log(e.what());
- }
-
- m_sem.release();
-}
-
-void SSMClient::onCreateQueryEngine(const OCRepresentation &rep, const int eCode)
-{
- if (eCode != 0)
- {
- m_retResponse = SSM_ERROR_NETWORK;
- goto CLEANUP;
- }
-
- m_responseAttributeMap = rep.getAttributeMap();
- m_queryEngineId = m_responseAttributeMap["queryEngineId"].back();
- m_responseAttributeMap["queryEngineId"].pop_back();
- m_retResponse = SSM_SUCCESS;
-
-CLEANUP: m_sem.release();
-}
-
-void SSMClient::onRegisterQuery(const OCRepresentation &rep, const int eCode)
-{
- QueryParamsMap queryParamsMap;
-
- if (eCode != 0)
- {
- m_retResponse = SSM_ERROR_NETWORK;
- goto CLEANUP;
- }
-
- m_responseAttributeMap = rep.getAttributeMap();
-
- if (m_responseAttributeMap.find("error") != m_responseAttributeMap.end())
- {
- m_retResponse = SSM_ERROR_QUERY_PARSING;
- goto CLEANUP;
- }
-
- m_SSMResource->observe(ObserveType::Observe, queryParamsMap,
- std::bind(&SSMClient::onObserve, this, std::placeholders::_1, std::placeholders::_2));
-
- m_retResponse = SSM_SUCCESS;
-
-CLEANUP: m_sem.release();
-}
-
-void SSMClient::onUnregisterQuery(const OCRepresentation &rep, const int eCode)
-{
- if (eCode != 0)
- {
- m_retResponse = SSM_ERROR_NETWORK;
- goto CLEANUP;
- }
-
- m_responseAttributeMap = rep.getAttributeMap();
-
- if (m_responseAttributeMap.find("error") != m_responseAttributeMap.end())
- {
- m_retResponse = SSM_ERROR_NO_QUERY;
- goto CLEANUP;
- }
-
- m_retResponse = SSM_SUCCESS;
-
-CLEANUP: m_sem.release();
-}
-
-void SSMClient::onReleaseQueryEngine(const OCRepresentation &rep, const int eCode)
-{
- if (eCode != 0)
- {
- m_retResponse = SSM_ERROR_NETWORK;
- goto CLEANUP;
- }
-
- m_responseAttributeMap = rep.getAttributeMap();
-
- m_retResponse = SSM_SUCCESS;
-
-CLEANUP: m_sem.release();
-}
-
-void SSMClient::onObserve(const OCRepresentation &rep, const int &eCode)
-{
- SSMReturn ret = SSM_SUCCESS;
-
- if (eCode != 0)
- {
- ret = SSM_ERROR_NETWORK;
- }
-
- m_appListener->onRegisterQuery(rep.getAttributeMap(), ret);
-}
+++ /dev/null
-//******************************************************************
-//
-// Copyright 2014 Samsung Electronics All Rights Reserved.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-/**
- * @file SSMClient.h
- * @brief This file contains the declaration of classes and its members related to SSMClient.
- */
-
-#ifndef RESOURCECLIENT_H_
-#define RESOURCECLIENT_H_
-
-#include <string>
-
-#include "OCResource.h"
-#include "OCPlatform.h"
-#include "ISSMClientListener.h"
-
-using namespace OC;
-
-#if defined(WIN32)
-class CSemaphore
-{
- private:
- HANDLE hSemaphore;
- int m_MaxTimeOut;
-
- public:
- /**
- * This is CSemaphore constructor.
- */
- CSemaphore()
- {
- m_MaxTimeOut = 0;
- }
- /**
- *This is CSemaphore destructor.
- */
- ~CSemaphore()
- {
- }
-
- /**
- * This is a function to creat a semaphore
- * This is syncronus call.
- * @param maximumRequestTimeOut
- * [IN] Request Time out.
- *
- * @return None
- *
- */
- void create(int maximumRequestTimeOut)
- {
- hSemaphore = CreateSemaphore(NULL, 1, 1, NULL);
- m_MaxTimeOut = maximumRequestTimeOut;
- }
-
- /**
- * This is a function to wait for semaphore
- *
- * @return None
- *
- */
- void wait()
- {
- WaitForSingleObject(hSemaphore, m_MaxTimeOut);
- }
-
- /**
- * This is a function to release semaphore
- *
- * @return None
- *
- */
- void release()
- {
- ReleaseSemaphore(hSemaphore, 1, NULL);
- }
-
-};
-
-#elif defined(LINUX)
-#include <semaphore.h>
-
-#define SEM_SUCCESS 0
-
-class CSemaphore
-{
- private:
- sem_t hSemaphore;
- timespec m_MaxTimeOut;
-
- public:
- /**
- * This is CSemaphore constructor.
- */
- CSemaphore()
- {
- m_MaxTimeOut.tv_sec = 0;
- m_MaxTimeOut.tv_nsec = 0;
- }
- /**
- *This is CSemaphore destructor.
- */
- ~CSemaphore()
- {
- }
- /**
- * This is a function to creat a semaphore
- * This is syncronus call.
- * @param maximumRequestTimeOut
- * [IN] Request Time out.
- *
- * @return None
- *
- */
- void create(int maximumRequestTimeOut)
- {
- if ( sem_init(&hSemaphore, 1, 0) < SEM_SUCCESS )
- {
- perror("Error : sem_init.");
- exit(0);
- }
- m_MaxTimeOut.tv_sec = maximumRequestTimeOut;
- }
-
- void wait()
- {
- sem_wait( &hSemaphore );
- }
-
- /**
- * This is a function to release semaphore
- *
- * @return None
- *
- */
- void release()
- {
- sem_post(&hSemaphore);
- }
-
-};
-#endif
-
-/**
- * @brief SSMClient is a wrapper class to provide SoftSensorManager functionality to Application.
- * Basically, SoftSensorManager is developed in Resource model (i.e. messaging with basic functions of put, get, and post).
- * SSMClient abstracts the resource based operations from client applications and provides c++ style functions.
- */
-class SSMClient
-{
- private:
- SSMReturn m_retResponse;
- OCPlatform *m_pPlatform;
- CSemaphore m_sem;
- /**
- * @brief SoftSensorManager Resource.
- */
- std::shared_ptr< OCResource > m_SSMResource;
- /**
- * @brief attribute map .
- */
- AttributeMap m_responseAttributeMap;
- /**
- * @brief query engine.
- */
- std::string m_queryEngineId;
- /**
- * @brief app listener
- */
- ISSMClientListener *m_appListener;
-
- /**
- * @brief internal find resource function
- */
- void _findResource(void);
-
- /**
- * @brief internal Query engine function
- */
- void _createQueryEngine(void);
-
- /**
- * @brief internal release query function
- */
- void _releaseQueryEngine(std::string queryEngineId);
-
- public:
- /**
- * Constructor for SSMClient.
- */
- SSMClient();
- ~SSMClient();
-
- /**
- * This API sends query strings of applications to SoftSensorManager on Iotivity Base messaging.
- *
- * @param [in] queryString - A conditions query statement where the caller application specifies sensors for required data and conditions when the caller wants to get the data.
- * @param [in] listener - The address of listener class. When an application which inherits the ISSMClientListener calls this operation, it sends its address for the listener so that
- * SSMClient can callback message to the application.
- * @param [out] cqid - A query id generated from SoftSensorManager service for the queryString request.
- * @return SSMReturn
-
- */
- SSMReturn registerQuery(std::string queryString, ISSMClientListener *listener,
- std::string &cqid);
- /**
- * This API is to cancel the registered sends query strings of applications to SoftSensorManager on Iotivity Base messaging.
- *
- * @param [in] listener - The address of listener class. When an application which inherits the ISSMClientListener calls this operation, it sends its address for the listener so that
- * SSMClient can callback message to the application.
- * @param [in] cqid - A query id generated from SoftSensorManager service for the queryString request.
- * @return SSMReturn
- */
- SSMReturn unregisterQuery(std::string cqid);
-
- // friend option. for callback from SSMResource
- void onFoundResource(std::shared_ptr< OCResource > resource);
- void onCreateQueryEngine(const OCRepresentation &rep, const int eCode);
- void onReleaseQueryEngine(const OCRepresentation &rep, const int eCode);
- void onRegisterQuery(const OCRepresentation &rep, const int eCode);
- void onUnregisterQuery(const OCRepresentation &rep, const int eCode);
- void onObserve(const OCRepresentation &rep, const int &eCode);
-};
-
-#endif /* RESOURCECLIENT_H_ */
+++ /dev/null
-[Unit]
-Description=OIC
-After=deviced.service
-
-[Service]
-Type=simple
-ExecStart=/usr/bin/simpleserver
-TimeoutStopSec=1s
-Restart=always
-
-[Install]
-WantedBy=multi-user.target
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ssm)
+
+SET(CMAKE_SHARED_LINKER_FLAGS " -Wl,--as-needed")
+SET(CMAKE_EXE_LINKER_FLAGS " -Wl,--as-needed -Wl,--hash-style=both")
+#SET(EX_SERVER "simpleserver")
+#SET(EX_CLIENT "simpleclient")
+#SET(EX_CLIENTSERVER "simpleclientserver")
+#SET(OCTBSTACK "octbstack")
+
+#INCLUDE_DIRECTORIES(include)
+#INCLUDE_DIRECTORIES(csdk/stack/include)
+#INCLUDE_DIRECTORIES(csdk/ocsocket/include)
+#INCLUDE_DIRECTORIES(csdk/ocrandom/include)
+#INCLUDE_DIRECTORIES(csdk/logger/include)
+#INCLUDE_DIRECTORIES(${INCLUDE_INSTALL_DIR}/boost)
+#LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+
+#SET(EXTRA_CXXFLAGS "-std=c++11")
+#SET(EXTRA_CXXFLAGS "-g3 -std=c++0x")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXXFLAGS}")
+
+#SET(SRCS
+# OCLib/OCReflect.cpp
+# OCLib/OCPlatform.cpp
+# OCLib/OCResource.cpp
+# OCLib/InProcServerWrapper.cpp
+# OCLib/InProcClientWrapper.cpp)
+#ADD_LIBRARY(${PROJECT_NAME} STATIC ${SRCS})
+
+#ADD_EXECUTABLE(${EX_SERVER} examples/simpleserver.cpp)
+#TARGET_LINK_LIBRARIES(${EX_SERVER} ${PROJECT_NAME} ${OCTBSTACK} pthread)
+#INSTALL(TARGETS ${EX_SERVER} DESTINATION ${BIN_INSTALL_DIR})
+
+#ADD_EXECUTABLE(${EX_CLIENT} examples/simpleclient.cpp)
+#TARGET_LINK_LIBRARIES(${EX_CLIENT} ${PROJECT_NAME} ${OCTBSTACK} pthread)
+#INSTALL(TARGETS ${EX_CLIENT} DESTINATION ${BIN_INSTALL_DIR})
+
+#ADD_EXECUTABLE(${EX_CLIENTSERVER} examples/simpleclientserver.cpp)
+#TARGET_LINK_LIBRARIES(${EX_CLIENTSERVER} ${PROJECT_NAME} ${OCTBSTACK} pthread)
+#INSTALL(TARGETS ${EX_CLIENTSERVER} DESTINATION ${BIN_INSTALL_DIR})
+
+#ADD_SUBDIRECTORY(csdk)
+#ADD_SUBDIRECTORY(examples)
+ADD_SUBDIRECTORY(oic-sample)
-SET(TESTAPP "oicapp-test")
+SET(TESTAPP "ssmtester")
FILE(GLOB SRCS src/*.c src/*.cpp)
SET(VENDOR "samsung")
SET(PACKAGE ${TESTAPP})
SET(PKGNAME "com.${VENDOR}.${PACKAGE}")
-SET(PREFIX "/usr/apps/com.samsung.oicapp-test")
+SET(PREFIX "/usr/apps/com.samsung.ssmtester")
SET(BINDIR "${PREFIX}/bin")
SET(RESDIR "${PREFIX}/res")
SET(DATADIR "${PREFIX}/data")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+LINK_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/lib)
+
ADD_EXECUTABLE(${TESTAPP} ${SRCS})
-TARGET_LINK_LIBRARIES(${TESTAPP} ${pkgs_LDFLAGS} ${PROJECT_NAME} ${OCTBSTACK} pthread)
+TARGET_LINK_LIBRARIES(${TESTAPP} ${pkgs_LDFLAGS} ssmcore oc octbstack oc_logger oc_logger_core pthread dl)
INSTALL(TARGETS ${TESTAPP} DESTINATION ${BINDIR})
--- /dev/null
+com.samsung.ssmtester system::use_internet r
+
+system::use_internet com.samsung.ssmtester r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="com.samsung.ssmtester" version="0.1.0" install-location="internal-only">
+ <label>OIC test</label>
+ <author email="email@samsung.com" href="www.samsung.com">Name</author>
+ <description>SSM test Application</description>
+ <ui-application appid="com.samsung.ssmtester" exec="/usr/apps/com.samsung.ssmtester/bin/ssmtester" nodisplay="false" multiple="false" type="capp" taskmanage="true" mainapp="true">
+ <icon>com.samsung.oicapp-test.png</icon>
+ <label>SSM test</label>
+ </ui-application>
+</manifest>
#include <efl_assist.h>
#include <string>
+#include <sstream>
#include "oicapp-test.h"
#include "oicapp-utils.h"
-#include "OCResource.h"
-#include "OCPlatform.h"
-#include "SSMClient.h"
-#include "ISSMClientListener.h"
+#include "SSMInterface.h"
static oicapp_data *g_ad = NULL;
-class CSSMClientListener: public ISSMClientListener
+int g_CQID = 9999;
+
+class CQueryEngineEvent : public IQueryEngineEvent
{
public:
- void onRegisterQuery(const AttributeMap &attributeMap, SSMReturn::SSMReturn &eCode)
- {
- //EFL UI printing
- char *queryResult = "";
+ SSMRESULT onQueryEngineEvent(int cqid, IDataReader *pResult)
+ {
std::stringstream sstream;
- for (AttributeMap::const_iterator itor = attributeMap.begin(); itor != attributeMap.end(); itor++)
+ int dataCount = 0;
+ IModelData *pModelData = NULL;
+ std::vector<std::string> affectedModels;
+
+ pResult->getAffectedModels(&affectedModels);
+
+ for (std::vector<std::string>::iterator itor = affectedModels.begin();
+ itor != affectedModels.end(); ++itor)
{
- //if (itor->first == "queryEngineId")
- //{
- // sstream << itor->first.c_str() << " : " << std::hex << stoi(itor->second.front().c_str()) << "\n";
- //}
- //else
- //{
- sstream << itor->first.c_str() << " : " << itor->second.front().c_str() << "\n";
- //}
+ printf("Printing %s\n", itor->c_str());
+ pResult->getModelDataCount(*itor, &dataCount);
+ for (int i = 0; i < dataCount; i++)
+ {
+ pResult->getModelData(*itor, i, &pModelData);
+ printf("dataId: %d\n", pModelData->getDataId());
+ for (int j = 0; j < pModelData->getPropertyCount(); j++)
+ {
+ sstream << "Type: " << pModelData->getPropertyName(j).c_str() <<
+ " Value: " << pModelData->getPropertyValue(j).c_str() << "<br>";
+ }
+ }
}
-// queryResult = const_cast<char *>(sstream .str().c_str());
- oicapp_util_put_msg (g_ad, g_ad->input_msg);
+ sstream << std::ends;
+ oicapp_util_put_msg(g_ad, sstream.str().c_str());
+ return SSM_S_OK;
}
};
-CSSMClientListener *g_SSMClientListener = new CSSMClientListener();
-SSMClient *g_SSMClient = NULL;
+CQueryEngineEvent *g_SSMClientListener = new CQueryEngineEvent();
+SSMInterface *g_SSMClient = new SSMInterface();
static Elm_Object_Item *oicapp_append_separator(Evas_Object *genlist,
oicapp_data *ad)
item = elm_genlist_item_append(genlist, &ad->itc_seperator, NULL, NULL,
ELM_GENLIST_ITEM_NONE, NULL, NULL);
- elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+ //elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
return item;
}
static void oicapp_append_contents(oicapp_data *ad)
{
Elm_Object_Item *item;
-
+ /*
oicapp_append_separator(ad->genlist, ad);
_gl_append_item(ad, &ad->itc_edit);
ad->item_multiline = item;
oicapp_append_separator(ad->genlist, ad);
+ */
+ oicapp_append_separator(ad->genlist, ad);
+
+ elm_genlist_item_append(ad->genlist, &ad->itc_edit, ad, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ oicapp_append_separator(ad->genlist, ad);
+
+ elm_genlist_item_append(ad->genlist, &ad->itc_btn, ad, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+
+ oicapp_append_separator(ad->genlist, ad);
+
+ oicapp_append_separator(ad->genlist, ad);
+
+ oicapp_append_separator(ad->genlist, ad);
+
+ item = _gl_append_item(ad, &ad->itc_multiline);
+
+ ad->item_multiline = item;
+
+ oicapp_append_separator(ad->genlist, ad);
}
static Evas_Object *oicapp_create_conform(Evas_Object *win)
{
oicapp_data *ad = (oicapp_data *)data;
- std::string cqid;
+ std::string str = std::string(ad->input_msg);
+
+ std::string strGT = ">";
+
+ std::string strLT = "<";
+
+ std::size_t foundGT = str.find(strGT);
- g_SSMClient->registerQuery(std::string(ad->input_msg), g_SSMClientListener, cqid);
+ std::size_t foundLT = str.find(strLT);
+
+ std::stringstream sstream;
+
+ if (foundGT != std::string::npos)
+ {
+ str.replace(foundGT, strGT.length(), ">");
+ }
+
+ if (foundLT != std::string::npos)
+ {
+ str.replace(foundLT, strLT.length(), "<");
+ }
+
+ g_SSMClient->registerQuery(str, g_SSMClientListener, g_CQID);
+
+ sstream << "Query executed! cqid = " << g_CQID << std::ends;
+
+ oicapp_util_put_msg(ad, sstream.str().c_str());
ERR("button clicked(%s)", ad->input_msg);
}
ad->input_msg = strdup(elm_entry_entry_get(obj));
-// oicapp_util_put_msg(ad, ad->input_msg);
-
DBG("Clicked : %s", ad->input_msg);
}
return entry;
}
+static char *_item_Text_get(void *data, Evas_Object *obj, const char *part)
+{
+ char *buf =
+ "subscribe Device.DiscomfortIndexSensor if Device.DiscomfortIndexSensor.discomfortIndex > 0";
+
+ return strdup(buf);
+}
+
static inline void oicapp_init_itcs(oicapp_data *ad)
{
ad->itc_seperator.item_style = "dialogue/separator";
ad->itc_seperator.func.del = NULL;
ad->itc_edit.item_style = "dialogue/editfield";
- ad->itc_edit.func.text_get = NULL;
+ ad->itc_edit.func.text_get = _item_Text_get;
ad->itc_edit.func.content_get = _gl_edit_content_get;
ad->itc_edit.func.state_get = NULL;
ad->itc_edit.func.del = NULL;
ad->itc_multiline.item_style = "multiline/1text";
ad->itc_multiline.func.text_get = _gl_multiline_text_get;
- //ad->itc_multiline.func.text_get = NULL;
ad->itc_multiline.func.content_get = NULL;
ad->itc_multiline.func.state_get = NULL;
ad->itc_multiline.func.del = NULL;
ad->genlist = oicapp_create_genlist(ad->navi);
- it = elm_naviframe_item_push(ad->navi, "OIC Tester", NULL, NULL, ad->genlist, NULL);
+ it = elm_naviframe_item_push(ad->navi, "SSM Tester", NULL, NULL, ad->genlist, NULL);
elm_naviframe_item_pop_cb_set(it, _back_cb, ad);
ad->ip_addr = oicapp_util_wifi();
oicapp_append_contents(ad);
- g_SSMClient = new SSMClient();
-
return 0;
}
{
oicapp_data *ad = (oicapp_data *)data;
+ if (g_CQID != 9999)
+ g_SSMClient->unregisterQuery(g_CQID);
+
if (ad->win)
evas_object_del(ad->win);
DBG("Output msg : %s", ad->output_msg);
elm_genlist_item_update(ad->item_multiline);
+ elm_genlist_item_item_class_update(ad->item_multiline, &(ad->itc_multiline));
}
char* oicapp_util_wifi()
-Name: oic
+Name: ssm
Summary: Open Interconnect Consortium
Version: 0.0.1
Release: 0
Group: Network & Connectivity/Service
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
-Source1: %{name}.service
+Source1: libDiscomfortIndexSensor.so
+Source2: SoftSensorDescription.xml
Source1001: %{name}.manifest
BuildRequires: cmake
-BuildRequires: boost-devel
+#BuildRequires: boost-devel
#BuildRequires: pkgconfig(glib-2.0)
-Buildrequires: gettext-tools
+#Buildrequires: gettext-tools
BuildRequires: pkgconfig(appcore-efl)
BuildRequires: pkgconfig(ecore-x)
BuildRequires: pkgconfig(elementary)
%install
-rm -rf %{buildroot}/BUILD/oic*
+rm -rf %{buildroot}/BUILD/ssm*
#%make_install
+cp -af %{SOURCE1} %{buildroot}/usr/apps/com.samsung.ssmtester/bin/
+cp -af %{SOURCE2} %{buildroot}/usr/apps/com.samsung.ssmtester/bin/
%post
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_bindir}/simple*
-/usr/apps/com.samsung.oicapp-test/*
+/usr/apps/com.samsung.ssmtester/*
/usr/share/*
-/etc/smack/accesses2.d/com.samsung.oicapp-test.rule
+/etc/smack/accesses2.d/com.samsung.ssmtester.rule
#%%license LICENSE.APLv2
--- /dev/null
+<softsensors>
+
+ <softsensor>
+ <name>DiscomfortIndexSensor</name>
+ <attributes>
+ <attribute>
+ <name>version</name>
+ <type>string</type>
+ <value>1.0</value>
+ </attribute>
+ <attribute>
+ <name>lifetime</name>
+ <type>int</type>
+ <value>60</value>
+ </attribute>
+ </attributes>
+ <outputs>
+ <output>
+ <name>timestamp</name>
+ <type>string</type>
+ </output>
+ <output>
+ <name>temperature</name>
+ <type>string</type>
+ </output>
+ <output>
+ <name>humidity</name>
+ <type>string</type>
+ </output>
+ <output>
+ <name>discomfortIndex</name>
+ <type>int</type>
+ </output>
+ </outputs>
+ <inputs>
+ <input>Thing_TempHumSensor</input>
+ <input>Thing_TempHumSensor1</input>
+ </inputs>
+ </softsensor>
+
+</softsensors>
+++ /dev/null
-<high_context_dictionary>
-
- <high_context>
- <root_name>DiscomfortIndexSensor</root_name>
- <attributes>
- <attribute_property_count>2</attribute_property_count>
- <attribute_property>
- <name>version</name>
- <type>string</type>
- <value>1.0</value>
- </attribute_property>
- <attribute_property>
- <name>lifetime</name>
- <type>int</type>
- <value>60</value>
- </attribute_property>
- </attributes>
- <outputs>
- <output_property_count>4</output_property_count>
- <output_property>
- <name>timestamp</name>
- <type>string</type>
- <value>""</value>
- </output_property>
- <output_property>
- <name>temperature</name>
- <type>int</type>
- <value>0</value>
- </output_property>
- <output_property>
- <name>humidity</name>
- <type>int</type>
- <value>0</value>
- </output_property>
- <output_property>
- <name>discomfortIndex</name>
- <type>int</type>
- <value>0</value>
- </output_property>
- </outputs>
- <app_inputs>
- <app_input_count>0</app_input_count>
- </app_inputs>
- <inputs>
- <input_count>2</input_count>
- <input>Thing_TempHumSensor</input>
- <input>Thing_TempHumSensor1</input>
- </inputs>
- <enter_conditions>
- <enter_condition>
- <name>Thing_TempHumSensor</name>
- <name>Thing_TempHumSensor1</name>
- </enter_condition>
- </enter_conditions>
- </high_context>
-
-</high_context_dictionary>
-
+-include ../../../../build/linux/root_path.inc
-include ../../../../build/linux/environment.mk
SRC_PATH=../../src
pre_job:
@echo " "
- @echo "---------- SoftSensor Build Begin. ------------"
+ @echo "---------- ${TARGET} Build Begin. ------------"
@mkdir -p ${RST_NAME}
@echo " "
post_job:
@echo " "
cp -Rdp ./${RST_NAME}/lib${TARGET}.so ${OUTPUTS_DIR}/
- cp -Rdp ./HighContextDictionary.xml ${OUTPUTS_DIR}/
- @echo "-------------- SoftSensor Build Successful. -------------"
+ cp -Rdp ../../${SSXML_NAME} ${OUTPUTS_DIR}/
+ @echo "-------------- ${TARGET} Build Successful. -------------"
@echo "Enter to ${RST_NAME} folder."
@echo " "
int discomfortIndex = (int) ERROR;
double sumDI = 0.0;
+ m_result.m_temperature = "";
+ m_result.m_humidity = "";
+
for (int i = 0; i < PHYSICAL_EA; i++)
{
if (i != 0)
output_property.clear();
output_property.insert(std::make_pair("name", "temperature"));
- output_property.insert(std::make_pair("type", "int"));
+ output_property.insert(std::make_pair("type", "string"));
output_property.insert(std::make_pair("value", m_result.m_temperature));
out.outputProperty.push_back(output_property);
output_property.clear();
output_property.insert(std::make_pair("name", "humidity"));
- output_property.insert(std::make_pair("type", "int"));
+ output_property.insert(std::make_pair("type", "string"));
output_property.insert(std::make_pair("value", m_result.m_humidity));
out.outputProperty.push_back(output_property);
+IOTIVITY_DIR=${shell cd ../../../../ && pwd}
+${shell echo "ROOT_DIR=${IOTIVITY_DIR}" > ./root_path.inc}
+-include ./root_path.inc
-include ./environment.mk
MAKE=make
@echo "* *"
@echo "* It's build script for SoftSensorManagement system. *"
@echo "* Before build, Open the environment.mk file. *"
- @echo "* And, Modify ROOT_DIR path, which depend on your PC. *"
@echo "* And, Modify BOOST_BASE path, which depend on your PC. *"
@echo "* *"
@echo "*********************************************************"
clean:
-# @cd ${CUR_DIR}/../../../resource/ && make clean
-# @cd ${CUR_DIR}/../../../resource/csdk && make deepclean
-# @cd ${CUR_DIR}/9_Arduino_THSensorApp && make clean
-# @cd ${CUR_DIR}
rm -rf ./${RST_NAME}
@for subdir in ${MAKE_LIST} ; do \
echo ">>>>>>>>>>>> $${subdir}/Makefile clean run <<<<<<<<<<<<<<" ; \
${MAKE} clean -C $${subdir} ; \
echo " " ; \
done
+ rm -rf ./root_path.inc
-# root path of each PC.
-ROOT_DIR=${PWD}/../../../..
-
# boost folder path.
-BOOST_BASE=/home/iotivity/Desktop/boost_1_56_0
+BOOST_BASE=/usr/include
# ioc-resource folder path.
IOT_BASE=${ROOT_DIR}/resource
IOT_MAKE_PATH=${IOT_BASE}
IOT_RELEASE=${IOT_MAKE_PATH}/release/obj
-IOT_CSDK_RELEASE=${IOT_BASE}/csdk/release
+IOT_CSDK_RELEASE=${IOT_BASE}/csdk/linux/release
+IOT_LOG_DIR=${IOT_BASE}/oc_logger
IOT_LIB=liboc.a
IOT_CSDK_LIB=liboctbstack.a
+IOT_LOG_LIB=liboc_logger.a
# service folder path.
FD_SSM=${ROOT_DIR}/service/soft-sensor-manager
# outputs directory path.
OUTPUTS_DIR=${FD_BUILD}/linux/release
EXEC_DIR=${OUTPUTS_DIR}
-MODEL_DIR="\"${EXEC_DIR}/\""
-HIGH_LOCATION="\"${EXEC_DIR}/HighContextDictionary.xml\""
+SSXML_NAME="SoftSensorDescription.xml"
+SSM_LIB = libSSM.a
+SSMCORE_LIB=libSSMCore.a
# SoftSensorManager makefile path
-MAKE_01=${FD_SDK}/build/linux
-MAKE_02=${FD_SSMCORE}/build/linux
+MAKE_01=${FD_SSMCORE}/build/linux
+MAKE_02=${FD_SDK}/build/linux
MAKE_03=${FD_SAMPLEAPP}/linux
MAKE_04=${FD_SAMPLEAPP}/arduino
MAKE_05=${FD_SOFTSENSOR}/DiscomfortIndexSensor/build/linux
+MAKE_06=${FD_SOFTSENSOR}/IndoorTrajectorySensor/build/linux
-MAKE_LIST=${MAKE_01} ${MAKE_02} ${MAKE_05} ${MAKE_03}
+MAKE_LIST=${MAKE_01} ${MAKE_02} ${MAKE_05} ${MAKE_06} ${MAKE_03}
+#MAKE_LIST=${MAKE_01} ${MAKE_02} ${MAKE_05} ${MAKE_03}