#include "cainterface.h"
#include "OCPlatform.h"
-#define PROV_RESOURCE_TYPE "ocf.wk.prov"
-#define WIFI_RESOURCE_TYPE "ocf.wk.wifi"
-#define DEV_RESOURCE_TYPE "ocf.wk.devconf"
-#define CLOUD_RESOURCE_TYPE "ocf.wk.cloudserver"
-
using namespace OIC::Service;
class ESMediatorSimulator
void discoverRemoteEnrollee(std::function<void(std::shared_ptr<OC::OCResource> resource)> cb)
{
m_discoveryCb = cb;
- std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCb,
{
m_getConfigurationCb = cb;
m_remoteEnrollee = NULL;
- std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetConfiguration,
void getWifiRsrc(std::function<void(const OCRepresentation& rep)> cb)
{
m_getWifiCb = cb;
- std::string uri = std::string("/oic/res?rt=") + WIFI_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_WIFI;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetWifiRsrc,
void getCloudRsrc(std::function<void(const OCRepresentation& rep)> cb)
{
m_getCloudCb = cb;
- std::string uri = std::string("/oic/res?rt=") + CLOUD_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_CLOUDSERVER;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetCloudRsrc,
void getDevConfiguration(std::function<void(const OCRepresentation& rep)> cb)
{
m_getDevConfCb = cb;
- std::string uri = std::string("/oic/res?rt=") + DEV_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_DEVCONF;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetDevConf,
{
m_getStatusCb = cb;
m_remoteEnrollee = NULL;
- std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetStatus,
{
m_DevicePropProvisioningCb = cb;
m_remoteEnrollee = NULL;
- std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToProvisionDeviceProperties,
{
m_CloudPropProvisioningCb = cb;
m_remoteEnrollee = NULL;
- std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToProvisionCloudProperties,
{
m_provPutCb = cb;
m_remoteEnrollee = NULL;
- std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+ std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
OC::OCPlatform::findResource("", uri,
OCConnectivityType::CT_DEFAULT,
std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToPutProvRsrc,
return ;
}
- if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) && m_discoveryCb)
+ if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_discoveryCb)
{
m_discoveryCb(resource);
m_discoveryCb = NULL;
return ;
}
- if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) && m_getConfigurationCb
+ if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_getConfigurationCb
&& !m_remoteEnrollee)
{
m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource);
void discoverRemoteEnrolleeCbToGetWifiRsrc(std::shared_ptr<OC::OCResource> resource)
{
- if(!resource->getResourceTypes().at(0).compare(WIFI_RESOURCE_TYPE) && m_getWifiCb)
+ if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_WIFI) && m_getWifiCb)
{
QueryParamsMap test;
resource->get(test, std::bind(
void discoverRemoteEnrolleeCbToGetCloudRsrc(std::shared_ptr<OC::OCResource> resource)
{
- if(!resource->getResourceTypes().at(0).compare(CLOUD_RESOURCE_TYPE) && m_getCloudCb)
+ if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER) && m_getCloudCb)
{
QueryParamsMap test;
resource->get(test, std::bind(
void discoverRemoteEnrolleeCbToGetDevConf(std::shared_ptr<OC::OCResource> resource)
{
- if(!resource->getResourceTypes().at(0).compare(DEV_RESOURCE_TYPE) && m_getDevConfCb)
+ if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_DEVCONF) && m_getDevConfCb)
{
QueryParamsMap test;
resource->get(test, std::bind(
return ;
}
- if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) && m_getStatusCb
+ if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_getStatusCb
&& !m_remoteEnrollee)
{
m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource);
return ;
}
- if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) &&
+ if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) &&
m_DevicePropProvisioningCb && !m_remoteEnrollee)
{
m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource);
return ;
}
- if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) &&
+ if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) &&
m_CloudPropProvisioningCb && !m_remoteEnrollee)
{
m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource);