From ed4f513f95c24c77eb9cc6506d0ebe71a81c3e6b Mon Sep 17 00:00:00 2001 From: sourav bhuwalka Date: Tue, 11 Dec 2018 22:52:33 +0530 Subject: [PATCH] Adding more samsung specific properties Changes: 1.Backward compatibility for "mnmo", "lang", "ctry", "loc" properties. 2.Adding OC_LOW_QOS_WITH_TCP to OCQualityOfService. 3.Adding support for new samsung specific properties: 4."x.com.samsung.serverid", "x.com.samsung.timezoneid", 5."x.com.samsung.saapiserver", "x.com.samsung.saauthserver", 6."x.com.samsung.sadsc", "x.com.samsung.hidden", "x.com.samsung.hubid" 7.Adding new WiFi Auth type - FT_PSK 8.Setting DeviceID seed while configuring stack. 9.Redundant m_observeCacheList removed from ResourceCacheManager. https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/364 (cherry picked from commit 1f00a113fcf6a7f65144d259ec4f39aac7288e02) Change-Id: I30f58b672eb74f4ad3433d0b7f3211888d57402c Signed-off-by: sourav bhuwalka Signed-off-by: Harish Kumara M Signed-off-by: Amit KS --- .../main/java/org/iotivity/base/OcPlatform.java | 22 +- .../java/org/iotivity/base/PlatformConfig.java | 55 ++++- .../java/org/iotivity/ca/CaLeClientInterface.java | 3 +- .../connectivity/src/adapter_util/caadapterutils.c | 2 +- resource/csdk/stack/include/octypes.h | 4 +- resource/csdk/stack/src/ocstack.c | 4 +- resource/include/OCApi.h | 4 +- .../easy-setup/enrollee/inc/samsung/sc_easysetup.h | 9 + .../easy-setup/enrollee/src/samsung/sc_easysetup.c | 32 +++ service/easy-setup/inc/escommon.h | 3 +- .../easysetup/mediator/enums/WIFI_AUTHTYPE.java | 3 +- .../easy-setup/mediator/richsdk/inc/ESSCCommon.h | 265 +++++++++++++++++++++ .../resourceCache/include/ResourceCacheManager.h | 1 - .../src/resourceCache/src/ResourceCacheManager.cpp | 1 - 14 files changed, 388 insertions(+), 20 deletions(-) mode change 100644 => 100755 android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java mode change 100644 => 100755 android/android_api/base/src/main/java/org/iotivity/base/PlatformConfig.java mode change 100644 => 100755 android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java mode change 100644 => 100755 resource/csdk/connectivity/src/adapter_util/caadapterutils.c diff --git a/android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java b/android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java old mode 100644 new mode 100755 index 954eab2..e43984d --- a/android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java +++ b/android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java @@ -24,6 +24,8 @@ package org.iotivity.base; import org.iotivity.ca.CaInterface; import org.iotivity.base.BuildConfig; +import org.iotivity.base.OcProvisioning; +import org.iotivity.base.OcException; import java.util.EnumSet; import java.util.Iterator; @@ -91,12 +93,6 @@ public final class OcPlatform { * @param platformConfig platform configuration */ public synchronized static void Configure(PlatformConfig platformConfig) { - if (sIsStopPlatform) - { - OcPlatform.start(); - sIsStopPlatform = false; - } - if (!sIsPlatformInitialized) { CaInterface.initialize(platformConfig.getActivity(), platformConfig.getContext()); @@ -116,8 +112,22 @@ public final class OcPlatform { platformConfig.getAvailableTransportType() ); + if (platformConfig.getUuidSeedSize() > 0) { + try { + OcProvisioning.setDeviceIdSeed(platformConfig.getUuidSeed()); + } catch (OcException e) { + // Do nothing. + } + } + sIsPlatformInitialized = true; } + + if (sIsStopPlatform) + { + OcPlatform.start(); + sIsStopPlatform = false; + } } private static native void configure(int serviceType, diff --git a/android/android_api/base/src/main/java/org/iotivity/base/PlatformConfig.java b/android/android_api/base/src/main/java/org/iotivity/base/PlatformConfig.java old mode 100644 new mode 100755 index e02602c..83cc2e8 --- a/android/android_api/base/src/main/java/org/iotivity/base/PlatformConfig.java +++ b/android/android_api/base/src/main/java/org/iotivity/base/PlatformConfig.java @@ -43,6 +43,9 @@ public class PlatformConfig { private int mKeySize; private byte[] mKey; private int mTransportType; + private byte[] mUuidSeed; + private int mUuidSeedSize; + /** * @param activity app activity * @param context app context @@ -56,6 +59,8 @@ public class PlatformConfig { * specify port * @param qualityOfService quality of service * @param dbPath Persistant storage file for SVR Database. + * @param uuidSeed byte array of seed value for gernerating UUID. + * @param uuidSeedSize length of seed */ public PlatformConfig(Activity activity, Context context, @@ -64,7 +69,9 @@ public class PlatformConfig { String ipAddress, int port, QualityOfService qualityOfService, - String dbPath) { + String dbPath, + byte[] seed, + int seedSize) { this.mActivity=activity; this.mContext = context; this.mServiceType = serviceType; @@ -74,6 +81,8 @@ public class PlatformConfig { this.mQualityOfService = qualityOfService; this.mSvrDbPath = dbPath; this.mTransportType = 0; + this.mUuidSeed = seed; + this.mUuidSeedSize = seedSize; } public PlatformConfig(Context context, @@ -100,6 +109,7 @@ public class PlatformConfig { this.mKey = key; this.mTransportType = 0; } + /** * @param context app context * @param serviceType indicate IN_PROC or OUT_OF_PROC @@ -120,7 +130,34 @@ public class PlatformConfig { int port, QualityOfService qualityOfService, String dbPath) { - this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, dbPath); + this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, dbPath, null, 0); + } + + /** + * @param context app context + * @param serviceType indicate IN_PROC or OUT_OF_PROC + * @param modeType indicate whether we want to do server, client or both + * @param ipAddress ip address of server + * if you specify 0.0.0.0 : it listens on any interface + * @param port port of server + * if you specifiy 0 : next available random port is used + * if you specify 5683 : client discovery can work even if they don't + * specify port + * @param qualityOfService quality of service + * @param dbPath Persistant storage file for SVR Database. + * @param uuidSeed byte array of seed value for gernerating UUID. + * @param uuidSeedSize length of seed + */ + public PlatformConfig(Context context, + ServiceType serviceType, + ModeType modeType, + String ipAddress, + int port, + QualityOfService qualityOfService, + String dbPath, + byte[] uuidSeed, + int uuidSeedSize) { + this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, dbPath, uuidSeed, uuidSeedSize); } /** @@ -142,7 +179,7 @@ public class PlatformConfig { String ipAddress, int port, QualityOfService qualityOfService) { - this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, ""); + this(null,context,serviceType,modeType,ipAddress,port,qualityOfService, "", null, 0); } /** @@ -166,7 +203,7 @@ public class PlatformConfig { String ipAddress, int port, QualityOfService qualityOfService) { - this(activity,context,serviceType,modeType,ipAddress,port,qualityOfService, ""); + this(activity,context,serviceType,modeType,ipAddress,port,qualityOfService, "", null, 0); } public Context getContext() { return mContext; @@ -228,4 +265,14 @@ public class PlatformConfig { public int getAvailableTransportType() { return mTransportType; } + + public byte[] getUuidSeed() + { + return mUuidSeed; + } + + public int getUuidSeedSize() + { + return mUuidSeedSize; + } } diff --git a/android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java b/android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java old mode 100644 new mode 100755 index fc1db0d..75dde18 --- a/android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java +++ b/android/android_api/base/src/main/java/org/iotivity/ca/CaLeClientInterface.java @@ -221,8 +221,7 @@ public class CaLeClientInterface { caLeScanCallback(device); } else if(uuid.toString().contains(CUSTOM_UUID.toLowerCase()) || uuid.toString().contains(CUSTOM_UUID2.toLowerCase())) { - Log.d(TAG, "we found that has the Device [" + device.getAddress() + - "] which has custom adv"); + Log.d(TAG, "Found device which has custom adv"); caLeScanCallback(device); } } diff --git a/resource/csdk/connectivity/src/adapter_util/caadapterutils.c b/resource/csdk/connectivity/src/adapter_util/caadapterutils.c old mode 100644 new mode 100755 index be74098..6b31fb1 --- a/resource/csdk/connectivity/src/adapter_util/caadapterutils.c +++ b/resource/csdk/connectivity/src/adapter_util/caadapterutils.c @@ -379,7 +379,7 @@ void CALogSendStateInfo(CATransportAdapter_t adapter, } CALogAdapterTypeInfo(adapter); - OIC_LOG_V(INFO, ANALYZER_TAG, "Address = [%s]:[%d]", addr, port); + OIC_LOG_V(DEBUG, ANALYZER_TAG, "Address = [%s]:[%d]", addr, port); OIC_LOG(DEBUG, ANALYZER_TAG, "================================================="); // samsung log diff --git a/resource/csdk/stack/include/octypes.h b/resource/csdk/stack/include/octypes.h index 1a5797b..a7e6dbf 100644 --- a/resource/csdk/stack/include/octypes.h +++ b/resource/csdk/stack/include/octypes.h @@ -882,7 +882,9 @@ typedef enum OC_HIGH_QOS, /** No Quality is defined, let the stack decide.*/ - OC_NA_QOS + OC_NA_QOS, + + OC_LOW_QOS_WITH_TCP } OCQualityOfService; /** diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 8f77cf7..e3aef64 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -3233,8 +3233,10 @@ OCStackResult OCCancel(OCDoHandle handle, OCQualityOfService qos, OCHeaderOption CopyDevAddrToEndpoint(clientCB->devAddr, &endpoint); - if ((endpoint.adapter & CA_ADAPTER_IP) && qos != OC_HIGH_QOS) + if (((endpoint.adapter & CA_ADAPTER_IP) && qos != OC_HIGH_QOS) || + ((endpoint.adapter & CA_ADAPTER_TCP) && OC_LOW_QOS_WITH_TCP == qos)) { + OIC_LOG_V(INFO, TAG, "the %s observe callback is removed", clientCB->requestUri); FindAndDeleteClientCB(clientCB); break; } diff --git a/resource/include/OCApi.h b/resource/include/OCApi.h index 5fb2b92..da8a401 100644 --- a/resource/include/OCApi.h +++ b/resource/include/OCApi.h @@ -126,7 +126,9 @@ namespace OC HighQos = OC_HIGH_QOS, /** No Quality is defined, let the stack decide. */ - NaQos = OC_NA_QOS + NaQos = OC_NA_QOS, + + LowQosWithTcp = OC_LOW_QOS_WITH_TCP }; /** diff --git a/service/easy-setup/enrollee/inc/samsung/sc_easysetup.h b/service/easy-setup/enrollee/inc/samsung/sc_easysetup.h index 18bd0f0..aa56a04 100644 --- a/service/easy-setup/enrollee/inc/samsung/sc_easysetup.h +++ b/service/easy-setup/enrollee/inc/samsung/sc_easysetup.h @@ -56,6 +56,9 @@ #define SC_RSRVD_ES_VENDOR_UTC_DATE_TIME "x.com.samsung.datetime" #define SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME "x.com.samsung.regionaldatetime" #define SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION "x.com.samsung.espv" +#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_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" @@ -86,6 +89,7 @@ typedef struct SCWiFiConfProperties { int discoveryChannel; /**< Wi-Fi AP Channel used for fast discovery **/ char bssid[MAXLEN_STRING]; /**< Wi-Fi bssid information. **/ + bool isHidden; int numCandidateAP; SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP]; } SCWiFiConfProperties; @@ -110,6 +114,8 @@ typedef struct SCDevConfProperties char gpsLocation[MAXLEN_STRING]; /**< GPS information of device. Longitude and latitude in json format **/ char utcDateTime[MAXLEN_DATE_TIME]; /**< UTC date time **/ char regionalDateTime[MAXLEN_DATE_TIME]; /**< Regional date time **/ + char timeZoneId[MAXLEN_STRING]; /** Name of Time Zone **/ + char hubId[MAXLEN_STRING]; /** HubId of device **/ } SCDevConfProperties; typedef struct SCCoapCloudServerConfProperties @@ -150,6 +156,9 @@ typedef struct SCProperties char utcDateTime[MAXLEN_DATE_TIME]; /**< UTC date time **/ char regionalDateTime[MAXLEN_DATE_TIME]; /**< Regional date time **/ char esProtocolVersion[MAXLEN_STRING]; /**< Samsung Easy Setup Protocol Version **/ + char timeZoneId[MAXLEN_STRING]; + bool isHidden; + char hubId[MAXLEN_STRING]; /**< HubId of device **/ int numCandidateAP; SCCandidateAPInfo candidateAPInfo[MAXNUM_CANDIDATE_AP]; } SCProperties; diff --git a/service/easy-setup/enrollee/src/samsung/sc_easysetup.c b/service/easy-setup/enrollee/src/samsung/sc_easysetup.c index b4cdc0e..7ebdbee 100644 --- a/service/easy-setup/enrollee/src/samsung/sc_easysetup.c +++ b/service/easy-setup/enrollee/src/samsung/sc_easysetup.c @@ -258,6 +258,7 @@ void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata) { int64_t channel = -1; char *bssid = NULL; + bool isHidden = false; if (OCRepPayloadGetPropInt(payload, SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL, &channel)) { if(*userdata == NULL) @@ -355,6 +356,24 @@ 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) + { + *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)); + } + OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "[User specific property] %s : %d", + SC_RSRVD_ES_VENDOR_HIDDEN, isHidden); + ((SCWiFiConfProperties*)(*userdata))->isHidden = isHidden; + g_SCProperties.isHidden = isHidden; + } } else if(strstr(resourceType, OC_RSRVD_ES_RES_TYPE_DEVCONF)) { @@ -438,6 +457,14 @@ void ReadUserdataCb(OCRepPayload* payload, char* resourceType, void** userdata) OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "pDevConfProp.regionalDateTime %s", g_SCProperties.regionalDateTime); } + char *timeZoneId = NULL; + if (OCRepPayloadGetPropString(payload, SC_RSRVD_ES_VENDOR_TIMEZONE_ID, &timeZoneId)) + { + OICStrcpy(pDevConfProp->timeZoneId, strlen(timeZoneId)+1, timeZoneId); + OICStrcpy(g_SCProperties.timeZoneId, strlen(timeZoneId)+1, timeZoneId); + OIC_LOG_V(INFO_PRIVATE, SC_ENROLLEE_TAG, "pDevConfProp.timeZoneId %s", g_SCProperties.timeZoneId); + } + char *ssoList = NULL; if (OCRepPayloadGetPropString(payload, SC_RSRVD_ES_VENDOR_SSO_LIST, &ssoList)) { @@ -622,6 +649,7 @@ void WriteUserdataCb(OCRepPayload* payload, char* resourceType) OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_UTC_DATE_TIME, g_SCProperties.utcDateTime); OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME, g_SCProperties.regionalDateTime); OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION, g_SCProperties.esProtocolVersion); + OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_HUB_ID, g_SCProperties.hubId); #else if(g_SCProperties.deviceType != NULL) { @@ -671,6 +699,10 @@ void WriteUserdataCb(OCRepPayload* payload, char* resourceType) { OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION, g_SCProperties.esProtocolVersion); } + if (g_SCProperties.hubId != NULL) + { + OCRepPayloadSetPropString(payload, SC_RSRVD_ES_VENDOR_HUB_ID, g_SCProperties.hubId); + } #endif } } diff --git a/service/easy-setup/inc/escommon.h b/service/easy-setup/inc/escommon.h index 1ce4c1c..94c5df1 100644 --- a/service/easy-setup/inc/escommon.h +++ b/service/easy-setup/inc/escommon.h @@ -109,7 +109,8 @@ typedef enum NONE_AUTH = 0, /**< NO authentication **/ WEP, /**< WEP **/ WPA_PSK, /**< WPA-PSK **/ - WPA2_PSK /**< WPA2-PSK **/ + WPA2_PSK, /**< WPA2-PSK **/ + FT_PSK /**< FT-PSK **/ } WIFI_AUTHTYPE; /** diff --git a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/enums/WIFI_AUTHTYPE.java b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/enums/WIFI_AUTHTYPE.java index f655048..90cf3db 100644 --- a/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/enums/WIFI_AUTHTYPE.java +++ b/service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/java/org/iotivity/service/easysetup/mediator/enums/WIFI_AUTHTYPE.java @@ -30,7 +30,8 @@ public enum WIFI_AUTHTYPE NONE_AUTH(0), WEP(1), WPA_PSK(2), - WPA2_PSK(3); + WPA2_PSK(3), + FT_PSK(4); private int value; diff --git a/service/easy-setup/mediator/richsdk/inc/ESSCCommon.h b/service/easy-setup/mediator/richsdk/inc/ESSCCommon.h index 68e4dba..db59319 100644 --- a/service/easy-setup/mediator/richsdk/inc/ESSCCommon.h +++ b/service/easy-setup/mediator/richsdk/inc/ESSCCommon.h @@ -35,6 +35,9 @@ using namespace std; #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_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_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_UTC_DATE_TIME "x.com.samsung.datetime" @@ -54,6 +57,15 @@ using namespace std; #define SC_RSRVD_ES_VENDOR_COUNTRY "x.com.samsung.country" #define SC_RSRVD_ES_VENDOR_GPSLOCATION "x.com.samsung.gpslocation" #define SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION "x.com.samsung.espv" +#define SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD "mnmo" +#define SC_RSRVD_ES_VENDOR_LANGUAGE_OLD "lang" +#define SC_RSRVD_ES_VENDOR_COUNTRY_OLD "ctry" +#define SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD "loc" +#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_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" @@ -160,6 +172,11 @@ namespace OIC m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE, language); m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY, country); m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION, location); + + /* [CONPRO-888] Support backward compatibility */ + m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD, language); + m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY_OLD, country); + m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD, location); } /** @@ -174,6 +191,10 @@ namespace OIC { return m_rep.getValue(SC_RSRVD_ES_VENDOR_LANGUAGE); } + else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD); + } return std::string(""); } @@ -189,6 +210,10 @@ namespace OIC { return m_rep.getValue(SC_RSRVD_ES_VENDOR_COUNTRY); } + else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY_OLD)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_COUNTRY_OLD); + } return std::string(""); } @@ -203,6 +228,10 @@ namespace OIC { return m_rep.getValue(SC_RSRVD_ES_VENDOR_GPSLOCATION); } + else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD); + } return std::string(""); } @@ -435,6 +464,55 @@ namespace OIC } return {}; } + + /** + * Set time zone for location based services when easy-setup is done + * + * @param Name of timeZone + */ + void setTimeZoneId(const std::string &timeZoneId) + { + m_rep.setValue(SC_RSRVD_ES_VENDOR_TIMEZONE_ID, timeZoneId); + } + + /** + * Get the Name of TimeZone + * + * @return Name of timeZone + */ + std::string getTimeZoneId() + { + if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TIMEZONE_ID)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_TIMEZONE_ID); + } + return {}; + } + + /** + * Sets the hidden property of wifi + * if the Value is true, wifi is a hidden wifi, otherwise it is not + * + * @param isHidden: value indicating whether the wifi is hidden or not + */ + void setHiddenProperty(bool isHidden) + { + m_rep.setValue(SC_RSRVD_ES_VENDOR_HIDDEN, isHidden); + } + + /** + * Gets the property of the wifi whether it is hidden or not + * + * @return hidden value indicating whether the wifi is hidden or not + */ + bool getHiddenProperty() + { + if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_HIDDEN)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_HIDDEN); + } + return false; + } }; class SCCloudProp : public CloudProp @@ -475,6 +553,102 @@ namespace OIC } /** + * Set samsung-specific additional Api provider to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO) + * + * @param additionalApiProvider - additional Api Provider + */ + void setAdditionalApiProvider(const std::string &additionalApiProvider) + { + m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_API_SERVER, additionalApiProvider); + } + + /** + * Get samsung-specific additional Api provider (for devices(TV/AV, Lux) sign up SSO) + * + * @return additionalApiProvider - additional Api Provider + */ + std::string getAdditionalApiProvider() + { + if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_API_SERVER)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_SA_API_SERVER); + } + return {}; + } + + /** + * Set samsung-specific additional Auth provider to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO) + * + * @param additionalAuthProvider - additional Auth Provider + */ + void setAdditionalAuthProvider(const std::string &additionalAuthProvider) + { + m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER, additionalAuthProvider); + } + + /** + * Get samsung-specific additional Auth provider (for devices(TV/AV, Lux) sign up SSO) + * + * @return additionalAuthProvider - additional Auth Provider + */ + std::string getAdditionalAuthProvider() + { + if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER); + } + return {}; + } + + /** + * Set samsung-specific additional device security code to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO) + * + * @param additionalDeviceSecCode - additional DeviceSecurityCode (for devices(TV/AV, Lux) sign up VD SSO) + */ + void setAdditionalDeviceSecCode(const std::string &additionalDeviceSecCode) + { + m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE, additionalDeviceSecCode); + } + + /** + * Get samsung-specific additional device security code + * + * @return additionalDeviceSecCode - additional DeviceSecurityCode + */ + std::string getAdditionalDeviceSecCode() + { + if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE); + } + return {}; + } + + /** + * Set current deployment environment which IoT Server is operating such as "PRD" "STG" + * + * @param serverDeploymentEnv - current server Deployment Environment + */ + void setServerDeploymentEnv(const std::string &serverDeploymentEnv) + { + m_rep.setValue(SC_RSRVD_ES_VENDOR_SERVER_DEPLOYMENT_ENVIRONMENT, serverDeploymentEnv); + } + + /** + * Get current server deployment environment which IoT Server is operating such as "PRD", "STG" etc + * + * @return serverDeploymentEnv - current server deployment environment + */ + std::string getServerDeploymentEnv() + { + if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SERVER_DEPLOYMENT_ENVIRONMENT)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_SERVER_DEPLOYMENT_ENVIRONMENT); + } + return {}; + } + + /** * Set samsung-specific refresh token property to be delivered to Enrollee * * @param refreshtoken - Refresh token. @@ -546,6 +720,30 @@ namespace OIC } return {}; } + + /** + * Set samsung-specific client service ID property to be delivered to Enrollee + * + * @param clientID - Client service ID + */ + void setServerId(const std::string &serverId) + { + m_rep.setValue(SC_RSRVD_ES_VENDOR_SERVER_ID, serverId); + } + + /** + * Get samsung-specific client service ID property. + * + * @return Client service ID. + */ + std::string getServerId() + { + if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SERVER_ID)) + { + return m_rep.getValue(SC_RSRVD_ES_VENDOR_SERVER_ID); + } + return {}; + } }; /** @@ -587,6 +785,10 @@ namespace OIC { return rep.getValue(SC_RSRVD_ES_VENDOR_MODEL_NUMBER); } + else if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD)) + { + return rep.getValue(SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD); + } } } return std::string(""); @@ -1090,6 +1292,69 @@ namespace OIC return std::string(""); } + /** + * Gets the ISO country code of the device + * (ISO 3166-1 Alpha-2) + * + * @return the ISO Country code of the device + */ + std::string getCountry() const + { + std::vector children = m_EasySetupRep.getChildren(); + for(auto child = children.begin(); child != children.end(); ++child) + { + if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos) + { + OCRepresentation rep; + if(child->hasAttribute(OC_RSRVD_REPRESENTATION)) + { + rep = child->getValue(OC_RSRVD_REPRESENTATION); + } + else + { + return std::string(""); + } + + if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY)) + { + return rep.getValue(SC_RSRVD_ES_VENDOR_COUNTRY); + } + } + } + return std::string(""); + } + + /** + * Gets the HubId of the device + * + * @return hubId of the device + */ + std::string getHubId() const + { + std::vector children = m_EasySetupRep.getChildren(); + for(auto child = children.begin(); child != children.end(); ++child) + { + if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos) + { + OCRepresentation rep; + if(child->hasAttribute(OC_RSRVD_REPRESENTATION)) + { + rep = child->getValue(OC_RSRVD_REPRESENTATION); + } + else + { + return std::string(""); + } + + if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_HUB_ID)) + { + return rep.getValue(SC_RSRVD_ES_VENDOR_HUB_ID); + } + } + } + return std::string(""); + } + }; } } diff --git a/service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h b/service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h index ae02cac..01b9921 100644 --- a/service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h +++ b/service/resource-encapsulation/src/resourceCache/include/ResourceCacheManager.h @@ -75,7 +75,6 @@ namespace OIC static std::unique_ptr> s_cacheDataList; std::map cacheIDmap; - std::list m_observeCacheList; std::map observeCacheIDmap; ResourceCacheManager() = default; diff --git a/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp b/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp index efe0cde..8a3f020 100644 --- a/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp +++ b/service/resource-encapsulation/src/resourceCache/src/ResourceCacheManager.cpp @@ -88,7 +88,6 @@ namespace OIC auto newHandler = std::make_shared(pResource); newHandler->startCache(std::move(func)); - m_observeCacheList.push_back(newHandler); observeCacheIDmap.insert(std::make_pair(retID, newHandler)); return retID; -- 2.7.4