+ OIC_LOG_V(DEBUG, ES_RH_TAG, "g_ESEasySetupResource.status %d", g_ESEasySetupResource.status);
+
+ int64_t *connect_req = NULL;
+ size_t dimensions[MAX_REP_ARRAY_DEPTH] = { 0 };
+ if (OCRepPayloadGetIntArray(input, OC_RSRVD_ES_CONNECT, &connect_req, dimensions))
+ {
+ ESConnectRequest* connectRequest = (ESConnectRequest*)OICMalloc(sizeof(ESConnectRequest));
+ if( !connectRequest )
+ {
+ OIC_LOG(ERROR, ES_RH_TAG, "Failed to allocate Payload");
+ return;
+ }
+
+ int cntRequest = 0;
+ for (size_t i = 0 ; i < NUM_CONNECT_TYPE ; ++i)
+ {
+ g_ESEasySetupResource.connectRequest[i] = ES_CONNECT_NONE;
+ connectRequest->connect[i] = ES_CONNECT_NONE;
+
+ if(i < dimensions[0] &&
+ (connect_req[i] == ES_CONNECT_WIFI || connect_req[i] == ES_CONNECT_COAPCLOUD))
+ {
+ g_ESEasySetupResource.connectRequest[cntRequest] = connect_req[i];
+ connectRequest->connect[cntRequest] = connect_req[i];
+ OIC_LOG_V(DEBUG, ES_RH_TAG, "g_ESEasySetupResource.connectType[%d] : %d",
+ cntRequest, g_ESEasySetupResource.connectRequest[cntRequest]);
+ cntRequest++;
+ }
+ }
+ connectRequest->numRequest = cntRequest;
+ g_ESEasySetupResource.numRequest = cntRequest;
+
+ if(g_ESEasySetupResource.connectRequest[0] != ES_CONNECT_NONE)
+ {
+ OIC_LOG(DEBUG, ES_RH_TAG, "Send ConnectRequest Callback To ES");
+
+ // TODO : Need to check appropriateness of gWiFiData
+ if(gConnectRequestEvtCb != NULL)
+ {
+ gConnectRequestEvtCb(ES_OK, connectRequest);
+ }
+ else
+ {
+ OIC_LOG(ERROR, ES_RH_TAG, "gConnectRequestEvtCb is NULL");
+ }
+ }
+ }