, SSM_E_POINTER
, SSM_E_OUTOFMEMORY
, SSM_E_FAIL
+ , SSM_E_NOTINIT
+ , SSM_E_INITIALIZED
+ , SSM_E_INVALIDXML
, SSM_E_NOINTERFACE
, SSM_E_NOTIMPL
};
};
/**
- * @class SSMInterface
- * @brief This class represents main class for querying Soft Sensors
+ * @fn InitializeSSM
+ * @brief Initialize Soft sensor manager using given configuration information.
*
+ * @param [in] std::string xmlDescription - specification described in XML
+ *
+ * @return SSMRESULT
+ * @warning
+ * @exception
* @see
*/
- class SSMInterface
- {
- public:
- SSMInterface();
- ~SSMInterface();
+ SSMRESULT InitializeSSM(std::string xmlDescription);
- /**
- * @fn registerQuery
- * @brief Execute ContextQuery and return ContextQuery ID
- *
- * @param [in] std::string queryString - query for requesting data
- *
- * @param [in] IQueryEngineEvent listener - listener for receiving data related to query
- *
- * @param [in, out] int &cqid - ID of ContextQuery
- *
- * @return SSMRESULT
- * @warning
- * @exception
- * @see
- */
- SSMRESULT registerQuery(std::string queryString, IQueryEngineEvent *listener, int &cqid);
+ /**
+ * @fn TerminateSSM
+ * @brief Terminates Soft sensor manager
+ *
+ * @param None
+ *
+ * @return SSMRESULT
+ * @warning
+ * @exception
+ * @see
+ */
+ SSMRESULT TerminateSSM();
- /**
- * @fn unregisterQuery
- * @brief unregister registered ContextQuery according to cqid
- *
- * @param [in] int cqid - Context query corresponding to the cqid will be terminated
- *
- * @return SSMRESULT
- * @warning
- * @exception
- * @see
- */
- SSMRESULT unregisterQuery(int cqid);
- };
+ /**
+ * @fn RegisterQuery
+ * @brief Execute ContextQuery and return ContextQuery ID
+ *
+ * @param [in] std::string queryString - query for requesting data
+ *
+ * @param [in] IQueryEngineEvent listener - listener for receiving data related to query
+ *
+ * @param [in, out] int &cqid - ID of ContextQuery
+ *
+ * @return SSMRESULT
+ * @warning
+ * @exception
+ * @see
+ */
+ SSMRESULT RegisterQuery(std::string queryString, IQueryEngineEvent *listener, int &cqid);
+ /**
+ * @fn UnregisterQuery
+ * @brief unregister registered ContextQuery according to cqid
+ *
+ * @param [in] int cqid - Context query corresponding to the cqid will be terminated
+ *
+ * @return SSMRESULT
+ * @warning
+ * @exception
+ * @see
+ */
+ SSMRESULT UnregisterQuery(int cqid);
}
#endif
\ No newline at end of file
IQueryEngine *g_pQueryEngineInstance = NULL;
SSMCoreEventReceiver *g_pEventReceiver = NULL;
-SSMInterface::SSMInterface()
+SSMRESULT OIC::InitializeSSM(std::string xmlDescription)
{
- std::string xmlDescription = "<SSMCore>"
- "<Device>"
- "<UDN>abcde123-31f8-11b4-a222-08002b34c003</UDN>"
- "<Name>MyPC</Name>"
- "<Type>PC</Type>"
- "</Device>"
- "</SSMCore>";
-
SSMRESULT res = SSM_E_FAIL;
+ if (g_pQueryEngineInstance != NULL)
+ SSM_CLEANUP_ASSERT(SSM_E_INITIALIZED);
+
g_pEventReceiver = new SSMCoreEventReceiver();
SSM_CLEANUP_NULL_ASSERT(g_pEventReceiver);
SSM_CLEANUP_ASSERT(InitializeSSMCore(xmlDescription));
SSM_CLEANUP_ASSERT(StartSSMCore());
SSM_CLEANUP_ASSERT(CreateQueryEngine(&g_pQueryEngineInstance));
SSM_CLEANUP_ASSERT(g_pQueryEngineInstance->registerQueryEvent(g_pEventReceiver));
+
CLEANUP:
- ;
+ if (res != SSM_S_OK)
+ {
+ SAFE_DELETE(g_pEventReceiver);
+ }
+
+ return res;
}
-SSMInterface::~SSMInterface()
+SSMRESULT OIC::TerminateSSM()
{
SSMRESULT res = SSM_E_FAIL;
+ if (g_pQueryEngineInstance == NULL)
+ SSM_CLEANUP_ASSERT(SSM_E_NOTINIT);
+
SSM_CLEANUP_ASSERT(g_pQueryEngineInstance->unregisterQueryEvent(g_pEventReceiver));
ReleaseQueryEngine(g_pQueryEngineInstance);
g_pQueryEngineInstance = NULL;
CLEANUP:
SAFE_DELETE(g_pEventReceiver);
+ return res;
}
-SSMRESULT SSMInterface::registerQuery(IN std::string queryString, IN IQueryEngineEvent *listener,
- IN int &cqid)
+SSMRESULT OIC::RegisterQuery(IN std::string queryString, IN IQueryEngineEvent *listener,
+ IN int &cqid)
{
SSMRESULT res = SSM_E_FAIL;
+ if (g_pQueryEngineInstance == NULL)
+ SSM_CLEANUP_ASSERT(SSM_E_NOTINIT);
+
g_pEventReceiver->lockListener();
SSM_CLEANUP_ASSERT(g_pQueryEngineInstance->executeContextQuery(queryString, &cqid));
g_pEventReceiver->addListener(cqid, listener);
CLEANUP:
- g_pEventReceiver->unlockListener();
+ if (g_pEventReceiver != NULL)
+ g_pEventReceiver->unlockListener();
return res;
}
-SSMRESULT SSMInterface::unregisterQuery(IN int cqid)
+SSMRESULT OIC::UnregisterQuery(IN int cqid)
{
SSMRESULT res = SSM_E_FAIL;
+ if (g_pQueryEngineInstance == NULL)
+ SSM_CLEANUP_ASSERT(SSM_E_NOTINIT);
+
g_pEventReceiver->lockListener();
SSM_CLEANUP_ASSERT(g_pQueryEngineInstance->killContextQuery(cqid));
g_pEventReceiver->removeListener(cqid);
CLEANUP:
- g_pEventReceiver->unlockListener();
+ if (g_pEventReceiver != NULL)
+ g_pEventReceiver->unlockListener();
return res;
}
\ No newline at end of file
, SSM_E_POINTER
, SSM_E_OUTOFMEMORY
, SSM_E_FAIL
+ , SSM_E_NOTINIT
+ , SSM_E_INITIALIZED
+ , SSM_E_INVALIDXML
, SSM_E_NOINTERFACE
, SSM_E_NOTIMPL
};
};
/**
- * @class SSMInterface
- * @brief This class represents main class for querying Soft Sensors
+ * @fn InitializeSSM
+ * @brief Initialize Soft sensor manager using given configuration information.
*
+ * @param [in] std::string xmlDescription - specification described in XML
+ *
+ * @return SSMRESULT
+ * @warning
+ * @exception
* @see
*/
- class SSMInterface
- {
- public:
- SSMInterface();
- ~SSMInterface();
+ SSMRESULT InitializeSSM(std::string xmlDescription);
- /**
- * @fn registerQuery
- * @brief Execute ContextQuery and return ContextQuery ID
- *
- * @param [in] std::string queryString - query for requesting data
- *
- * @param [in] IQueryEngineEvent listener - listener for receiving data related to query
- *
- * @param [in, out] int &cqid - ID of ContextQuery
- *
- * @return SSMRESULT
- * @warning
- * @exception
- * @see
- */
- SSMRESULT registerQuery(std::string queryString, IQueryEngineEvent *listener, int &cqid);
+ /**
+ * @fn TerminateSSM
+ * @brief Terminates Soft sensor manager
+ *
+ * @param None
+ *
+ * @return SSMRESULT
+ * @warning
+ * @exception
+ * @see
+ */
+ SSMRESULT TerminateSSM();
- /**
- * @fn unregisterQuery
- * @brief unregister registered ContextQuery according to cqid
- *
- * @param [in] int cqid - Context query corresponding to the cqid will be terminated
- *
- * @return SSMRESULT
- * @warning
- * @exception
- * @see
- */
- SSMRESULT unregisterQuery(int cqid);
- };
+ /**
+ * @fn RegisterQuery
+ * @brief Execute ContextQuery and return ContextQuery ID
+ *
+ * @param [in] std::string queryString - query for requesting data
+ *
+ * @param [in] IQueryEngineEvent listener - listener for receiving data related to query
+ *
+ * @param [in, out] int &cqid - ID of ContextQuery
+ *
+ * @return SSMRESULT
+ * @warning
+ * @exception
+ * @see
+ */
+ SSMRESULT RegisterQuery(std::string queryString, IQueryEngineEvent *listener, int &cqid);
+ /**
+ * @fn UnregisterQuery
+ * @brief unregister registered ContextQuery according to cqid
+ *
+ * @param [in] int cqid - Context query corresponding to the cqid will be terminated
+ *
+ * @return SSMRESULT
+ * @warning
+ * @exception
+ * @see
+ */
+ SSMRESULT UnregisterQuery(int cqid);
}
#endif
\ No newline at end of file
virtual SSMRESULT registerResourceFinderEvent(IN IResourceEvent *pResourceEvent) = 0;
virtual SSMRESULT startResourceFinder() = 0;
+ virtual SSMRESULT stopResourceFinder() = 0;
virtual SSMRESULT onResourceFound(IN ISSMResource *pSensor) = 0;
virtual SSMRESULT onResourceLost(IN ISSMResource *pSensor) = 0;
public:
virtual SSMRESULT registerResourceFinderEvent(IN IResourceFinderEvent *pEvent) = 0;
virtual SSMRESULT startResourceFinder() = 0;
+ virtual SSMRESULT stopResourceFinder() = 0;
virtual SSMRESULT startObserveResource(IN ISSMResource *pSensor, IN IEvent *pEvent) = 0;
virtual SSMRESULT stopObserveResource(IN ISSMResource *pSensor) = 0;
};
msg = "SSM_E_FAIL";
break;
+ case SSM_E_NOTINIT:
+ msg = "SSM_E_NOTINIT";
+ break;
+
+ case SSM_E_INITIALIZED:
+ msg = "SSM_E_INITIALIZED";
+ break;
+
+ case SSM_E_INVALIDXML:
+ msg = "SSM_E_INVALIDXML";
+ break;
+
case SSM_E_NOINTERFACE:
msg = "SSM_E_NOINTERFACE";
break;
}
}
- SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_IContextRepository, (IBase **)&m_pContextRepository));
SSM_CLEANUP_ASSERT(CreateGlobalInstance(OID_ISensingEngine, (IBase **)&m_pSensingEngine));
+ SSM_CLEANUP_ASSERT(m_pSensingEngine->queryInterface(OID_IContextRepository,
+ (IBase **)&m_pContextRepository));
SSM_CLEANUP_ASSERT(m_pContextRepository->initRepository(name, type, pathSoftSensors,
pathDescription));
SSMRESULT CSoftSensorManager::startCore()
{
- //m_pSharingLayer->Start();
- return SSM_S_OK;
+ SSMRESULT res = SSM_E_FAIL;
+
+ SSM_CLEANUP_ASSERT(m_pContextRepository->startResourceFinder());
+
+CLEANUP:
+ return res;
}
SSMRESULT CSoftSensorManager::stopCore()
{
- //m_pSharingLayer->Stop();
- return SSM_S_OK;
+ SSMRESULT res = SSM_E_FAIL;
+
+ SSM_CLEANUP_ASSERT(m_pContextRepository->stopResourceFinder());
+
+CLEANUP:
+ return res;
}
SSMRESULT CSoftSensorManager::terminateCore(bool factoryResetFlag)
return res;
}
+SSMRESULT CContextRepository::stopResourceFinder()
+{
+ SSMRESULT res = SSM_E_FAIL;
+
+ SSM_CLEANUP_ASSERT(m_resourceFinder->stopResourceFinder());
+
+CLEANUP:
+ return res;
+}
+
SSMRESULT CContextRepository::registerResourceFinderEvent(IN IResourceEvent *pResourceEvent)
{
m_resourceEvents.push_back(pResourceEvent);
std::vector<DictionaryData> *dataList)
{
// use rapidxml-----------------------
- SSMRESULT res = SSM_E_FAIL;
+ SSMRESULT res = SSM_E_INVALIDXML;
rapidxml::xml_document< char > xmlDoc;
//xmlDoc.parse< 0 >( &xmlData.front() );
- xmlDoc.parse< 0 >(xmlData);
std::string keyStr;
std::string valueStr;
rapidxml::xml_node< char > *subItem2;
rapidxml::xml_node< char > *subItem3;
- // get value
- rapidxml::xml_node< char > *root = xmlDoc.first_node();
+ rapidxml::xml_node< char > *root;
- if (!root)
+ try
{
- SSM_CLEANUP_ASSERT(SSM_E_FAIL);
- }
+ xmlDoc.parse< 0 >(xmlData);
- for ( item = root->first_node(); item; item = item->next_sibling() )
- {
- DictionaryData dictionaryData;
- for ( subItem = item->first_node(); subItem ; subItem = subItem->next_sibling() )
+ // get value
+ root = xmlDoc.first_node();
+
+ if (!root)
{
- //root name
- keyStr = subItem->name(); // key
- valueStr = subItem->value(); // value
+ throw rapidxml::parse_error("No Root Element", 0);
+ }
- if (!keyStr.compare("name"))
- {
- dictionaryData.rootName = trim_both(valueStr);
- }
- ////std::cout<<keyStr << " : " << subItem->value() <<std::endl<<std::endl; //root_name
- for (subItem2 = subItem->first_node(); subItem2 ; subItem2 = subItem2->next_sibling())
+ for (item = root->first_node(); item; item = item->next_sibling())
+ {
+ DictionaryData dictionaryData;
+ for (subItem = item->first_node(); subItem; subItem = subItem->next_sibling())
{
- std::map<std::string, std::string> propertyMap;
- std::vector<std::string> enterconditionVector;
+ //root name
+ keyStr = subItem->name(); // key
+ valueStr = subItem->value(); // value
- keyStr = subItem2->name(); // key
- valueStr = subItem2->value(); // value
-
- if (!keyStr.compare("input"))
+ if (!keyStr.compare("name"))
{
- dictionaryData.inputs.push_back(trim_both(valueStr));
+ dictionaryData.rootName = trim_both(valueStr);
}
- ////std::cout<<name << " :: " << subItem2->value() <<std::endl<<std::endl;
- for (subItem3 = subItem2->first_node(); subItem3 ; subItem3 = subItem3->next_sibling())
+ ////std::cout<<keyStr << " : " << subItem->value() <<std::endl<<std::endl; //root_name
+ for (subItem2 = subItem->first_node(); subItem2; subItem2 = subItem2->next_sibling())
{
- std::string newKeyStr = subItem3->name(); // key
- valueStr = subItem3->value(); // value
+ std::map<std::string, std::string> propertyMap;
+ std::vector<std::string> enterconditionVector;
+
+ keyStr = subItem2->name(); // key
+ valueStr = subItem2->value(); // value
- if (!keyStr.compare("attribute") || !keyStr.compare("output") )
+ if (!keyStr.compare("input"))
{
- propertyMap.insert(std::make_pair(trim_both(newKeyStr), trim_both(valueStr)));
+ 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") || !keyStr.compare("output"))
+ {
+ propertyMap.insert(std::make_pair(trim_both(newKeyStr), trim_both(valueStr)));
+ }
+ }
+ if (!keyStr.compare("attribute"))
+ {
+ dictionaryData.attributeProperty.push_back(propertyMap);
+ }
+ else if (!keyStr.compare("output"))
+ {
+ dictionaryData.outputProperty.push_back(propertyMap);
}
- }
- if (!keyStr.compare("attribute"))
- {
- dictionaryData.attributeProperty.push_back(propertyMap);
- }
- else if (!keyStr.compare("output"))
- {
- dictionaryData.outputProperty.push_back(propertyMap);
}
}
+ //for accurate data.
+ /*
+ dictionaryData.app_input_count = std::to_string((long long)dictionaryData.app_inputs.size());
+ dictionaryData.input_count = std::to_string((long long)dictionaryData.inputs.size());
+ dictionaryData.attribute_property_count = std::to_string((long long)dictionaryData.attribute_property.size());
+ dictionaryData.output_property_count = std::to_string((long long)dictionaryData.output_property.size());
+ */
+
+ dataList->push_back(dictionaryData);
}
- //for accurate data.
- /*
- dictionaryData.app_input_count = std::to_string((long long)dictionaryData.app_inputs.size());
- dictionaryData.input_count = std::to_string((long long)dictionaryData.inputs.size());
- dictionaryData.attribute_property_count = std::to_string((long long)dictionaryData.attribute_property.size());
- dictionaryData.output_property_count = std::to_string((long long)dictionaryData.output_property.size());
- */
-
- dataList->push_back(dictionaryData);
- }
- res = SSM_S_OK;
+ res = SSM_S_OK;
+ }
+ catch (rapidxml::parse_error &e)
+ {
+ SSM_CLEANUP_ASSERT(SSM_E_INVALIDXML);
+ }
CLEANUP:
return res;
CLEANUP:
return res;
-}
\ No newline at end of file
+}
SSMRESULT registerResourceFinderEvent(IN IResourceEvent *pResourceEvent);
SSMRESULT startResourceFinder();
+ SSMRESULT stopResourceFinder();
SSMRESULT onResourceFound(IN ISSMResource *pSensor);
SSMRESULT onResourceLost(IN ISSMResource *pSensor);
SSMRESULT loadXMLFromString(IN char *xmlData, IN std::vector<DictionaryData> *dataList);
SSMRESULT getCurrentPath(OUT std::string *path);
};
-#endif
\ No newline at end of file
+#endif
m_pResourceFinderEvent = NULL;
+ m_multicastPresenceHandle = nullptr;
+
CLEANUP:
return res;
}
pMessage[0] = RESOURCE_DISCOVER_REQUESTPROFILE;
pMessage[1] = reinterpret_cast<intptr_t> (new std::shared_ptr<OC::OCResource>(resource));
- std::cout << "Resource Found !! >> " << path << std::endl;
-
m_pTasker->addTask(this, pMessage);
}
}
SSMRESULT res = SSM_E_FAIL;
OCStackResult ret = OC_STACK_ERROR;
- OC::OCPlatform::OCPresenceHandle presenceHandle = nullptr;
-
ret = OC::OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=SoftSensorManager.Sensor",
std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
if (ret != OC_STACK_OK)
SSM_CLEANUP_ASSERT(SSM_E_FAIL);
- ret = OC::OCPlatform::subscribePresence(presenceHandle, "coap://224.0.1.187",
+ ret = OC::OCPlatform::subscribePresence(m_multicastPresenceHandle, "coap://224.0.1.187",
"SoftSensorManager.Sensor",
std::bind(&CResourceFinder::presenceHandler, this, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3));
return res;
}
+SSMRESULT CResourceFinder::stopResourceFinder()
+{
+ SSMRESULT res = SSM_E_FAIL;
+ OCStackResult ret = OC_STACK_ERROR;
+
+ ret = OC::OCPlatform::unsubscribePresence(m_multicastPresenceHandle);
+
+ if (ret != OC_STACK_OK)
+ SSM_CLEANUP_ASSERT(SSM_E_FAIL);
+
+ m_multicastPresenceHandle = nullptr;
+
+ res = SSM_S_OK;
+
+CLEANUP:
+ return res;
+}
+
SSMRESULT CResourceFinder::startObserveResource(IN ISSMResource *pSensor, IN IEvent *pEvent)
{
return m_mapResourceHandler[pSensor->name]->startObserve(pEvent);
void presenceHandler(OCStackResult result, const unsigned int nonce,
const std::string &hostAddress);
SSMRESULT startResourceFinder();
+ SSMRESULT stopResourceFinder();
SSMRESULT startObserveResource(IN ISSMResource *pSensor, IN IEvent *pEvent);
SSMRESULT stopObserveResource(IN ISSMResource *pSensor);
RESOURCE_DISCOVER_INSTALL_RESOURCE,
RESOURCE_DISCOVER_UNINSTALL_RESOURCE
};
+
IResourceFinderEvent *m_pResourceFinderEvent;
CObjectPtr< ITasker > m_pTasker;
+ OC::OCPlatform::OCPresenceHandle m_multicastPresenceHandle;
std::map< std::string, OICResourceHandler * > m_mapResourceHandler;
std::map< std::string, std::vector<std::string> >
m_mapResources; // <hostaddress, std::vector<resources> >
{
typedef enum
{
- NONE = 0, REGISTER, UNREGISTER, DISCOMFORT_SAMPLE, EXIT = 9
+ NONE = 0, REGISTER, UNREGISTER, DISCOMFORT_SAMPLE, ITS_SAMPLE, EXIT = 9
} APPMenu;
}
;
class SSMTestApp: public IQueryEngineEvent
{
- private:
- SSMInterface m_SSMClient;
-
public:
SSMTestApp();
void registerQuery(std::string queryString);
void unregisterQuery();
+ void TrajectoryDataOutput(IModelData *pModelData);
+
/* operations from listener interface */
SSMRESULT onQueryEngineEvent(int cqid, IDataReader *pResult);
};
printf(" 1. Register Query \n");
printf(" 2. Unregister Query \n");
printf(" 3. Register DiscomfortIndexSensor sample query \n");
+ printf(" 4. Register IndoorTrajectorySensor sample query \n");
printf(" 9. exit \n");
printf("===============================================\n");
printf(" Please Enter the NO: ");
getline(cin, queryString);
}
- rtn = m_SSMClient.registerQuery(queryString, this, qid);
+ rtn = RegisterQuery(queryString, this, qid);
if (rtn == SSM_S_OK)
{
printf("QID : %d\n", qid);
}
else
- printf("Error occured(%d)", rtn);
+ printf("Error occured(%d)\n", rtn);
}
/* unRegister Query.*/
std::string qid;
SSMRESULT rtn = SSM_E_FAIL;
- printf(" Please Enter query string: ");
+ printf(" Please Enter query Id: ");
cin.ignore();
getline(cin, qid);
- rtn = m_SSMClient.unregisterQuery(atoi(qid.c_str()));
+ rtn = UnregisterQuery(atoi(qid.c_str()));
if (rtn == SSM_S_OK)
printf("The query has been unregistered!\n");
printf("Error occured(%d)\n", (int) rtn);
}
+
+#define INPUT_EA 9
+char input_name[INPUT_EA][10] = { "trackeeID", "timeT0", "ref01T0", "ref02T0", "ref03T0", "timeT1", "ref01T1", "ref02T1", "ref03T1" };
+
+void SSMTestApp::TrajectoryDataOutput(IModelData *pModelData)
+{
+ std::string name = "";
+ int l = 0;
+
+ std::string trackeeID;
+ std::string T0DateTime;
+ std::string T0Ref01;
+ std::string T0Ref02;
+ std::string T0Ref03;
+ std::string T1DateTime;
+ std::string T1Ref01;
+ std::string T1Ref02;
+ std::string T1Ref03;
+
+ for (int j = 0; j < pModelData->getPropertyCount(); j++)
+ {
+ name = pModelData->getPropertyName(j);
+
+ for (l = 0; l < INPUT_EA; l++)
+ {
+ if (name.compare(input_name[l]) == 0)
+ break;
+ }
+
+ switch (l)
+ {
+ case 0:
+ trackeeID = pModelData->getPropertyValue(j);
+ break;
+ case 1:
+ T0DateTime = pModelData->getPropertyValue(j);
+ break;
+ case 2:
+ T0Ref01 = pModelData->getPropertyValue(j);
+ break;
+ case 3:
+ T0Ref02 = pModelData->getPropertyValue(j);
+ break;
+ case 4:
+ T0Ref03 = pModelData->getPropertyValue(j);
+ break;
+ case 5:
+ T1DateTime = pModelData->getPropertyValue(j);
+ break;
+ case 6:
+ T1Ref01 = pModelData->getPropertyValue(j);
+ break;
+ case 7:
+ T1Ref02 = pModelData->getPropertyValue(j);
+ break;
+ case 8:
+ T1Ref03 = pModelData->getPropertyValue(j);
+ break;
+ default:
+ ;
+ }
+ }
+
+ printf("===========================================\n");
+ printf(" ITS Trajectory Data Output \n");
+ printf("===========================================\n");
+ printf("\n");
+ printf(" < Trackee Thing ID : %s > \n", trackeeID.c_str());
+ printf(" - Trajectory 01 \n");
+ printf(" 0. Date, Time : %s \n", T0DateTime.c_str());
+ printf(" 1. Ref. Thing : %s \n", T0Ref01.c_str());
+ printf(" 2. Ref. Thing : %s \n", T0Ref02.c_str());
+ printf(" 3. Ref. Thing : %s \n", T0Ref03.c_str());
+ printf("\n");
+ printf(" - Trajectory 02 \n");
+ printf(" 0. Date, Time : %s \n", T1DateTime.c_str());
+ printf(" 1. Ref. Thing : %s \n", T1Ref01.c_str());
+ printf(" 2. Ref. Thing : %s \n", T1Ref02.c_str());
+ printf(" 3. Ref. Thing : %s \n", T1Ref03.c_str());
+ printf("\n");
+ printf("===========================================\n");
+}
+
/* APP. Level Callback Function for Observer of client. */
SSMRESULT SSMTestApp::onQueryEngineEvent(int cqid, IDataReader *pResult)
{
cout << "Type: " << pModelData->getPropertyName(j) << " Value: " << pModelData->getPropertyValue(
j) << endl;
}
+
+ //TrajectoryDataOutput(pModelData);
}
}
SSMTestApp *SSMApp = new SSMTestApp();
APPMenu::APPMenu menu = APPMenu::NONE;
+ std::string xmlDescription = "<SSMCore>"
+ "<Device>"
+ "<UDN>abcde123-31f8-11b4-a222-08002b34c003</UDN>"
+ "<Name>MyPC</Name>"
+ "<Type>PC</Type>"
+ "</Device>"
+ "</SSMCore>";
+
+ if (InitializeSSM(xmlDescription) != SSM_S_OK)
+ std::cout << "core init failed" << std::endl;
+
while (menu != APPMenu::EXIT)
{
SSMApp->displayMenu();
"if Device.DiscomfortIndexSensor.discomfortIndex > 0");
break;
+ case APPMenu::ITS_SAMPLE:
+ SSMApp->registerQuery("subscribe Device.IndoorTrajectorySensor "\
+ "if Device.IndoorTrajectorySensor.trackeeID == \"9059AF16FEF7\"");
+ break;
+
case APPMenu::EXIT:
std::cout << "program exit." << std::endl;
break;
}
} // while
+ TerminateSSM();
+
delete SSMApp;
}
};
CQueryEngineEvent *g_SSMClientListener = new CQueryEngineEvent();
-SSMInterface *g_SSMClient = new SSMInterface();
static Elm_Object_Item *oicapp_append_separator(Evas_Object *genlist,
oicapp_data *ad)
str.replace(foundLT, strLT.length(), "<");
}
- g_SSMClient->registerQuery(str, g_SSMClientListener, g_CQID);
+ RegisterQuery(str, g_SSMClientListener, g_CQID);
sstream << "Query executed! cqid = " << g_CQID << std::ends;
oicapp_data *ad = (oicapp_data *)data;
if (g_CQID != 9999)
- g_SSMClient->unregisterQuery(g_CQID);
+ UnregisterQuery(g_CQID);
if (ad->win)
evas_object_del(ad->win);