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
......@@ -90,12 +90,11 @@ if target_os == 'linux':
# Tizen Enrollee
######################################################################
if target_os == 'tizen':
enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
enrollee_env.AppendUnique(CPPPATH = [
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi'])
enrollee_env.AppendUnique(LIBPATH = [enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(RPATH = [enrollee_env.get('BUILD_DIR')])
enrollee_env.AppendUnique(CXXFLAGS = ['-pthread'])
enrollee_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'pthread', 'connectivity_abstraction'])
enrollee_env.AppendUnique(CPPPATH = [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/tizen/wifi'])
######################################################################
# Arduino Enrollee
......@@ -113,7 +112,7 @@ if target_os == 'arduino':
es_enrollee_src = None
if target_os == 'linux':
es_enrollee_common_src = [enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/easysetup.c',
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/onboarding.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/resourcehandler.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
......@@ -126,31 +125,39 @@ if target_os == 'linux':
enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrollee')
if target_os == 'tizen':
enrollee_sdk_shared = enrollee_env.SharedLibrary('ESEnrolleeSDK', [
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',
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/onboarding.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/tizen/wifi/softapnative.c'])
enrollee_env.InstallTarget(enrollee_sdk_shared, 'libESEnrolleeSDK')
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/src/softap.c',
enrollee_env.get('SRC_DIR') + '/service/easy-setup/enrollee/linux/wifi/softapnative.c',
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')
if target_os == 'arduino':
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/onboarding.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/easysetup.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/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.InstallTarget(es_sdk_static, 'libESEnrolleeSDK')
#Go to build sample apps
if target_os == 'arduino':
SConscript('../sampleapp/enrollee/arduino/SConscript')
#if target_os == 'arduino':
# SConscript('../sampleapp/enrollee/arduino/SConscript')
if target_os == 'linux':
SConscript('../sampleapp/enrollee/linux/SConscript')
#Build UnitTestcases for Enrollee
SConscript('../enrollee/unittests/SConscript')
# SConscript('../enrollee/unittests/SConscript')
......@@ -159,7 +159,7 @@ ESResult ESTerminateEnrollee()
UnRegisterResourceEventCallBack();
//Delete Prov resource
if (DeleteProvisioningResource() != OC_STACK_OK)
if (DeleteEasySetupResources() != OC_STACK_OK)
{
OIC_LOG(ERROR, ES_ENROLLEE_TAG, "Deleting prov resource error!!");
return ES_ERROR;
......@@ -173,7 +173,7 @@ ESResult ESInitProvisioning()
{
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");
return ES_ERROR;
......
......@@ -40,25 +40,45 @@ typedef void (*ESEnrolleeResourceEventCallback)(ESResult);
typedef struct PROVRESOURCE
{
OCResourceHandle handle;
int64_t ps; // 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.
int64_t tnt; // target network type, 1: WLAN, 2: BT, 3: BLE, 4: Zigbee.
char tnn[MAXSSIDLEN]; // target network name, i.e. SSID for WLAN, MAC address for BT.
char cd[MAXNETCREDLEN]; // credential information.
int64_t status; // provisiong status, 1 : need to provisioning, 2 : Connected to Enroller.
bool trigger; // Trigger network connection, 0 : Init value, 1 : Connected to the target network.
int64_t errorCode;
} ProvResource;
/* Structure to represent a Light resource */
typedef struct NETRESOURCE
typedef struct
{
OCResourceHandle handle;
int64_t cnt; // current network type, 1: WLAN, 2: BT, 3: BLE, 4: Zigbee.
int64_t ant[MAXNUMTYPE]; // available network type, 1: WLAN, 2: BT, 3: BLE, 4: Zigbee.
char ipaddr[MAXADDRLEN]; // ip address.
char cnn[MAXSSIDLEN]; // current network name.
} NetResource;
int64_t supportedMode[NUM_WIFIMODE];
uint8_t numMode;
int64_t supportedFreq;
char ssid[MAXSSIDLEN]; // target network name, i.e. SSID for WLAN, MAC address for BT.
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 CreateEasySetupResources(bool isSecured);
OCStackResult DeleteProvisioningResource();
OCStackResult DeleteEasySetupResources();
void GetTargetNetworkInfoFromProvResource(char *, char *);
void RegisterResourceEventCallBack(ESEnrolleeResourceEventCallback);
......@@ -68,4 +88,4 @@ void UnRegisterResourceEventCallBack(void);
}
#endif
#endif //ES_RESOURCE_HANDLER_H_
\ No newline at end of file
#endif //ES_RESOURCE_HANDLER_H_
......@@ -39,28 +39,78 @@
/**
* Attributes used to form a proper easysetup conforming JSON message.
*/
#define OC_RSRVD_ES_PS "ps"
#define OC_RSRVD_ES_TNN "tnn"
#define OC_RSRVD_ES_CD "cd"
#define OC_RSRVD_ES_TR "tr"
#define OC_RSRVD_ES_TNT "tnt"
#define OC_RSRVD_ES_ANT "ant"
#define OC_RSRVD_ES_PROVSTATUS "ps"
#define OC_RSRVD_ES_ERRORCODE "ec"
#define OC_RSRVD_ES_TRIGGER "tr"
#define OC_RSRVD_ES_SUPPORTEDWIFIMODE "swmt"
#define OC_RSRVD_ES_SUPPORTEDWIFIFREQ "swf"
#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.
*/
#define OC_RSRVD_ES_PROV_RES_TYPE "oic.r.prov"
#define OC_RSRVD_ES_URI_PROV "/oic/prov"
#define OC_RSRVD_ES_URI_NET "/oic/net"
#define OC_RSRVD_ES_RES_TYPE_PROV "ocf.r.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"
/**
* @brief Defines for Provisioning status accepted values
*/
#define ES_PS_NEED_PROVISIONING 1
#define ES_PS_PROVISIONING_COMPLETED 2
#define ES_PS_TRIGGER_INIT_VALUE 0
#define ES_PS_TRIGGER_CONNECTION 1
#define OC_RSRVD_ES_URI_NET "/oic/net"
#define NUM_WIFIMODE 10
typedef enum
{
NO_PROVISION = 0,
CONNECTED_ENROLLER,
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
......
......@@ -26,7 +26,7 @@ Import('env')
target_os = env.get('TARGET_OS')
# Build easy-setup Mediator C SDK
SConscript('csdk/SConscript')
#SConscript('csdk/SConscript')
# Build easy-setup Mediator Rich [C++] SDK
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