From: Jihun Ha Date: Fri, 20 Jan 2017 02:25:53 +0000 (+0900) Subject: Change resource type, URI, and all relevant words in Easy setup service X-Git-Tag: 1.3.0~784 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bff73296b8fec7be5e04e1d4cdbebaf667b16847;p=platform%2Fupstream%2Fiotivity.git Change resource type, URI, and all relevant words in Easy setup service On decision of OCF meeting, resource types and URIs of easy setup resources are decided to be changed: * Resource type oic.wk.prov -> oic.r.easysetup oic.wk.wifi -> oic.r.wificonf oic.wk.cloudserver -> oic.r.coapcloudconf oic.wk.devconf -> oic.r.devconf * URI /ProvisioningResURI -> /EasySetupResURI /WiFiProvisioningResURI -> /WiFiConfResURI /CloudServerProvisioningResURI -> /CoapCloudConfResURI /DevConfProvisioningResURI -> /DevConfResURI Along with those changes, all classes, functions, structures' names are changed, respectively. Change-Id: I45a34e69be3348dd5adb9f7478995bee53be80e5 Signed-off-by: Jihun Ha Reviewed-on: https://gerrit.iotivity.org/gerrit/16581 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/easy-setup/enrollee/inc/ESEnrolleeCommon.h b/service/easy-setup/enrollee/inc/ESEnrolleeCommon.h index 99cce50..b1835e6 100755 --- a/service/easy-setup/enrollee/inc/ESEnrolleeCommon.h +++ b/service/easy-setup/enrollee/inc/ESEnrolleeCommon.h @@ -34,12 +34,12 @@ extern "C" */ typedef struct { - char ssid[OIC_STRING_MAX_VALUE]; /**< Ssid of the Enroller**/ - char pwd[OIC_STRING_MAX_VALUE]; /**< Pwd of the Enroller**/ - WIFI_AUTHTYPE authtype; /**< Auth type of the Enroller**/ - WIFI_ENCTYPE enctype; /**< Encryption type of the Enroller**/ - void *userdata; /**< Vender-specific data**/ -} ESWiFiProvData; + char ssid[OIC_STRING_MAX_VALUE]; /**< Ssid of the Enroller**/ + char pwd[OIC_STRING_MAX_VALUE]; /**< Pwd of the Enroller**/ + WIFI_AUTHTYPE authtype; /**< Auth type of the Enroller**/ + WIFI_ENCTYPE enctype; /**< Encryption type of the Enroller**/ + void *userdata; /**< Vender-specific data**/ +} ESWiFiConfData; /** * @brief Data structure delivered from mediator, which provides device configuration information @@ -50,7 +50,7 @@ typedef struct char language[OIC_STRING_MAX_VALUE]; /**< IETF language tag using ISO 639X **/ char country[OIC_STRING_MAX_VALUE]; /**< ISO Country Code (ISO 3166-1 Alpha-2) **/ void *userdata; /**< Vender-specific data**/ -} ESDevConfProvData; +} ESDevConfData; /** * @brief Data structure delivered from mediator, which provides Cloud server information @@ -63,7 +63,7 @@ typedef struct char authProvider[OIC_STRING_MAX_VALUE]; /**< Auth provider ID **/ char ciServer[OIC_STRING_MAX_VALUE]; /**< Cloud interface server URL which an Enrollee is going to registered **/ void *userdata; /**< Vender-specific data**/ -} ESCloudProvData; +} ESCoapCloudConfData; /** * @brief Data structure stored for Device property which includes a WiFi and device configuration. @@ -95,9 +95,9 @@ typedef struct */ typedef struct { - void (*WiFiProvCb) (ESWiFiProvData *); - void (*DevConfProvCb) (ESDevConfProvData *); - void (*CloudDataProvCb) (ESCloudProvData *); + void (*WiFiConfProvCb) (ESWiFiConfData *); + void (*DevConfProvCb) (ESDevConfData *); + void (*CoapCloudConfProvCb) (ESCoapCloudConfData *); } ESProvisioningCallbacks; diff --git a/service/easy-setup/enrollee/inc/easysetup.h b/service/easy-setup/enrollee/inc/easysetup.h index 5c993cc..99b926f 100755 --- a/service/easy-setup/enrollee/inc/easysetup.h +++ b/service/easy-setup/enrollee/inc/easysetup.h @@ -61,10 +61,10 @@ typedef void (*ESReadUserdataCb)(OCRepPayload* payload, char* resourceType, void * * @param isSecured True if the Enrollee is operating in secured mode. * @param resourceMask Provisining Resource Type which application wants to make. - * ES_WIFI_RESOURCE = 0x01, - * ES_CLOUD_RESOURCE = 0x02, + * ES_WIFICONF_RESOURCE = 0x01, + * ES_COAPCLOUDCONF_RESOURCE = 0x02, * ES_DEVCONF_RESOURCE = 0x04 - * @param callbacks ESProvisioningCallbacks for updating Provisioning Resources' data to the application + * @param callbacks ESProvisioningCallbacks for updating Easy setup Resources' data to the application * @return ::ES_OK on success, some other value upon failure. */ ESResult ESInitEnrollee(bool isSecured, ESResourceMask resourceMask, ESProvisioningCallbacks callbacks); @@ -73,7 +73,7 @@ ESResult ESInitEnrollee(bool isSecured, ESResourceMask resourceMask, ESProvision /** * This function Sets Device Information. * - * @param deviceProperty Contains device information composed of WiFi Structure & DevConf Structure + * @param deviceProperty Contains device information composed of WiFiConf Structure & DevConf Structure * @return ::ES_OK on success, some other value upon failure. * * @see ESDeviceProperty @@ -103,8 +103,7 @@ ESResult ESSetState(ESEnrolleeState esState); ESResult ESSetErrorCode(ESErrorCode esErrCode); /** - * This function performs termination of Provisioning and Network resources. - * Also terminates the IoTivity core stack. + * This function performs termination of all Easy setup resources. * * @return ::ES_OK on success, some other value upon failure. */ diff --git a/service/easy-setup/enrollee/src/easysetup.c b/service/easy-setup/enrollee/src/easysetup.c index e7d0b47..d463556 100755 --- a/service/easy-setup/enrollee/src/easysetup.c +++ b/service/easy-setup/enrollee/src/easysetup.c @@ -44,56 +44,56 @@ static bool gIsSecured = false; static ESProvisioningCallbacks gESProvisioningCb; static ESDeviceProperty gESDeviceProperty; -void ESWiFiRsrcCallback(ESResult esResult, ESWiFiProvData *eventData) +void ESWiFiConfRsrcCallback(ESResult esResult, ESWiFiConfData *eventData) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESWiFiRsrcCallback IN"); + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESWiFiConfRsrcCallback IN"); if(esResult != ES_OK) { - OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESWiFiRsrcCallback Error Occured"); + OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESWiFiConfRsrcCallback Error Occured"); return; } // deliver data to ESProvisioningCallbacks - if(gESProvisioningCb.WiFiProvCb != NULL) + if(gESProvisioningCb.WiFiConfProvCb != NULL) { - gESProvisioningCb.WiFiProvCb(eventData); + gESProvisioningCb.WiFiConfProvCb(eventData); } else { - OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "WiFiProvCb is NULL"); + OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "WiFiConfProvCb is NULL"); return; } } -void ESCloudRsrcCallback(ESResult esResult, ESCloudProvData *eventData) +void ESCoapCloudConfRsrcCallback(ESResult esResult, ESCoapCloudConfData *eventData) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESCloudRsrcCallback IN"); + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESCoapCloudConfRsrcCallback IN"); if(esResult != ES_OK) { - OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESCloudRsrcCallback Error Occured"); + OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESCoapCloudConfRsrcCallback Error Occured"); return; } - if(gESProvisioningCb.CloudDataProvCb != NULL) + if(gESProvisioningCb.CoapCloudConfProvCb != NULL) { - gESProvisioningCb.CloudDataProvCb(eventData); + gESProvisioningCb.CoapCloudConfProvCb(eventData); } else { - OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "CloudDataProvCb is NULL"); + OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "CoapCloudConfProvCb is NULL"); return; } } -void ESDevconfRsrcallback(ESResult esResult, ESDevConfProvData *eventData) +void ESDevConfRsrcallback(ESResult esResult, ESDevConfData *eventData) { - OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESDevconfRsrcallback IN"); + OIC_LOG_V(DEBUG, ES_ENROLLEE_TAG, "ESDevConfRsrcallback IN"); if(esResult != ES_OK) { - OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESDevconfRsrcallback Error Occured"); + OIC_LOG_V(ERROR, ES_ENROLLEE_TAG, "ESDevConfRsrcallback Error Occured"); return; } @@ -114,16 +114,16 @@ ESResult ESInitEnrollee(bool isSecured, ESResourceMask resourceMask, ESProvision gIsSecured = isSecured; - if((resourceMask & ES_WIFI_RESOURCE) == ES_WIFI_RESOURCE) + if((resourceMask & ES_WIFICONF_RESOURCE) == ES_WIFICONF_RESOURCE) { - if(callbacks.WiFiProvCb != NULL) + if(callbacks.WiFiConfProvCb != NULL) { - gESProvisioningCb.WiFiProvCb = callbacks.WiFiProvCb; - RegisterWifiRsrcEventCallBack(ESWiFiRsrcCallback); + gESProvisioningCb.WiFiConfProvCb = callbacks.WiFiConfProvCb; + RegisterWifiRsrcEventCallBack(ESWiFiConfRsrcCallback); } else { - OIC_LOG(ERROR, ES_ENROLLEE_TAG, "WiFiProvCb NULL"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "WiFiConfProvCb NULL"); return ES_ERROR; } } @@ -132,7 +132,7 @@ ESResult ESInitEnrollee(bool isSecured, ESResourceMask resourceMask, ESProvision if(callbacks.DevConfProvCb != NULL) { gESProvisioningCb.DevConfProvCb = callbacks.DevConfProvCb; - RegisterDevConfRsrcEventCallBack(ESDevconfRsrcallback); + RegisterDevConfRsrcEventCallBack(ESDevConfRsrcallback); } else { @@ -140,16 +140,16 @@ ESResult ESInitEnrollee(bool isSecured, ESResourceMask resourceMask, ESProvision return ES_ERROR; } } - if((resourceMask & ES_CLOUD_RESOURCE) == ES_CLOUD_RESOURCE) + if((resourceMask & ES_COAPCLOUDCONF_RESOURCE) == ES_COAPCLOUDCONF_RESOURCE) { - if(callbacks.CloudDataProvCb != NULL) + if(callbacks.CoapCloudConfProvCb != NULL) { - gESProvisioningCb.CloudDataProvCb = callbacks.CloudDataProvCb; - RegisterCloudRsrcEventCallBack(ESCloudRsrcCallback); + gESProvisioningCb.CoapCloudConfProvCb = callbacks.CoapCloudConfProvCb; + RegisterCloudRsrcEventCallBack(ESCoapCloudConfRsrcCallback); } else { - OIC_LOG(ERROR, ES_ENROLLEE_TAG, "CloudDataProvCb NULL"); + OIC_LOG(ERROR, ES_ENROLLEE_TAG, "CoapCloudConfProvCb NULL"); return ES_ERROR; } } diff --git a/service/easy-setup/enrollee/src/resourcehandler.c b/service/easy-setup/enrollee/src/resourcehandler.c index 44b5c04..9a4fed1 100755 --- a/service/easy-setup/enrollee/src/resourcehandler.c +++ b/service/easy-setup/enrollee/src/resourcehandler.c @@ -35,12 +35,12 @@ //----------------------------------------------------------------------------- /** - * @var g_ESProvResource + * @var g_ESEasySetupResource * @brief Structure for holding the Provisioning status */ -ProvResource g_ESProvResource; -WiFiResource g_ESWiFiResource; -CloudResource g_ESCloudResource; +EasySetupResource g_ESEasySetupResource; +WiFiConfResource g_ESWiFiConfResource; +CoapCloudConfResource g_ESCoapCloudConfResource; DevConfResource g_ESDevConfResource; //----------------------------------------------------------------------------- @@ -51,14 +51,14 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, OCEntityHandle OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload); OCEntityHandlerResult ProcessPutRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload); OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRepPayload** payload); -void updateProvResource(OCEntityHandlerRequest* ehRequest, OCRepPayload* input); -void updateWiFiResource(OCRepPayload* input); -void updateCloudResource(OCRepPayload* input); +void updateEasySetupResource(OCEntityHandlerRequest* ehRequest, OCRepPayload* input); +void updateWiFiConfResource(OCRepPayload* input); +void updateCoapCloudConfResource(OCRepPayload* input); void updateDevConfResource(OCRepPayload* input); const char *getResult(OCStackResult result); -ESWiFiCB gWifiRsrcEvtCb = NULL; -ESCloudCB gCloudRsrcEvtCb = NULL; +ESWiFiConfCB gWifiConfRsrcEvtCb = NULL; +ESCoapCloudConfCB gCoapCloudConfRsrcEvtCb = NULL; ESDevConfCB gDevConfRsrcEvtCb = NULL; ESReadUserdataCb gReadUserdataCb = NULL; @@ -105,14 +105,14 @@ ESResult SetCallbackForUserData(ESReadUserdataCb readCb, ESWriteUserdataCb write return ES_OK; } -void RegisterWifiRsrcEventCallBack(ESWiFiCB cb) +void RegisterWifiRsrcEventCallBack(ESWiFiConfCB cb) { - gWifiRsrcEvtCb = cb; + gWifiConfRsrcEvtCb = cb; } -void RegisterCloudRsrcEventCallBack(ESCloudCB cb) +void RegisterCloudRsrcEventCallBack(ESCoapCloudConfCB cb) { - gCloudRsrcEvtCb = cb; + gCoapCloudConfRsrcEvtCb = cb; } void RegisterDevConfRsrcEventCallBack(ESDevConfCB cb) @@ -122,13 +122,13 @@ void RegisterDevConfRsrcEventCallBack(ESDevConfCB cb) void UnRegisterResourceEventCallBack() { - if (gWifiRsrcEvtCb) + if (gWifiConfRsrcEvtCb) { - gWifiRsrcEvtCb = NULL; + gWifiConfRsrcEvtCb = NULL; } - if (gCloudRsrcEvtCb) + if (gCoapCloudConfRsrcEvtCb) { - gCloudRsrcEvtCb = NULL; + gCoapCloudConfRsrcEvtCb = NULL; } if (gDevConfRsrcEvtCb) { @@ -136,114 +136,114 @@ void UnRegisterResourceEventCallBack() } } -OCStackResult initProvResource(bool isSecured) +OCStackResult initEasySetupResource(bool isSecured) { - g_ESProvResource.status = ES_STATE_INIT; - g_ESProvResource.lastErrCode = ES_ERRCODE_NO_ERROR; + g_ESEasySetupResource.status = ES_STATE_INIT; + g_ESEasySetupResource.lastErrCode = ES_ERRCODE_NO_ERROR; OCStackResult res = OC_STACK_ERROR; if (isSecured) { - res = OCCreateResource(&g_ESProvResource.handle, OC_RSRVD_ES_RES_TYPE_PROV, + res = OCCreateResource(&g_ESEasySetupResource.handle, OC_RSRVD_ES_RES_TYPE_EASYSETUP, OC_RSRVD_INTERFACE_DEFAULT, - OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb, + OC_RSRVD_ES_URI_EASYSETUP, OCEntityHandlerCb, NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE); }else { - res = OCCreateResource(&g_ESProvResource.handle, OC_RSRVD_ES_RES_TYPE_PROV, + res = OCCreateResource(&g_ESEasySetupResource.handle, OC_RSRVD_ES_RES_TYPE_EASYSETUP, OC_RSRVD_INTERFACE_DEFAULT, - OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb, + OC_RSRVD_ES_URI_EASYSETUP, OCEntityHandlerCb, NULL, OC_DISCOVERABLE | OC_OBSERVABLE); } if(res) { - OIC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, ES_RH_TAG, "Created EasySetup resource with result: %s", getResult(res)); return res; } - res = OCBindResourceTypeToResource(g_ESProvResource.handle, OC_RSRVD_ES_RES_TYPE_COL); + res = OCBindResourceTypeToResource(g_ESEasySetupResource.handle, OC_RSRVD_ES_RES_TYPE_COL); if(res) { OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource type with result: %s", getResult(res)); return res; } - res = OCBindResourceInterfaceToResource(g_ESProvResource.handle, OC_RSRVD_INTERFACE_LL); + res = OCBindResourceInterfaceToResource(g_ESEasySetupResource.handle, OC_RSRVD_INTERFACE_LL); if(res) { OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource interface with result: %s", getResult(res)); return res; } - res = OCBindResourceInterfaceToResource(g_ESProvResource.handle, OC_RSRVD_INTERFACE_BATCH); + res = OCBindResourceInterfaceToResource(g_ESEasySetupResource.handle, OC_RSRVD_INTERFACE_BATCH); if(res) { OIC_LOG_V(INFO, ES_RH_TAG, "Binding Resource interface with result: %s", getResult(res)); return res; } - OIC_LOG_V(INFO, ES_RH_TAG, "Created Prov resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, ES_RH_TAG, "Created EasySetup resource with result: %s", getResult(res)); return res; } -OCStackResult initWiFiResource(bool isSecured) +OCStackResult initWiFiConfResource(bool isSecured) { OCStackResult res = OC_STACK_ERROR; - g_ESWiFiResource.supportedFreq = WIFI_BOTH; - g_ESWiFiResource.supportedMode[0] = WIFI_11A; - g_ESWiFiResource.supportedMode[1] = WIFI_11B; - g_ESWiFiResource.supportedMode[2] = WIFI_11G; - g_ESWiFiResource.supportedMode[3] = WIFI_11N; - g_ESWiFiResource.numMode = 4; - g_ESWiFiResource.authType = NONE_AUTH; - g_ESWiFiResource.encType = NONE_ENC; - OICStrcpy(g_ESWiFiResource.ssid, sizeof(g_ESWiFiResource.ssid), ""); - OICStrcpy(g_ESWiFiResource.cred, sizeof(g_ESWiFiResource.cred), ""); + g_ESWiFiConfResource.supportedFreq = WIFI_BOTH; + g_ESWiFiConfResource.supportedMode[0] = WIFI_11A; + g_ESWiFiConfResource.supportedMode[1] = WIFI_11B; + g_ESWiFiConfResource.supportedMode[2] = WIFI_11G; + g_ESWiFiConfResource.supportedMode[3] = WIFI_11N; + g_ESWiFiConfResource.numMode = 4; + g_ESWiFiConfResource.authType = NONE_AUTH; + g_ESWiFiConfResource.encType = NONE_ENC; + OICStrcpy(g_ESWiFiConfResource.ssid, sizeof(g_ESWiFiConfResource.ssid), ""); + OICStrcpy(g_ESWiFiConfResource.cred, sizeof(g_ESWiFiConfResource.cred), ""); if (isSecured) { - res = OCCreateResource(&g_ESWiFiResource.handle, OC_RSRVD_ES_RES_TYPE_WIFI, + res = OCCreateResource(&g_ESWiFiConfResource.handle, OC_RSRVD_ES_RES_TYPE_WIFICONF, OC_RSRVD_INTERFACE_DEFAULT, - OC_RSRVD_ES_URI_WIFI, OCEntityHandlerCb, + OC_RSRVD_ES_URI_WIFICONF, OCEntityHandlerCb, NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE); }else { - res = OCCreateResource(&g_ESWiFiResource.handle, OC_RSRVD_ES_RES_TYPE_WIFI, + res = OCCreateResource(&g_ESWiFiConfResource.handle, OC_RSRVD_ES_RES_TYPE_WIFICONF, OC_RSRVD_INTERFACE_DEFAULT, - OC_RSRVD_ES_URI_WIFI, OCEntityHandlerCb, + OC_RSRVD_ES_URI_WIFICONF, OCEntityHandlerCb, NULL, OC_DISCOVERABLE | OC_OBSERVABLE); } - OIC_LOG_V(INFO, ES_RH_TAG, "Created WiFi resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, ES_RH_TAG, "Created WiFiConf resource with result: %s", getResult(res)); return res; } -OCStackResult initCloudServerResource(bool isSecured) +OCStackResult initCoapCloudConfResource(bool isSecured) { OCStackResult res = OC_STACK_ERROR; - OICStrcpy(g_ESCloudResource.authCode, sizeof(g_ESCloudResource.authCode), ""); - OICStrcpy(g_ESCloudResource.accessToken, sizeof(g_ESCloudResource.accessToken), ""); - g_ESCloudResource.accessTokenType = NONE_OAUTH_TOKENTYPE; - OICStrcpy(g_ESCloudResource.authProvider, sizeof(g_ESCloudResource.authProvider), ""); - OICStrcpy(g_ESCloudResource.ciServer, sizeof(g_ESCloudResource.ciServer), ""); + OICStrcpy(g_ESCoapCloudConfResource.authCode, sizeof(g_ESCoapCloudConfResource.authCode), ""); + OICStrcpy(g_ESCoapCloudConfResource.accessToken, sizeof(g_ESCoapCloudConfResource.accessToken), ""); + g_ESCoapCloudConfResource.accessTokenType = NONE_OAUTH_TOKENTYPE; + OICStrcpy(g_ESCoapCloudConfResource.authProvider, sizeof(g_ESCoapCloudConfResource.authProvider), ""); + OICStrcpy(g_ESCoapCloudConfResource.ciServer, sizeof(g_ESCoapCloudConfResource.ciServer), ""); if (isSecured) { - res = OCCreateResource(&g_ESCloudResource.handle, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER, + res = OCCreateResource(&g_ESCoapCloudConfResource.handle, OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF, OC_RSRVD_INTERFACE_DEFAULT, - OC_RSRVD_ES_URI_CLOUDSERVER, OCEntityHandlerCb, + OC_RSRVD_ES_URI_COAPCLOUDCONF, OCEntityHandlerCb, NULL, OC_DISCOVERABLE | OC_OBSERVABLE | OC_SECURE); }else { - res = OCCreateResource(&g_ESCloudResource.handle, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER, + res = OCCreateResource(&g_ESCoapCloudConfResource.handle, OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF, OC_RSRVD_INTERFACE_DEFAULT, - OC_RSRVD_ES_URI_CLOUDSERVER, OCEntityHandlerCb, + OC_RSRVD_ES_URI_COAPCLOUDCONF, OCEntityHandlerCb, NULL, OC_DISCOVERABLE | OC_OBSERVABLE); } - OIC_LOG_V(INFO, ES_RH_TAG, "Created CloudServer resource with result: %s", getResult(res)); + OIC_LOG_V(INFO, ES_RH_TAG, "Created CoapCloudConf resource with result: %s", getResult(res)); return res; } @@ -277,25 +277,25 @@ OCStackResult initDevConfResource(bool isSecured) } -void updateProvResource(OCEntityHandlerRequest* ehRequest, OCRepPayload* input) +void updateEasySetupResource(OCEntityHandlerRequest* ehRequest, OCRepPayload* input) { - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESProvResource.status %d", g_ESProvResource.status); + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESEasySetupResource.status %d", g_ESEasySetupResource.status); if(ehRequest->query) { if(CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_BATCH)) { // When Provisioning resource has a POST with BatchInterface - updateCloudResource(input); - updateWiFiResource(input); + updateCoapCloudConfResource(input); + updateWiFiConfResource(input); updateDevConfResource(input); } } } -void updateWiFiResource(OCRepPayload* input) +void updateWiFiConfResource(OCRepPayload* input) { - ESWiFiProvData* wiFiData = (ESWiFiProvData*)OICMalloc(sizeof(ESWiFiProvData)); + ESWiFiConfData* wiFiData = (ESWiFiConfData*)OICMalloc(sizeof(ESWiFiConfData)); if(wiFiData == NULL) { @@ -312,66 +312,66 @@ void updateWiFiResource(OCRepPayload* input) char* ssid = NULL; if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_SSID, &ssid)) { - OICStrcpy(g_ESWiFiResource.ssid, sizeof(g_ESWiFiResource.ssid), ssid); + OICStrcpy(g_ESWiFiConfResource.ssid, sizeof(g_ESWiFiConfResource.ssid), ssid); OICStrcpy(wiFiData->ssid, sizeof(wiFiData->ssid), ssid); - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESWiFiResource.ssid : %s", g_ESWiFiResource.ssid); + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESWiFiConfResource.ssid : %s", g_ESWiFiConfResource.ssid); } char* cred = NULL; if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_CRED, &cred)) { - OICStrcpy(g_ESWiFiResource.cred, sizeof(g_ESWiFiResource.cred), cred); + OICStrcpy(g_ESWiFiConfResource.cred, sizeof(g_ESWiFiConfResource.cred), cred); OICStrcpy(wiFiData->pwd, sizeof(wiFiData->pwd), cred); - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESWiFiResource.cred %s", g_ESWiFiResource.cred); + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESWiFiConfResource.cred %s", g_ESWiFiConfResource.cred); } int64_t authType = -1; if (OCRepPayloadGetPropInt(input, OC_RSRVD_ES_AUTHTYPE, &authType)) { - g_ESWiFiResource.authType = authType; - wiFiData->authtype = g_ESWiFiResource.authType; - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESWiFiResource.authType %u", g_ESWiFiResource.authType); + g_ESWiFiConfResource.authType = authType; + wiFiData->authtype = g_ESWiFiConfResource.authType; + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESWiFiConfResource.authType %u", g_ESWiFiConfResource.authType); } int64_t encType = -1; if (OCRepPayloadGetPropInt(input, OC_RSRVD_ES_ENCTYPE, &encType)) { - g_ESWiFiResource.encType = encType; - wiFiData->enctype = g_ESWiFiResource.encType; - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESWiFiResource.encType %u", g_ESWiFiResource.encType); + g_ESWiFiConfResource.encType = encType; + wiFiData->enctype = g_ESWiFiConfResource.encType; + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESWiFiConfResource.encType %u", g_ESWiFiConfResource.encType); } if(gReadUserdataCb) { - gReadUserdataCb(input, OC_RSRVD_ES_RES_TYPE_WIFI, &wiFiData->userdata); + gReadUserdataCb(input, OC_RSRVD_ES_RES_TYPE_WIFICONF, &wiFiData->userdata); } if(ssid || cred || authType!= -1 || encType != -1) { - OIC_LOG(INFO, ES_RH_TAG, "Send WiFiRsrc Callback To ES"); + OIC_LOG(INFO, ES_RH_TAG, "Send WiFiConfRsrc Callback To ES"); // TODO : Need to check appropriateness of gWiFiData - if(gWifiRsrcEvtCb != NULL) + if(gWifiConfRsrcEvtCb != NULL) { - gWifiRsrcEvtCb(ES_OK, wiFiData); + gWifiConfRsrcEvtCb(ES_OK, wiFiData); } else { - OIC_LOG(ERROR, ES_RH_TAG, "gWifiRsrcEvtCb is NULL"); + OIC_LOG(ERROR, ES_RH_TAG, "gWifiConfRsrcEvtCb is NULL"); } } - if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESWiFiResource.handle, OC_HIGH_QOS)) + if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESWiFiConfResource.handle, OC_HIGH_QOS)) { - OIC_LOG(INFO, ES_RH_TAG, "Enrollee doesn't have any observers."); + OIC_LOG(INFO, ES_RH_TAG, "Enrollee doesn't have any observer."); } OICFree(wiFiData); } -void updateCloudResource(OCRepPayload* input) +void updateCoapCloudConfResource(OCRepPayload* input) { - ESCloudProvData* cloudData = (ESCloudProvData*)OICMalloc(sizeof(ESCloudProvData)); + ESCoapCloudConfData* cloudData = (ESCoapCloudConfData*)OICMalloc(sizeof(ESCoapCloudConfData)); if(cloudData == NULL) { @@ -381,7 +381,7 @@ void updateCloudResource(OCRepPayload* input) memset(cloudData->authCode, 0, OIC_STRING_MAX_VALUE); memset(cloudData->accessToken, 0, OIC_STRING_MAX_VALUE); - g_ESCloudResource.accessTokenType = NONE_OAUTH_TOKENTYPE; + g_ESCoapCloudConfResource.accessTokenType = NONE_OAUTH_TOKENTYPE; memset(cloudData->authProvider, 0, OIC_STRING_MAX_VALUE); memset(cloudData->ciServer, 0, OIC_STRING_MAX_VALUE); cloudData->userdata = NULL; @@ -389,66 +389,66 @@ void updateCloudResource(OCRepPayload* input) char *authCode = NULL; if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_AUTHCODE, &authCode)) { - OICStrcpy(g_ESCloudResource.authCode, sizeof(g_ESCloudResource.authCode), authCode); + OICStrcpy(g_ESCoapCloudConfResource.authCode, sizeof(g_ESCoapCloudConfResource.authCode), authCode); OICStrcpy(cloudData->authCode, sizeof(cloudData->authCode), authCode); - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCloudResource.authCode %s", g_ESCloudResource.authCode); + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCoapCloudConfResource.authCode %s", g_ESCoapCloudConfResource.authCode); } char *accessToken = NULL; if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_ACCESSTOKEN, &accessToken)) { - OICStrcpy(g_ESCloudResource.accessToken, sizeof(g_ESCloudResource.accessToken), accessToken); + OICStrcpy(g_ESCoapCloudConfResource.accessToken, sizeof(g_ESCoapCloudConfResource.accessToken), accessToken); OICStrcpy(cloudData->accessToken, sizeof(cloudData->accessToken), accessToken); - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCloudResource.accessToken %s", g_ESCloudResource.accessToken); + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCoapCloudConfResource.accessToken %s", g_ESCoapCloudConfResource.accessToken); } int64_t accessTokenType = -1; if (OCRepPayloadGetPropInt(input, OC_RSRVD_ES_ACCESSTOKEN_TYPE, &accessTokenType)) { - g_ESCloudResource.accessTokenType = accessTokenType; - cloudData->accessTokenType = g_ESCloudResource.accessTokenType; - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCloudResource.accessTokenType %d", g_ESCloudResource.accessTokenType); + g_ESCoapCloudConfResource.accessTokenType = accessTokenType; + cloudData->accessTokenType = g_ESCoapCloudConfResource.accessTokenType; + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCoapCloudConfResource.accessTokenType %d", g_ESCoapCloudConfResource.accessTokenType); } char *authProvider = NULL; if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_AUTHPROVIDER, &authProvider)) { - OICStrcpy(g_ESCloudResource.authProvider, sizeof(g_ESCloudResource.authProvider), authProvider); + OICStrcpy(g_ESCoapCloudConfResource.authProvider, sizeof(g_ESCoapCloudConfResource.authProvider), authProvider); OICStrcpy(cloudData->authProvider, sizeof(cloudData->authProvider), authProvider); - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCloudResource.authServerUrl %s", g_ESCloudResource.authProvider); + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCoapCloudConfResource.authServerUrl %s", g_ESCoapCloudConfResource.authProvider); } char *ciServer = NULL; if (OCRepPayloadGetPropString(input, OC_RSRVD_ES_CISERVER, &ciServer)) { - OICStrcpy(g_ESCloudResource.ciServer, sizeof(g_ESCloudResource.ciServer), ciServer); + OICStrcpy(g_ESCoapCloudConfResource.ciServer, sizeof(g_ESCoapCloudConfResource.ciServer), ciServer); OICStrcpy(cloudData->ciServer, sizeof(cloudData->ciServer), ciServer); - OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCloudResource.ciServer %s", g_ESCloudResource.ciServer); + OIC_LOG_V(INFO, ES_RH_TAG, "g_ESCoapCloudConfResource.ciServer %s", g_ESCoapCloudConfResource.ciServer); } if(gReadUserdataCb) { - gReadUserdataCb(input, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER, &cloudData->userdata); + gReadUserdataCb(input, OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF, &cloudData->userdata); } if(authCode || accessToken || authProvider || ciServer) { - OIC_LOG(INFO, ES_RH_TAG, "Send CloudRsrc Callback To ES"); + OIC_LOG(INFO, ES_RH_TAG, "Send CoapCloudConfRsrc Callback To ES"); // TODO : Need to check appropriateness of gCloudData - if(gCloudRsrcEvtCb != NULL) + if(gCoapCloudConfRsrcEvtCb != NULL) { - gCloudRsrcEvtCb(ES_OK, cloudData); + gCoapCloudConfRsrcEvtCb(ES_OK, cloudData); } else { - OIC_LOG(ERROR, ES_RH_TAG, "gCloudRsrcEvtCb is NULL"); + OIC_LOG(ERROR, ES_RH_TAG, "gCoapCloudConfRsrcEvtCb is NULL"); } } - if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESCloudResource.handle, OC_HIGH_QOS)) + if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESCoapCloudConfResource.handle, OC_HIGH_QOS)) { - OIC_LOG(INFO, ES_RH_TAG, "cloudResource doesn't have any observers."); + OIC_LOG(INFO, ES_RH_TAG, "CoapCloudConf resource doesn't have any observer."); } OICFree(cloudData); @@ -456,7 +456,7 @@ void updateCloudResource(OCRepPayload* input) void updateDevConfResource(OCRepPayload* input) { - ESDevConfProvData* devConfData = (ESDevConfProvData*)OICMalloc(sizeof(ESDevConfProvData)); + ESDevConfData* devConfData = (ESDevConfData*)OICMalloc(sizeof(ESDevConfData)); if(devConfData == NULL) { @@ -513,13 +513,13 @@ void updateDevConfResource(OCRepPayload* input) if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESDevConfResource.handle, OC_HIGH_QOS)) { - OIC_LOG(INFO, ES_RH_TAG, "devConfResource doesn't have any observers."); + OIC_LOG(INFO, ES_RH_TAG, "devConfResource doesn't have any observer."); } OICFree(devConfData); } -OCRepPayload* constructResponseOfWiFi(char *interface) +OCRepPayload* constructResponseOfWiFiConf(char *interface) { OCRepPayload* payload = OCRepPayloadCreate(); if (!payload) @@ -528,14 +528,14 @@ OCRepPayload* constructResponseOfWiFi(char *interface) return NULL; } - if(g_ESWiFiResource.handle == NULL) + if(g_ESWiFiConfResource.handle == NULL) { - OIC_LOG(ERROR, ES_RH_TAG, "WiFi resource is not created"); + OIC_LOG(ERROR, ES_RH_TAG, "WiFiConf resource is not created"); return NULL; } - OIC_LOG(INFO, ES_RH_TAG, "constructResponse wifi res"); - OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_WIFI); + OIC_LOG(INFO, ES_RH_TAG, "constructResponse WiFiConf res"); + OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_WIFICONF); OCRepPayload* repPayload = NULL; OCRepPayload* tempPayload = NULL; @@ -561,33 +561,33 @@ OCRepPayload* constructResponseOfWiFi(char *interface) size_t resourceTypesDimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0}; char **resourceTypes = (char **)OICMalloc(2 * sizeof(char*)); - resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_WIFI); + resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_WIFICONF); OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_RES_TYPE, (char **)resourceTypes, resourceTypesDimensions); } else { OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT); - OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_WIFI); + OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_WIFICONF); } - size_t dimensions[MAX_REP_ARRAY_DEPTH] = {g_ESWiFiResource.numMode, 0, 0}; - int64_t *modes_64 = (int64_t *)OICMalloc(g_ESWiFiResource.numMode * sizeof(int64_t)); - for(int i = 0 ; i < g_ESWiFiResource.numMode ; ++i) + size_t dimensions[MAX_REP_ARRAY_DEPTH] = {g_ESWiFiConfResource.numMode, 0, 0}; + int64_t *modes_64 = (int64_t *)OICMalloc(g_ESWiFiConfResource.numMode * sizeof(int64_t)); + for(int i = 0 ; i < g_ESWiFiConfResource.numMode ; ++i) { - modes_64[i] = g_ESWiFiResource.supportedMode[i]; + modes_64[i] = g_ESWiFiConfResource.supportedMode[i]; } OCRepPayloadSetIntArray(payload, OC_RSRVD_ES_SUPPORTEDWIFIMODE, (int64_t *)modes_64, dimensions); - OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_SUPPORTEDWIFIFREQ, g_ESWiFiResource.supportedFreq); - OCRepPayloadSetPropString(payload, OC_RSRVD_ES_SSID, g_ESWiFiResource.ssid); - OCRepPayloadSetPropString(payload, OC_RSRVD_ES_CRED, g_ESWiFiResource.cred); - OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_AUTHTYPE, (int) g_ESWiFiResource.authType); - OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_ENCTYPE, (int) g_ESWiFiResource.encType); + OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_SUPPORTEDWIFIFREQ, g_ESWiFiConfResource.supportedFreq); + OCRepPayloadSetPropString(payload, OC_RSRVD_ES_SSID, g_ESWiFiConfResource.ssid); + OCRepPayloadSetPropString(payload, OC_RSRVD_ES_CRED, g_ESWiFiConfResource.cred); + OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_AUTHTYPE, (int) g_ESWiFiConfResource.authType); + OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_ENCTYPE, (int) g_ESWiFiConfResource.encType); if(gWriteUserdataCb) { - gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_WIFI); + gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_WIFICONF); } if(!strcmp(interface, OC_RSRVD_INTERFACE_BATCH)) @@ -599,7 +599,7 @@ OCRepPayload* constructResponseOfWiFi(char *interface) return payload; } -OCRepPayload* constructResponseOfCloud(char *interface) +OCRepPayload* constructResponseOfCoapCloudConf(char *interface) { OCRepPayload* payload = OCRepPayloadCreate(); if (!payload) @@ -608,14 +608,14 @@ OCRepPayload* constructResponseOfCloud(char *interface) return NULL; } - if(g_ESCloudResource.handle == NULL) + if(g_ESCoapCloudConfResource.handle == NULL) { - OIC_LOG(ERROR, ES_RH_TAG, "CloudServer resource is not created"); + OIC_LOG(ERROR, ES_RH_TAG, "CoapCloudConf resource is not created"); return NULL; } - OIC_LOG(INFO, ES_RH_TAG, "constructResponse cloudserver res"); - OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_CLOUDSERVER); + OIC_LOG(INFO, ES_RH_TAG, "constructResponse CoapCloudConf res"); + OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_COAPCLOUDCONF); OCRepPayload* repPayload = NULL; OCRepPayload* tempPayload = NULL; @@ -641,25 +641,25 @@ OCRepPayload* constructResponseOfCloud(char *interface) size_t resourceTypesDimensions[MAX_REP_ARRAY_DEPTH] = {1, 0, 0}; char **resourceTypes = (char **)OICMalloc(2 * sizeof(char*)); - resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER); + resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF); OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_RES_TYPE, (char **)resourceTypes, resourceTypesDimensions); } else { OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT); - OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER); + OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF); } - OCRepPayloadSetPropString(payload, OC_RSRVD_ES_AUTHCODE, g_ESCloudResource.authCode); - OCRepPayloadSetPropString(payload, OC_RSRVD_ES_ACCESSTOKEN, g_ESCloudResource.accessToken); - OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_ACCESSTOKEN_TYPE, (int)g_ESCloudResource.accessTokenType); - OCRepPayloadSetPropString(payload, OC_RSRVD_ES_AUTHPROVIDER, g_ESCloudResource.authProvider); - OCRepPayloadSetPropString(payload, OC_RSRVD_ES_CISERVER, g_ESCloudResource.ciServer); + OCRepPayloadSetPropString(payload, OC_RSRVD_ES_AUTHCODE, g_ESCoapCloudConfResource.authCode); + OCRepPayloadSetPropString(payload, OC_RSRVD_ES_ACCESSTOKEN, g_ESCoapCloudConfResource.accessToken); + OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_ACCESSTOKEN_TYPE, (int)g_ESCoapCloudConfResource.accessTokenType); + OCRepPayloadSetPropString(payload, OC_RSRVD_ES_AUTHPROVIDER, g_ESCoapCloudConfResource.authProvider); + OCRepPayloadSetPropString(payload, OC_RSRVD_ES_CISERVER, g_ESCoapCloudConfResource.ciServer); if(gWriteUserdataCb) { - gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_CLOUDSERVER); + gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF); } if(!strcmp(interface, OC_RSRVD_INTERFACE_BATCH)) @@ -686,7 +686,7 @@ OCRepPayload* constructResponseOfDevConf(char *interface) return NULL; } - OIC_LOG(INFO, ES_RH_TAG, "constructResponse devconf res"); + OIC_LOG(INFO, ES_RH_TAG, "constructResponse DevConf res"); OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_DEVCONF); OCRepPayload* repPayload = NULL; @@ -743,7 +743,7 @@ OCRepPayload* constructResponseOfDevConf(char *interface) return payload; } -OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) +OCRepPayload* constructResponseOfEasySetup(OCEntityHandlerRequest *ehRequest) { OCRepPayload* payload = OCRepPayloadCreate(); if (!payload) @@ -763,7 +763,7 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) int childResCnt = 0; - if(g_ESWiFiResource.handle != NULL) + if(g_ESWiFiConfResource.handle != NULL) { OCRepPayload *add = OCRepPayloadCreate(); if(!add) @@ -784,17 +784,17 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) return NULL; } - resourceType[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_WIFI); + resourceType[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_WIFICONF); resourceInterface[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT); add->base.type = PAYLOAD_TYPE_REPRESENTATION; - OCRepPayloadSetPropString(add, OC_RSRVD_HREF, OC_RSRVD_ES_URI_WIFI); + OCRepPayloadSetPropString(add, OC_RSRVD_HREF, OC_RSRVD_ES_URI_WIFICONF); OCRepPayloadSetStringArray(add, OC_RSRVD_RESOURCE_TYPE, (const char **)resourceType, dimensions); OCRepPayloadSetStringArray(add, OC_RSRVD_INTERFACE, (const char **)resourceInterface, dimensions); - OCResourceProperty p = OCGetResourceProperties((OCResourceHandle *)g_ESWiFiResource.handle); + OCResourceProperty p = OCGetResourceProperties((OCResourceHandle *)g_ESWiFiConfResource.handle); OCRepPayload *policy = OCRepPayloadCreate(); if (!policy) { @@ -871,7 +871,7 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) arrayPayload[childResCnt++] = add; } - if(g_ESCloudResource.handle != NULL) + if(g_ESCoapCloudConfResource.handle != NULL) { OCRepPayload *add = OCRepPayloadCreate(); if(!add) @@ -892,17 +892,17 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) return NULL; } - resourceType[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER); + resourceType[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF); resourceInterface[0] = OICStrdup(OC_RSRVD_INTERFACE_DEFAULT); add->base.type = PAYLOAD_TYPE_REPRESENTATION; - OCRepPayloadSetPropString(add, OC_RSRVD_HREF, OC_RSRVD_ES_URI_CLOUDSERVER); + OCRepPayloadSetPropString(add, OC_RSRVD_HREF, OC_RSRVD_ES_URI_COAPCLOUDCONF); OCRepPayloadSetStringArray(add, OC_RSRVD_RESOURCE_TYPE, (const char **)resourceType, dimensions); OCRepPayloadSetStringArray(add, OC_RSRVD_INTERFACE, (const char **)resourceInterface, dimensions); - OCResourceProperty p = OCGetResourceProperties((OCResourceHandle *)g_ESCloudResource.handle); + OCResourceProperty p = OCGetResourceProperties((OCResourceHandle *)g_ESCoapCloudConfResource.handle); OCRepPayload *policy = OCRepPayloadCreate(); if (!policy) { @@ -931,20 +931,20 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) (ehRequest->query && !strcmp(ehRequest->query, "")) || (ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_DEFAULT))) { - OIC_LOG(INFO, ES_RH_TAG, "constructResponse prov res"); - OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_PROV); + OIC_LOG(INFO, ES_RH_TAG, "constructResponse EasySetup res"); + OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_EASYSETUP); OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_DEFAULT); OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_LL); OCRepPayloadAddInterface(payload, OC_RSRVD_INTERFACE_BATCH); - OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_PROV); + OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_EASYSETUP); OCRepPayloadAddResourceType(payload, OC_RSRVD_ES_RES_TYPE_COL); - OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_PROVSTATUS, g_ESProvResource.status); - OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_LAST_ERRORCODE, g_ESProvResource.lastErrCode); + OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_PROVSTATUS, g_ESEasySetupResource.status); + OCRepPayloadSetPropInt(payload, OC_RSRVD_ES_LAST_ERRORCODE, g_ESEasySetupResource.lastErrCode); if(gWriteUserdataCb) { - gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_PROV); + gWriteUserdataCb(payload, OC_RSRVD_ES_RES_TYPE_EASYSETUP); } OCRepPayloadSetPropObjectArray(payload, OC_RSRVD_ES_LINKS, arrayPayload, dimensions); @@ -957,8 +957,8 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) ehRequest->query && CompareResourceInterface(ehRequest->query, OC_RSRVD_INTERFACE_BATCH)) { - OIC_LOG(INFO, ES_RH_TAG, "constructResponse prov res"); - OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_PROV); + OIC_LOG(INFO, ES_RH_TAG, "constructResponse EasySetup res"); + OCRepPayloadSetUri(payload, OC_RSRVD_ES_URI_EASYSETUP); OCRepPayload* repPayload = NULL; @@ -991,17 +991,17 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) return NULL; } - resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_PROV); + resourceTypes[0] = OICStrdup(OC_RSRVD_ES_RES_TYPE_EASYSETUP); resourceTypes[1] = OICStrdup(OC_RSRVD_ES_RES_TYPE_COL); OCRepPayloadSetStringArray(repPayload, OC_RSRVD_ES_RES_TYPE, (char **)resourceTypes, resourceTypesDimensions); - OCRepPayloadSetPropInt(repPayload, OC_RSRVD_ES_PROVSTATUS, g_ESProvResource.status); - OCRepPayloadSetPropInt(repPayload, OC_RSRVD_ES_LAST_ERRORCODE, g_ESProvResource.lastErrCode); + OCRepPayloadSetPropInt(repPayload, OC_RSRVD_ES_PROVSTATUS, g_ESEasySetupResource.status); + OCRepPayloadSetPropInt(repPayload, OC_RSRVD_ES_LAST_ERRORCODE, g_ESEasySetupResource.lastErrCode); if(gWriteUserdataCb) { - gWriteUserdataCb(repPayload, OC_RSRVD_ES_RES_TYPE_PROV); + gWriteUserdataCb(repPayload, OC_RSRVD_ES_RES_TYPE_EASYSETUP); } OCRepPayloadSetPropObject(payload, OC_RSRVD_REPRESENTATION, repPayload); @@ -1014,14 +1014,14 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) OCRepPayload* head = payload; OCRepPayload* nextPayload = NULL; - nextPayload = constructResponseOfWiFi(OC_RSRVD_INTERFACE_BATCH); + nextPayload = constructResponseOfWiFiConf(OC_RSRVD_INTERFACE_BATCH); if(nextPayload != NULL) { payload->next = nextPayload; payload = payload->next; } - nextPayload = constructResponseOfCloud(OC_RSRVD_INTERFACE_BATCH); + nextPayload = constructResponseOfCoapCloudConf(OC_RSRVD_INTERFACE_BATCH); if(nextPayload != NULL) { payload->next = nextPayload; @@ -1047,48 +1047,48 @@ OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMa OCStackResult res = OC_STACK_ERROR; bool maskFlag = false; - res = initProvResource(isSecured); + res = initEasySetupResource(isSecured); if(res != OC_STACK_OK) { // TODO: destroy logic will be added - OIC_LOG_V(ERROR, ES_RH_TAG, "initProvResource result: %s", getResult(res)); + OIC_LOG_V(ERROR, ES_RH_TAG, "initEasySetupResource result: %s", getResult(res)); return res; } - if((resourceMask & ES_WIFI_RESOURCE) == ES_WIFI_RESOURCE) + if((resourceMask & ES_WIFICONF_RESOURCE) == ES_WIFICONF_RESOURCE) { maskFlag = true; - res = initWiFiResource(isSecured); + res = initWiFiConfResource(isSecured); if(res != OC_STACK_OK) { - OIC_LOG_V(ERROR, ES_RH_TAG, "initWiFiResource result: %s", getResult(res)); + OIC_LOG_V(ERROR, ES_RH_TAG, "initWiFiConfResource result: %s", getResult(res)); return res; } - res = OCBindResource(g_ESProvResource.handle, g_ESWiFiResource.handle); + res = OCBindResource(g_ESEasySetupResource.handle, g_ESWiFiConfResource.handle); if(res != OC_STACK_OK) { - OIC_LOG_V(ERROR, ES_RH_TAG, "Bind WiFiResource result: %s", getResult(res)); + OIC_LOG_V(ERROR, ES_RH_TAG, "Bind WiFiConfResource result: %s", getResult(res)); return res; } } - if((resourceMask & ES_CLOUD_RESOURCE) == ES_CLOUD_RESOURCE) + if((resourceMask & ES_COAPCLOUDCONF_RESOURCE) == ES_COAPCLOUDCONF_RESOURCE) { maskFlag = true; - res = initCloudServerResource(isSecured); + res = initCoapCloudConfResource(isSecured); if(res != OC_STACK_OK) { - OIC_LOG_V(ERROR, ES_RH_TAG, "initCloudResource result: %s", getResult(res)); + OIC_LOG_V(ERROR, ES_RH_TAG, "initCoapCloudConfResource result: %s", getResult(res)); return res; } - res = OCBindResource(g_ESProvResource.handle, g_ESCloudResource.handle); + res = OCBindResource(g_ESEasySetupResource.handle, g_ESCoapCloudConfResource.handle); if(res != OC_STACK_OK) { - OIC_LOG_V(ERROR, ES_RH_TAG, "Bind CloudResource result: %s", getResult(res)); + OIC_LOG_V(ERROR, ES_RH_TAG, "Bind CoapCloudConfResource result: %s", getResult(res)); return res; } } @@ -1103,7 +1103,7 @@ OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMa return res; } - res = OCBindResource(g_ESProvResource.handle, g_ESDevConfResource.handle); + res = OCBindResource(g_ESEasySetupResource.handle, g_ESDevConfResource.handle); if(res != OC_STACK_OK) { OIC_LOG_V(ERROR, ES_RH_TAG, "Bind DevConfResource result: %s", getResult(res)); @@ -1111,7 +1111,6 @@ OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMa } } - if(maskFlag == false) { OIC_LOG_V(ERROR, ES_RH_TAG, "Invalid ResourceMask"); @@ -1124,31 +1123,20 @@ OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMa return res; } -OCStackResult DeleteProvisioningResource() -{ - OCStackResult res = OCDeleteResource(g_ESProvResource.handle); - if (res != OC_STACK_OK) - { - OIC_LOG_V(INFO, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res)); - } - - return res; -} - OCStackResult DeleteEasySetupResources() { OCStackResult res = OC_STACK_ERROR; - if (g_ESWiFiResource.handle != NULL) + if (g_ESWiFiConfResource.handle != NULL) { - res = OCUnBindResource(g_ESProvResource.handle, g_ESWiFiResource.handle); + res = OCUnBindResource(g_ESEasySetupResource.handle, g_ESWiFiConfResource.handle); if(res != OC_STACK_OK) { OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind WiFi resource error with result: %s", getResult(res)); } } - if (g_ESCloudResource.handle != NULL) + if (g_ESCoapCloudConfResource.handle != NULL) { - res = OCUnBindResource(g_ESProvResource.handle, g_ESCloudResource.handle); + res = OCUnBindResource(g_ESEasySetupResource.handle, g_ESCoapCloudConfResource.handle); if(res != OC_STACK_OK) { OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind CloudServer resource error with result: %s", getResult(res)); @@ -1156,25 +1144,25 @@ OCStackResult DeleteEasySetupResources() } if (g_ESDevConfResource.handle != NULL) { - res = OCUnBindResource(g_ESProvResource.handle, g_ESDevConfResource.handle); + res = OCUnBindResource(g_ESEasySetupResource.handle, g_ESDevConfResource.handle); if(res != OC_STACK_OK) { OIC_LOG_V(ERROR, ES_RH_TAG, "Unbind DevConf resource error with result: %s", getResult(res)); } } - if (g_ESWiFiResource.handle != NULL) + if (g_ESWiFiConfResource.handle != NULL) { - res = OCDeleteResource(g_ESWiFiResource.handle); + res = OCDeleteResource(g_ESWiFiConfResource.handle); if (res != OC_STACK_OK) { OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting WiFi resource error with result: %s", getResult(res)); } } - if(g_ESCloudResource.handle != NULL) + if(g_ESCoapCloudConfResource.handle != NULL) { - res = OCDeleteResource(g_ESCloudResource.handle); + res = OCDeleteResource(g_ESCoapCloudConfResource.handle); if (res != OC_STACK_OK) { OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting CloudServer resource error with result: %s", getResult(res)); @@ -1190,9 +1178,9 @@ OCStackResult DeleteEasySetupResources() } } - if(g_ESProvResource.handle != NULL) + if(g_ESEasySetupResource.handle != NULL) { - res = OCDeleteResource(g_ESProvResource.handle); + res = OCDeleteResource(g_ESEasySetupResource.handle); if (res != OC_STACK_OK) { OIC_LOG_V(ERROR, ES_RH_TAG, "Deleting Prov resource error with result: %s", getResult(res)); @@ -1219,7 +1207,7 @@ OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRep OCRepPayload *getResp = NULL; *payload = NULL; - if(ehRequest->resource == g_ESProvResource.handle) + if(ehRequest->resource == g_ESEasySetupResource.handle) { if(ehRequest->query && strcmp(ehRequest->query, "") && @@ -1232,10 +1220,10 @@ OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRep } else { - getResp = constructResponseOfProv(ehRequest); + getResp = constructResponseOfEasySetup(ehRequest); } } - else if(ehRequest->resource == g_ESWiFiResource.handle) + else if(ehRequest->resource == g_ESWiFiConfResource.handle) { if(CheckEhRequestPayload(ehRequest) != OC_EH_OK) { @@ -1244,10 +1232,10 @@ OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRep } else { - getResp = constructResponseOfWiFi(OC_RSRVD_INTERFACE_DEFAULT); + getResp = constructResponseOfWiFiConf(OC_RSRVD_INTERFACE_DEFAULT); } } - else if(ehRequest->resource == g_ESCloudResource.handle) + else if(ehRequest->resource == g_ESCoapCloudConfResource.handle) { if(CheckEhRequestPayload(ehRequest) != OC_EH_OK) { @@ -1256,7 +1244,7 @@ OCEntityHandlerResult ProcessGetRequest(OCEntityHandlerRequest *ehRequest, OCRep } else { - getResp = constructResponseOfCloud(OC_RSRVD_INTERFACE_DEFAULT); + getResp = constructResponseOfCoapCloudConf(OC_RSRVD_INTERFACE_DEFAULT); } } else if(ehRequest->resource == g_ESDevConfResource.handle) @@ -1301,7 +1289,7 @@ OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRe return ehResult; } - if(ehRequest->resource == g_ESProvResource.handle) + if(ehRequest->resource == g_ESEasySetupResource.handle) { if(ehRequest->query && strcmp(ehRequest->query, "") && @@ -1313,10 +1301,10 @@ OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRe } else { - updateProvResource(ehRequest, input); + updateEasySetupResource(ehRequest, input); } } - else if(ehRequest->resource == g_ESWiFiResource.handle) + else if(ehRequest->resource == g_ESWiFiConfResource.handle) { if(CheckEhRequestPayload(ehRequest) != OC_EH_OK) { @@ -1325,10 +1313,10 @@ OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRe } else { - updateWiFiResource(input); + updateWiFiConfResource(input); } } - else if(ehRequest->resource == g_ESCloudResource.handle) + else if(ehRequest->resource == g_ESCoapCloudConfResource.handle) { if(CheckEhRequestPayload(ehRequest) != OC_EH_OK) { @@ -1337,7 +1325,7 @@ OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRe } else { - updateCloudResource(input); + updateCoapCloudConfResource(input); } } else if(ehRequest->resource == g_ESDevConfResource.handle) @@ -1354,17 +1342,17 @@ OCEntityHandlerResult ProcessPostRequest(OCEntityHandlerRequest *ehRequest, OCRe } OCRepPayload *getResp = NULL; - if(ehRequest->resource == g_ESProvResource.handle) + if(ehRequest->resource == g_ESEasySetupResource.handle) { - getResp = constructResponseOfProv(ehRequest); + getResp = constructResponseOfEasySetup(ehRequest); } - else if(ehRequest->resource == g_ESWiFiResource.handle) + else if(ehRequest->resource == g_ESWiFiConfResource.handle) { - getResp = constructResponseOfWiFi(OC_RSRVD_INTERFACE_DEFAULT); + getResp = constructResponseOfWiFiConf(OC_RSRVD_INTERFACE_DEFAULT); } - else if(ehRequest->resource == g_ESCloudResource.handle) + else if(ehRequest->resource == g_ESCoapCloudConfResource.handle) { - getResp = constructResponseOfCloud(OC_RSRVD_INTERFACE_DEFAULT); + getResp = constructResponseOfCoapCloudConf(OC_RSRVD_INTERFACE_DEFAULT); } else if(ehRequest->resource == g_ESDevConfResource.handle) { @@ -1419,7 +1407,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, OIC_LOG(INFO, ES_RH_TAG, "Received PUT request"); //PUT request will be handled in the internal implementation - if (g_ESProvResource.handle != NULL) + if (g_ESEasySetupResource.handle != NULL) { ehRet = ProcessPutRequest(entityHandlerRequest, &payload); } @@ -1432,7 +1420,7 @@ OCEntityHandlerResult OCEntityHandlerCb(OCEntityHandlerFlag flag, else if (OC_REST_POST == entityHandlerRequest->method) { OIC_LOG(INFO, ES_RH_TAG, "Received OC_REST_POST from client"); - if (g_ESProvResource.handle != NULL) + if (g_ESEasySetupResource.handle != NULL) { ehRet = ProcessPostRequest(entityHandlerRequest, &payload); } @@ -1483,17 +1471,17 @@ OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty) { OIC_LOG(INFO, ES_RH_TAG, "SetDeviceProperty IN"); - g_ESWiFiResource.supportedFreq = (deviceProperty->WiFi).freq; - OIC_LOG_V(INFO, ES_RH_TAG, "WiFi Freq : %d", g_ESWiFiResource.supportedFreq); + g_ESWiFiConfResource.supportedFreq = (deviceProperty->WiFi).freq; + OIC_LOG_V(INFO, ES_RH_TAG, "WiFi Freq : %d", g_ESWiFiConfResource.supportedFreq); int modeIdx = 0; while((deviceProperty->WiFi).mode[modeIdx] != WiFi_EOF) { - g_ESWiFiResource.supportedMode[modeIdx] = (deviceProperty->WiFi).mode[modeIdx]; - OIC_LOG_V(INFO, ES_RH_TAG, "WiFi Mode : %d", g_ESWiFiResource.supportedMode[modeIdx]); + g_ESWiFiConfResource.supportedMode[modeIdx] = (deviceProperty->WiFi).mode[modeIdx]; + OIC_LOG_V(INFO, ES_RH_TAG, "WiFi Mode : %d", g_ESWiFiConfResource.supportedMode[modeIdx]); modeIdx ++; } - g_ESWiFiResource.numMode = modeIdx; + g_ESWiFiConfResource.numMode = modeIdx; OICStrcpy(g_ESDevConfResource.devName, OIC_STRING_MAX_VALUE, (deviceProperty->DevConf).deviceName); OIC_LOG_V(INFO, ES_RH_TAG, "Device Name : %s", g_ESDevConfResource.devName); @@ -1502,7 +1490,7 @@ OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty) (deviceProperty->DevConf).modelNumber); OIC_LOG_V(INFO, ES_RH_TAG, "Model Number : %s", g_ESDevConfResource.modelNumber); - if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESWiFiResource.handle, OC_HIGH_QOS)) + if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESWiFiConfResource.handle, OC_HIGH_QOS)) { OIC_LOG(INFO, ES_RH_TAG, "wifiResource doesn't have any observers."); } @@ -1520,10 +1508,10 @@ OCStackResult SetEnrolleeState(ESEnrolleeState esState) { OIC_LOG(INFO, ES_RH_TAG, "SetEnrolleeState IN"); - g_ESProvResource.status = esState; - OIC_LOG_V(INFO, ES_RH_TAG, "Enrollee Status : %d", g_ESProvResource.status); + g_ESEasySetupResource.status = esState; + OIC_LOG_V(INFO, ES_RH_TAG, "Enrollee Status : %d", g_ESEasySetupResource.status); - if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESProvResource.handle, OC_HIGH_QOS)) + if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESEasySetupResource.handle, OC_HIGH_QOS)) { OIC_LOG(INFO, ES_RH_TAG, "provResource doesn't have any observers."); } @@ -1536,10 +1524,10 @@ OCStackResult SetEnrolleeErrCode(ESErrorCode esErrCode) { OIC_LOG(INFO, ES_RH_TAG, "SetEnrolleeErrCode IN"); - g_ESProvResource.lastErrCode = esErrCode; - OIC_LOG_V(INFO, ES_RH_TAG, "Enrollee ErrorCode : %d", g_ESProvResource.lastErrCode); + g_ESEasySetupResource.lastErrCode = esErrCode; + OIC_LOG_V(INFO, ES_RH_TAG, "Enrollee ErrorCode : %d", g_ESEasySetupResource.lastErrCode); - if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESProvResource.handle, OC_HIGH_QOS)) + if(OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESEasySetupResource.handle, OC_HIGH_QOS)) { OIC_LOG(INFO, ES_RH_TAG, "provResource doesn't have any observers."); } diff --git a/service/easy-setup/enrollee/src/resourcehandler.h b/service/easy-setup/enrollee/src/resourcehandler.h index c1e8520..1bd3b33 100755 --- a/service/easy-setup/enrollee/src/resourcehandler.h +++ b/service/easy-setup/enrollee/src/resourcehandler.h @@ -34,20 +34,20 @@ extern "C" { #endif -typedef void (*ESWiFiCB) (ESResult, ESWiFiProvData *); -typedef void (*ESCloudCB) (ESResult, ESCloudProvData *); -typedef void (*ESDevConfCB) (ESResult, ESDevConfProvData *); +typedef void (*ESWiFiConfCB) (ESResult, ESWiFiConfData *); +typedef void (*ESCoapCloudConfCB) (ESResult, ESCoapCloudConfData *); +typedef void (*ESDevConfCB) (ESResult, ESDevConfData *); typedef void (*ESWriteUserdataCb)(OCRepPayload* payload, char* resourceType); typedef void (*ESReadUserdataCb)(OCRepPayload* payload, char* resourceType, void** userdata); /* Structure to represent a Light resource */ -typedef struct PROVRESOURCE +typedef struct { OCResourceHandle handle; ProvStatus status; // provisiong status ESErrorCode lastErrCode; -} ProvResource; +} EasySetupResource; typedef struct { @@ -59,7 +59,7 @@ typedef struct char cred[OIC_STRING_MAX_VALUE]; // credential information. WIFI_AUTHTYPE authType; WIFI_ENCTYPE encType; -} WiFiResource; +} WiFiConfResource; typedef struct { @@ -69,7 +69,7 @@ typedef struct OAUTH_TOKENTYPE accessTokenType; char authProvider[OIC_STRING_MAX_VALUE]; char ciServer[OIC_STRING_MAX_VALUE]; -} CloudResource; +} CoapCloudConfResource; typedef struct { @@ -82,9 +82,9 @@ typedef struct } DevConfResource; /* Note: These values of structures are not thread-safety */ -extern ProvResource g_ESProvResource; -extern WiFiResource g_ESWiFiResource; -extern CloudResource g_ESCloudResource; +extern EasySetupResource g_ESEasySetupResource; +extern WiFiConfResource g_ESWiFiConfResource; +extern CoapCloudConfResource g_ESCoapCloudConfResource; extern DevConfResource g_ESDevConfResource; OCStackResult CreateEasySetupResources(bool isSecured, ESResourceMask resourceMask); @@ -95,8 +95,8 @@ OCStackResult SetEnrolleeState(ESEnrolleeState esState); OCStackResult SetEnrolleeErrCode(ESErrorCode esErrCode); OCEntityHandlerResult CheckEhRequestPayload(OCEntityHandlerRequest *ehRequest); -void RegisterWifiRsrcEventCallBack(ESWiFiCB); -void RegisterCloudRsrcEventCallBack(ESCloudCB); +void RegisterWifiRsrcEventCallBack(ESWiFiConfCB); +void RegisterCloudRsrcEventCallBack(ESCoapCloudConfCB); void RegisterDevConfRsrcEventCallBack(ESDevConfCB); void UnRegisterResourceEventCallBack(void); ESResult SetCallbackForUserData(ESReadUserdataCb readCb, ESWriteUserdataCb writeCb); diff --git a/service/easy-setup/enrollee/unittests/ESEnrolleeTest.cpp b/service/easy-setup/enrollee/unittests/ESEnrolleeTest.cpp index 6ebe826..6efd924 100755 --- a/service/easy-setup/enrollee/unittests/ESEnrolleeTest.cpp +++ b/service/easy-setup/enrollee/unittests/ESEnrolleeTest.cpp @@ -118,30 +118,30 @@ public: std::cout << __func__ << std::endl; } - static void WiFiProvCbInApp(ESWiFiProvData *) + static void WiFiConfProvCbInApp(ESWiFiConfData *) { std::cout << __func__ << std::endl; } - static void DevConfProvCbInApp(ESDevConfProvData *) + static void DevConfProvCbInApp(ESDevConfData *) { std::cout << __func__ << std::endl; } - static void CloudDataCbInApp(ESCloudProvData *) + static void CoapCloudConfCbInApp(ESCoapCloudConfData *) { std::cout << __func__ << std::endl; } ESResult startEnrollee() { - ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFI_RESOURCE | - ES_CLOUD_RESOURCE | + ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFICONF_RESOURCE | + ES_COAPCLOUDCONF_RESOURCE | ES_DEVCONF_RESOURCE); ESProvisioningCallbacks callbacks; - callbacks.WiFiProvCb = &EasysetupEnrolleeTest::WiFiProvCbInApp; + callbacks.WiFiConfProvCb = &EasysetupEnrolleeTest::WiFiConfProvCbInApp; callbacks.DevConfProvCb = &EasysetupEnrolleeTest::DevConfProvCbInApp; - callbacks.CloudDataProvCb = &EasysetupEnrolleeTest::CloudDataCbInApp; + callbacks.CoapCloudConfProvCb = &EasysetupEnrolleeTest::CoapCloudConfCbInApp; return ESInitEnrollee(false, resourcemMask, callbacks); } @@ -149,9 +149,9 @@ public: ESResult startEnrolleeWithInvalidRsrcMask() { ESProvisioningCallbacks callbacks; - callbacks.WiFiProvCb = &EasysetupEnrolleeTest::WiFiProvCbInApp; + callbacks.WiFiConfProvCb = &EasysetupEnrolleeTest::WiFiConfProvCbInApp; callbacks.DevConfProvCb = &EasysetupEnrolleeTest::DevConfProvCbInApp; - callbacks.CloudDataProvCb = &EasysetupEnrolleeTest::CloudDataCbInApp; + callbacks.CoapCloudConfProvCb = &EasysetupEnrolleeTest::CoapCloudConfCbInApp; return ESInitEnrollee(false, (ESResourceMask)0, callbacks); } @@ -211,13 +211,13 @@ TEST_F(EasysetupEnrolleeTest, ESInitEnrolleeFailedInvalidRsrcMask) TEST_F(EasysetupEnrolleeTest, ESInitEnrolleeFailedByWiFiCbIsNull) { - ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFI_RESOURCE | - ES_CLOUD_RESOURCE | + ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFICONF_RESOURCE | + ES_COAPCLOUDCONF_RESOURCE | ES_DEVCONF_RESOURCE); ESProvisioningCallbacks callbacks; - callbacks.WiFiProvCb = NULL; + callbacks.WiFiConfProvCb = NULL; callbacks.DevConfProvCb = &EasysetupEnrolleeTest::DevConfProvCbInApp; - callbacks.CloudDataProvCb = &EasysetupEnrolleeTest::CloudDataCbInApp; + callbacks.CoapCloudConfProvCb = &EasysetupEnrolleeTest::CoapCloudConfCbInApp; ESResult ret = ESInitEnrollee(false, resourcemMask, callbacks); EXPECT_EQ(ret, ES_ERROR); @@ -226,13 +226,13 @@ TEST_F(EasysetupEnrolleeTest, ESInitEnrolleeFailedByWiFiCbIsNull) TEST_F(EasysetupEnrolleeTest, ESInitEnrolleeFailedByDevConfCbIsNull) { - ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFI_RESOURCE | - ES_CLOUD_RESOURCE | + ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFICONF_RESOURCE | + ES_COAPCLOUDCONF_RESOURCE | ES_DEVCONF_RESOURCE); ESProvisioningCallbacks callbacks; - callbacks.WiFiProvCb = &EasysetupEnrolleeTest::WiFiProvCbInApp; + callbacks.WiFiConfProvCb = &EasysetupEnrolleeTest::WiFiConfProvCbInApp; callbacks.DevConfProvCb = NULL; - callbacks.CloudDataProvCb = &EasysetupEnrolleeTest::CloudDataCbInApp; + callbacks.CoapCloudConfProvCb = &EasysetupEnrolleeTest::CoapCloudConfCbInApp; ESResult ret = ESInitEnrollee(false, resourcemMask, callbacks); EXPECT_EQ(ret, ES_ERROR); @@ -241,13 +241,13 @@ TEST_F(EasysetupEnrolleeTest, ESInitEnrolleeFailedByDevConfCbIsNull) TEST_F(EasysetupEnrolleeTest, ESInitEnrolleeFailedByCloudCbIsNull) { - ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFI_RESOURCE | - ES_CLOUD_RESOURCE | + ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFICONF_RESOURCE | + ES_COAPCLOUDCONF_RESOURCE | ES_DEVCONF_RESOURCE); ESProvisioningCallbacks callbacks; - callbacks.WiFiProvCb = &EasysetupEnrolleeTest::WiFiProvCbInApp; + callbacks.WiFiConfProvCb = &EasysetupEnrolleeTest::WiFiConfProvCbInApp; callbacks.DevConfProvCb = &EasysetupEnrolleeTest::DevConfProvCbInApp; - callbacks.CloudDataProvCb = NULL; + callbacks.CoapCloudConfProvCb = NULL; ESResult ret = ESInitEnrollee(false, resourcemMask, callbacks); EXPECT_EQ(ret, ES_ERROR); @@ -382,8 +382,8 @@ TEST_F(EasysetupEnrolleeTest, WiFiAndDevConfProperiesProvisionedWithSuccess) cntForReceivedCallbackWithSuccess++; }); - mocks.OnCallFunc(WiFiProvCbInApp).Do( - [& cntForReceivedCallbackWithSuccess](ESWiFiProvData *data) + mocks.OnCallFunc(WiFiConfProvCbInApp).Do( + [& cntForReceivedCallbackWithSuccess](ESWiFiConfData *data) { if(!strcmp(data->ssid, "Iotivity_SSID") && !strcmp(data->pwd, "Iotivity_PWD") && @@ -394,7 +394,7 @@ TEST_F(EasysetupEnrolleeTest, WiFiAndDevConfProperiesProvisionedWithSuccess) } }); mocks.OnCallFunc(DevConfProvCbInApp).Do( - [& cntForReceivedCallbackWithSuccess](ESDevConfProvData *data) + [& cntForReceivedCallbackWithSuccess](ESDevConfData *data) { if(!strcmp(data->language, "korean") && !strcmp(data->country, "Korea")) @@ -428,8 +428,8 @@ TEST_F(EasysetupEnrolleeTest, CloudServerProperiesProvisionedWithSuccess) } }); - mocks.OnCallFunc(CloudDataCbInApp).Do( - [& cntForReceivedCallbackWithSuccess](ESCloudProvData *data) + mocks.OnCallFunc(CoapCloudConfCbInApp).Do( + [& cntForReceivedCallbackWithSuccess](ESCoapCloudConfData *data) { if(!strcmp(data->authCode, "authCode") && !strcmp(data->authProvider, "authProvider") && diff --git a/service/easy-setup/enrollee/unittests/ESMediatorSimulator.h b/service/easy-setup/enrollee/unittests/ESMediatorSimulator.h index 392cf6c..46b9738 100755 --- a/service/easy-setup/enrollee/unittests/ESMediatorSimulator.h +++ b/service/easy-setup/enrollee/unittests/ESMediatorSimulator.h @@ -68,7 +68,7 @@ public: void discoverRemoteEnrollee(std::function resource)> cb) { m_discoveryCb = cb; - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_EASYSETUP; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCb, @@ -80,7 +80,7 @@ public: { m_getConfigurationCb = cb; m_remoteEnrollee = NULL; - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_EASYSETUP; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetConfiguration, @@ -90,7 +90,7 @@ public: void getWifiRsrc(std::function cb) { m_getWifiCb = cb; - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_WIFI; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_WIFICONF; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetWifiRsrc, @@ -100,7 +100,7 @@ public: void getCloudRsrc(std::function cb) { m_getCloudCb = cb; - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_CLOUDSERVER; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetCloudRsrc, @@ -121,7 +121,7 @@ public: { m_getStatusCb = cb; m_remoteEnrollee = NULL; - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_EASYSETUP; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetStatus, @@ -132,7 +132,7 @@ public: { m_DevicePropProvisioningCb = cb; m_remoteEnrollee = NULL; - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_EASYSETUP; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToProvisionDeviceProperties, @@ -143,7 +143,7 @@ public: { m_CloudPropProvisioningCb = cb; m_remoteEnrollee = NULL; - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_EASYSETUP; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToProvisionCloudProperties, @@ -154,7 +154,7 @@ public: { m_provPutCb = cb; m_remoteEnrollee = NULL; - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_EASYSETUP; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToPutProvRsrc, @@ -201,7 +201,7 @@ private: return ; } - if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_discoveryCb) + if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_EASYSETUP) && m_discoveryCb) { m_discoveryCb(resource); m_discoveryCb = NULL; @@ -224,7 +224,7 @@ private: return ; } - if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_getConfigurationCb + if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_EASYSETUP) && m_getConfigurationCb && !m_remoteEnrollee) { m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource); @@ -271,7 +271,7 @@ private: return ; } - if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_WIFI) && m_getWifiCb) + if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_WIFICONF) && m_getWifiCb) { QueryParamsMap test; resource->get(test, std::bind( @@ -314,7 +314,7 @@ private: return ; } - if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER) && m_getCloudCb) + if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF) && m_getCloudCb) { QueryParamsMap test; resource->get(test, std::bind( @@ -381,7 +381,7 @@ private: return ; } - if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_getStatusCb + if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_EASYSETUP) && m_getStatusCb && !m_remoteEnrollee) { m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource); @@ -411,7 +411,7 @@ private: return ; } - if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && + if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_EASYSETUP) && m_DevicePropProvisioningCb && !m_remoteEnrollee) { m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource); @@ -449,7 +449,7 @@ private: return ; } - if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && + if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_EASYSETUP) && m_CloudPropProvisioningCb && !m_remoteEnrollee) { m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource); diff --git a/service/easy-setup/inc/escommon.h b/service/easy-setup/inc/escommon.h index 30289da..82f992f 100755 --- a/service/easy-setup/inc/escommon.h +++ b/service/easy-setup/inc/escommon.h @@ -68,14 +68,14 @@ extern "C" /** * Easysetup defined resoruce types and uris. */ -#define OC_RSRVD_ES_RES_TYPE_PROV "oic.wk.prov" -#define OC_RSRVD_ES_URI_PROV "/ProvisioningResURI" -#define OC_RSRVD_ES_RES_TYPE_WIFI "oic.wk.wifi" -#define OC_RSRVD_ES_URI_WIFI "/WiFiProvisioningResURI" -#define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "oic.wk.cloudserver" -#define OC_RSRVD_ES_URI_CLOUDSERVER "/CloudServerProvisioningResURI" -#define OC_RSRVD_ES_RES_TYPE_DEVCONF "oic.wk.devconf" -#define OC_RSRVD_ES_URI_DEVCONF "/DevConfProvisioningResURI" +#define OC_RSRVD_ES_RES_TYPE_EASYSETUP "oic.r.easysetup" +#define OC_RSRVD_ES_URI_EASYSETUP "/EasySetupResURI" +#define OC_RSRVD_ES_RES_TYPE_WIFICONF "oic.r.wificonf" +#define OC_RSRVD_ES_URI_WIFICONF "/WiFiConfResURI" +#define OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF "oic.r.coapcloudconf" +#define OC_RSRVD_ES_URI_COAPCLOUDCONF "/CoapCloudConfResURI" +#define OC_RSRVD_ES_RES_TYPE_DEVCONF "oic.r.devconf" +#define OC_RSRVD_ES_URI_DEVCONF "/DevConfResURI" /** @@ -239,14 +239,14 @@ typedef enum */ typedef enum { - ES_WIFI_RESOURCE = 0x01, - ES_CLOUD_RESOURCE = 0x02, + ES_WIFICONF_RESOURCE = 0x01, + ES_COAPCLOUDCONF_RESOURCE = 0x02, ES_DEVCONF_RESOURCE = 0x04 } ESResourceMask; /** * @brief Indicate enrollee and provisioning status. Provisioning status is shown in "provisioning - * status" property in provisioning resource. + * status" property in easysetup resource. */ typedef enum { diff --git a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESConstants.java b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESConstants.java index a694df2..e18281d 100755 --- a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESConstants.java +++ b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESConstants.java @@ -48,13 +48,13 @@ public class ESConstants { /** * Easysetup defined resoruce types and uris */ - public static final String OC_RSRVD_ES_RES_TYPE_PROV = "oic.wk.prov"; - public static final String OC_RSRVD_ES_URI_PROV = "/ProvisioningResURI"; - public static final String OC_RSRVD_ES_RES_TYPE_WIFI = "oic.wk.wifi"; - public static final String OC_RSRVD_ES_URI_WIFI = "/WiFiProvisioningResURI"; - public static final String OC_RSRVD_ES_RES_TYPE_CLOUDSERVER = "oic.wk.cloudserver"; - public static final String OC_RSRVD_ES_URI_CLOUDSERVER = "/CloudServerProvisioningResURI"; - public static final String OC_RSRVD_ES_RES_TYPE_DEVCONF = "oic.wk.devconf"; - public static final String OC_RSRVD_ES_URI_DEVCONF = "/DevConfProvisioningResURI"; + public static final String OC_RSRVD_ES_RES_TYPE_EASYSETUP = "oic.r.easysetup"; + public static final String OC_RSRVD_ES_URI_EASYSETUP = "/EasySetupResURI"; + public static final String OC_RSRVD_ES_RES_TYPE_WIFICONF = "oic.r.wificonf"; + public static final String OC_RSRVD_ES_URI_WIFICONF = "/WiFiConfResURI"; + public static final String OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF = "oic.r.coapcloudconf"; + public static final String OC_RSRVD_ES_URI_COAPCLOUDCONF = "/CoapCloudConfResURI"; + public static final String OC_RSRVD_ES_RES_TYPE_DEVCONF = "oic.r.devconf"; + public static final String OC_RSRVD_ES_URI_DEVCONF = "/DevConfResURI"; } diff --git a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetup.java b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetup.java index e04d11e..b89c8d7 100755 --- a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetup.java +++ b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetup.java @@ -89,7 +89,7 @@ public class EasySetup { * discovered in a network. The OcResource object can be obtained by calling * OcPlatform.findResource() API. What resource you have to discover with * the OcPlatform.findResource() API is a "provisioning" resource with a certain - * resource type, i.e. oic.wk.prov + * resource type, i.e. oic.r.easysetup * * @return Pointer to RemoteEnrollee instance */ diff --git a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeConf.java b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeConf.java index becbe52..fa4cfb2 100755 --- a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeConf.java +++ b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EnrolleeConf.java @@ -39,7 +39,7 @@ import java.util.List; public class EnrolleeConf { private static final String TAG = EnrolleeConf.class.getName(); - protected OcRepresentation mProvRep = null; + protected OcRepresentation mEasySetupRep = null; /** * Constructor * @@ -48,12 +48,12 @@ public class EnrolleeConf */ public EnrolleeConf(OcRepresentation rep) { - mProvRep = rep; + mEasySetupRep = rep; } public EnrolleeConf(EnrolleeConf enrolleeConf) { - mProvRep = enrolleeConf.getProvResRep(); + mEasySetupRep = enrolleeConf.getEasySetupRep(); } /** @@ -63,12 +63,12 @@ public class EnrolleeConf */ public String getDeviceName() { - if(mProvRep == null) + if(mEasySetupRep == null) { return null; } - List children = mProvRep.getChildren(); + List children = mEasySetupRep.getChildren(); for (OcRepresentation child : children) { if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_DEVCONF) != -1) @@ -103,12 +103,12 @@ public class EnrolleeConf */ public String getModelNumber() { - if(mProvRep == null) + if(mEasySetupRep == null) { return null; } - List children = mProvRep.getChildren(); + List children = mEasySetupRep.getChildren(); for (OcRepresentation child : children) { if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_DEVCONF) != -1) @@ -143,15 +143,15 @@ public class EnrolleeConf */ public ArrayList getWiFiModes() { - if(mProvRep == null) + if(mEasySetupRep == null) { return null; } - List children = mProvRep.getChildren(); + List children = mEasySetupRep.getChildren(); ArrayList modes = new ArrayList(); for (OcRepresentation child : children) { - if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_WIFI) != -1) + if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_WIFICONF) != -1) { try { OcRepresentation rep; @@ -185,15 +185,15 @@ public class EnrolleeConf */ public WIFI_FREQ getWiFiFreq() { - if(mProvRep == null) + if(mEasySetupRep == null) { return WIFI_FREQ.WIFI_FREQ_NONE; } - List children = mProvRep.getChildren(); + List children = mEasySetupRep.getChildren(); for (OcRepresentation child : children) { - if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_WIFI) != -1) + if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_WIFICONF) != -1) { try{ OcRepresentation rep; @@ -225,15 +225,15 @@ public class EnrolleeConf */ public boolean isCloudAccessible() { - if(mProvRep == null) + if(mEasySetupRep == null) { return false; } - List children = mProvRep.getChildren(); + List children = mEasySetupRep.getChildren(); for (OcRepresentation child : children) { - if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_CLOUDSERVER) != -1) + if(child.getUri().indexOf(ESConstants.OC_RSRVD_ES_URI_COAPCLOUDCONF) != -1) { return true; } @@ -241,9 +241,9 @@ public class EnrolleeConf return false; } - public OcRepresentation getProvResRep() + public OcRepresentation getEasySetupRep() { - return mProvRep; + return mEasySetupRep; } } diff --git a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/jni/JniGetConfigurationStatusListener.cpp b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/jni/JniGetConfigurationStatusListener.cpp index ac02811..3de688e 100755 --- a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/jni/JniGetConfigurationStatusListener.cpp +++ b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/jni/JniGetConfigurationStatusListener.cpp @@ -81,7 +81,7 @@ void JniGetConfigurationStatusListener::getConfigurationStatusCallback ( } EnrolleeConf enrolleeConf = getConfigurationStatusCb->getEnrolleeConf(); - OCRepresentation m_ProvRep = enrolleeConf.getProvResRep(); + OCRepresentation m_ProvRep = enrolleeConf.getEasySetupRep(); OCRepresentation* rep = new OCRepresentation(m_ProvRep); jlong handle = reinterpret_cast(rep); diff --git a/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h b/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h index 4ba1249..7783de2 100755 --- a/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h +++ b/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h @@ -47,7 +47,7 @@ namespace OIC namespace Service { /** - * @brief Properties of provisioning resource. It includes a provisioning status and last + * @brief Properties of easysetup resource. It includes a provisioning status and last * error code. */ class EnrolleeStatus @@ -116,7 +116,7 @@ namespace OIC }; /** - * @brief Data class stored for Cloud server property provisioning + * @brief Data class stored for provisioning of coap cloud server properties */ class CloudProp { @@ -156,7 +156,7 @@ namespace OIC } /** - * Set CloudServer resource properties to be delivered to Enrollee + * Set CoapCloudConf resource properties to be delivered to Enrollee * * @param authCode Auth code issued by OAuth2.0-compatible account server * @param authProvider Auth provider ID @@ -170,7 +170,7 @@ namespace OIC } /** - * Set CloudServer resource properties with Access token to be delivered to Enrollee + * Set CoapCloudConf resource properties with Access token to be delivered to Enrollee * * @param accessToken Access token which is given in a return of auth code issued by * OAuth2.0-compatible account server @@ -317,8 +317,8 @@ namespace OIC }; /** - * @brief Data class stored for Device property provisioning which includes a WiFi - * and device configuration provisioning + * @brief Data class stored for provisioning of Device properties which includes + * properties of WiFiConf resource and DevConf resource */ class DeviceProp { @@ -350,7 +350,7 @@ namespace OIC } /** - * Set WiFi resource properties to be delivered to Enrollee + * Set WiFiConf resource properties to be delivered to Enrollee * * @param ssid Ssid of the Enroller * @param pwd Pwd of the Enrolle @@ -588,21 +588,21 @@ namespace OIC /** * Constructor * The expected OCRepresentation is one for collection resource and has several child - * OCRepresentation object corresponding to WiFi, DevConf, and CloudServer resource's - * representation. + * OCRepresentation object corresponding to WiFiConf, DevConf, and CoapCloudConf + * resources' representations. */ EnrolleeConf(const OCRepresentation& rep) : - m_ProvRep(rep) + m_EasySetupRep(rep) { } EnrolleeConf(const EnrolleeConf& enrolleeConf) : - m_ProvRep(enrolleeConf.getProvResRep()) + m_EasySetupRep(enrolleeConf.getEasySetupRep()) { } EnrolleeConf(const EnrolleeConf&& enrolleeConf) : - m_ProvRep(std::move(enrolleeConf.getProvResRep())) + m_EasySetupRep(std::move(enrolleeConf.getEasySetupRep())) { } @@ -614,7 +614,7 @@ namespace OIC */ std::string getDeviceName() const { - std::vector children = m_ProvRep.getChildren(); + std::vector children = m_EasySetupRep.getChildren(); for(auto child = children.begin(); child != children.end(); ++child) { if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos) @@ -645,7 +645,7 @@ namespace OIC */ std::string getModelNumber() const { - std::vector children = m_ProvRep.getChildren(); + std::vector children = m_EasySetupRep.getChildren(); for(auto child = children.begin(); child != children.end(); ++child) { if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos) @@ -681,10 +681,10 @@ namespace OIC vector modes; modes.clear(); - std::vector children = m_ProvRep.getChildren(); + std::vector children = m_EasySetupRep.getChildren(); for(auto child = children.begin(); child != children.end(); ++child) { - if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos) + if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos) { OCRepresentation rep; if(child->hasAttribute(OC_RSRVD_REPRESENTATION)) @@ -718,10 +718,10 @@ namespace OIC */ WIFI_FREQ getWiFiFreq() const { - std::vector children = m_ProvRep.getChildren(); + std::vector children = m_EasySetupRep.getChildren(); for(auto child = children.begin(); child != children.end(); ++child) { - if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos) + if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos) { OCRepresentation rep; if(child->hasAttribute(OC_RSRVD_REPRESENTATION)) @@ -750,12 +750,12 @@ namespace OIC */ bool isCloudAccessible() const { - std::vector children = m_ProvRep.getChildren(); + std::vector children = m_EasySetupRep.getChildren(); for(auto child = children.begin(); child != children.end(); ++child) { for(auto rt : child->getResourceTypes()) { - if(0 == rt.compare(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER)) + if(0 == rt.compare(OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF)) { return true; } @@ -769,13 +769,13 @@ namespace OIC * * @return OCRepresentation object */ - const OCRepresentation& getProvResRep() const + const OCRepresentation& getEasySetupRep() const { - return m_ProvRep; + return m_EasySetupRep; } protected: - OCRepresentation m_ProvRep; + OCRepresentation m_EasySetupRep; }; /** diff --git a/service/easy-setup/mediator/richsdk/inc/EasySetup.hpp b/service/easy-setup/mediator/richsdk/inc/EasySetup.hpp index 5cfe9f5..82163bf 100755 --- a/service/easy-setup/mediator/richsdk/inc/EasySetup.hpp +++ b/service/easy-setup/mediator/richsdk/inc/EasySetup.hpp @@ -53,8 +53,8 @@ namespace OIC * @param enrolleeResource an OCResource object corresponding to enrollee resource * discovered in a network. The OCResource object can be obtained by calling * OCPlatform.findResource() API. What resource you have to discover with - * the OCPlatform.findResource() API is a "provisioning" resource with a certain - * resource type, i.e. oic.wk.prov + * the OCPlatform.findResource() API is a "easysetup" resource with a certain + * resource type, i.e. oic.r.easysetup * * @throws ESBadRequestException If createEnrolleeDevice is invoked with the same * provisioning information. diff --git a/service/easy-setup/mediator/richsdk/src/CloudResource.cpp b/service/easy-setup/mediator/richsdk/src/CloudResource.cpp index dcbd207..ce94718 100755 --- a/service/easy-setup/mediator/richsdk/src/CloudResource.cpp +++ b/service/easy-setup/mediator/richsdk/src/CloudResource.cpp @@ -68,7 +68,7 @@ namespace OIC std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)), shared_from_this()); - m_ocResource->post(OC_RSRVD_ES_RES_TYPE_PROV, BATCH_INTERFACE, + m_ocResource->post(OC_RSRVD_ES_RES_TYPE_EASYSETUP, BATCH_INTERFACE, provisioningRepresentation, QueryParamsMap(), cb, OC::QualityOfService::HighQos); OIC_LOG (DEBUG, ES_CLOUD_RES_TAG, "provisionProperties OUT"); diff --git a/service/easy-setup/mediator/richsdk/src/EasySetup.cpp b/service/easy-setup/mediator/richsdk/src/EasySetup.cpp index 9415bdb..e57bb80 100755 --- a/service/easy-setup/mediator/richsdk/src/EasySetup.cpp +++ b/service/easy-setup/mediator/richsdk/src/EasySetup.cpp @@ -31,7 +31,7 @@ namespace OIC { namespace Service { - #define EASYSETUP_TAG "EASY_SETUP" + #define EASYSETUP_TAG "ES_EASY_SETUP" EasySetup * EasySetup::s_instance = nullptr; @@ -54,7 +54,7 @@ namespace OIC if(resource) { - if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_PROV || + if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_EASYSETUP || resource->connectivityType() & CT_ADAPTER_TCP) { OIC_LOG (ERROR, EASYSETUP_TAG, "Given resource is not valid due to wrong rt or conntype"); diff --git a/service/easy-setup/mediator/richsdk/src/EnrolleeResource.cpp b/service/easy-setup/mediator/richsdk/src/EnrolleeResource.cpp index c642892..ad6dd1a 100755 --- a/service/easy-setup/mediator/richsdk/src/EnrolleeResource.cpp +++ b/service/easy-setup/mediator/richsdk/src/EnrolleeResource.cpp @@ -272,7 +272,7 @@ namespace OIC std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)), shared_from_this()); - m_ocResource->post(OC_RSRVD_ES_RES_TYPE_PROV, BATCH_INTERFACE, + m_ocResource->post(OC_RSRVD_ES_RES_TYPE_EASYSETUP, BATCH_INTERFACE, provisioningRepresentation, QueryParamsMap(), cb, OC::QualityOfService::HighQos); OIC_LOG (DEBUG, ES_REMOTE_ENROLLEE_RES_TAG, "provisionProperties OUT"); diff --git a/service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp b/service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp index ea963ff..9c44bbb 100755 --- a/service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp +++ b/service/easy-setup/mediator/richsdk/src/RemoteEnrollee.cpp @@ -174,7 +174,7 @@ namespace OIC { OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "devicePropProvisioningStatusHandler IN"); - OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "ProvStatus = %d", status->getESResult()); + OIC_LOG_V(DEBUG, ES_REMOTE_ENROLLEE_TAG, "DeviceProvStatus = %d", status->getESResult()); m_devicePropProvStatusCb(status); OIC_LOG(DEBUG, ES_REMOTE_ENROLLEE_TAG, "devicePropProvisioningStatusHandler OUT"); @@ -269,7 +269,7 @@ namespace OIC std::string query(""); query.append(ES_BASE_RES_URI); query.append("?rt="); - query.append(OC_RSRVD_ES_RES_TYPE_PROV); + query.append(OC_RSRVD_ES_RES_TYPE_EASYSETUP); OIC_LOG_V (DEBUG, ES_REMOTE_ENROLLEE_TAG, "query = %s", query.c_str()); @@ -532,7 +532,7 @@ namespace OIC if(resource) { - if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_PROV || + if(resource->getResourceTypes().at(0) != OC_RSRVD_ES_RES_TYPE_EASYSETUP || resource->connectivityType() & CT_ADAPTER_TCP) { OIC_LOG (ERROR, ES_REMOTE_ENROLLEE_TAG, "Given resource is not valid due to wrong rt or conntype"); diff --git a/service/easy-setup/mediator/richsdk/unittests/ESEnrolleeSimulator.h b/service/easy-setup/mediator/richsdk/unittests/ESEnrolleeSimulator.h index 026dec7..20f522e 100755 --- a/service/easy-setup/mediator/richsdk/unittests/ESEnrolleeSimulator.h +++ b/service/easy-setup/mediator/richsdk/unittests/ESEnrolleeSimulator.h @@ -47,14 +47,14 @@ public: ESResult initEnrollee() { - ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFI_RESOURCE | - ES_CLOUD_RESOURCE | + ESResourceMask resourcemMask = (ESResourceMask)(ES_WIFICONF_RESOURCE | + ES_COAPCLOUDCONF_RESOURCE | ES_DEVCONF_RESOURCE); ESProvisioningCallbacks callbacks; - callbacks.WiFiProvCb = &onWiFiProvisioning; + callbacks.WiFiConfProvCb = &onWiFiProvisioning; callbacks.DevConfProvCb = &onDevConfProvisioning; - callbacks.CloudDataProvCb = &onCloudProvisioning; + callbacks.CoapCloudConfProvCb = &onCloudProvisioning; return ESInitEnrollee(false, resourcemMask, callbacks); } @@ -79,15 +79,15 @@ public: } private: - static void onWiFiProvisioning(ESWiFiProvData* /*data*/) + static void onWiFiProvisioning(ESWiFiConfData* /*data*/) { } - static void onDevConfProvisioning(ESDevConfProvData* /*data*/) + static void onDevConfProvisioning(ESDevConfData* /*data*/) { } - static void onCloudProvisioning(ESCloudProvData* /*data*/) + static void onCloudProvisioning(ESCoapCloudConfData* /*data*/) { } }; diff --git a/service/easy-setup/mediator/richsdk/unittests/ESMediatorTest.cpp b/service/easy-setup/mediator/richsdk/unittests/ESMediatorTest.cpp index f0931f0..0dcd6ef 100755 --- a/service/easy-setup/mediator/richsdk/unittests/ESMediatorTest.cpp +++ b/service/easy-setup/mediator/richsdk/unittests/ESMediatorTest.cpp @@ -88,14 +88,14 @@ public: EasysetupMediatorTest() = default; ~EasysetupMediatorTest() = default; - std::shared_ptr CreateNotProvResource() + std::shared_ptr CreateNotEasySetupResource() { OCConnectivityType connectivityType = CT_DEFAULT; - std::vector types = {"oic.wk.notprov"}; + std::vector types = {"oic.r.noteasysetup"}; std::vector ifaces = {DEFAULT_INTERFACE}; return OCPlatform::constructResourceObject("coap://192.168.1.2:5000", - "/NotProvisioningResURI", + "/NotEasySetupResURI", connectivityType, false, types, @@ -104,7 +104,7 @@ public: void discoverRemoteEnrollee() { - std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV; + std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_EASYSETUP; OC::OCPlatform::findResource("", uri, OCConnectivityType::CT_DEFAULT, std::bind(&EasysetupMediatorTest::discoverRemoteEnrolleeCb, @@ -175,21 +175,21 @@ private: return ; } - if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV)) + if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_EASYSETUP)) { m_enrolleeResource = resource; } } }; -TEST_F(EasysetupMediatorTest, createremoteenrolleeFailedWithNotProvResource) +TEST_F(EasysetupMediatorTest, createremoteenrolleeFailedWithNotEasySetupResource) { - auto remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(CreateNotProvResource()); + auto remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(CreateNotEasySetupResource()); EXPECT_EQ(nullptr, remoteEnrollee); } -TEST_F(EasysetupMediatorTest, createremoteenrolleeSucceedWithProvResource) +TEST_F(EasysetupMediatorTest, createremoteenrolleeSucceedWithEasySetupResource) { discoverRemoteEnrollee(); g_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(m_enrolleeResource); diff --git a/service/easy-setup/sampleapp/enrollee/linux/easysetup_x.c b/service/easy-setup/sampleapp/enrollee/linux/easysetup_x.c index 5a1f29a..669fc38 100755 --- a/service/easy-setup/sampleapp/enrollee/linux/easysetup_x.c +++ b/service/easy-setup/sampleapp/enrollee/linux/easysetup_x.c @@ -48,7 +48,7 @@ void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata) if(payload != NULL) { - if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFI)) + if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFICONF)) { int64_t value = -1; if (OCRepPayloadGetPropInt(payload, USERPROPERTY_KEY_INT, &value)) @@ -74,7 +74,7 @@ void WriteUserdataCb(OCRepPayload* payload, char* resourceType) if(payload != NULL) { - if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFI)) + if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFICONF)) { OCRepPayloadSetPropInt(payload, USERPROPERTY_KEY_INT, g_userProperties.userValue_int); } diff --git a/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.c b/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.c index 9caada0..cc63855 100755 --- a/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.c +++ b/service/easy-setup/sampleapp/enrollee/linux/enrolleewifi.c @@ -67,13 +67,13 @@ void PrintMenu() printf("============\n"); } -void WiFiProvCbInApp(ESWiFiProvData *eventData) +void WiFiConfProvCbInApp(ESWiFiConfData *eventData) { - printf("WiFiProvCbInApp IN\n"); + printf("WiFiConfProvCbInApp IN\n"); if(eventData == NULL) { - printf("ESWiFiProvData is NULL\n"); + printf("ESWiFiConfData is NULL\n"); return ; } @@ -87,16 +87,16 @@ void WiFiProvCbInApp(ESWiFiProvData *eventData) printf("userValue : %d\n", ((UserProperties *)(eventData->userdata))->userValue_int); } - printf("WiFiProvCbInApp OUT\n"); + printf("WiFiConfProvCbInApp OUT\n"); } -void DevConfProvCbInApp(ESDevConfProvData *eventData) +void DevConfProvCbInApp(ESDevConfData *eventData) { printf("DevConfProvCbInApp IN\n"); if(eventData == NULL) { - printf("ESDevConfProvData is NULL\n"); + printf("ESDevConfData is NULL\n"); return ; } @@ -106,13 +106,13 @@ void DevConfProvCbInApp(ESDevConfProvData *eventData) printf("DevConfProvCbInApp OUT\n"); } -void CloudDataProvCbInApp(ESCloudProvData *eventData) +void CoapCloudConfProvCbInApp(ESCoapCloudConfData *eventData) { - printf("CloudDataProvCbInApp IN\n"); + printf("CoapCloudConfProvCbInApp IN\n"); if(eventData == NULL) { - printf("ESCloudProvData is NULL\n"); + printf("ESCoapCloudConfData is NULL\n"); return ; } @@ -122,13 +122,13 @@ void CloudDataProvCbInApp(ESCloudProvData *eventData) printf("AuthProvider : %s\n", eventData->authProvider); printf("CI Server : %s\n", eventData->ciServer); - printf("CloudDataProvCbInApp OUT\n"); + printf("CoapCloudConfProvCbInApp OUT\n"); } ESProvisioningCallbacks gCallbacks = { - .WiFiProvCb = &WiFiProvCbInApp, + .WiFiConfProvCb = &WiFiConfProvCbInApp, .DevConfProvCb = &DevConfProvCbInApp, - .CloudDataProvCb = &CloudDataProvCbInApp + .CoapCloudConfProvCb = &CoapCloudConfProvCbInApp }; FILE* server_fopen(const char *path, const char *mode) @@ -164,7 +164,7 @@ void StartEasySetup() return; } - ESResourceMask resourcemMask = ES_WIFI_RESOURCE | ES_CLOUD_RESOURCE | ES_DEVCONF_RESOURCE; + ESResourceMask resourcemMask = ES_WIFICONF_RESOURCE | ES_COAPCLOUDCONF_RESOURCE | ES_DEVCONF_RESOURCE; if(ESInitEnrollee(gIsSecured, resourcemMask, gCallbacks) != ES_OK) { printf("OCStack init error!!\n"); diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp index ce8d673..17a035e 100755 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp @@ -70,16 +70,16 @@ void PrintMenu() cout << "========================" << endl; } -void WiFiProvCbInApp(ESWiFiProvData *eventData) +void WiFiConfProvCbInApp(ESWiFiConfData *eventData) { - cout << "WiFiProvCbInApp IN" << endl; + cout << "WiFiConfProvCbInApp IN" << endl; gWiFiCBflag = true; ESSetState(ES_STATE_CONNECTING_TO_ENROLLER); if(eventData == NULL) { - cout << "ESWiFiProvData is NULL" << endl; + cout << "ESWiFiConfData is NULL" << endl; return ; } @@ -100,17 +100,17 @@ void WiFiProvCbInApp(ESWiFiProvData *eventData) strncpy(gPasswd, eventData->pwd, strlen(eventData->pwd)); } - cout << "WiFiProvCbInApp OUT" << endl; + cout << "WiFiConfProvCbInApp OUT" << endl; PrintMenu(); } -void DevConfProvCbInApp(ESDevConfProvData *eventData) +void DevConfProvCbInApp(ESDevConfData *eventData) { cout << "DevConfProvCbInApp IN" << endl; if(eventData == NULL) { - cout << "ESDevConfProvData is NULL" << endl; + cout << "ESDevConfData is NULL" << endl; return ; } @@ -120,27 +120,27 @@ void DevConfProvCbInApp(ESDevConfProvData *eventData) PrintMenu(); } -void CloudDataProvCbInApp(ESCloudProvData *eventData) +void CoapCloudConfProvCbInApp(ESCoapCloudConfData *eventData) { - cout << "CloudDataProvCbInApp IN" << endl; + cout << "CoapCloudConfProvCbInApp IN" << endl; if(eventData == NULL) { - cout << "ESCloudProvData is NULL" << endl; + cout << "ESCoapCloudConfData is NULL" << endl; return ; } cout << "AuthCode : " << eventData->authCode << endl; cout << "AuthProvider : " << eventData->authProvider << endl; cout << "CI Server : " << eventData->ciServer << endl; - cout << "CloudDataProvCbInApp OUT" << endl; + cout << "CoapCloudConfProvCbInApp OUT" << endl; PrintMenu(); } ESProvisioningCallbacks gCallbacks = { - .WiFiProvCb = &WiFiProvCbInApp, + .WiFiConfProvCb = &WiFiConfProvCbInApp, .DevConfProvCb = &DevConfProvCbInApp, - .CloudDataProvCb = &CloudDataProvCbInApp + .CoapCloudConfProvCb = &CoapCloudConfProvCbInApp }; FILE* server_fopen(const char *path, const char *mode) @@ -176,7 +176,7 @@ void StartEasySetup() return; } - ESResourceMask resourcemMask = (ESResourceMask) (ES_WIFI_RESOURCE | ES_CLOUD_RESOURCE | ES_DEVCONF_RESOURCE); + ESResourceMask resourcemMask = (ESResourceMask) (ES_WIFICONF_RESOURCE | ES_COAPCLOUDCONF_RESOURCE | ES_DEVCONF_RESOURCE); cout << "resourcemMask : " << resourcemMask << endl; if(ESInitEnrollee(gIsSecured, resourcemMask, gCallbacks) != ES_OK) { diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java index 0271ae5..650f44d 100755 --- a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java +++ b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java @@ -472,7 +472,7 @@ public class EasysetupActivity extends Activity }); try { - String requestUri = OcPlatform.WELL_KNOWN_QUERY + "?rt=" + ESConstants.OC_RSRVD_ES_RES_TYPE_PROV; + String requestUri = OcPlatform.WELL_KNOWN_QUERY + "?rt=" + ESConstants.OC_RSRVD_ES_RES_TYPE_EASYSETUP; OcPlatform.findResource("", requestUri, EnumSet.of(OcConnectivityType.CT_DEFAULT), diff --git a/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/mediator.cpp b/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/mediator.cpp index 47313f1..0566527 100755 --- a/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/mediator.cpp +++ b/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/mediator.cpp @@ -307,7 +307,7 @@ void foundResource(std::shared_ptr resource) // Do some operations with resource object. if(resource && !curResource && - resource->getResourceTypes().at(0) == OC_RSRVD_ES_RES_TYPE_PROV) + resource->getResourceTypes().at(0) == OC_RSRVD_ES_RES_TYPE_EASYSETUP) { std::cout<<"DISCOVERED Resource:"< resource) // Do some operations with resource object. if(resource && !curResource && - resource->getResourceTypes().at(0) == OC_RSRVD_ES_RES_TYPE_PROV) + resource->getResourceTypes().at(0) == OC_RSRVD_ES_RES_TYPE_EASYSETUP) { std::cout<<"DISCOVERED Resource:"<