Commit 3bbe07cb authored by Jihun Ha's avatar Jihun Ha Committed by Uze Choi

Update resource models of easy setup in Enrollee side

There are 4 resource modesl in Enrollee side:
1. Provisioning resource
 - provisioning status and trigger properties
2. WiFi resource
 - WiFi ssid, password, security type, etc.
3. CloudServer resource
 - Auth code, Auth provider, etc.
4. DevConf resource
 - Device name, language, country

Change-Id: I31a088b7cde8178d9ddd951ac0641989706dc249
Signed-off-by: default avatarJihun Ha <jihun.ha@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8429Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarMadan Lanka <lanka.madan@samsung.com>
Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
parent d89db3ea
...@@ -94,8 +94,7 @@ if target_os == 'tizen': ...@@ -94,8 +94,7 @@ if target_os == 'tizen':
enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')]) enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(CXXFLAGS = ['-pthread']) enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction']) enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
enrollee_env.AppendUnique(CPPPATH = [ enrollee_env.AppendUnique(CPPPATH = [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi'])
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi'])
###################################################################### ######################################################################
# Arduino Enrollee # Arduino Enrollee
...@@ -126,31 +125,39 @@ if target_os == 'linux': ...@@ -126,31 +125,39 @@ if target_os == 'linux':
enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrollee') enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrollee')
if target_os == 'tizen': if target_os == 'tizen':
enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', [ es_enrollee_common_src = [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c', enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c', enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi/networkhandler.c', enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi/softapnative.c']) enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/softapnative.c',
enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrolleeSDK') enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/networkhandler.c']
enrollee_env.AppendUnique(es_enrollee_src = es_enrollee_common_src)
enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', enrollee_env.get('es_enrollee_src'))
enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrollee')
enrollee_env.UserInstallTargetLib(enrollee_sdk_shared, 'libESEnrolleeSDK') enrollee_env.UserInstallTargetLib(enrollee_sdk_shared, 'libESEnrolleeSDK')
if target_os == 'arduino': if target_os == 'arduino':
es_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK', [ es_sdk_static = enrollee_env.StaticLibrary('ESEnrolleeSDK', [
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/easysetup.cpp', # enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/easysetup.cpp',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/onboarding.cpp', # enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/onboarding.cpp',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/softap.cpp', # enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/softap.cpp',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/resourcehandler.cpp', # enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/resourcehandler.cpp',
# enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp'])
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/onboarding.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp']) enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/arduino/wifi/networkhandler.cpp'])
enrollee_env.InstallTarget(es_sdk_static, 'libESEnrolleeSDK') enrollee_env.InstallTarget(es_sdk_static, 'libESEnrolleeSDK')
#Go to build sample apps #Go to build sample apps
if target_os == 'arduino': #if target_os == 'arduino':
SConscript('../sampleapp/enrollee/arduino/SConscript') # SConscript('../sampleapp/enrollee/arduino/SConscript')
if target_os == 'linux': if target_os == 'linux':
SConscript('../sampleapp/enrollee/linux/SConscript') SConscript('../sampleapp/enrollee/linux/SConscript')
#Build UnitTestcases for Enrollee #Build UnitTestcases for Enrollee
SConscript('../enrollee/unittests/SConscript') # SConscript('../enrollee/unittests/SConscript')
...@@ -159,7 +159,7 @@ ESResult ESTerminateEnrollee() ...@@ -159,7 +159,7 @@ ESResult ESTerminateEnrollee()
UnRegisterResourceEventCallBack(); UnRegisterResourceEventCallBack();
//Delete Prov resource //Delete Prov resource
if (DeleteProvisioningResource() != OC_STACK_OK) if (DeleteEasySetupResources() != OC_STACK_OK)
{ {
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!"); OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
return ES_ERROR; return ES_ERROR;
...@@ -173,7 +173,7 @@ ESResult ESInitProvisioning() ...@@ -173,7 +173,7 @@ ESResult ESInitProvisioning()
{ {
OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitProvisioning <<IN>>"); OIC_LOG(INFO, ES_ENROLLEE_TAG, "ESInitProvisioning <<IN>>");
if (CreateProvisioningResource(gIsSecured) != OC_STACK_OK) if (CreateEasySetupResources(gIsSecured) != OC_STACK_OK)
{ {
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateProvisioningResource error"); OIC_LOG(ERROR, ES_ENROLLEE_TAG, "CreateProvisioningResource error");
return ES_ERROR; return ES_ERROR;
......
...@@ -40,25 +40,45 @@ typedef void (*ESEnrolleeResourceEventCallback)(ESResult); ...@@ -40,25 +40,45 @@ typedef void (*ESEnrolleeResourceEventCallback)(ESResult);
typedef struct PROVRESOURCE typedef struct PROVRESOURCE
{ {
OCResourceHandle handle; OCResourceHandle handle;
int64_t ps; // provisiong status, 1 : need to provisioning, 2 : Connected to Enroller. int64_t status; // provisiong status, 1 : need to provisioning, 2 : Connected to Enroller.
int64_t tr; // Trigger network connection, 0 : Init value, 1 : Connected to the target network. bool trigger; // Trigger network connection, 0 : Init value, 1 : Connected to the target network.
int64_t tnt; // target network type, 1: WLAN, 2: BT, 3: BLE, 4: Zigbee. int64_t errorCode;
char tnn[MAXSSIDLEN]; // target network name, i.e. SSID for WLAN, MAC address for BT.
char cd[MAXNETCREDLEN]; // credential information.
} ProvResource; } ProvResource;
/* Structure to represent a Light resource */ typedef struct
typedef struct NETRESOURCE
{ {
OCResourceHandle handle; OCResourceHandle handle;
int64_t cnt; // current network type, 1: WLAN, 2: BT, 3: BLE, 4: Zigbee. int64_t supportedMode[NUM_WIFIMODE];
int64_t ant[MAXNUMTYPE]; // available network type, 1: WLAN, 2: BT, 3: BLE, 4: Zigbee. uint8_t numMode;
char ipaddr[MAXADDRLEN]; // ip address. int64_t supportedFreq;
char cnn[MAXSSIDLEN]; // current network name. char ssid[MAXSSIDLEN]; // target network name, i.e. SSID for WLAN, MAC address for BT.
} NetResource; char cred[MAXNETCREDLEN]; // credential information.
int64_t authType;
int64_t encType;
} WiFiResource;
typedef struct
{
OCResourceHandle handle;
char authCode[OIC_STRING_MAX_VALUE];
char authProvider[OIC_STRING_MAX_VALUE];
char ciServer[OIC_STRING_MAX_VALUE];
} CloudResource;
typedef struct
{
OCResourceHandle handle;
char devName[OIC_STRING_MAX_VALUE];
char language[OIC_STRING_MAX_VALUE];
char country[OIC_STRING_MAX_VALUE];
} DevConfResource;
OCStackResult CreateProvisioningResource(bool isSecured); OCStackResult CreateProvisioningResource(bool isSecured);
OCStackResult CreateEasySetupResources(bool isSecured);
OCStackResult DeleteProvisioningResource(); OCStackResult DeleteProvisioningResource();
OCStackResult DeleteEasySetupResources();
void GetTargetNetworkInfoFromProvResource(char *, char *); void GetTargetNetworkInfoFromProvResource(char *, char *);
void RegisterResourceEventCallBack(ESEnrolleeResourceEventCallback); void RegisterResourceEventCallBack(ESEnrolleeResourceEventCallback);
......
...@@ -39,28 +39,78 @@ ...@@ -39,28 +39,78 @@
/** /**
* Attributes used to form a proper easysetup conforming JSON message. * Attributes used to form a proper easysetup conforming JSON message.
*/ */
#define OC_RSRVD_ES_PS "ps" #define OC_RSRVD_ES_PROVSTATUS "ps"
#define OC_RSRVD_ES_TNN "tnn" #define OC_RSRVD_ES_ERRORCODE "ec"
#define OC_RSRVD_ES_CD "cd" #define OC_RSRVD_ES_TRIGGER "tr"
#define OC_RSRVD_ES_TR "tr" #define OC_RSRVD_ES_SUPPORTEDWIFIMODE "swmt"
#define OC_RSRVD_ES_TNT "tnt" #define OC_RSRVD_ES_SUPPORTEDWIFIFREQ "swf"
#define OC_RSRVD_ES_ANT "ant" #define OC_RSRVD_ES_SSID "tnn"
#define OC_RSRVD_ES_CRED "cd"
#define OC_RSRVD_ES_AUTHTYPE "wat"
#define OC_RSRVD_ES_ENCTYPE "wet"
#define OC_RSRVD_ES_AUTHCODE "ac"
#define OC_RSRVD_ES_AUTHPROVIDER "apn"
#define OC_RSRVD_ES_CISERVER "cisurl"
#define OC_RSRVD_ES_DEVNAME "dn"
#define OC_RSRVD_ES_LANGUAGE "lang"
#define OC_RSRVD_ES_COUNTRY "cont"
/** /**
* Easysetup defined resoruce types and uris. * Easysetup defined resoruce types and uris.
*/ */
#define OC_RSRVD_ES_PROV_RES_TYPE "oic.r.prov" #define OC_RSRVD_ES_RES_TYPE_PROV "ocf.r.prov"
#define OC_RSRVD_ES_URI_PROV "/oic/prov" #define OC_RSRVD_ES_URI_PROV "/.well-known/ocf/prov"
#define OC_RSRVD_ES_RES_TYPE_WIFI "ocf.r.wifi"
#define OC_RSRVD_ES_URI_WIFI "/.well-known/ocf/prov/wifi"
#define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "ocf.r.cloudserver"
#define OC_RSRVD_ES_URI_CLOUDSERVER "/.well-known/ocf/prov/cloudserver"
#define OC_RSRVD_ES_RES_TYPE_DEVCONF "ocf.r.devconf"
#define OC_RSRVD_ES_URI_DEVCONF "/.well-known/ocf/prov/devconf"
#define OC_RSRVD_ES_URI_NET "/oic/net" #define OC_RSRVD_ES_URI_NET "/oic/net"
/** #define NUM_WIFIMODE 10
* @brief Defines for Provisioning status accepted values
*/ typedef enum
#define ES_PS_NEED_PROVISIONING 1 {
#define ES_PS_PROVISIONING_COMPLETED 2 NO_PROVISION = 0,
#define ES_PS_TRIGGER_INIT_VALUE 0 CONNECTED_ENROLLER,
#define ES_PS_TRIGGER_CONNECTION 1 FAILED_CONNECTION
} PROV_STATUS;
typedef enum
{
WiFi_11A = 0,
WiFi_11B,
WiFi_11G,
WiFi_11N,
WiFi_11AC
} WIFI_MODE;
typedef enum
{
WiFi_24G = 0,
WiFi_5G,
WiFi_BOTH
} WIFI_FREQ;
typedef enum
{
NONE_AUTH = 0,
WEP,
WPA_PSK,
WPA2_PSK
} WIFI_AUTHTYPE;
typedef enum
{
NONE_ENC = 0,
WEP_64,
WEP_128,
TKIP,
AES,
TKIP_AES
} WIFI_ENCTYPE;
/** /**
* Device Roles defined for each device type used in easy setup * Device Roles defined for each device type used in easy setup
......
...@@ -26,7 +26,7 @@ Import('env') ...@@ -26,7 +26,7 @@ Import('env')
target_os = env.get('TARGET_OS') target_os = env.get('TARGET_OS')
# Build easy-setup Mediator C SDK # Build easy-setup Mediator C SDK
SConscript('csdk/SConscript') #SConscript('csdk/SConscript')
# Build easy-setup Mediator Rich [C++] SDK # Build easy-setup Mediator Rich [C++] SDK
SConscript('richsdk/SConscript') SConscript('richsdk/SConscript')
......
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