#define MAXLEN_STRING 1000
#define MAXNUM_LOCATION 20
#define MAXLEN_DATE_TIME 33
+#define MAXNUM_CANDIDATE_AP 20
#define SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE "x.com.samsung.ncs"
#define SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL "x.com.samsung.chn"
int discoveryChannel; /**< Wi-Fi AP Channel used for fast discovery **/
char bssid[MAXLEN_STRING]; /**< Wi-Fi bssid information. **/
int numCandidateAP;
- SCCandidateAPInfo candidateAPInfo[5];
+ SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP];
} SCWiFiConfProperties;
typedef struct SCTncInfo
char regionalDateTime[MAXLEN_DATE_TIME]; /**< Regional date time **/
char esProtocolVersion[MAXLEN_STRING]; /**< Samsung Easy Setup Protocol Version **/
int numCandidateAP;
- SCCandidateAPInfo candidateAPInfo[5];
+ SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP];
} SCProperties;
void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata);
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))
+ if (strstr(resourceType, OC_RSRVD_ES_RES_TYPE_WIFICONF))
{
OCRepPayload **repPayload = OICCalloc(g_SCProperties.numCandidateAP, sizeof(OCRepPayload *));
*/
std::vector<SCCandidateAPInfo> getCandidateAPList()
{
- if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
+ if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
{
std::vector<OC::OCRepresentation> candidateInfo=
m_rep.getValue<std::vector<OC::OCRepresentation>>(SC_RSRVD_ES_VENDOR_CANDIDATEAPS);
{
OC::OCRepresentation rep = *it;
SCCandidateAPInfo candidateInfotemp;
- if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSID))
+ if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSID))
{
candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSID);
}
- if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PASSPHRASE))
+ if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_PASSPHRASE))
{
candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PASSPHRASE);
}
- if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
+ if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
{
candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
}
- if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
+ if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
{
candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
}
}
}
}
+ return {};
}
/**
SCWiFiConfProperties *data = eventData->userdata;
printf("[SC] DiscoveryChannel : %d\n", data->discoveryChannel);
printf("[SC] Number of candidate AP : %d\n", data->numCandidateAP);
- for (int i = 0; i< data->numCandidateAP ; i++)
+ for ( int i = 0; i < data->numCandidateAP; i++)
{
printf("[SC] Candidate Bssid : %s\n", data->candidateAPInfo[i].bssid);
printf("[SC] Candidate Channel : %d\n", data->candidateAPInfo[i].channel);
void SetWiFiInfo()
{
-
printf("SetWiFiInfo IN\n");
strncpy(g_SCProperties.candidateAPInfo[0].ssid, "x_5GHz", MAXLEN_STRING);
strncpy(g_SCProperties.candidateAPInfo[0].passphrase, "12345678",MAXLEN_STRING);
if(SetSCProperties(&g_SCProperties) == ES_ERROR)
printf("SetSCProperties Error\n");
printf("SetWiFiInfo OUT\n");
-
}
void StopEasySetup()
cout << "\tRegional time: " << conf.getRegionalDatetime() << endl;
cout << "\tEasy Setup Protocol Version: " << conf.getESProtocolVersion() << endl;
std::vector<SCCandidateAPInfo> candidateInfo = conf.getCandidateAPList();
- int size = candidateInfo.size();
- for(int i=0;i< size;i++)
+ size_t size = candidateInfo.size();
+ for( int i = 0; i < size; i++)
{
cout << "[SC] Candidate Bssid :" << candidateInfo[i].bssid << endl;
cout << "[SC] Candidate Channel :" << candidateInfo[i].channel << endl;