#define SC_RSRVD_ES_VENDOR_SSID "x.com.samsung.ssid"
#define SC_RSRVD_ES_VENDOR_PASSPHRASE "x.com.samsung.passphrase"
#define SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL "x.com.samsung.channel"
+#define SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT "x.com.samsung.deployenv"
+#define SC_RSRVD_ES_VENDOR_IATT "x.com.samsung.iatt"
#define WIFI_DISCOVERY_CHANNEL_INIT -1
{
int discoveryChannel; /**< Wi-Fi AP Channel used for fast discovery **/
char bssid[MAXLEN_STRING]; /**< Wi-Fi bssid information. **/
- bool isHidden;
+ bool isHidden;
int numCandidateAP;
SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP];
} SCWiFiConfProperties;
char tncResult[MAXLEN_STRING]; /**< Samsung-specific Terms & Conditions result **/
char refreshToken[MAXLEN_STRING]; /**< Samsung-specific refreshToken information. Indicate refresh token to be used if the access token is expired**/
char uid[MAXLEN_STRING]; /**< Samsung-specific aac information. Indicate user ID corresponding to user account **/
+ char deployEnv[MAXLEN_STRING]; /**< Samsung-specific deployment server with which device is connected to. For example "PROD", "STG" and etc **/
+ int iatt; /**< Samsung-specific Access token type indicator. 0 for SA token, 1 for IoT JWT **/
} SCCoapCloudServerConfProperties;
typedef struct SCProperties
char hubId[MAXLEN_STRING]; /**< HubId of device **/
int numCandidateAP;
SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP];
+ char deployEnv[MAXLEN_STRING];
+ int iatt;
} SCProperties;
void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata);
pWifiConfProp->numCandidateAP = (int)dimensions[0];
g_SCProperties.numCandidateAP = (int)dimensions[0];
}
-
+
if (OCRepPayloadGetPropBool(payload, SC_RSRVD_ES_VENDOR_HIDDEN, &isHidden))
{
if(*userdata == NULL)
if( *userdata == NULL )
{
OIC_LOG(ERROR, SC_ENROLLEE_TAG, "OICMalloc for SCCoapCloudServerConfProperties is failed");
- return ;
+ OICFree(clientID);
+ return;
}
memset(*userdata, 0, sizeof(SCCoapCloudServerConfProperties));
}
OICStrcpy(pCloudProp->clientID, strlen(clientID)+1, clientID);
OICStrcpy(g_SCProperties.clientID, strlen(clientID)+1, clientID);
+ OICFree(clientID);
OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %s",
SC_RSRVD_ES_VENDOR_CLIENTID, pCloudProp->clientID);
if( *userdata == NULL )
{
OIC_LOG(ERROR, SC_ENROLLEE_TAG, "OICMalloc for SCCoapCloudServerConfProperties is failed");
- return ;
+ OICFree(aac);
+ return;
}
memset(*userdata, 0, sizeof(SCCoapCloudServerConfProperties));
}
if( *userdata == NULL )
{
OIC_LOG(ERROR, SC_ENROLLEE_TAG, "OICMalloc for SCCoapCloudServerConfProperties is failed");
- return ;
+ OICFree(uid);
+ return;
}
memset(*userdata, 0, sizeof(SCCoapCloudServerConfProperties));
}
if( *userdata == NULL )
{
OIC_LOG(ERROR, SC_ENROLLEE_TAG, "OICMalloc for SCCoapCloudServerConfProperties is failed");
- return ;
+ OICFree(refreshToken);
+ return;
}
memset(*userdata, 0, sizeof(SCCoapCloudServerConfProperties));
}
}
}
+ // SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT
+ char *deployEnv = NULL;
+ if (OCRepPayloadGetPropString(payload, SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT, &deployEnv))
+ {
+ if(*userdata == NULL)
+ {
+ *userdata = (void*)OICMalloc(sizeof(SCCoapCloudServerConfProperties));
+ if( *userdata == NULL )
+ {
+ OIC_LOG(ERROR, SC_ENROLLEE_TAG, "OICMalloc for SCCoapCloudServerConfProperties is failed");
+ OICFree(deployEnv);
+ return;
+ }
+ memset(*userdata, 0, sizeof(SCCoapCloudServerConfProperties));
+ }
+
+ if (*userdata != NULL)
+ {
+ SCCoapCloudServerConfProperties *pCloudProp =
+ (SCCoapCloudServerConfProperties*) (*userdata);
+ OICStrcpy(pCloudProp->deployEnv, MAXLEN_STRING, deployEnv);
+ OICStrcpy(g_SCProperties.deployEnv, MAXLEN_STRING, deployEnv);
+ OICFree(deployEnv);
+
+ OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %s",
+ SC_RSRVD_ES_VENDOR_REFRESH_TOKEN, pCloudProp->deployEnv);
+ }
+ }
+
+ // SC_RSRVD_ES_VENDOR_IATT
+ int64_t iatt;
+ if (OCRepPayloadGetPropInt(payload, SC_RSRVD_ES_VENDOR_IATT, &iatt))
+ {
+ if(*userdata == NULL)
+ {
+ *userdata = (void*)OICMalloc(sizeof(SCCoapCloudServerConfProperties));
+ if( *userdata == NULL )
+ {
+ OIC_LOG(ERROR, SC_ENROLLEE_TAG, "OICMalloc for SCCoapCloudServerConfProperties is failed");
+ return;
+ }
+ memset(*userdata, 0, sizeof(SCCoapCloudServerConfProperties));
+ }
+
+ SCCoapCloudServerConfProperties *pCloudProp =
+ (SCCoapCloudServerConfProperties*) (*userdata);
+
+ pCloudProp->iatt = iatt;
+ g_SCProperties.iatt = iatt;
+
+ OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %d",
+ SC_RSRVD_ES_VENDOR_REFRESH_TOKEN, pCloudProp->iatt);
+ }
+
ReadTnCdata(payload,userdata);
}
}
size_t dimensions[MAX_REP_ARRAY_DEPTH] = {g_SCProperties.numCandidateAP, 0, 0};
OCRepPayloadSetPropObjectArray(payload,SC_RSRVD_ES_VENDOR_CANDIDATEAPS, (const struct OCRepPayload **)repPayload, dimensions);
}
- if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_DEVCONF))
+ else if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_DEVCONF))
{
#ifndef __TIZENRT__
OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_DEVICE_TYPE, g_SCProperties.deviceType);
}
#endif
}
+ else if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_COAPCLOUDCONF))
+ {
+ // x.com.samsung.deployenv
+ if (g_SCProperties.deployEnv != NULL)
+ {
+ OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT, g_SCProperties.deployEnv);
+ }
+
+ // x.com.samsung.iatt
+ OCRepPayloadSetPropInt(payload, SC_RSRVD_ES_VENDOR_IATT, g_SCProperties.iatt);
+ }
}
WriteTnCdata(payload, resourceType);
#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_SSO_LIST "x.com.samsung.ssolist"
#define SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE "x.com.samsung.aac"
-#define SC_RSRVD_ES_VENDOR_SA_API_SERVER "x.com.samsung.saapiserver"
-#define SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER "x.com.samsung.saauthserver"
+#define SC_RSRVD_ES_VENDOR_SA_API_SERVER "x.com.samsung.saapiserver"
+#define SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER "x.com.samsung.saauthserver"
#define SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE "x.com.samsung.sadsc"
#define SC_RSRVD_ES_VENDOR_ACCESS_TOKEN "x.com.samsung.accesstoken"
#define SC_RSRVD_ES_VENDOR_REFRESH_TOKEN "x.com.samsung.refreshtoken"
#define SC_RSRVD_ES_VENDOR_SERVER_ID "x.com.samsung.serverid"
#define SC_RSRVD_ES_VENDOR_TIMEZONE_ID "x.com.samsung.timezoneid"
#define SC_RSRVD_ES_VENDOR_HIDDEN "x.com.samsung.hidden"
-#define SC_RSRVD_ES_VENDOR_HUB_ID "x.com.samsung.hubid"
-#define SC_RSRVD_ES_VENDOR_SERVER_DEPLOYMENT_ENVIRONMENT "x.com.samsung.deployenv"
+#define SC_RSRVD_ES_VENDOR_HUB_ID "x.com.samsung.hubid"
+#define SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT "x.com.samsung.deployenv"
+#define SC_RSRVD_ES_VENDOR_IATT "x.com.samsung.iatt"
#define SC_RSRVD_ES_VENDOR_CANDIDATEAPS "x.com.samsung.candidateaps"
#define SC_RSRVD_ES_VENDOR_SSID "x.com.samsung.ssid"
#define SC_RSRVD_ES_VENDOR_PASSPHRASE "x.com.samsung.passphrase"
*/
void setServerDeploymentEnv(const std::string &serverDeploymentEnv)
{
- m_rep.setValue(SC_RSRVD_ES_VENDOR_SERVER_DEPLOYMENT_ENVIRONMENT, serverDeploymentEnv);
+ m_rep.setValue(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT, serverDeploymentEnv);
}
/**
*/
std::string getServerDeploymentEnv()
{
- if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SERVER_DEPLOYMENT_ENVIRONMENT))
+ if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT))
{
- return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SERVER_DEPLOYMENT_ENVIRONMENT);
+ return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT);
}
return {};
}
/**
+ * Set Access token type.
+ *
+ * @param type - Access token type
+ */
+ void setAccessTokenType(const int type)
+ {
+ m_rep.setValue(SC_RSRVD_ES_VENDOR_IATT, type);
+ }
+
+ /**
+ * Get Access token type.
+ *
+ * @return Access token type.
+ */
+ int getAccessTokenType(void)
+ {
+ if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_IATT))
+ {
+ return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_IATT);
+ }
+ return 0;
+ }
+
+ /**
* Set samsung-specific refresh token property to be delivered to Enrollee
*
* @param refreshtoken - Refresh token.
}
return std::string("");
}
-
+
/**
* Gets the HubId of the device
*
void CloudDataProvCbInApp(ESCoapCloudConfData *eventData)
{
- printf("CloudDataProvCbInApp IN\n");
+ printf("Cloud provisioning data received\n");
if(eventData == NULL)
{
printf("ESCloudProvData is NULL\n");
- return ;
+ return;
}
printf("AuthCode : %s\n", eventData->authCode);
+ printf("AcessToken : %s\n", eventData->accessToken);
+ printf("AcessTokenType : %d\n", eventData->accessTokenType);
printf("AuthProvider : %s\n", eventData->authProvider);
printf("CI Server : %s\n", eventData->ciServer);
if(eventData->userdata != NULL)
{
SCCoapCloudServerConfProperties *data = eventData->userdata;
- printf("[SC] ClientID : %s\n", data->clientID);
+ printf("[SC] Client id : %s\n", data->clientID);
+ printf("[SC] aac : %s\n", data->aac);
+ printf("[SC] TNC result : %s\n", data->tncResult);
+ printf("[SC] Refresh token : %s\n", data->refreshToken);
+ printf("[SC] UID : %s\n", data->uid);
+ printf("[SC] Deploy Env : %s\n", data->deployEnv);
+ printf("[SC] iatt : %d\n", data->iatt);
}
-
- printf("CloudDataProvCbInApp OUT\n");
}
ESProvisioningCallbacks gCallbacks = {
void CoapCloudConfProvCbInApp(ESCoapCloudConfData *eventData)
{
- printf("CoapCloudConfProvCbInApp IN\n");
+ printf("Cloud provisioning data received\n");
if(eventData == NULL)
{
printf("ESCoapCloudConfData is NULL\n");
- return ;
+ return;
}
printf("AuthCode : %s\n", eventData->authCode);
printf("AcessTokenType : %d\n", eventData->accessTokenType);
printf("AuthProvider : %s\n", eventData->authProvider);
printf("CI Server : %s\n", eventData->ciServer);
-
- printf("CoapCloudConfProvCbInApp OUT\n");
}
ESProvisioningCallbacks gCallbacks = {
printf("OCProcess error");
}
- // Sleep for 100 ms to avoid high CPU Utilization.
+ // Sleep for 100 ms to avoid high CPU Utilization.
usleep(100 * 1000); // 100 milli-seconds
}
return NULL;
cloudProp.setCredID(1);
cloudProp.setClientID("166135d296");
+ // Set samsung specific properties
+ cloudProp.setServerDeploymentEnv("PROD");
+ cloudProp.setAccessTokenType(1);
+
try
{
remoteEnrollee->provisionCloudProperties(cloudProp, cloudProvisioningStatusCallback);