*/
#define SC_ENROLLEE_TAG "ES_SC_ENROLLEE"
-EasySetupResource g_ESEasySetupResource;
-WiFiConfResource g_ESWiFiConfResource;
-CoapCloudConfResource g_ESCoapCloudConfResource;
-DevConfResource g_ESDevConfResource;
-
SCProperties g_SCProperties;
static void ReadAccountData(OCRepPayload* payload,void** userdata);
return ES_ERROR;
}
+ESResult SetSSOList(const char *ssoList)
+{
+ if(ssoList != NULL)
+ {
+ OICStrcpy(g_SCProperties.ssoList, sizeof(g_SCProperties.ssoList), ssoList);
+ return ES_OK;
+ }
+ return ES_ERROR;
+}
+
void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata)
{
OIC_LOG(INFO, SC_ENROLLEE_TAG, "ReadUserdataCb IN");
OICFree(bssid);
}
}
+
+ OCRepPayload **repPayload = NULL;
+ size_t dimensions[MAX_REP_ARRAY_DEPTH];
+ if(OCRepPayloadGetPropObjectArray(payload, SC_RSRVD_ES_VENDOR_CANDIDATEAPS, &repPayload, dimensions))
+ {
+ if(*userdata == NULL)
+ {
+ *userdata = (void*) OICMalloc(sizeof(SCWiFiConfProperties));
+ if( *userdata == NULL )
+ {
+ OIC_LOG(ERROR, SC_ENROLLEE_TAG, "OICMalloc for SCWiFiConfProperties is failed");
+ return ;
+ }
+ memset(*userdata, 0, sizeof(SCWiFiConfProperties));
+ }
+ //size_t dim = calcDimTotal(dimensions);
+ SCWiFiConfProperties* pWifiConfProp = (SCWiFiConfProperties*)(*userdata);
+ for (size_t i = 0; i < dimensions[0]; i++)
+ {
+ int64_t cd_channel = -1;
+ char *cd_bssid = NULL;
+ char *ssid = NULL;
+ char *pwd = NULL;
+ if (OCRepPayloadGetPropString(repPayload[i], SC_RSRVD_ES_VENDOR_SSID, &ssid))
+ {
+ OICStrcpy(pWifiConfProp->candidateAPInfo[i].ssid, sizeof(pWifiConfProp->candidateAPInfo[i].ssid), ssid);
+ OICStrcpy(g_SCProperties.candidateAPInfo[i].ssid, sizeof(g_SCProperties.candidateAPInfo[i].ssid), ssid);
+ OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %s",
+ SC_RSRVD_ES_VENDOR_SSID, ssid);
+ OICFree(ssid);
+ }
+ if (OCRepPayloadGetPropString(repPayload[i], SC_RSRVD_ES_VENDOR_PASSPHRASE, &pwd))
+ {
+ OICStrcpy(pWifiConfProp->candidateAPInfo[i].passphrase, sizeof(pWifiConfProp->candidateAPInfo[i].passphrase), pwd);
+ OICStrcpy(g_SCProperties.candidateAPInfo[i].passphrase, sizeof(g_SCProperties.candidateAPInfo[i].passphrase), pwd);
+ OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %s",
+ SC_RSRVD_ES_VENDOR_PASSPHRASE, ssid);
+ OICFree(pwd);
+ }
+ if (OCRepPayloadGetPropInt(repPayload[i], SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL, &cd_channel))
+ {
+ pWifiConfProp->candidateAPInfo[i].channel = (int) cd_channel;
+ g_SCProperties.candidateAPInfo[i].channel = cd_channel;
+ OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %d",
+ SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL, cd_channel);
+ }
+ if (OCRepPayloadGetPropString(repPayload[i], SC_RSRVD_ES_VENDOR_BSSID, &cd_bssid))
+ {
+ OICStrcpy(pWifiConfProp->candidateAPInfo[i].bssid, sizeof(pWifiConfProp->candidateAPInfo[i].bssid), cd_bssid);
+ OICStrcpy(g_SCProperties.candidateAPInfo[i].bssid, sizeof(g_SCProperties.candidateAPInfo[i].bssid), cd_bssid);
+ OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %s",
+ SC_RSRVD_ES_VENDOR_BSSID, cd_bssid);
+ OICFree(bssid);
+ }
+ }
+ pWifiConfProp->numCandidateAP = (int)dimensions[0];
+ g_SCProperties.numCandidateAP = (int)dimensions[0];
+ }
}
else if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_DEVCONF))
{
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))
{
if(payload != NULL)
{
- if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_EASYSETUP))
+ if (strstr(resourceType, OC_RSRVD_ES_RES_TYPE_EASYSETUP))
{
OCRepPayloadSetPropInt(payload, SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE, (int) g_SCProperties.netConnectionState);
}
+ if (strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFICONF))
+ {
+ OCRepPayload **repPayload = OICCalloc(g_SCProperties.numCandidateAP, sizeof(OCRepPayload *));
+
+ for (size_t i = 0; i < (size_t)g_SCProperties.numCandidateAP; i++)
+ {
+ repPayload[i] = OCRepPayloadCreate();
+ if (!repPayload[i])
+ {
+ OCRepPayloadDestroy(payload);
+ for (size_t k = 0; k < i; k++)
+ {
+ OCRepPayloadDestroy(repPayload[k]);
+ }
+ OCRepPayloadDestroy(*repPayload);
+ break;
+ }
+ OCRepPayloadSetPropString(repPayload[i], SC_RSRVD_ES_VENDOR_SSID, g_SCProperties.candidateAPInfo[i].ssid);
+ OCRepPayloadSetPropString(repPayload[i], SC_RSRVD_ES_VENDOR_PASSPHRASE, g_SCProperties.candidateAPInfo[i].passphrase);
+ OCRepPayloadSetPropString(repPayload[i], SC_RSRVD_ES_VENDOR_BSSID, g_SCProperties.candidateAPInfo[i].bssid);
+ OCRepPayloadSetPropInt(repPayload[i], SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL, g_SCProperties.candidateAPInfo[i].channel);
+ }
+ 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))
{
#ifndef __TIZENRT__
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);
{
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);