Update resource types of easy setup
authorJihun Ha <jihun.ha@samsung.com>
Tue, 23 Aug 2016 01:16:08 +0000 (10:16 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Tue, 23 Aug 2016 08:32:36 +0000 (08:32 +0000)
Rather than "ocf.wk." prefix, "oic.wk." is decided to be used.

Change-Id: Ic140b82fdc987da0d95491abe9985febf1e6b544
Signed-off-by: Jihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10757
Reviewed-by: Heewon Park <h_w.park@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/easy-setup/enrollee/unittests/ESMediatorSimulator.h
service/easy-setup/inc/escommon.h
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/ESConstants.java [changed mode: 0644->0755]
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/EasySetup.java
service/easy-setup/mediator/richsdk/inc/EasySetup.h
service/easy-setup/mediator/richsdk/unittests/ESEnrolleeSimulator.h [changed mode: 0644->0755]
service/easy-setup/mediator/richsdk/unittests/ESMediatorTest.cpp
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java

index f6f8049..9efd51d 100755 (executable)
 #include "cainterface.h"
 #include "OCPlatform.h"
 
-#define PROV_RESOURCE_TYPE "ocf.wk.prov"
-#define WIFI_RESOURCE_TYPE "ocf.wk.wifi"
-#define DEV_RESOURCE_TYPE  "ocf.wk.devconf"
-#define CLOUD_RESOURCE_TYPE "ocf.wk.cloudserver"
-
 using namespace OIC::Service;
 
 class ESMediatorSimulator
@@ -73,7 +68,7 @@ public:
     void discoverRemoteEnrollee(std::function<void(std::shared_ptr<OC::OCResource> resource)> cb)
     {
         m_discoveryCb = cb;
-        std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCb,
@@ -85,7 +80,7 @@ public:
     {
         m_getConfigurationCb = cb;
         m_remoteEnrollee = NULL;
-        std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetConfiguration,
@@ -95,7 +90,7 @@ public:
     void getWifiRsrc(std::function<void(const OCRepresentation& rep)> cb)
     {
         m_getWifiCb = cb;
-        std::string uri = std::string("/oic/res?rt=") + WIFI_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_WIFI;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetWifiRsrc,
@@ -105,7 +100,7 @@ public:
     void getCloudRsrc(std::function<void(const OCRepresentation& rep)> cb)
     {
         m_getCloudCb = cb;
-        std::string uri = std::string("/oic/res?rt=") + CLOUD_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_CLOUDSERVER;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetCloudRsrc,
@@ -115,7 +110,7 @@ public:
     void getDevConfiguration(std::function<void(const OCRepresentation& rep)> cb)
     {
         m_getDevConfCb = cb;
-        std::string uri = std::string("/oic/res?rt=") + DEV_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_DEVCONF;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetDevConf,
@@ -126,7 +121,7 @@ public:
     {
         m_getStatusCb = cb;
         m_remoteEnrollee = NULL;
-        std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToGetStatus,
@@ -137,7 +132,7 @@ public:
     {
         m_DevicePropProvisioningCb = cb;
         m_remoteEnrollee = NULL;
-        std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToProvisionDeviceProperties,
@@ -148,7 +143,7 @@ public:
     {
         m_CloudPropProvisioningCb = cb;
         m_remoteEnrollee = NULL;
-        std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToProvisionCloudProperties,
@@ -159,7 +154,7 @@ public:
     {
         m_provPutCb = cb;
         m_remoteEnrollee = NULL;
-        std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&ESMediatorSimulator::discoverRemoteEnrolleeCbToPutProvRsrc,
@@ -206,7 +201,7 @@ private:
             return ;
         }
 
-        if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) && m_discoveryCb)
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_discoveryCb)
         {
             m_discoveryCb(resource);
             m_discoveryCb = NULL;
@@ -229,7 +224,7 @@ private:
             return ;
         }
 
-        if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) && m_getConfigurationCb
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_getConfigurationCb
                                                                            && !m_remoteEnrollee)
         {
             m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource);
@@ -270,7 +265,7 @@ private:
 
     void discoverRemoteEnrolleeCbToGetWifiRsrc(std::shared_ptr<OC::OCResource> resource)
     {
-        if(!resource->getResourceTypes().at(0).compare(WIFI_RESOURCE_TYPE) && m_getWifiCb)
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_WIFI) && m_getWifiCb)
         {
             QueryParamsMap test;
             resource->get(test, std::bind(
@@ -308,7 +303,7 @@ private:
 
     void discoverRemoteEnrolleeCbToGetCloudRsrc(std::shared_ptr<OC::OCResource> resource)
     {
-        if(!resource->getResourceTypes().at(0).compare(CLOUD_RESOURCE_TYPE) && m_getCloudCb)
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER) && m_getCloudCb)
         {
             QueryParamsMap test;
             resource->get(test, std::bind(
@@ -345,7 +340,7 @@ private:
 
     void discoverRemoteEnrolleeCbToGetDevConf(std::shared_ptr<OC::OCResource> resource)
     {
-        if(!resource->getResourceTypes().at(0).compare(DEV_RESOURCE_TYPE) && m_getDevConfCb)
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_DEVCONF) && m_getDevConfCb)
         {
             QueryParamsMap test;
             resource->get(test, std::bind(
@@ -370,7 +365,7 @@ private:
             return ;
         }
 
-        if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) && m_getStatusCb
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) && m_getStatusCb
                                                                             && !m_remoteEnrollee)
         {
             m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource);
@@ -400,7 +395,7 @@ private:
             return ;
         }
 
-        if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) &&
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) &&
                                                 m_DevicePropProvisioningCb && !m_remoteEnrollee)
         {
             m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource);
@@ -438,7 +433,7 @@ private:
             return ;
         }
 
-        if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE) &&
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV) &&
                                                 m_CloudPropProvisioningCb && !m_remoteEnrollee)
         {
             m_remoteEnrollee = EasySetup::getInstance()->createRemoteEnrollee(resource);
index 15933c2..f65325a 100755 (executable)
@@ -59,13 +59,13 @@ extern "C"
 /**
  * Easysetup defined resoruce types and uris.
  */
-#define OC_RSRVD_ES_RES_TYPE_PROV         "ocf.wk.prov"
+#define OC_RSRVD_ES_RES_TYPE_PROV         "oic.wk.prov"
 #define OC_RSRVD_ES_URI_PROV              "/ProvisioningResURI"
-#define OC_RSRVD_ES_RES_TYPE_WIFI         "ocf.wk.wifi"
+#define OC_RSRVD_ES_RES_TYPE_WIFI         "oic.wk.wifi"
 #define OC_RSRVD_ES_URI_WIFI              "/WiFiProvisioningResURI"
-#define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER  "ocf.wk.cloudserver"
+#define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER  "oic.wk.cloudserver"
 #define OC_RSRVD_ES_URI_CLOUDSERVER       "/CloudServerProvisioningResURI"
-#define OC_RSRVD_ES_RES_TYPE_DEVCONF      "ocf.wk.devconf"
+#define OC_RSRVD_ES_RES_TYPE_DEVCONF      "oic.wk.devconf"
 #define OC_RSRVD_ES_URI_DEVCONF           "/DevConfProvisioningResURI"
 
 
old mode 100644 (file)
new mode 100755 (executable)
index 5f88ae6..3928cb6
@@ -27,13 +27,13 @@ public class ESConstants {
 /**
 * Easysetup defined resoruce types and uris
 */
-    public static final String OC_RSRVD_ES_RES_TYPE_PROV = "ocf.wk.prov";
+    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 = "ocf.wk.wifi";
+    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 = "ocf.wk.cloudserver";
+    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 = "ocf.wk.devconf";
+    public static final String OC_RSRVD_ES_RES_TYPE_DEVCONF = "oic.wk.devconf";
     public static final String OC_RSRVD_ES_URI_DEVCONF = "/DevConfProvisioningResURI";
 
 }
index 56a7d80..a4ed96e 100755 (executable)
@@ -40,7 +40,6 @@ import java.util.List;
 public class EasySetup {
 
     private static final String TAG = EasySetup.class.getName();
-    public static final String PROV_RESOURCE_TYPE = "ocf.wk.prov";
     private static EasySetup sInstance;
 
     private static Context mContext;
@@ -88,14 +87,14 @@ 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. ocf.wk.prov
+     *        resource type, i.e. oic.wk.prov
      *
      * @return Pointer to RemoteEnrollee instance
      */
     public synchronized RemoteEnrollee createRemoteEnrollee(OcResource enrolleeResource)
     {
         // native call
-        if(!enrolleeResource.getResourceTypes().contains(PROV_RESOURCE_TYPE)
+        if(!enrolleeResource.getResourceTypes().contains(ESConstants.OC_RSRVD_ES_RES_TYPE_PROV)
                 || !enrolleeResource.getResourceInterfaces().contains(OcPlatform.BATCH_INTERFACE))
         {
             Log.e(TAG, "Validation check for OcResource is failed.");
index 68eb295..531971d 100755 (executable)
@@ -54,7 +54,7 @@ namespace OIC
              *        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. ocf.wk.prov
+             *        resource type, i.e. oic.wk.prov
              *
              * @throws ESBadRequestException If createEnrolleeDevice is invoked with the same
              *         provisioning information.
old mode 100644 (file)
new mode 100755 (executable)
index 80220be..026dec7
@@ -31,8 +31,6 @@
 #include "ESEnrolleeCommon.h"
 #include "easysetup.h"
 
-#define PROV_RESOURCE_TYPE "ocf.wk.prov"
-
 class ESEnrolleeSimulator
 {
 public:
index 86d83bd..4cc18ab 100755 (executable)
@@ -39,8 +39,6 @@
 #include "cainterface.h"
 #include "OCPlatform.h"
 
-#define PROV_RESOURCE_TYPE "ocf.wk.prov"
-
 using namespace OC;
 using namespace OIC::Service;
 
@@ -93,7 +91,7 @@ public:
     std::shared_ptr<OC::OCResource> CreateNotProvResource()
     {
         OCConnectivityType connectivityType = CT_DEFAULT;
-        std::vector<std::string> types = {"ocf.wk.notprov"};
+        std::vector<std::string> types = {"oic.wk.notprov"};
         std::vector<std::string> ifaces = {DEFAULT_INTERFACE};
 
         return OCPlatform::constructResourceObject("coap://192.168.1.2:5000",
@@ -106,7 +104,7 @@ public:
 
     void discoverRemoteEnrollee()
     {
-        std::string uri = std::string("/oic/res?rt=") + PROV_RESOURCE_TYPE;
+        std::string uri = std::string("/oic/res?rt=") + OC_RSRVD_ES_RES_TYPE_PROV;
         OC::OCPlatform::findResource("", uri,
                 OCConnectivityType::CT_DEFAULT,
                 std::bind(&EasysetupMediatorTest::discoverRemoteEnrolleeCb,
@@ -177,7 +175,7 @@ private:
             return ;
         }
 
-        if(!resource->getResourceTypes().at(0).compare(PROV_RESOURCE_TYPE))
+        if(!resource->getResourceTypes().at(0).compare(OC_RSRVD_ES_RES_TYPE_PROV))
         {
             m_enrolleeResource = resource;
         }
index 5105710..e9f2cc7 100755 (executable)
@@ -54,6 +54,7 @@ import org.iotivity.base.OcResource;
 import org.iotivity.base.PlatformConfig;
 import org.iotivity.base.QualityOfService;
 import org.iotivity.base.ServiceType;
+import org.iotivity.service.easysetup.mediator.ESConstants;
 import org.iotivity.service.easysetup.mediator.CloudProp;
 import org.iotivity.service.easysetup.mediator.CloudPropProvisioningCallback;
 import org.iotivity.service.easysetup.mediator.CloudPropProvisioningStatus;
@@ -440,7 +441,7 @@ public class EasysetupActivity extends Activity implements OcPlatform.OnPresence
                         });
 
                         try {
-                            String requestUri = OcPlatform.WELL_KNOWN_QUERY + "?rt=ocf.wk.prov";
+                            String requestUri = OcPlatform.WELL_KNOWN_QUERY + "?rt=" + ESConstants.OC_RSRVD_ES_RES_TYPE_PROV;
                             OcPlatform.findResource("",
                                     requestUri,
                                     EnumSet.of(OcConnectivityType.CT_DEFAULT),