Added Samsung Specific Property(sso list) for easy setup 72/177872/1
authorKush <kush.agrawal@samsung.com>
Mon, 16 Apr 2018 14:17:43 +0000 (19:47 +0530)
committerAmit KS <amit.s12@samsung.com>
Fri, 4 May 2018 05:45:54 +0000 (11:15 +0530)
Following Samsung Specific Property is added :
Resource: Device Configuration (rt = "oic.r.devconf")
Property Name: SSO List Information
Key: "x.com.samsung.ssolist"
Type: String (JSON value with array of string internally).
Access Mode: Read Only
Description: SSO List information

Changes made at Mediator and Enrollee Side (Samsung specific source).

Linux Sample apps updated and verified (Samsung Specific Sample Apps).

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/284
(cherry picked from commit 26aec98b390c57957416dff8c3e9a920299aad8a)

Change-Id: Ib5143bb96488820b01404c2ec68dcf04c9f6a02c
Signed-off-by: Kush <kush.agrawal@samsung.com>
Signed-off-by: Amit KS <amit.s12@samsung.com>
service/easy-setup/enrollee/inc/samsung/sc_easysetup.h [changed mode: 0755->0644]
service/easy-setup/enrollee/src/samsung/sc_easysetup.c
service/easy-setup/mediator/richsdk/inc/ESSCCommon.h [changed mode: 0755->0644]
service/easy-setup/sampleapp/enrollee/linux-samsung/sc_enrollee.c [changed mode: 0755->0644]
service/easy-setup/sampleapp/mediator/linux-samsung/richsdk_sample/mediator_sc.cpp [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 5542094..ac52b06
@@ -38,6 +38,7 @@
 #define SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV     "x.com.samsung.rsd"
 #define SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO    "x.com.samsung.npi"
 #define SC_RSRVD_ES_VENDOR_ACCOUNT              "x.com.samsung.account"
+#define SC_RSRVD_ES_VENDOR_SSO_LIST             "x.com.samsung.ssolist"
 #define SC_RSRVD_ES_VENDOR_AAC                  "x.com.samsung.aac"
 #define SC_RSRVD_ES_VENDOR_TNC_HEADER           "x.com.samsung.tcheader"
 #define SC_RSRVD_ES_VENDOR_TNC_VERSION          "x.com.samsung.tcversion"
@@ -87,6 +88,7 @@ typedef struct SCDevConfProperties
     char location[MAXNUM_LOCATION][MAXLEN_STRING];  /**< Samsung-specific location-related information **/
     char regMobileDev[MAXLEN_STRING];               /**< Samsung-specific mobile device information for 'register TV' **/
     char account[MAXLEN_STRING];  /**< Samsung-specific account-related information **/
+    char ssoList[MAXLEN_STRING];            /**< Samsung-specific SSO list information which is registered in device **/
     SCTncInfo scTnCInfo;    /**< Samsung-specific Terms & Conditions information **/
     char modelNumber[MAXLEN_STRING];                /**< Samsung-specific model number **/
     char language[MAXLEN_STRING];                   /**< IETF language tag using ISO 639X **/
@@ -118,6 +120,7 @@ typedef struct SCProperties
     char regSetDev[MAXLEN_STRING];          /**< Samsung-specific set device information for 'register TV' **/
     char nwProvInfo[MAXLEN_STRING];         /**< Samsung-specific network provisioning information for cellular network vendor **/
     char account[MAXLEN_STRING];            /**< Samsung-specific account-related information **/
+    char ssoList[MAXLEN_STRING];            /**< Samsung-specific SSO list information which is registered in device **/
     char aac[MAXLEN_STRING];                /**< Samsung-specific aac information **/
     SCTncInfo tncInfo;                      /**< Samsung-specific Terms & Conditions information **/
     char tncResult[MAXLEN_STRING];          /**< Samsung-specific Terms & Conditions result **/
index e86e1b9..cb6bc24 100644 (file)
@@ -369,6 +369,14 @@ void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata)
                 OICStrcpy(g_SCProperties.regionalDateTime, strlen(regionalDateTime)+1, regionalDateTime);
                 OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "pDevConfProp.regionalDateTime %s", g_SCProperties.regionalDateTime);
             }
+
+            char *ssoList = NULL;
+            if (OCRepPayloadGetPropString(payload, SC_RSRVD_ES_VENDOR_SSO_LIST, &ssoList))
+            {
+                OICStrcpy(pDevConfProp->ssoList, strlen(ssoList)+1, ssoList);
+                OICStrcpy(g_SCProperties.ssoList, strlen(ssoList)+1, ssoList);
+                OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "pDevConfProp.ssoList %s", g_SCProperties.ssoList);
+            }
         }
         else if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF))
         {
@@ -512,6 +520,7 @@ void WriteUserdataCb(OCRepPayload* payload, char* resourceType)
             OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV, g_SCProperties.regSetDev);
             OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV, g_SCProperties.regMobileDev);
             OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO, g_SCProperties.nwProvInfo);
+            OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_SSO_LIST, g_SCProperties.ssoList);
             OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_PNP_PIN, g_SCProperties.pnpPin);
             OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_MODEL_NUMBER, g_SCProperties.modelNumber);
             OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_COUNTRY, g_SCProperties.country);
@@ -541,6 +550,10 @@ void WriteUserdataCb(OCRepPayload* payload, char* resourceType)
             {
                 OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO, g_SCProperties.nwProvInfo);
             }
+            if(g_SCProperties.ssoList!= NULL)
+            {
+                OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_SSO_LIST, g_SCProperties.ssoList);
+            }
             if(g_SCProperties.pnpPin != NULL)
             {
                OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_PNP_PIN, g_SCProperties.pnpPin);
old mode 100755 (executable)
new mode 100644 (file)
index 3253de2..1df7cb6
@@ -33,6 +33,7 @@ using namespace std;
 #define SC_RSRVD_ES_VENDOR_LOCATION             "x.com.samsung.location"
 #define SC_RSRVD_ES_VENDOR_CLIENTID             "x.com.samsung.clientid"
 #define SC_RSRVD_ES_VENDOR_ACCOUNT              "x.com.samsung.account"
+#define SC_RSRVD_ES_VENDOR_SSO_LIST            "x.com.samsung.ssolist"
 #define SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE "x.com.samsung.aac"
 #define SC_RSRVD_ES_VENDOR_ACCESS_TOKEN         "x.com.samsung.accesstoken"
 #define SC_RSRVD_ES_VENDOR_REFRESH_TOKEN        "x.com.samsung.refreshtoken"
@@ -338,6 +339,30 @@ namespace OIC
                 }
                 return {};
             }
+
+            /**
+             * Set SSO list information
+             *
+             * @param  SSO list
+             */
+            void setSSOList(const std::string &ssoList)
+            {
+                m_rep.setValue(SC_RSRVD_ES_VENDOR_SSO_LIST, ssoList);
+            }
+
+            /**
+             * Get SSO List information which is registered in device
+             *
+             * @return SSO List
+             */
+            std::string getSSOList()
+            {
+                if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
+                {
+                    return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
+                }
+                return {};
+            }
         };
 
         class SCCloudProp : public CloudProp
@@ -629,6 +654,40 @@ namespace OIC
             }
 
             /**
+             * Get SSO List information for the device.
+             * The format is in JSON. The key indicates the meaning of value and the value is a
+             * corresponding information. Supported keys include: Available Count , Registered Count,
+             * Account List
+             *
+             * @return SSo List Information String.
+             */
+            std::string getSSOList() const
+            {
+                std::vector<OCRepresentation> 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)
+                    {
+                        OCRepresentation rep;
+                        if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
+                        {
+                            rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
+                        }
+                        else
+                        {
+                            return std::string("");
+                        }
+
+                        if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
+                        {
+                            return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
+                        }
+                    }
+                }
+                return std::string("");
+            }
+
+            /**
              * Get T&C status
              * Indicates T&C is already agreed or not.
              *
old mode 100755 (executable)
new mode 100644 (file)
index 0584ccc..df91cd0
@@ -107,6 +107,7 @@ void DevConfProvCbInApp(ESDevConfData *eventData)
         printf("[SC] GPS Location : %s\n", data->gpsLocation);
         printf("[SC] UTC Date time : %s\n", data->utcDateTime);
         printf("[SC] Regional time : %s\n", data->regionalDateTime);
+        printf("[SC] SSO List : %s\n", data->ssoList);
     }
 
     printf("DevConfProvCbInApp OUT\n");
old mode 100755 (executable)
new mode 100644 (file)
index 19f2a4b..ad913f9
@@ -85,6 +85,7 @@ void printConfiguration(const SCEnrolleeConf& conf)
     cout << "\tDevice Sub-Type: " << conf.getDeviceSubType() << endl;
     cout << "\tRegister Set Device: " << conf.getRegisterSetDevice() << endl;
     cout << "\tNetwork Provisioning Info: " << conf.getNetworkProvisioningInfo() << endl;
+    cout << "\tSSOList: " << conf.getSSOList() << endl;
     cout << "\tPnP Pin: " << conf.getPnpPin() << endl;
     cout << "\tNetwork Connection State : " << conf.getNetConnectionState() << endl;
     cout << "\tBSSID : " << conf.getBSSID() << endl;
@@ -227,6 +228,8 @@ void provisionDeviceProperty()
     locations.push_back("bd=apartment");
     scDevProp.setSCLocation(locations);
     scDevProp.setRegisterMobileDevice("{\"wm\":\"00:11:22:33:44:55\",\"pm\":\"00:11:22:33:44:55\",\"bm\":\"00:11:22:33:44:55\",\"dt\":\"0\",\"it\":\"0\"}");
+    scDevProp.setSSOList("[{\"AvailableCount\" : \"1\", \"RegisteredCount\" : \"3\", \"AccountList\" : {\"aaa@samsung.com\", \"bbb@samsung.com\",\"ccc@samsung.com\"} }] ");
+
 
     // Set UTC and regional date
     time_t t = time(NULL);