[ENROLLEE] Tizen enrollee sample application build using scons command
authorSandipan Patra <sandipan.p@samsung.com>
Wed, 10 Feb 2016 04:15:28 +0000 (09:45 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Thu, 11 Feb 2016 04:43:06 +0000 (04:43 +0000)
[CODING STANDARD] Enrollee files rename as per iotivity coding standard

Change-Id: Ib873ede13d6b1539e812e535676c2c33d34b9481
Signed-off-by: Sandipan Patra <sandipan.p@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4967
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Sooho Chang <sooho.chang@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
28 files changed:
gbsbuild.sh
service/easy-setup/SConscript
service/easy-setup/sampleapp/enrollee/arduino/SConscript
service/easy-setup/sampleapp/enrollee/arduino/enrolleewifi.cpp [moved from service/easy-setup/sampleapp/enrollee/arduino/enrollee_wifi.cpp with 98% similarity, mode: 0644]
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/SConscript [new file with mode: 0644]
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/Makefile [new file with mode: 0644]
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript [new file with mode: 0644]
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConstruct [new file with mode: 0644]
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh [new file with mode: 0644]
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrolleewifi.cpp [moved from service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/enrollee_wifi.cpp with 100% similarity]
service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/scons/SConscript
service/easy-setup/sampleapp/enrollee/tizen-sdb/README.txt
service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrolleewifi.h [moved from service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/inc/enrollee_wifi.h with 100% similarity]
service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleemain.cpp [moved from service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrollee_main.cpp with 100% similarity]
service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrolleewifi.cpp [moved from service/easy-setup/sampleapp/enrollee/tizen/EnrolleeGUISample/src/enrollee_wifi.cpp with 100% similarity]
service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrolleewifi.h [moved from service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/inc/enrollee_wifi.h with 100% similarity]
service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrolleewifi.cpp [moved from service/easy-setup/sampleapp/enrollee/tizen/Enrolleesample/src/enrollee_wifi.cpp with 100% similarity]
service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.cpp [moved from service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.cpp with 99% similarity]
service/easy-setup/sdk/enrollee/arduino/wifi/networkhandler.h [moved from service/easy-setup/sdk/enrollee/arduino/wifi/networkHandler.h with 100% similarity]
service/easy-setup/sdk/enrollee/inc/onboarding.h
service/easy-setup/sdk/enrollee/inc/resourcehandler.h [moved from service/easy-setup/sdk/enrollee/inc/resourceHandler.h with 98% similarity]
service/easy-setup/sdk/enrollee/inc/softap.h
service/easy-setup/sdk/enrollee/src/easysetup.cpp
service/easy-setup/sdk/enrollee/src/onboarding.cpp
service/easy-setup/sdk/enrollee/src/resourcehandler.cpp [moved from service/easy-setup/sdk/enrollee/src/resourceHandler.cpp with 99% similarity]
service/easy-setup/sdk/enrollee/src/softap.cpp
service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.cpp [moved from service/easy-setup/sdk/enrollee/tizen/wifi/networkHandler.cpp with 99% similarity]
service/easy-setup/sdk/enrollee/tizen/wifi/networkhandler.h [moved from service/easy-setup/sdk/enrollee/tizen/wifi/networkHandler.h with 100% similarity]

index e7dc27c..d9ab246 100755 (executable)
@@ -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
 
index 840b987..e4948e0 100755 (executable)
@@ -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')
 
index 2fa74cd..53b2dbf 100755 (executable)
@@ -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)
old mode 100755 (executable)
new mode 100644 (file)
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
@@ -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 (file)
index 0000000..7507147
--- /dev/null
@@ -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/<target_os>/<target_arch>/<release or debug>/
+#
+# 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 (file)
index 0000000..726faee
--- /dev/null
@@ -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 (file)
index 0000000..11957c9
--- /dev/null
@@ -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 (file)
index 0000000..bc860fb
--- /dev/null
@@ -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 (file)
index 0000000..7df3130
--- /dev/null
@@ -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
index 385476d..fcea067 100644 (file)
@@ -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'])
 
index a7935da..a112a4c 100644 (file)
@@ -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/<target>/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/<target>/armv7l/RPMS".
 
 Procedure to Execute Sample App:
 ================================
@@ -18,7 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#include "networkHandler.h"
+#include "networkhandler.h"
 
 // Arduino WiFi Shield includes
 #include <SPI.h>
index 7822413..aba330a 100644 (file)
@@ -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
@@ -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_
index 57efb35..60080d4 100644 (file)
@@ -22,7 +22,7 @@
 #define EASYSETUP_ENROLLEE_SOFTAP_H__
 
 #include "escommon.h"
-#include "networkHandler.h"
+#include "networkhandler.h"
 
 //#ifdef __cplusplus
 //extern "C" {
index eb4dd31..b87f0c8 100644 (file)
@@ -28,7 +28,7 @@
 #include "softap.h"
 #include "onboarding.h"
 #include "logger.h"
-#include "resourceHandler.h"
+#include "resourcehandler.h"
 
 /**
  * @var ES_ENROLLEE_TAG
index be7a4ff..2977e3e 100644 (file)
@@ -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);
@@ -18,7 +18,7 @@
 //
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
-#include "resourceHandler.h"
+#include "resourcehandler.h"
 #include "ocpayload.h"
 
 
index 3d0075c..dc1fe10 100644 (file)
@@ -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 );