From bff0ed253aa6bae7aa172a334c093ba59dd59e0f Mon Sep 17 00:00:00 2001 From: Sandipan Patra Date: Wed, 10 Feb 2016 09:45:28 +0530 Subject: [PATCH] [ENROLLEE] Tizen enrollee sample application build using scons command [CODING STANDARD] Enrollee files rename as per iotivity coding standard Change-Id: Ib873ede13d6b1539e812e535676c2c33d34b9481 Signed-off-by: Sandipan Patra Reviewed-on: https://gerrit.iotivity.org/gerrit/4967 Tested-by: jenkins-iotivity Reviewed-by: Sooho Chang Reviewed-by: Madan Lanka --- gbsbuild.sh | 25 +-- service/easy-setup/SConscript | 8 +- .../sampleapp/enrollee/arduino/SConscript | 2 +- .../{enrollee_wifi.cpp => enrolleewifi.cpp} | 2 +- .../tizen-sdb/EnrolleeSample/build/SConscript | 226 +++++++++++++++++++++ .../tizen-sdb/EnrolleeSample/build/tizen/Makefile | 65 ++++++ .../EnrolleeSample/build/tizen/SConscript | 24 +++ .../EnrolleeSample/build/tizen/SConstruct | 23 +++ .../EnrolleeSample/build/tizen/gbsbuild.sh | 103 ++++++++++ .../{enrollee_wifi.cpp => enrolleewifi.cpp} | 0 .../tizen-sdb/EnrolleeSample/scons/SConscript | 2 +- .../sampleapp/enrollee/tizen-sdb/README.txt | 8 +- .../inc/{enrollee_wifi.h => enrolleewifi.h} | 0 .../src/{enrollee_main.cpp => enrolleemain.cpp} | 0 .../src/{enrollee_wifi.cpp => enrolleewifi.cpp} | 0 .../inc/{enrollee_wifi.h => enrolleewifi.h} | 0 .../src/{enrollee_wifi.cpp => enrolleewifi.cpp} | 0 .../{networkHandler.cpp => networkhandler.cpp} | 2 +- .../wifi/{networkHandler.h => networkhandler.h} | 0 service/easy-setup/sdk/enrollee/inc/onboarding.h | 2 +- .../inc/{resourceHandler.h => resourcehandler.h} | 2 +- service/easy-setup/sdk/enrollee/inc/softap.h | 2 +- service/easy-setup/sdk/enrollee/src/easysetup.cpp | 2 +- service/easy-setup/sdk/enrollee/src/onboarding.cpp | 4 +- .../{resourceHandler.cpp => resourcehandler.cpp} | 2 +- service/easy-setup/sdk/enrollee/src/softap.cpp | 2 +- .../{networkHandler.cpp => networkhandler.cpp} | 2 +- .../wifi/{networkHandler.h => networkhandler.h} | 0 28 files changed, 465 insertions(+), 43 deletions(-) rename service/easy-setup/sampleapp/enrollee/arduino/{enrollee_wifi.cpp => enrolleewifi.cpp} (98%) mode change 100755 => 100644 create mode 100644 service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript create mode 100644 service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/Makefile create mode 100644 service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript create mode 100644 service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConstruct create mode 100644 service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh rename service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/{enrollee_wifi.cpp => enrolleewifi.cpp} (100%) rename service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/{enrollee_wifi.h => enrolleewifi.h} (100%) rename service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/{enrollee_main.cpp => enrolleemain.cpp} (100%) rename service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/{enrollee_wifi.cpp => enrolleewifi.cpp} (100%) rename service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/{enrollee_wifi.h => enrolleewifi.h} (100%) rename service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/{enrollee_wifi.cpp => enrolleewifi.cpp} (100%) rename service/easy-setup/sdk/enrollee/arduino/wifi/{networkHandler.cpp => networkhandler.cpp} (99%) rename service/easy-setup/sdk/enrollee/arduino/wifi/{networkHandler.h => networkhandler.h} (100%) rename service/easy-setup/sdk/enrollee/inc/{resourceHandler.h => resourcehandler.h} (98%) rename service/easy-setup/sdk/enrollee/src/{resourceHandler.cpp => resourcehandler.cpp} (99%) rename service/easy-setup/sdk/enrollee/tizen/wifi/{networkHandler.cpp => networkhandler.cpp} (99%) rename service/easy-setup/sdk/enrollee/tizen/wifi/{networkHandler.h => networkhandler.h} (100%) diff --git a/gbsbuild.sh b/gbsbuild.sh index e7dc27c..d9ab246 100755 --- a/gbsbuild.sh +++ b/gbsbuild.sh @@ -44,8 +44,7 @@ cp ./SConstruct ./tmp # copy dependency RPMs and conf files for tizen build cp ./tools/tizen/*.rpm ./tmp cp ./tools/tizen/.gbs.conf ./tmp -cp ./tools/tizen/*.rpm $sourcedir/tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample -cp ./tools/tizen/.gbs.conf ./tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample + cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp cd $sourcedir/tmp @@ -72,28 +71,6 @@ else exit 1 fi -cd service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample -echo `pwd` - -if [ ! -d .git ]; then - git init ./ - git config user.email "you@example.com" - git config user.name "Your Name" - git add ./ - git commit -m "Initial commit" -fi - -echo "Calling sample gbs build command" -gbscommand="gbs build -A armv7l -B ~/GBS-ROOT --include-all --repository ./ --define 'TARGET_TRANSPORT IP' --define 'SECURED 0' --define 'RELEASE 0' --define 'LOGGING True' --define 'ROUTING EP' --define 'TARGET_ENROLLEE tizen -'" -echo $gbscommand -if eval $gbscommand; then - echo "Sample build is successful" -else - echo "Sample build is failed. " - exit 1 -fi - cd $sourcedir rm -rf $sourcedir/tmp diff --git a/service/easy-setup/SConscript b/service/easy-setup/SConscript index 840b987..e4948e0 100755 --- a/service/easy-setup/SConscript +++ b/service/easy-setup/SConscript @@ -142,8 +142,8 @@ if target_os == 'arduino': es_sdk_static = easy_setup_env.StaticLibrary('ESSDKLibrary', ['sdk/enrollee/src/easysetup.cpp', 'sdk/enrollee/src/onboarding.cpp', - 'sdk/enrollee/src/resourceHandler.cpp', - 'sdk/enrollee/arduino/wifi/networkHandler.cpp']) + 'sdk/enrollee/src/resourcehandler.cpp', + 'sdk/enrollee/arduino/wifi/networkhandler.cpp']) easy_setup_env.InstallTarget(es_sdk_static, 'libESSDK') if target_os == 'android': @@ -158,8 +158,8 @@ if target_os == 'tizen': ['sdk/enrollee/src/easysetup.cpp', 'sdk/enrollee/src/onboarding.cpp', 'sdk/enrollee/src/softap.cpp', - 'sdk/enrollee/src/resourceHandler.cpp', - 'sdk/enrollee/tizen/wifi/networkHandler.cpp', + 'sdk/enrollee/src/resourcehandler.cpp', + 'sdk/enrollee/tizen/wifi/networkhandler.cpp', 'sdk/enrollee/tizen/wifi/softapnative.cpp']) easy_setup_env.InstallTarget(es_sdk_shared, 'libESSDK') diff --git a/service/easy-setup/sampleapp/enrollee/arduino/SConscript b/service/easy-setup/sampleapp/enrollee/arduino/SConscript index 2fa74cd..53b2dbf 100755 --- a/service/easy-setup/sampleapp/enrollee/arduino/SConscript +++ b/service/easy-setup/sampleapp/enrollee/arduino/SConscript @@ -42,7 +42,7 @@ enrollee_env.AppendUnique(CPPDEFINES = ['TB_LOG', 'ESWIFI']) enrollee_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')]) enrollee_env.PrependUnique(LIBS = ['octbstack','ocsrm','connectivity_abstraction','coap', 'ESSDKLibrary']) -enrollee = enrollee_env.Program('enrollee', 'enrollee_wifi.cpp') +enrollee = enrollee_env.Program('enrollee', 'enrolleewifi.cpp') env.CreateBin('enrollee') i_enrollee = enrollee_env.Install(env.get('BUILD_DIR'), enrollee) diff --git a/service/easy-setup/sampleapp/enrollee/arduino/enrollee_wifi.cpp b/service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp old mode 100755 new mode 100644 similarity index 98% rename from service/easy-setup/sampleapp/enrollee/arduino/enrollee_wifi.cpp rename to service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp index dd3c58c..b26bc91 --- a/service/easy-setup/sampleapp/enrollee/arduino/enrollee_wifi.cpp +++ b/service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp @@ -181,7 +181,7 @@ void StartEasySetup() g_isInitialized = true; - OC_LOG_V(ERROR, TAG, "OnBoarding succeeded. Successfully connected to ssid : %s",ssid); + OC_LOG_V(ERROR, TAG, "OnBoarding succeded. Successfully connected to ssid : %s",ssid); } void StartProvisioning() diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript new file mode 100644 index 0000000..7507147 --- /dev/null +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript @@ -0,0 +1,226 @@ +## +# This script includes generic build options: +# release/debug, target os, target arch, cross toolchain, build environment etc +## +import os +import platform + +# Map of host os and allowed target os (host: allowed target os) +host_target_map = { + 'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'], + 'windows': ['windows', 'winrt', 'android', 'arduino'], + 'darwin': ['darwin', 'ios', 'android', 'arduino'], + } + +# Map of os and allowed archs (os: allowed archs) +os_arch_map = { + 'linux': ['x86', 'x86_64', 'arm', 'arm64'], + 'tizen': ['x86', 'x86_64', 'arm', 'arm64'], + 'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'], + 'windows': ['x86', 'amd64', 'arm'], + 'winrt': ['arm'], + 'darwin': ['i386', 'x86_64'], + 'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'], + 'arduino': ['avr', 'arm'], + 'yocto': ['i586', 'x86_64', 'arm', 'powerpc', 'powerpc64', 'mips', 'mipsel'], + } + +host = platform.system().lower() + +if not host_target_map.has_key(host): + print "\nError: Current system (%s) isn't supported\n" % host + Exit(1) + +###################################################################### +# Get build options (the optins from command line) +###################################################################### +target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os + +if target_os not in host_target_map[host]: + print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host]) + Exit(1) + +default_arch = platform.machine() +if default_arch not in os_arch_map[target_os]: + default_arch = os_arch_map[target_os][0].lower() + +target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch + +# True if binary needs to be installed on board. (Might need root permissions) +# set to 'no', 'false' or 0 for only compilation +require_upload = ARGUMENTS.get('UPLOAD', True) + +# Get the device name +device_name = ARGUMENTS.get('DEVICE_NAME', "OIC-DEVICE") + +###################################################################### +# Common build options (release, target os, target arch) +###################################################################### +help_vars = Variables() +help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug +help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', False)) +help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host])) +help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP', 'TCP'])) +help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os])) +help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1'))) +help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload)) +help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP'))) +help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF'))) + +help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),) + +AddOption('--prefix', + dest='prefix', + type='string', + nargs=1, + action='store', + metavar='DIR', + help='installation prefix') + +###################################################################### +# Platform(build target) specific options: SDK/NDK & toolchain +###################################################################### +targets_support_cc = ['linux', 'arduino', 'tizen'] + +if target_os in targets_support_cc: + # Set cross compile toolchain + help_vars.Add('TC_PREFIX', "Toolchain prefix (Generally only be required for cross-compiling)", os.environ.get('TC_PREFIX')) + help_vars.Add(PathVariable('TC_PATH', + 'Toolchain path (Generally only be required for cross-compiling)', + os.environ.get('TC_PATH'))) + +if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compiler regardless of the host + env = Environment(variables = help_vars, + tools = ['gnulink', 'gcc', 'g++', 'ar', 'as'] + ) +else: + env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix')) + +Help(help_vars.GenerateHelpText(env)) + +# Set device name to __OIC_DEVICE_NAME__ +env.AppendUnique(CPPDEFINES = ['-D__OIC_DEVICE_NAME__=' + "\'\"" + device_name + "\"\'"]) + +tc_set_msg = ''' +************************************ Warning ********************************** +* Enviornment variable TC_PREFIX/TC_PATH is set. It will change the default * +* toolchain, if it isn't what you expect you should unset it, otherwise it may* +* cause inexplicable errors. * +******************************************************************************* +''' + +if target_os in targets_support_cc: + prefix = env.get('TC_PREFIX') + tc_path = env.get('TC_PATH') + if prefix: + env.Replace(CC = prefix + 'gcc') + env.Replace(CXX = prefix + 'g++') + env.Replace(AR = prefix + 'ar') + env.Replace(AS = prefix + 'as') + env.Replace(LINK = prefix + 'ld') + env.Replace(RANLIB = prefix + 'ranlib') + + if tc_path: + env.PrependENVPath('PATH', tc_path) + sys_root = os.path.abspath(tc_path + '/../') + env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root]) + env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root]) + + if prefix or tc_path: + print tc_set_msg + +# Ensure scons be able to change its working directory +env.SConscriptChdir(1) + +# Set the source directory and build directory +# Source directory: 'dir' +# Build directory: 'dir'/out//// +# +# You can get the directory as following: +# env.get('SRC_DIR') +# env.get('BUILD_DIR') + +def __set_dir(env, dir): + if not os.path.exists(dir + '/SConstruct'): + print ''' +*************************************** Error ********************************* +* The directory(%s) seems isn't a source code directory, no SConstruct file is +* found. * +******************************************************************************* +''' % dir + Exit(1) + + if env.get('RELEASE'): + build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/' + else: + build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/' + env.VariantDir(build_dir, dir, duplicate=0) + + env.Replace(BUILD_DIR = build_dir) + env.Replace(SRC_DIR = dir) + +def __src_to_obj(env, src, home = ''): + obj = env.get('BUILD_DIR') + src.replace(home, '') + if env.get('OBJSUFFIX'): + obj += env.get('OBJSUFFIX') + return env.Object(obj, src) + +def __install(ienv, targets, name): + i_n = ienv.Install(env.get('BUILD_DIR'), targets) + Alias(name, i_n) + env.AppendUnique(TS = [name]) + +def __installlib(ienv, targets, name): + user_prefix = env.get('PREFIX') + if user_prefix: + i_n = ienv.Install(user_prefix + '/lib', targets) + else: + i_n = ienv.Install(env.get('BUILD_DIR'), targets) + ienv.Alias("install", i_n) + +def __installbin(ienv, targets, name): + user_prefix = env.get('PREFIX') + if user_prefix: + i_n = ienv.Install(user_prefix + '/bin', targets) + else: + i_n = ienv.Install(env.get('BUILD_DIR'), targets) + ienv.Alias("install", i_n) + +def __append_target(ienv, target): + env.AppendUnique(TS = [target]) + +def __print_targets(env): + Help(''' +=============================================================================== +Targets:\n ''') + for t in env.get('TS'): + Help(t + ' ') + Help(''' +\nDefault all targets will be built. You can specify the target to build: + + $ scons [options] [target] +=============================================================================== +''') + +env.AddMethod(__set_dir, 'SetDir') +env.AddMethod(__print_targets, 'PrintTargets') +env.AddMethod(__src_to_obj, 'SrcToObj') +env.AddMethod(__append_target, 'AppendTarget') +env.AddMethod(__install, 'InstallTarget') +env.AddMethod(__installlib, 'UserInstallTargetLib') +env.AddMethod(__installbin, 'UserInstallTargetBin') +env.SetDir(env.GetLaunchDir()) +env['ROOT_DIR']=env.GetLaunchDir()+'/..' + +Export('env') + +# Delete the temp files of configuration +if env.GetOption('clean'): + dir = env.get('SRC_DIR') + + if os.path.exists(dir + '/config.log'): + Execute(Delete(dir + '/config.log')) + Execute(Delete(dir + '/.sconsign.dblite')) + Execute(Delete(dir + '/.sconf_temp')) + +Return('env') diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/Makefile b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/Makefile new file mode 100644 index 0000000..726faee --- /dev/null +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/Makefile @@ -0,0 +1,65 @@ +## +# override with `make BUILD=debug` +# override with `make PLATFORM=arduinomega` or `make PLATFORM=arduinodue` +# default to release build +# default to build for linux +BUILD := debug +PLATFORM := tizen +OBJ_DIR := ./bin +ROOT_DIR := . +VERSION_MAJOR := 0 +VERSION_MINOR := 1 +VERSION_PATCH := 0 +ADAPTER_MACRO := -DWIFI_ADAPTER + +$(info *******************tizen Build !!******************) + +CC=gcc +LIBCOAP=./lib/libcoap-4.1.1/ +LIBCOAP_OBJ_DIR=./lib/libcoap-4.1.1/obj + +TINYDTLS=./lib/extlibs/tinydtls +TINYDTLS_OBJ_DIR=./lib/extlibs/tinydtls/obj + +# TODO : Currently Hardcoded WIFI_ADAPTER. Change it to generic +CFLAGS.debug = -DWITH_POSIX -D__TIZEN__ -Wall -std=c99 -DSLP_SDK_LOG -g -D_GNU_SOURCE -DTIZEN_DEBUG_ENABLE -DTB_LOG $(ADAPTER_MACRO) +CFLAGS.release = -DWITH_POSIX -D__TIZEN__ -Wall -std=c99 -DSLP_SDK_LOG -D_GNU_SOURCE -DTIZEN_DEBUG_ENABLE -DTB_LOG $(ADAPTER_MACRO) +COMPILEFLAG = `pkg-config --cflags --libs capi-network-wifi dlog capi-network-bluetooth glib-2.0` + +# Include files will be copied into a single folder on gbsbuild. +# NO NEED to mention the path explicitly. + +CA_INC = $(ROOT_DIR)/ +DTLS_INC = $(ROOT_DIR)/dtls/ + +INC_DIRS := -I$(CA_INC) +INC_DIRS += -I$(DTLS_INC) + +SRC = $(wildcard *.c) +OBJECTS = $(patsubst %.c, %.o, $(SRC)) + +#Currently compiling libcoap objects. If it's provided by external party. +#Then don't compile, Instead directly extract objects and create liboicinterface.a +all: $(OBJECTS) + $(MAKE) -C $(LIBCOAP) clean + $(MAKE) -C $(LIBCOAP) + -mkdir $(LIBCOAP_OBJ_DIR) + @cd $(LIBCOAP_OBJ_DIR) && $(AR) -x ../libcoap.a + ar rcs liboicinterface.a $(OBJECTS) $(LIBCOAP_OBJ_DIR)/*.o + +%.o : %.c + $(CC) -c $(CFLAGS.$(BUILD)) $(COMPILEFLAG) $(INC_DIRS) $< -o $@ + + +pack: +#$(CC) $(CFLAGS) $(COMPILEFLAG) WiFiInterface.c bt_interface.c tc_interface.c sample_main.c -o sample /usr/lib/liboctbstack.a -lm -pthread + $(info **************************************TEST***************************) +install: +#cp -rf sample ./usr/apps/com.samsung.oicca/bin/sample + +clean: + rm -rf *.o sample + rm -f *.o *.d *.elf *.eep core.a *.hex *.bin *.map *- + rm -rf $(OBJ_DIR) + rm -rf $(LIBCOAP_OBJ_DIR) + diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript new file mode 100644 index 0000000..11957c9 --- /dev/null +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript @@ -0,0 +1,24 @@ +## +# Enrollee sample build script +## + +SConscript('./service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript') + +Import('env') + +target_os = env.get('TARGET_OS') +transport = env.get('TARGET_TRANSPORT') +buildsample = env.get('BUILD_SAMPLE') +release_mode = env.get('RELEASE') +secured = env.get('SECURED') +logging = env.get('LOGGING') +routing = env.get('ROUTING') + +print "Given Transport is %s" % transport +print "Given OS is %s" % target_os + +if target_os == 'tizen': + command = "sh service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh %s %s %s %s %s %s" % (transport, secured, buildsample, routing, release_mode, logging) + print "Created Command is %s" % command + gbs_script = env.Command('gbs_build', None, command) + AlwaysBuild ('gbs_script') \ No newline at end of file diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConstruct b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConstruct new file mode 100644 index 0000000..bc860fb --- /dev/null +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConstruct @@ -0,0 +1,23 @@ +## +# The main build script +# +## + +# Load common build config +# Load common build config +SConscript('SConscript') + +Import('env') + +target_os = env.get('TARGET_OS') +transport = env.get('TARGET_TRANSPORT') + +print "Given Transport is %s" % transport +print "Given OS is %s" % target_os +print "Secured %s" % env.get('SECURED') + +if target_os == 'tizen': + SConscript('scons/SConscript') +else: + print "Given platform is not supported" + diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh new file mode 100644 index 0000000..7df3130 --- /dev/null +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh @@ -0,0 +1,103 @@ +#!/bin/sh + +cur_dir="./service/easy-setup" + +spec=`ls ./service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/packaging/*.spec` +version=`rpm --query --queryformat '%{version}\n' --specfile $spec` + +name=`echo $name|cut -d" " -f 1` +version=`echo $version|cut -d" " -f 1` + +name=iotivity + +rm -rf $name-$version + +builddir=`pwd` +sourcedir=`pwd` + +echo `pwd` + +rm -rf ./tmp + +# Create directory structure for GBS Build +mkdir ./tmp +mkdir ./tmp/con/ +mkdir ./tmp/extlibs/ +mkdir ./tmp/packaging +cp -R ./build_common $sourcedir/tmp +cp -R ./examples $sourcedir/tmp + +# tinycbor is available as soft-link, so copying with 'dereference' option. +cp -LR ./extlibs/tinycbor $sourcedir/tmp/extlibs +rm -rf $sourcedir/tmp/extlibs/tinycbor/tinycbor/.git + +cp -R ./extlibs/cjson $sourcedir/tmp/extlibs +cp -R ./extlibs/tinydtls $sourcedir/tmp/extlibs +cp -R ./extlibs/sqlite3 $sourcedir/tmp/extlibs +cp -R ./extlibs/timer $sourcedir/tmp/extlibs +cp -R ./extlibs/rapidxml $sourcedir/tmp/extlibs +cp -R ./resource $sourcedir/tmp +cp -R ./service $sourcedir/tmp +cp ./extra_options.scons $sourcedir/tmp +cp ./tools/tizen/*.spec ./tmp/packaging +cp ./tools/tizen/*.manifest ./tmp/packaging +cp ./SConstruct ./tmp + +# copy dependency RPMs and conf files for tizen build +cp ./tools/tizen/*.rpm ./tmp +cp ./tools/tizen/.gbs.conf ./tmp +cp ./tools/tizen/*.rpm $sourcedir/tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample +cp ./tools/tizen/.gbs.conf ./tmp/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample +cp -R $sourcedir/iotivity.pc.in $sourcedir/tmp + +cd $sourcedir/tmp + +echo `pwd` + +whoami +# Initialize Git repository +if [ ! -d .git ]; then + git init ./ + git config user.email "you@example.com" + git config user.name "Your Name" + git add ./ + git commit -m "Initial commit" +fi + +echo "Calling core gbs build command" +gbscommand="gbs build -A armv7l --include-all --repository ./ --define 'TARGET_TRANSPORT IP' --define 'SECURED 0' --define 'RELEASE 0' --define 'LOGGING true'" +echo $gbscommand +if eval $gbscommand; then + echo "Core build is successful" +else + echo "Core build failed." + cd $sourcedir + rm -rf $sourcedir/tmp + exit 1 +fi + +cd service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample +echo `pwd` +# Initialize Git repository +if [ ! -d .git ]; then + git init ./ + git config user.email "you@example.com" + git config user.name "Your Name" + git add ./ + git commit -m "Initial commit" +fi +echo "Calling sample gbs build command" +gbscommand="gbs build -A armv7l -B ~/GBS-ROOT --include-all --repository ./ --define 'TARGET_TRANSPORT IP' --define 'SECURED 0' --define 'RELEASE 0' --define 'LOGGING True' --define 'ROUTING EP' --define 'TARGET_ENROLLEE tizen +'" +echo $gbscommand +if eval $gbscommand; then + echo "Sample build is successful" +else + echo "Sample build is failed." + exit 1 +fi +rm -rf tmp +cd $sourcedir +rm -rf $sourcedir/tmp + +exit 0 diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrollee_wifi.cpp b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp similarity index 100% rename from service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrollee_wifi.cpp rename to service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript index 385476d..fcea067 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript @@ -47,5 +47,5 @@ if secured == '1': env.AppendUnique(CPPDEFINES = ['__WITH_DTLS__']) env.Append(LIBS=['-ltinydtls']) -env.Program('enrollee_wifi', [sample_dir + 'enrollee_wifi.cpp']) +env.Program('enrollee_wifi', [sample_dir + 'enrolleewifi.cpp']) diff --git a/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt b/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt index a7935da..a112a4c 100644 --- a/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt +++ b/service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt @@ -27,9 +27,11 @@ Build Procedure 2) Go to "iotivity/" folder. 3) Execute following command(s) to start build based on transport selection required : -sh gbsbuild.sh -Note :- Upon successful execution of above command(s) RI library and sample applications will be - generated at path "~/GBS-ROOT/local/repos//armv7l/RPMS". +scons -f service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP ROUTING=EP RELEASE=0 LOGGING=true + +(If needed, modify the parameters accordingly) +Note :- Upon successful execution of above command(s) RI library and sample console application(for tizen enrollee) + will be generated at path "~/GBS-ROOT/local/repos//armv7l/RPMS". Procedure to Execute Sample App: ================================ diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrollee_wifi.h b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrolleewifi.h similarity index 100% rename from service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrollee_wifi.h rename to service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrolleewifi.h diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrollee_main.cpp b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleemain.cpp similarity index 100% rename from service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrollee_main.cpp rename to service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleemain.cpp diff --git a/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrollee_wifi.cpp b/service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleewifi.cpp similarity index 100% rename from service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrollee_wifi.cpp rename to service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleewifi.cpp diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrollee_wifi.h b/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrolleewifi.h similarity index 100% rename from service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrollee_wifi.h rename to service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrolleewifi.h diff --git a/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrollee_wifi.cpp b/service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrolleewifi.cpp similarity index 100% rename from service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrollee_wifi.cpp rename to service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrolleewifi.cpp diff --git a/service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.cpp b/service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.cpp similarity index 99% rename from service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.cpp rename to service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.cpp index d4b3327..44900bf 100755 --- a/service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.cpp +++ b/service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.cpp @@ -18,7 +18,7 @@ // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#include "networkHandler.h" +#include "networkhandler.h" // Arduino WiFi Shield includes #include diff --git a/service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.h b/service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.h similarity index 100% rename from service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.h rename to service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.h diff --git a/service/easy-setup/sdk/enrollee/inc/onboarding.h b/service/easy-setup/sdk/enrollee/inc/onboarding.h index 7822413..aba330a 100644 --- a/service/easy-setup/sdk/enrollee/inc/onboarding.h +++ b/service/easy-setup/sdk/enrollee/inc/onboarding.h @@ -25,7 +25,7 @@ extern "C" { #endif // __cplusplus:$ -#include "networkHandler.h" +#include "networkhandler.h" /** * It will on-board the Enrollee device. This is a template method that has diff --git a/service/easy-setup/sdk/enrollee/inc/resourceHandler.h b/service/easy-setup/sdk/enrollee/inc/resourcehandler.h similarity index 98% rename from service/easy-setup/sdk/enrollee/inc/resourceHandler.h rename to service/easy-setup/sdk/enrollee/inc/resourcehandler.h index 1dead62..d6e6588 100644 --- a/service/easy-setup/sdk/enrollee/inc/resourceHandler.h +++ b/service/easy-setup/sdk/enrollee/inc/resourcehandler.h @@ -24,7 +24,7 @@ #include "logger.h" #include "ocstack.h" #include "escommon.h" -#include "networkHandler.h" +#include "networkhandler.h" #include "octypes.h" #ifndef ES_RESOURCE_HANDLER_H_ diff --git a/service/easy-setup/sdk/enrollee/inc/softap.h b/service/easy-setup/sdk/enrollee/inc/softap.h index 57efb35..60080d4 100644 --- a/service/easy-setup/sdk/enrollee/inc/softap.h +++ b/service/easy-setup/sdk/enrollee/inc/softap.h @@ -22,7 +22,7 @@ #define EASYSETUP_ENROLLEE_SOFTAP_H__ #include "escommon.h" -#include "networkHandler.h" +#include "networkhandler.h" //#ifdef __cplusplus //extern "C" { diff --git a/service/easy-setup/sdk/enrollee/src/easysetup.cpp b/service/easy-setup/sdk/enrollee/src/easysetup.cpp index eb4dd31..b87f0c8 100644 --- a/service/easy-setup/sdk/enrollee/src/easysetup.cpp +++ b/service/easy-setup/sdk/enrollee/src/easysetup.cpp @@ -28,7 +28,7 @@ #include "softap.h" #include "onboarding.h" #include "logger.h" -#include "resourceHandler.h" +#include "resourcehandler.h" /** * @var ES_ENROLLEE_TAG diff --git a/service/easy-setup/sdk/enrollee/src/onboarding.cpp b/service/easy-setup/sdk/enrollee/src/onboarding.cpp index be7a4ff..2977e3e 100644 --- a/service/easy-setup/sdk/enrollee/src/onboarding.cpp +++ b/service/easy-setup/sdk/enrollee/src/onboarding.cpp @@ -30,7 +30,7 @@ #include "onboarding.h" #include "logger.h" -#include "resourceHandler.h" +#include "resourcehandler.h" /** * @var ES_ENROLLEE_TAG @@ -65,12 +65,14 @@ bool ESOnboard(const char * ssid, const char* passwd, NetworkEventCallback cb) if (ESSoftapOnboarding()) { +#ifndef ARDUINO //SoftAp at Arduino is not supported if (ESSoftapAtEnrollee()) { OC_LOG(DEBUG, ES_ENROLLEE_TAG, "Create softap at enrollee"); ESCreateSoftap(ssid, passwd, cb); } else +#endif { OC_LOG(DEBUG, ES_ENROLLEE_TAG, "Connecting to SoftAp"); ConnectToWiFiNetwork(ssid, passwd, cb); diff --git a/service/easy-setup/sdk/enrollee/src/resourceHandler.cpp b/service/easy-setup/sdk/enrollee/src/resourcehandler.cpp similarity index 99% rename from service/easy-setup/sdk/enrollee/src/resourceHandler.cpp rename to service/easy-setup/sdk/enrollee/src/resourcehandler.cpp index 33dbfdb..18ac940 100755 --- a/service/easy-setup/sdk/enrollee/src/resourceHandler.cpp +++ b/service/easy-setup/sdk/enrollee/src/resourcehandler.cpp @@ -18,7 +18,7 @@ // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -#include "resourceHandler.h" +#include "resourcehandler.h" #include "ocpayload.h" diff --git a/service/easy-setup/sdk/enrollee/src/softap.cpp b/service/easy-setup/sdk/enrollee/src/softap.cpp index 3d0075c..dc1fe10 100644 --- a/service/easy-setup/sdk/enrollee/src/softap.cpp +++ b/service/easy-setup/sdk/enrollee/src/softap.cpp @@ -15,7 +15,7 @@ #include "softapnative.h" #include "easysetup.h" #include "softap.h" -#include "networkHandler.h" +#include "networkhandler.h" void ESCreateSoftapCallback(int result, const char *ip, const char* mac_addr, const char* device_name ); diff --git a/service/easy-setup/sdk/enrollee/tizen/wifi/networkHandler.cpp b/service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.cpp similarity index 99% rename from service/easy-setup/sdk/enrollee/tizen/wifi/networkHandler.cpp rename to service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.cpp index 12cc031..0c816bf 100644 --- a/service/easy-setup/sdk/enrollee/tizen/wifi/networkHandler.cpp +++ b/service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.cpp @@ -23,7 +23,7 @@ #include "logger.h" #include "easysetup.h" -#include "networkHandler.h" +#include "networkhandler.h" #define LOG_TAG "TIZEN ES" diff --git a/service/easy-setup/sdk/enrollee/tizen/wifi/networkHandler.h b/service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.h similarity index 100% rename from service/easy-setup/sdk/enrollee/tizen/wifi/networkHandler.h rename to service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.h -- 2.7.4