Commit 5617a85d authored by Ankur Bansal's avatar Ankur Bansal

[IOT-2628][EasySetup]Add new prop. swat,swet

Add new mandatory properties to oic.r.wificonf
- swat: Enrollee's supported Wi-Fi Authentication Types
- swet: Enrollee's supported Wi-Fi Encryption Types
- Update Enrollee sample apps (Linux and Tizen).

Note: This impacts Easy Setup Enrollee API "ESSetDeviceProperty".

Change-Id: Ic765671dfbe3a4e1c8a857ef6ae1d3dcb9ba783e
Signed-off-by: default avatarAnkur Bansal <ankur.b1@samsung.com>
parent 132838c4
......@@ -86,6 +86,10 @@ typedef struct
uint8_t numSupportedMode;
WIFI_FREQ supportedFreq[NUM_WIFIFREQ];
uint8_t numSupportedFreq;
WIFI_AUTHTYPE supportedAuthType[NUM_WIFIAUTHTYPE];
uint8_t numSupportedAuthType;
WIFI_ENCTYPE supportedEncType[NUM_WIFIENCTYPE];
uint8_t numSupportedEncType;
} WiFi;
/**
......
......@@ -706,6 +706,26 @@ OCRepPayload* constructResponseOfWiFiConf(char *interface)
OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_SUPPORTEDWIFIFREQ, freq, dimensionsFreq);
}
size_t dimensionsAuthType[MAX_REP_ARRAY_DEPTH] = { g_ESWiFiConfResource.numSupportedAuthType, 0,
0 };
const char *authType[NUM_WIFIAUTHTYPE] = { 0, };
for (int i = 0; i < g_ESWiFiConfResource.numSupportedAuthType; ++i)
{
authType[i] = WiFiAuthTypeEnumToString(g_ESWiFiConfResource.supportedAuthType[i]);
}
OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_SUPPORTEDWIFIAUTHTYPE, authType,
dimensionsAuthType);
size_t dimensionsEncType[MAX_REP_ARRAY_DEPTH] =
{ g_ESWiFiConfResource.numSupportedEncType, 0, 0 };
const char *encType[NUM_WIFIENCTYPE] = { 0, };
for (int i = 0; i < g_ESWiFiConfResource.numSupportedEncType; ++i)
{
encType[i] = WiFiEncTypeEnumToString(g_ESWiFiConfResource.supportedEncType[i]);
}
OCRepPayloadSetStringArray(payload, OC_RSRVD_ES_SUPPORTEDWIFIENCTYPE, encType,
dimensionsEncType);
OCRepPayloadSetPropString(payload, OC_RSRVD_ES_SSID, g_ESWiFiConfResource.ssid);
OCRepPayloadSetPropString(payload, OC_RSRVD_ES_CRED, g_ESWiFiConfResource.cred);
OCRepPayloadSetPropString(payload, OC_RSRVD_ES_AUTHTYPE,
......@@ -1667,7 +1687,9 @@ OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty)
OIC_LOG(DEBUG, ES_RH_TAG, "SetDeviceProperty IN");
if (deviceProperty->WiFi.numSupportedMode > NUM_WIFIMODE
|| deviceProperty->WiFi.numSupportedFreq > NUM_WIFIFREQ)
|| deviceProperty->WiFi.numSupportedFreq > NUM_WIFIFREQ
|| deviceProperty->WiFi.numSupportedAuthType > NUM_WIFIAUTHTYPE
|| deviceProperty->WiFi.numSupportedEncType > NUM_WIFIENCTYPE)
{
OIC_LOG(ERROR, ES_RH_TAG, "SetDeviceProperty: Invalid Input Param");
return OC_STACK_INVALID_PARAM;
......@@ -1687,7 +1709,24 @@ OCStackResult SetDeviceProperty(ESDeviceProperty *deviceProperty)
OIC_LOG_V(INFO_PRIVATE, ES_RH_TAG, "WiFi Mode : %d", g_ESWiFiConfResource.supportedMode[i]);
}
OICStrcpy(g_ESDevConfResource.devName, OIC_STRING_MAX_VALUE, (deviceProperty->DevConf).deviceName);
g_ESWiFiConfResource.numSupportedAuthType = deviceProperty->WiFi.numSupportedAuthType;
for (uint8_t i = 0; i < g_ESWiFiConfResource.numSupportedAuthType; ++i)
{
g_ESWiFiConfResource.supportedAuthType[i] = (deviceProperty->WiFi).supportedAuthType[i];
OIC_LOG_V(INFO_PRIVATE, ES_RH_TAG, "WiFi Auth Type : %d",
g_ESWiFiConfResource.supportedAuthType[i]);
}
g_ESWiFiConfResource.numSupportedEncType = deviceProperty->WiFi.numSupportedEncType;
for (uint8_t i = 0; i < g_ESWiFiConfResource.numSupportedEncType; ++i)
{
g_ESWiFiConfResource.supportedEncType[i] = (deviceProperty->WiFi).supportedEncType[i];
OIC_LOG_V(INFO_PRIVATE, ES_RH_TAG, "WiFi Enc Type : %d",
g_ESWiFiConfResource.supportedAuthType[i]);
}
OICStrcpy(g_ESDevConfResource.devName, OIC_STRING_MAX_VALUE,
(deviceProperty->DevConf).deviceName);
OIC_LOG_V(INFO_PRIVATE, ES_RH_TAG, "Device Name : %s", g_ESDevConfResource.devName);
if (OC_STACK_NO_OBSERVERS == OCNotifyAllObservers(g_ESWiFiConfResource.handle, OC_HIGH_QOS))
......
......@@ -59,6 +59,10 @@ typedef struct
uint8_t numMode; // the number of device's supported Wi-Fi modes
WIFI_FREQ supportedFreq[NUM_WIFIFREQ];
uint8_t numSupportedFreq; // the number of device's supported Wi-Fi frequency bands
WIFI_AUTHTYPE supportedAuthType[NUM_WIFIAUTHTYPE];
uint8_t numSupportedAuthType;
WIFI_ENCTYPE supportedEncType[NUM_WIFIENCTYPE];
uint8_t numSupportedEncType;
char ssid[OIC_STRING_MAX_VALUE]; // SSID
char cred[OIC_STRING_MAX_VALUE]; // credential information.
WIFI_AUTHTYPE authType;
......
......@@ -162,7 +162,9 @@ public:
{
{
{ WIFI_11G, WIFI_11N, WIFI_11AC }, 3,
{ WIFI_24G, WIFI_5G }, 2
{ WIFI_24G, WIFI_5G }, 2,
{ WPA_PSK, WPA2_PSK }, 2,
{ AES, TKIP_AES }, 2
},
{ "Test Device"}
};
......
......@@ -40,6 +40,8 @@ extern "C"
#define NUM_WIFIMODE 10
#define NUM_WIFIFREQ 5
#define NUM_CONNECT_TYPE 3
#define NUM_WIFIAUTHTYPE 4
#define NUM_WIFIENCTYPE 6
/**
* Attributes used to form a proper easysetup conforming JSON message.
......
......@@ -65,7 +65,9 @@ public:
{
{
{ WIFI_11G, WIFI_11N, WIFI_11AC }, 3,
{ WIFI_24G, WIFI_5G }, 2
{ WIFI_24G, WIFI_5G }, 2,
{ WPA_PSK, WPA2_PSK }, 2,
{ AES, TKIP_AES }, 2
},
{ "Test Device"}
};
......
......@@ -204,7 +204,9 @@ void SetDeviceInfo()
{
{
{ WIFI_11G, WIFI_11N, WIFI_11AC }, 3,
{ WIFI_24G, WIFI_5G }, 2
{ WIFI_24G, WIFI_5G }, 2,
{ WPA_PSK, WPA2_PSK }, 2,
{ AES, TKIP_AES }, 2
},
{ "Test Device"}
};
......
......@@ -250,7 +250,9 @@ void SetDeviceInfo()
{
{
{ WIFI_11G, WIFI_11N, WIFI_11AC }, 3,
{ WIFI_24G, WIFI_5G }, 2
{ WIFI_24G, WIFI_5G }, 2,
{ WPA_PSK, WPA2_PSK }, 2,
{ AES, TKIP_AES }, 2
},
{ "Test Device"}
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment