# Build 'resource' sub-project
SConscript(build_dir + 'resource/SConscript')
- if target_os not in ['arduino','darwin','ios', 'android']:
+ if target_os not in ['arduino','darwin','ios', 'android', 'msys_nt', 'windows']:
SConscript(build_dir + 'examples/OICMiddle/SConscript')
++java_build = None
++if env.get('BUILD_JAVA') == 'ON' or target_os == 'android':
++ if env.get('JAVA_HOME') != None:
++ java_build = SConscript(build_dir + 'java/SConscript')
++
# Build 'service' sub-project
--SConscript(build_dir + 'service/SConscript')
++service_build = SConscript(build_dir + 'service/SConscript')
+
- # Build "plugin interface" sub-project
- SConscript(build_dir + 'plugins/SConscript')
++if env.get('BUILD_JAVA') == 'ON' or target_os == 'android':
++ if env.get('JAVA_HOME') != None:
++ Depends(service_build, java_build)
# Build "cloud" sub-project
SConscript(build_dir + 'cloud/SConscript')
--- /dev/null
+ #!/usr/bin/python
+
+ import os
+ import sys
+ import platform
+ import subprocess
+ import multiprocessing
+
+ # help message
+ def helpmsg(script):
+ helpstr = '''
+ Usage:
+ build:
+ python %s <targetbuild>
+ Allowed values for <target_build>: all, linux_unsecured, linux_secured, linux_unsecured_with_ra, linux_secured_with_ra, linux_unsecured_with_rd, linux_secured_with_rd, android, arduino, tizen, simulator, darwin, windows, msys
+ Note: \"linux\" will build \"linux_unsecured\", \"linux_secured\", \"linux_unsecured_with_ra\", \"linux_secured_with_ra\", \"linux_secured_with_rd\", \"linux_unsecured_with_mq\", \"linux_secured_with_tcp\" & \"linux_unsecured_with_tcp\" & \"linux_unsecured_with_rd\".
+ Any selection will build both debug and release versions of all available targets in the scope you've selected.
+ To choose any specific command, please use the SCons commandline directly. Please refer to [IOTIVITY_REPO]/Readme.scons.txt.
+ clean:
+ python %s -c
+ '''
+ print (helpstr % (script, script))
+ sys.exit()
+
+ def call_scons(build_options, extra_option_str):
+ """
+ This function formats and runs a scons command
+ Arguments:
+ build_options -- {Dictionary} build flags (keys) associated with values;
+ extra_option_str -- {String} extra options to append to scons command
+ """
+ cmd_line = "scons VERBOSE=" + VERBOSE
+ for key in build_options:
+ cmd_line += " " + key + "=" + str(build_options[key])
+
+ cmd_line += " " + str(extra_option_str)
+
+ print ("Running : " + cmd_line)
+ sys.stdout.flush()
+ exit_code = subprocess.Popen([cmd_line], shell=True).wait()
+ if exit_code != 0:
+ exit(exit_code)
+
+ def build_all(flag, extra_option_str):
+ if platform.system() == "Linux":
+ build_linux_unsecured(flag, extra_option_str)
+ build_linux_secured(flag, extra_option_str)
+ build_linux_unsecured_with_ra(flag, extra_option_str)
+ build_linux_secured_with_ra(flag, extra_option_str)
+ build_linux_unsecured_with_rm(flag, extra_option_str)
+ build_linux_unsecured_with_rd(flag, extra_option_str)
+ build_linux_secured_with_rd(flag, extra_option_str)
+ build_linux_unsecured_with_mq(flag, extra_option_str)
+ build_linux_unsecured_with_tcp(flag, extra_option_str)
+ build_linux_secured_with_tcp(flag, extra_option_str)
++ build_linux_unsecured_with_java(flag, extra_option_str)
++ build_linux_secured_with_java(flag, extra_option_str)
+ build_simulator(flag, extra_option_str)
+
+ build_android(flag, extra_option_str)
+ build_arduino(flag, extra_option_str)
+ build_tizen(flag, extra_option_str)
+
+ if platform.system() == "Windows":
+ build_windows(flag, extra_option_str)
+
+ if platform.system() == "Darwin":
+ build_darwin(flag, extra_option_str)
+
+ def build_linux(flag, extra_option_str):
+ build_linux_unsecured(flag, extra_option_str)
+ build_linux_secured(flag, extra_option_str)
+
+ def build_linux_unsecured(flag, extra_option_str):
+ print ("*********** Build for linux ************")
+ build_options = {
+ 'RELEASE':flag,
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_secured_with_tcp(flag, extra_option_str):
+ print ("*********** Build for linux with Secured TCP ************")
+ build_options = {
+ 'RELEASE':flag,
+ 'WITH_TCP': 1,
+ 'WITH_CLOUD':1,
+ 'SECURED':1,
+ }
+ call_scons(build_options, extra_option_str)
+
++def build_linux_unsecured_with_java(flag, extra_option_str):
++ print ("*********** Build for linux with Java support ************")
++ build_options = {
++ 'RELEASE':flag,
++ 'BUILD_JAVA': 'ON',
++ 'TARGET_TRANSPORT': 'IP',
++ }
++ call_scons(build_options, extra_option_str)
++
++def build_linux_secured_with_java(flag, extra_option_str):
++ print ("*********** Build for linux with Java support and secured ************")
++ build_options = {
++ 'RELEASE':flag,
++ 'BUILD_JAVA': 'ON',
++ 'TARGET_TRANSPORT': 'IP',
++ 'SECURED': 1,
++ }
++ call_scons(build_options, extra_option_str)
++
+ def build_linux_unsecured_with_tcp(flag, extra_option_str):
+ print ("*********** Build for linux with TCP ************")
+ build_options = {
+ 'RELEASE':flag,
+ 'WITH_TCP': 1,
+ 'TARGET_TRANSPORT': 'IP',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_unsecured_with_rm(flag, extra_option_str):
+ print ("*********** Build for linux with RoutingManager************")
+ build_options = {
+ 'ROUTING':'GW',
+ 'RELEASE':flag,
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_secured(flag, extra_option_str):
+ print ("*********** Build for linux with Security *************")
+ build_options = {
+ 'RELEASE':flag,
+ 'SECURED':1,
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_unsecured_with_ra(flag, extra_option_str):
+ print ("*********** Build for linux With Remote Access *************")
+ build_options = {
+ 'RELEASE':flag,
+ 'WITH_RA':1,
+ 'WITH_RA_IBB':1,
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_secured_with_ra(flag, extra_option_str):
+ print ("*********** Build for linux With Remote Access & Security ************")
+ build_options = {
+ 'RELEASE':flag,
+ 'WITH_RA':1,
+ 'WITH_RA_IBB':1,
+ 'SECURED':1,
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_unsecured_with_rd(flag, extra_option_str):
+ print ("*********** Build for linux With Resource Directory *************")
+ build_options = {
+ 'RELEASE':flag,
+ 'RD_MODE':'all',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_secured_with_rd(flag, extra_option_str):
+ print ("*********** Build for linux With Resource Directory & Security ************")
+ build_options = {
+ 'RELEASE':flag,
+ 'RD_MODE':'all',
+ 'SECURED':1,
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_unsecured_with_mq(flag, extra_option_str):
+ print ("*********** Build for linux With Message Queue ************")
+ build_options = {
+ 'RELEASE':flag,
+ 'WITH_MQ':'PUB,SUB,BROKER',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_linux_unsecured_with_tcp(flag, extra_option_str):
+ print ("*********** Build for linux With tcp ************")
+ build_options = {
+ 'RELEASE':flag,
+ 'WITH_TCP':'1',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android(flag, extra_option_str):
+ # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
+ # it requires gcc-4.9, currently only android-ndk-r10(for linux)
+ # and windows android-ndk-r10(64bit target version) support these features.
+ print ("*********** Build for android armeabi *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'armeabi',
+ 'RELEASE':flag,
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_x86(flag, extra_option_str):
+ """ Build Android x86 Suite """
+ build_android_x86_with_ip(flag, extra_option_str)
+ build_android_x86_with_bt(flag, extra_option_str)
+ build_android_x86_with_ble(flag, extra_option_str)
+
+ def build_android_x86_with_ip(flag, extra_option_str):
+ print ("*********** Build for android x86 *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'x86',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'IP',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_x86_with_bt(flag, extra_option_str):
+ print ("*********** Build for android x86 with Bluetooth *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'x86',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'BT',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_x86_with_ble(flag, extra_option_str):
+ print ("*********** Build for android x86 with Bluetooth Low Energy *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'x86',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'BLE',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_x86_with_rm(flag, extra_option_str):
+ """ Build Android x86 Routing Manager Suite """
+ build_android_x86_with_rm_and_ip(flag, extra_option_str)
+ build_android_x86_with_rm_and_bt(flag, extra_option_str)
+ build_android_x86_with_rm_and_ble(flag, extra_option_str)
+
+ def build_android_x86_with_rm_and_ip(flag, extra_option_str):
+ print ("*********** Build for android x86 with Routing Manager *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'x86',
+ 'ROUTING':'GW',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'IP',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_x86_with_rm_and_bt(flag, extra_option_str):
+ print ("*********** Build for android x86 with Routing Manager and Bluetooth *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'x86',
+ 'ROUTING':'GW',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'BT',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_x86_with_rm_and_ble(flag, extra_option_str):
+ print ("*********** Build for android x86 with Routing Manager and Bluetooth Low Energy *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'x86',
+ 'ROUTING':'GW',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'BLE',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_armeabi(flag, extra_option_str):
+ """ Build Android Armeabi Suite """
+ build_android_armeabi_with_ip(flag, extra_option_str)
+ build_android_armeabi_with_bt(flag, extra_option_str)
+ build_android_armeabi_with_ble(flag, extra_option_str)
+
+ def build_android_armeabi_with_ip(flag, extra_option_str):
+ print ("*********** Build for android armeabi *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'armeabi',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'IP',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_armeabi_with_bt(flag, extra_option_str):
+ print ("*********** Build for android armeabi with Bluetooth *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'armeabi',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'BT',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_armeabi_with_ble(flag, extra_option_str):
+ print ("*********** Build for android armeabi with Bluetooth Low Energy *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'armeabi',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'BLE',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_armeabi_with_rm(flag, extra_option_str):
+ """ Build Android Armeabi Routing Manager Suite """
+ build_android_armeabi_with_rm_and_ip(flag, extra_option_str)
+ build_android_armeabi_with_rm_and_bt(flag, extra_option_str)
+ build_android_armeabi_with_rm_and_ble(flag, extra_option_str)
+
+ def build_android_armeabi_with_rm_and_ip(flag, extra_option_str):
+ print ("*********** Build for android armeabi with Routing Manager *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'armeabi',
+ 'ROUTING':'GW',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'IP',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_armeabi_with_rm_and_bt(flag, extra_option_str):
+ print ("*********** Build for android armeabi with Routing Manager and Bluetooth *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'armeabi',
+ 'ROUTING':'GW',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'BT',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_android_armeabi_with_rm_and_ble(flag, extra_option_str):
+ print ("*********** Build for android armeabi with Routing Manager and Bluetooth Low Energy *************")
+ build_options = {
+ 'TARGET_OS':'android',
+ 'TARGET_ARCH':'armeabi',
+ 'ROUTING':'GW',
+ 'RELEASE':flag,
+ 'TARGET_TRANSPORT':'BLE',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_arduino(flag, extra_option_str):
+ print ("*********** Build for arduino avr *************")
+ extra_option_str = "resource " + extra_option_str
+ build_options = {
+ 'TARGET_OS':'arduino',
+ 'UPLOAD':'false',
+ 'BOARD':'mega',
+ 'TARGET_ARCH':'avr',
+ 'TARGET_TRANSPORT':'IP',
+ 'SHIELD':'ETH',
+ 'RELEASE':flag,
+ }
+ call_scons(build_options, extra_option_str)
+
+ build_options['SHIELD'] = 'WIFI'
+ call_scons(build_options, extra_option_str)
+
+ build_options['TARGET_TRANSPORT'] = 'BLE'
+ build_options['SHIELD'] = 'RBL_NRF8001'
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Build for arduino arm *************")
+ build_options['BOARD'] = 'arduino_due_x'
+ build_options['TARGET_ARCH'] = 'arm'
+ build_options['TARGET_TRANSPORT'] = 'IP'
+ build_options['SHIELD'] = 'ETH'
+ call_scons(build_options, extra_option_str)
+
+ build_options['SHIELD'] = 'WIFI'
+ call_scons(build_options, extra_option_str)
+
+ # BLE support for the Arduino Due is currently unavailable.
+
+ def build_tizen(flag, extra_option_str):
+ print ("*********** Build for Tizen *************")
+ cmd_line = "/bin/sh " + os.getcwd() + "/gbsbuild.sh"
+ print ("Running : " + cmd_line)
+ subprocess.Popen([cmd_line], shell=True).wait()
+
+ print ("*********** Build for Tizen octbstack lib and sample *************")
+ extra_option_str = "-f resource/csdk/stack/samples/tizen/build/SConscript " + extra_option_str
+ build_options = {
+ 'TARGET_OS':'tizen',
+ 'TARGET_TRANSPORT':'IP',
+ 'LOGGING':'true',
+ 'RELEASE':flag,
+ }
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Build for Tizen octbstack lib and sample with Security*************")
+ build_options['SECURED'] = 1
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Build for Tizen octbstack lib and sample with Routing Manager*************")
+ del build_options['SECURED']
+ build_options['ROUTING'] = 'GW'
+ call_scons(build_options, extra_option_str)
+
+ # Mac OS and iOS
+ def build_darwin(flag, extra_option_str):
+ print ("*********** Build for OSX *************")
+ build_options = {
+ 'TARGET_OS':'darwin',
+ 'SYS_VERSION':'10.9',
+ 'RELEASE':flag,
+ }
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Build for IOS i386 *************")
+ build_options = {
+ 'TARGET_OS':'ios',
+ 'TARGET_ARCH':'i386',
+ 'SYS_VERSION':'7.0',
+ 'RELEASE':flag,
+ }
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Build for IOS x86_64 *************")
+ build_options['TARGET_ARCH'] = 'x86_64'
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Build for IOS armv7 *************")
+ build_options['TARGET_ARCH'] = 'armv7'
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Build for IOS armv7s *************")
+ build_options['TARGET_ARCH'] = 'armv7s'
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Build for IOS arm64 *************")
+ build_options['TARGET_ARCH'] = 'arm64'
+ call_scons(build_options, extra_option_str)
+
+ # Windows
+ def build_windows(flag, extra_option_str):
+ print ("*********** Build for Windows *************")
+ os.environ["SCONSFLAGS"] = ""
+ build_options = {
+ 'TARGET_OS':'windows',
+ 'TARGET_ARCH':'amd64',
+ 'RELEASE':flag,
+ 'WITH_RA':0,
+ 'TARGET_TRANSPORT':'IP',
+ 'SECURED':1,
+ 'WITH_TCP':0,
+ 'BUILD_SAMPLE':'ON',
+ 'LOGGING':'off',
+ 'TEST':1,
+ 'RD_MODE':'all',
+ }
+ call_scons(build_options, extra_option_str)
+
+ # Windows msys
+ def build_msys(flag, extra_option_str):
+ print ("*********** Build for msys_nt *************")
+ os.environ["SCONSFLAGS"] = ""
+ build_options = {
+ 'TARGET_OS':'msys_nt',
+ 'TARGET_ARCH':'x86_64',
+ 'RELEASE':flag,
+ 'WITH_RA':0,
+ 'TARGET_TRANSPORT':'IP',
+ 'SECURED':1,
+ 'WITH_TCP':0,
+ 'BUILD_SAMPLE':'ON',
+ 'LOGGING':'off',
+ 'TEST':1,
+ 'RD_MODE':'all',
+ }
+ call_scons(build_options, extra_option_str)
+
+ def build_simulator(flag, extra_option_str):
+ print ("*********** Build for simulator plugin *************")
+ build_options = {
+ 'SIMULATOR':1,
+ 'RELEASE':flag,
+ }
+ call_scons(build_options, extra_option_str)
+
+ def unit_tests():
+ print ("*********** Unit test Start *************")
+ build_options = {
+ 'RELEASE':'false',
+ }
+ extra_option_str = "resource -c"
+ call_scons(build_options, extra_option_str)
+
+ build_options = {
+ 'LOGGING':'false',
+ 'RELEASE':'false',
+ }
+ extra_option_str = "resource"
+ call_scons(build_options, extra_option_str)
+
+ build_options = {
+ 'TEST':1,
+ 'RELEASE':'false',
+ }
+ extra_option_str = "resource"
+ call_scons(build_options, extra_option_str)
+
+ print ("*********** Unit test Stop *************")
+
+ # Main module starts here
+ if os.getenv("SCONSFLAGS", "") == "":
+ os.environ["SCONSFLAGS"] = "-Q -j " + str(multiprocessing.cpu_count())
+
+ arg_num = len(sys.argv)
+ script_name = sys.argv[0]
+
+ # May be overridden in user's shell
+ VERBOSE = os.getenv("VERBOSE", "1")
+
+ if arg_num == 1:
+ build_all("true", "")
+ build_all("false", "")
+ unit_tests()
+
+ elif arg_num == 2:
+ if str(sys.argv[1]) == '-c':
+ build_all("true", "-c")
+ build_all("false", "-c")
+
+ elif str(sys.argv[1]) == "all":
+ build_all("true", "")
+ build_all("false", "")
+ unit_tests()
+
+ elif str(sys.argv[1]) == "linux":
+ build_linux("true", "")
+ build_linux("false", "")
+
+ elif str(sys.argv[1]) == "linux_unsecured":
+ build_linux_unsecured("true", "")
+ build_linux_unsecured("false", "")
+ build_linux_unsecured_with_rm("true", "")
+ build_linux_unsecured_with_rm("false", "")
+
+ elif str(sys.argv[1]) == "linux_secured":
+ build_linux_secured("true", "")
+ build_linux_secured("false", "")
+
+ elif str(sys.argv[1]) == "linux_unsecured_with_ra":
+ build_linux_unsecured_with_ra("true", "")
+ build_linux_unsecured_with_ra("false", "")
+
+ elif str(sys.argv[1]) == "linux_secured_with_ra":
+ build_linux_secured_with_ra("true", "")
+ build_linux_secured_with_ra("false", "")
+
+ elif str(sys.argv[1]) == "linux_unsecured_with_rd":
+ build_linux_unsecured_with_rd("true", "")
+ build_linux_unsecured_with_rd("false", "")
+
+ elif str(sys.argv[1]) == "linux_secured_with_rd":
+ build_linux_secured_with_rd("true", "")
+ build_linux_secured_with_rd("false", "")
+
+ elif str(sys.argv[1]) == "linux_unsecured_with_mq":
+ build_linux_unsecured_with_mq("true", "")
+ build_linux_unsecured_with_mq("false", "")
+
+ elif str(sys.argv[1]) == "linux_unsecured_with_tcp":
+ build_linux_unsecured_with_tcp("true", "")
+ build_linux_unsecured_with_tcp("false", "")
+
+ elif str(sys.argv[1]) == "linux_secured_with_tcp":
+ build_linux_secured_with_tcp("false", "")
+ build_linux_secured_with_tcp("true", "")
+
++ elif str(sys.argv[1]) == "linux_unsecured_with_java":
++ build_linux_unsecured_with_java("false", "")
++ build_linux_unsecured_with_java("true", "")
++
++ elif str(sys.argv[1]) == "linux_secured_with_java":
++ build_linux_secured_with_java("false", "")
++ build_linux_secured_with_java("true", "")
++
+ elif str(sys.argv[1]) == "android":
+ build_android("true", "")
+ build_android("false", "")
+
+ elif str(sys.argv[1]) == "android_x86":
+ build_android_x86("true", "")
+ build_android_x86("false", "")
+ build_android_x86_with_rm("true", "")
+ build_android_x86_with_rm("false", "")
+
+ elif str(sys.argv[1]) == "android_x86_with_ip":
+ build_android_x86_with_ip("true", "")
+ build_android_x86_with_ip("false", "")
+
+ elif str(sys.argv[1]) == "android_x86_with_bt":
+ build_android_x86_with_bt("true", "")
+ build_android_x86_with_bt("false", "")
+
+ elif str(sys.argv[1]) == "android_x86_with_ble":
+ build_android_x86_with_ble("true", "")
+ build_android_x86_with_ble("false", "")
+
+ elif str(sys.argv[1]) == "android_x86_with_rm_and_ip":
+ build_android_x86_with_rm_and_ip("true", "")
+ build_android_x86_with_rm_and_ip("false", "")
+
+ elif str(sys.argv[1]) == "android_x86_with_rm_and_bt":
+ build_android_x86_with_rm_and_bt("true", "")
+ build_android_x86_with_rm_and_bt("false", "")
+
+ elif str(sys.argv[1]) == "android_x86_with_rm_and_ble":
+ build_android_x86_with_rm_and_ble("true", "")
+ build_android_x86_with_rm_and_ble("false", "")
+
+ elif str(sys.argv[1]) == "android_armeabi":
+ build_android_armeabi("true", "")
+ build_android_armeabi("false", "")
+ build_android_armeabi_with_rm("true", "")
+ build_android_armeabi_with_rm("false", "")
+
+ elif str(sys.argv[1]) == "android_armeabi_with_ip":
+ build_android_armeabi_with_ip("true", "")
+ build_android_armeabi_with_ip("false", "")
+
+ elif str(sys.argv[1]) == "android_armeabi_with_bt":
+ build_android_armeabi_with_bt("true", "")
+ build_android_armeabi_with_bt("false", "")
+
+ elif str(sys.argv[1]) == "android_armeabi_with_ble":
+ build_android_armeabi_with_ble("true", "")
+ build_android_armeabi_with_ble("false", "")
+
+ elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ip":
+ build_android_armeabi_with_rm_and_ip("true", "")
+ build_android_armeabi_with_rm_and_ip("false", "")
+
+ elif str(sys.argv[1]) == "android_armeabi_with_rm_and_bt":
+ build_android_armeabi_with_rm_and_bt("true", "")
+ build_android_armeabi_with_rm_and_bt("false", "")
+
+ elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ble":
+ build_android_armeabi_with_rm_and_ble("true", "")
+ build_android_armeabi_with_rm_and_ble("false", "")
+
+ elif str(sys.argv[1]) == "arduino":
+ build_arduino("true", "")
+ build_arduino("false", "")
+
+ elif str(sys.argv[1]) == "windows":
+ build_windows("true", "")
+ build_windows("false", "")
+
+ elif str(sys.argv[1]) == "msys":
+ build_msys("true", "")
+ build_msys("false", "")
+
+ elif str(sys.argv[1]) == "tizen":
+ build_tizen("true", "")
+ build_tizen("false", "")
+
+ elif str(sys.argv[1]) == "simulator":
+ build_simulator("true", "")
+ build_simulator("false", "")
+
+ elif str(sys.argv[1]) == "darwin":
+ build_darwin("true", "")
+ build_darwin("false", "")
+
+ elif str(sys.argv[1]) == "unit_tests":
+ unit_tests()
+
+ else:
+ helpmsg(script_name)
+ else:
+ helpmsg(script_name)
+
+ print ("===================== done =====================")
help_vars.Add(PathVariable('ANDROID_NDK', 'Android NDK path', None, PathVariable.PathAccept))
help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariable.PathAccept))
help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile))
- #ES_TARGET_ENROLLEE is for specifying what is our target enrollee (Arduino or rest of platforms which support Multicast)
- help_vars.Add(EnumVariable('ES_TARGET_ENROLLEE', 'Target Enrollee', 'arduino', allowed_values=('arduino', 'tizen', 'linux')))
- #ES_ROLE is for specifying the role (Enrollee or Mediator) for which scons is being executed
- help_vars.Add(EnumVariable('ES_ROLE', 'Target build mode', 'mediator', allowed_values=('mediator', 'enrollee')))
- #ES_SOFT_MODE is for specifying MODE (Mode 1 : Enrollee with Soft AP or Mode 2 : Mediator with Soft AP)
- help_vars.Add(EnumVariable('ES_SOFTAP_MODE', 'Target build mode', 'ENROLLEE_SOFTAP', allowed_values=('ENROLLEE_SOFTAP', 'MEDIATOR_SOFTAP')))
+ help_vars.Add(EnumVariable('WITH_UPSTREAM_LIBCOAP', 'Use latest stable version of LibCoAP downloaded from github', default_with_upstream_libcoap, allowed_values=('0','1')))
+
+ if target_os == 'windows':
+ # For VS2013, MSVC_VERSION is '12.0'. For VS2015, MSVC_VERSION is '14.0'.
+ # Default value is None, meaning that SCons has to choose automatically a VS version.
+ help_vars.Add(EnumVariable('MSVC_VERSION', 'MSVC compiler version - Windows', None, allowed_values=('12.0', '14.0')))
+help_vars.Add(EnumVariable('BUILD_JAVA', 'Build Java bindings', 'OFF', allowed_values=('ON', 'OFF')))
+help_vars.Add(PathVariable('JAVA_HOME', 'JDK directory', os.environ.get('JAVA_HOME'), PathVariable.PathAccept))
+
AddOption('--prefix',
dest='prefix',
type='string',
env.AppendUnique(CPPPATH = ['/usr/local/include'])
env.AppendUnique(LIBPATH = ['/usr/local/lib'])
+if env.get('BUILD_JAVA') == 'ON' and target_os != 'android':
+ if env.get('JAVA_HOME') != None:
+ env.AppendUnique(CCFLAGS = ['-D__JAVA__'])
+ env.AppendUnique(CPPPATH = [
+ env.get('JAVA_HOME') + '/include',
+ env.get('JAVA_HOME') + '/include/' + target_os
+ ])
+ else:
+ raise SCons.Errors.StopError( 'BUILD_JAVA is ON, but JAVA_HOME is not set.')
+
+
# External library include files are in <src_dir>/deps/<target_os>/include
# the library binaries are in <src_dir>/deps/<target_os>/lib/<arch>
- env.AppendUnique(CPPPATH = [os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'include')])
- env.AppendUnique(LIBPATH = [os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'lib', target_arch)])
+ if target_os not in ['windows']:
+ env.AppendUnique(CPPPATH = [os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'include')])
+ env.AppendUnique(LIBPATH = [os.path.join(env.get('SRC_DIR'), 'deps', target_os, 'lib', target_arch)])
# Check whether a library exists, if not, notify user to install it or try to
# download the source code and build it
exit 1
fi
--BASE_PATH="android/android_api/base/src/main/java/"
++BASE_PATH="java/common/src/main/java/"
BASE_PKG="org.iotivity.base"
TM_PATH="service/things-manager/sdk/java/src/"
--- /dev/null
-
+import os
+import platform
+Import('env')
+
+TARGET_ARCH = env.get('TARGET_ARCH')
+if env.get('RELEASE'):
+ RELEASE="release"
+else:
+ RELEASE="debug"
+SECURED = env.get('SECURED')
+
+target_os = env.get('TARGET_OS')
+
++if env.get('WITH_CLOUD'):
++ CLOUD=1
++else:
++ CLOUD=0
++
++if env.get('WITH_TCP'):
++ TCP=1
++else:
++ TCP=0
++
++MQ = env.get('WITH_MQ')
++MQ_SUB = 0
++MQ_PUB = 0
++MQ_BROKER = 0
++RD_MODE = env.get('RD_MODE')
++TARGET_TRANSPORT = env.get('TARGET_TRANSPORT')
++TRANSPORT_EDR = 0
++TRANSPORT_BLE = 0
++TRANSPORT_NFC = 0
++
++if 'SUB' in MQ:
++ MQ_SUB = 1
++if 'PUB' in MQ:
++ MQ_PUB = 1
++if 'BROKER' in MQ:
++ MQ_BROKER = 1
++
++if 'ALL' in TARGET_TRANSPORT:
++ TRANSPORT_EDR = 1
++ TRANSPORT_BLE = 1
++ TRANSPORT_NFC = 1
++ print "Android Transport is ALL"
++else:
++ if 'BT' in TARGET_TRANSPORT:
++ TRANSPORT_EDR = 1
++ if 'BLE' in TARGET_TRANSPORT:
++ TRANSPORT_BLE = 1
++ if 'NFC' in TARGET_TRANSPORT:
++ TRANSPORT_NFC = 1
++
+if target_os == "android":
+ android_home = env.get('ANDROID_HOME')
+ os.environ['ANDROID_HOME'] = env.get('ANDROID_HOME')
+ os.environ['ANDROID_NDK_HOME'] = env.get('ANDROID_NDK')
- os.system(android_home + '/tools/android')
+ if not os.path.exists(android_home + '/platforms/android-21') or not os.path.exists(android_home + '/build-tools/20.0.0'):
+ print '''
+***************************************** Info ********************************
+* Either 'Android API 21' is not installed or 'Android SDK Build Tools *
+* 20.0.0' is not installed. The Android SDK Manager will now open. Please *
+* be sure to deselect all options, then select the following 2 packages: *
+* 1. Under "Tools" select "Android SDK Build-tools" Revision 20. *
+* 2. Under "Android 5.0.1 (API 21)" select "SDK Platform" *
+* 3. Continue by selecting "Install 2 Packages" *
+* *
+* NOTE: If you have an http proxy, please press ctrl+c now and edit/create *
+* the following file in your $HOME directory as follows: *
+* *
+* Edit/Create file: "$HOME/.android/androidtool.cfg" *
+* *
+* http.proxyPort=<YOUR_PORT_NUMBER> *
+* sdkman.monitor.density=108 *
+* http.proxyHost=<YOUR_HTTP_PROXY_ADDRESS> *
+* sdkman.show.update.only=true *
+* sdkman.ask.adb.restart=false *
+* sdkman.force.http=true *
+* sdkman.show.updateonly=true *
+* *
+*******************************************************************************
+
+...Opening Android SDK Manager now. Once you are finished, the build will continue.
+'''
- jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b' + env.get('SRC_DIR') + '/java/iotivity-%s/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -PBUILD_DIR=%s -PSRC_DIR=%s --stacktrace' %(target_os, TARGET_ARCH, RELEASE, SECURED, env.get('BUILD_DIR'), env.get('SRC_DIR')), emitter = ensure_libs)
++ os.system(android_home + '/tools/android')
+
+def ensure_libs(target, source, env):
+ return target, [source, env.get('BUILD_DIR') + 'liboc.so', env.get('BUILD_DIR') + 'liboc_logger.so', env.get('BUILD_DIR') + 'libocstack-jni.so']
+
+SConscript('jni/SConscript')
+
+jdk_env = Environment(ENV=os.environ)
-
- jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b' + 'java/examples-%s/build.gradle -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s --stacktrace' % (examples_target, target_os, TARGET_ARCH, RELEASE, SECURED))
++jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + env.get('SRC_DIR') + '/java/iotivity-%s/build.gradle -PWITH_TRANSPORT_EDR=%s -PWITH_TRANSPORT_BLE=%s -PWITH_TRANSPORT_NFC=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PBUILD_DIR=%s --stacktrace' %(target_os, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, env.get('BUILD_DIR')), emitter = ensure_libs)
+jdk_env['BUILD_DIR'] = env.get('BUILD_DIR')
+cmdBuildApi=jdk_env.Gradle(target="base/objs", source="common/src/main/java/org/iotivity/base/OcResource.java")
+
+examples_target = "java"
+if target_os == 'android':
+ examples_target = "android"
++jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b ' + 'java/examples-%s/build.gradle -DWITH_TRANSPORT_EDR=%s -DWITH_TRANSPORT_BLE=%s -DWITH_TRANSPORT_NFC=%s -PTARGET_OS=%s -PTARGET_ARCH=%s -PRELEASE=%s -PSECURED=%s -DSECURE=%s -PWITH_CLOUD=%s -PRD_MODE=%s -PWITH_MQ_PUB=%s -PWITH_MQ_SUB=%s -PWITH_MQ_BROKER=%s -PWITH_TCP=%s -PBUILD_DIR=%s --stacktrace' %(examples_target, TRANSPORT_EDR, TRANSPORT_BLE, TRANSPORT_NFC, target_os, TARGET_ARCH, RELEASE, SECURED, SECURED, CLOUD, RD_MODE, MQ_PUB, MQ_SUB, MQ_BROKER, TCP, env.get('BUILD_DIR')))
++#cmdBuildExamples=jdk_env.Gradle(target="../examples-%s/devicediscoveryclient/apk" % (examples_target, ), source="examples-%s/devicediscoveryclient/src/main/java/org/iotivity/base/examples/DeviceDiscoveryClient.java" % (examples_target, ))
+cmdBuildExamples=jdk_env.Gradle(target="examples-%s/simpleclient/jar" % (examples_target, ), source="examples-%s/simpleclient/src/main/java/org/iotivity/base/examples/SimpleClient.java" % (examples_target, ))
+
+Depends(cmdBuildExamples, cmdBuildApi)
++env.AppendUnique(baseAAR = cmdBuildApi)
--- /dev/null
--- /dev/null
++<?xml version="1.0" encoding="UTF-8"?>
++<project version="4">
++ <component name="CompilerConfiguration">
++ <resourceExtensions />
++ <wildcardResourcePatterns>
++ <entry name="!?*.java" />
++ <entry name="!?*.form" />
++ <entry name="!?*.class" />
++ <entry name="!?*.groovy" />
++ <entry name="!?*.scala" />
++ <entry name="!?*.flex" />
++ <entry name="!?*.kt" />
++ <entry name="!?*.clj" />
++ <entry name="!?*.aj" />
++ </wildcardResourcePatterns>
++ <annotationProcessing>
++ <profile default="true" name="Default" enabled="false">
++ <processorPath useClasspath="true" />
++ </profile>
++ </annotationProcessing>
++ </component>
++</project>
--- /dev/null
--- /dev/null
++<component name="CopyrightManager">
++ <settings default="" />
++</component>
--- /dev/null
--- /dev/null
++<?xml version="1.0" encoding="UTF-8"?>
++<project version="4">
++ <component name="Encoding">
++ <file url="PROJECT" charset="UTF-8" />
++ </component>
++</project>
--- /dev/null
--- /dev/null
++<?xml version="1.0" encoding="UTF-8"?>
++<project version="4">
++ <component name="GradleSettings">
++ <option name="linkedExternalProjectsSettings">
++ <GradleProjectSettings>
++ <option name="distributionType" value="DEFAULT_WRAPPED" />
++ <option name="externalProjectPath" value="$PROJECT_DIR$" />
++ <option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.14.1" />
++ <option name="resolveModulePerSourceSet" value="false" />
++ </GradleProjectSettings>
++ </option>
++ </component>
++</project>
--- /dev/null
--- /dev/null
++<?xml version="1.0" encoding="UTF-8"?>
++<project version="4">
++ <component name="EntryPointsManager">
++ <entry_points version="2.0" />
++ </component>
++ <component name="NullableNotNullManager">
++ <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
++ <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
++ <option name="myNullables">
++ <value>
++ <list size="4">
++ <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
++ <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
++ <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
++ <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
++ </list>
++ </value>
++ </option>
++ <option name="myNotNulls">
++ <value>
++ <list size="4">
++ <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
++ <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
++ <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
++ <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
++ </list>
++ </value>
++ </option>
++ </component>
++ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
++ <OptionsSetting value="true" id="Add" />
++ <OptionsSetting value="true" id="Remove" />
++ <OptionsSetting value="true" id="Checkout" />
++ <OptionsSetting value="true" id="Update" />
++ <OptionsSetting value="true" id="Status" />
++ <OptionsSetting value="true" id="Edit" />
++ <ConfirmationsSetting value="0" id="Add" />
++ <ConfirmationsSetting value="0" id="Remove" />
++ </component>
++ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="true" assert-keyword="true" jdk-15="true">
++ <output url="file://$PROJECT_DIR$/build/classes" />
++ </component>
++ <component name="ProjectType">
++ <option name="id" value="Android" />
++ </component>
++</project>
--- /dev/null
--- /dev/null
++<?xml version="1.0" encoding="UTF-8"?>
++<project version="4">
++ <component name="ProjectModuleManager">
++ <modules>
++ <module fileurl="file://$PROJECT_DIR$/devicediscoveryserver.iml" filepath="$PROJECT_DIR$/devicediscoveryserver.iml" />
++ </modules>
++ </component>
++</project>
--- /dev/null
--- /dev/null
++<?xml version="1.0" encoding="UTF-8"?>
++<project version="4">
++ <component name="RunConfigurationProducerService">
++ <option name="ignoredProducers">
++ <set>
++ <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
++ <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
++ <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
++ </set>
++ </option>
++ </component>
++</project>
--- /dev/null
--- /dev/null
++<?xml version="1.0" encoding="UTF-8"?>
++<project version="4">
++ <component name="ChangeListManager">
++ <list default="true" id="5d562efc-80cc-4d57-9114-b5d5b4f7b057" name="Default" comment="" />
++ <ignored path="devicediscoveryserver.iws" />
++ <ignored path=".idea/workspace.xml" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/assets/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/bundles/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/classes/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/coverage-instrumented-classes/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/dependency-cache/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/dex/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/dex-cache/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/incremental/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/jacoco/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/javaResources/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/libs/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/lint/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/manifests/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/ndk/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/pre-dexed/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/proguard/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/res/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/rs/" />
++ <ignored path="$PROJECT_DIR$/build/intermediates/symbols/" />
++ <ignored path="$PROJECT_DIR$/build/outputs/" />
++ <ignored path="$PROJECT_DIR$/build/reports/" />
++ <ignored path="$PROJECT_DIR$/build/test-results/" />
++ <ignored path="$PROJECT_DIR$/build/tmp/" />
++ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
++ <option name="TRACKING_ENABLED" value="true" />
++ <option name="SHOW_DIALOG" value="false" />
++ <option name="HIGHLIGHT_CONFLICTS" value="true" />
++ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
++ <option name="LAST_RESOLUTION" value="IGNORE" />
++ </component>
++ <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
++ <component name="CreatePatchCommitExecutor">
++ <option name="PATCH_PATH" value="" />
++ </component>
++ <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
++ <component name="ExternalProjectsManager">
++ <system id="GRADLE">
++ <state>
++ <projects_view />
++ </state>
++ </system>
++ </component>
++ <component name="FavoritesManager">
++ <favorites_list name="devicediscoveryserver" />
++ </component>
++ <component name="FileEditorManager">
++ <leaf SIDE_TABS_SIZE_LIMIT_KEY="600">
++ <file leaf-file-name="build.gradle" pinned="false" current-in-tab="true">
++ <entry file="file://$PROJECT_DIR$/build.gradle">
++ <provider selected="true" editor-type-id="text-editor">
++ <state relative-caret-position="464">
++ <caret line="16" column="0" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
++ <folding />
++ </state>
++ </provider>
++ </entry>
++ </file>
++ </leaf>
++ </component>
++ <component name="GradleLocalSettings">
++ <option name="externalProjectsViewState">
++ <projects_view />
++ </option>
++ </component>
++ <component name="ProjectFrameBounds">
++ <option name="y" value="39" />
++ <option name="width" value="3840" />
++ <option name="height" value="2060" />
++ </component>
++ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
++ <OptionsSetting value="true" id="Add" />
++ <OptionsSetting value="true" id="Remove" />
++ <OptionsSetting value="true" id="Checkout" />
++ <OptionsSetting value="true" id="Update" />
++ <OptionsSetting value="true" id="Status" />
++ <OptionsSetting value="true" id="Edit" />
++ <ConfirmationsSetting value="0" id="Add" />
++ <ConfirmationsSetting value="0" id="Remove" />
++ </component>
++ <component name="ProjectView">
++ <navigator currentView="AndroidView" proportions="" version="1">
++ <flattenPackages />
++ <showMembers />
++ <showModules />
++ <showLibraryContents />
++ <hideEmptyPackages />
++ <abbreviatePackageNames />
++ <autoscrollToSource />
++ <autoscrollFromSource />
++ <sortByType />
++ <manualOrder />
++ <foldersAlwaysOnTop value="true" />
++ </navigator>
++ <panes>
++ <pane id="ProjectPane" />
++ <pane id="Scope" />
++ <pane id="PackagesPane" />
++ <pane id="AndroidView">
++ <subPane>
++ <PATH>
++ <PATH_ELEMENT>
++ <option name="myItemId" value="devicediscoveryserver" />
++ <option name="myItemType" value="com.android.tools.idea.navigator.nodes.AndroidViewProjectNode" />
++ </PATH_ELEMENT>
++ </PATH>
++ </subPane>
++ </pane>
++ <pane id="Scratches" />
++ </panes>
++ </component>
++ <component name="PropertiesComponent">
++ <property name="android.sdk.path" value="$USER_HOME$/Android/Sdk" />
++ <property name="settings.editor.selected.configurable" value="android.sdk-updates" />
++ <property name="settings.editor.splitter.proportion" value="0.2" />
++ <property name="show.do.not.copy.http.proxy.settings.to.gradle" value="true" />
++ </component>
++ <component name="RunManager">
++ <configuration default="true" type="Application" factoryName="Application">
++ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
++ <option name="MAIN_CLASS_NAME" />
++ <option name="VM_PARAMETERS" />
++ <option name="PROGRAM_PARAMETERS" />
++ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
++ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
++ <option name="ALTERNATIVE_JRE_PATH" />
++ <option name="ENABLE_SWING_INSPECTOR" value="false" />
++ <option name="ENV_VARIABLES" />
++ <option name="PASS_PARENT_ENVS" value="true" />
++ <module name="" />
++ <envs />
++ <method />
++ </configuration>
++ <configuration default="true" type="JUnit" factoryName="JUnit">
++ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
++ <module name="" />
++ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
++ <option name="ALTERNATIVE_JRE_PATH" />
++ <option name="PACKAGE_NAME" />
++ <option name="MAIN_CLASS_NAME" />
++ <option name="METHOD_NAME" />
++ <option name="TEST_OBJECT" value="class" />
++ <option name="VM_PARAMETERS" value="-ea" />
++ <option name="PARAMETERS" />
++ <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
++ <option name="ENV_VARIABLES" />
++ <option name="PASS_PARENT_ENVS" value="true" />
++ <option name="TEST_SEARCH_SCOPE">
++ <value defaultName="singleModule" />
++ </option>
++ <envs />
++ <patterns />
++ <method />
++ </configuration>
++ <configuration default="true" type="Remote" factoryName="Remote">
++ <option name="USE_SOCKET_TRANSPORT" value="true" />
++ <option name="SERVER_MODE" value="false" />
++ <option name="SHMEM_ADDRESS" value="javadebug" />
++ <option name="HOST" value="localhost" />
++ <option name="PORT" value="5005" />
++ <method />
++ </configuration>
++ <configuration default="true" type="TestNG" factoryName="TestNG">
++ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
++ <module name="" />
++ <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
++ <option name="ALTERNATIVE_JRE_PATH" />
++ <option name="SUITE_NAME" />
++ <option name="PACKAGE_NAME" />
++ <option name="MAIN_CLASS_NAME" />
++ <option name="METHOD_NAME" />
++ <option name="GROUP_NAME" />
++ <option name="TEST_OBJECT" value="CLASS" />
++ <option name="VM_PARAMETERS" value="-ea" />
++ <option name="PARAMETERS" />
++ <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
++ <option name="OUTPUT_DIRECTORY" />
++ <option name="ANNOTATION_TYPE" />
++ <option name="ENV_VARIABLES" />
++ <option name="PASS_PARENT_ENVS" value="true" />
++ <option name="TEST_SEARCH_SCOPE">
++ <value defaultName="singleModule" />
++ </option>
++ <option name="USE_DEFAULT_REPORTERS" value="false" />
++ <option name="PROPERTIES_FILE" />
++ <envs />
++ <properties />
++ <listeners />
++ <method />
++ </configuration>
++ <configuration name="<template>" type="Applet" default="true" selected="false">
++ <option name="MAIN_CLASS_NAME" />
++ <option name="HTML_FILE_NAME" />
++ <option name="HTML_USED" value="false" />
++ <option name="WIDTH" value="400" />
++ <option name="HEIGHT" value="300" />
++ <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
++ <option name="VM_PARAMETERS" />
++ </configuration>
++ <configuration name="<template>" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false">
++ <option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
++ </configuration>
++ </component>
++ <component name="ShelveChangesManager" show_recycled="false">
++ <option name="remove_strategy" value="false" />
++ </component>
++ <component name="SvnConfiguration">
++ <configuration />
++ </component>
++ <component name="TaskManager">
++ <task active="true" id="Default" summary="Default task">
++ <changelist id="5d562efc-80cc-4d57-9114-b5d5b4f7b057" name="Default" comment="" />
++ <created>1475014322794</created>
++ <option name="number" value="Default" />
++ <option name="presentableId" value="Default" />
++ <updated>1475014322794</updated>
++ </task>
++ <servers />
++ </component>
++ <component name="ToolWindowManager">
++ <frame x="0" y="39" width="3840" height="2060" extended-state="6" />
++ <editor active="false" />
++ <layout>
++ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
++ <window_info id="Nl-Palette" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Messages" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.32932416" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
++ <window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
++ <window_info id="Palette	" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
++ <window_info id="Android Monitor" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
++ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
++ <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
++ <window_info id="Properties" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
++ <window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
++ <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
++ <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.24986681" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
++ <window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
++ <window_info id="Android Model" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
++ <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
++ <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
++ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
++ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
++ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
++ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
++ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
++ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
++ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
++ </layout>
++ </component>
++ <component name="Vcs.Log.UiProperties">
++ <option name="RECENTLY_FILTERED_USER_GROUPS">
++ <collection />
++ </option>
++ <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
++ <collection />
++ </option>
++ </component>
++ <component name="VcsContentAnnotationSettings">
++ <option name="myLimit" value="2678400000" />
++ </component>
++ <component name="XDebuggerManager">
++ <breakpoint-manager />
++ <watches-manager />
++ </component>
++ <component name="editorHistoryManager">
++ <entry file="file://$PROJECT_DIR$/build.gradle">
++ <provider selected="true" editor-type-id="text-editor">
++ <state relative-caret-position="0">
++ <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
++ <folding />
++ </state>
++ </provider>
++ </entry>
++ <entry file="file://$PROJECT_DIR$/build.gradle">
++ <provider selected="true" editor-type-id="text-editor">
++ <state relative-caret-position="464">
++ <caret line="16" column="0" selection-start-line="16" selection-start-column="0" selection-end-line="16" selection-end-column="0" />
++ <folding />
++ </state>
++ </provider>
++ </entry>
++ </component>
++</project>
--- /dev/null
--- /dev/null
++## Project-wide Gradle settings.
++#
++# For more details on how to configure your build environment visit
++# http://www.gradle.org/docs/current/userguide/build_environment.html
++#
++# Specifies the JVM arguments used for the daemon process.
++# The setting is particularly useful for tweaking memory settings.
++# Default value: -Xmx1024m -XX:MaxPermSize=256m
++# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
++#
++# When configured, Gradle will run in incubating parallel mode.
++# This option should only be used with decoupled projects. More details, visit
++# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
++# org.gradle.parallel=true
++#Tue Sep 27 15:12:19 PDT 2016
++systemProp.http.proxyHost=proxy-us.intel.com
++systemProp.http.nonProxyHosts=localhost, 127.0.0.0/8, \:\:1, .intel.com
++systemProp.http.proxyPort=911
--- /dev/null
--- /dev/null
++#Tue Sep 27 15:14:13 PDT 2016
++distributionBase=GRADLE_USER_HOME
++distributionPath=wrapper/dists
++zipStoreBase=GRADLE_USER_HOME
++zipStorePath=wrapper/dists
++distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
--- /dev/null
--- /dev/null
++#!/usr/bin/env bash
++
++##############################################################################
++##
++## Gradle start up script for UN*X
++##
++##############################################################################
++
++# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
++DEFAULT_JVM_OPTS=""
++
++APP_NAME="Gradle"
++APP_BASE_NAME=`basename "$0"`
++
++# Use the maximum available, or set MAX_FD != -1 to use that value.
++MAX_FD="maximum"
++
++warn ( ) {
++ echo "$*"
++}
++
++die ( ) {
++ echo
++ echo "$*"
++ echo
++ exit 1
++}
++
++# OS specific support (must be 'true' or 'false').
++cygwin=false
++msys=false
++darwin=false
++case "`uname`" in
++ CYGWIN* )
++ cygwin=true
++ ;;
++ Darwin* )
++ darwin=true
++ ;;
++ MINGW* )
++ msys=true
++ ;;
++esac
++
++# Attempt to set APP_HOME
++# Resolve links: $0 may be a link
++PRG="$0"
++# Need this for relative symlinks.
++while [ -h "$PRG" ] ; do
++ ls=`ls -ld "$PRG"`
++ link=`expr "$ls" : '.*-> \(.*\)$'`
++ if expr "$link" : '/.*' > /dev/null; then
++ PRG="$link"
++ else
++ PRG=`dirname "$PRG"`"/$link"
++ fi
++done
++SAVED="`pwd`"
++cd "`dirname \"$PRG\"`/" >/dev/null
++APP_HOME="`pwd -P`"
++cd "$SAVED" >/dev/null
++
++CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
++
++# Determine the Java command to use to start the JVM.
++if [ -n "$JAVA_HOME" ] ; then
++ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
++ # IBM's JDK on AIX uses strange locations for the executables
++ JAVACMD="$JAVA_HOME/jre/sh/java"
++ else
++ JAVACMD="$JAVA_HOME/bin/java"
++ fi
++ if [ ! -x "$JAVACMD" ] ; then
++ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
++
++Please set the JAVA_HOME variable in your environment to match the
++location of your Java installation."
++ fi
++else
++ JAVACMD="java"
++ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
++
++Please set the JAVA_HOME variable in your environment to match the
++location of your Java installation."
++fi
++
++# Increase the maximum file descriptors if we can.
++if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
++ MAX_FD_LIMIT=`ulimit -H -n`
++ if [ $? -eq 0 ] ; then
++ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
++ MAX_FD="$MAX_FD_LIMIT"
++ fi
++ ulimit -n $MAX_FD
++ if [ $? -ne 0 ] ; then
++ warn "Could not set maximum file descriptor limit: $MAX_FD"
++ fi
++ else
++ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
++ fi
++fi
++
++# For Darwin, add options to specify how the application appears in the dock
++if $darwin; then
++ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
++fi
++
++# For Cygwin, switch paths to Windows format before running java
++if $cygwin ; then
++ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
++ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
++ JAVACMD=`cygpath --unix "$JAVACMD"`
++
++ # We build the pattern for arguments to be converted via cygpath
++ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
++ SEP=""
++ for dir in $ROOTDIRSRAW ; do
++ ROOTDIRS="$ROOTDIRS$SEP$dir"
++ SEP="|"
++ done
++ OURCYGPATTERN="(^($ROOTDIRS))"
++ # Add a user-defined pattern to the cygpath arguments
++ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
++ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
++ fi
++ # Now convert the arguments - kludge to limit ourselves to /bin/sh
++ i=0
++ for arg in "$@" ; do
++ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
++ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
++
++ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
++ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
++ else
++ eval `echo args$i`="\"$arg\""
++ fi
++ i=$((i+1))
++ done
++ case $i in
++ (0) set -- ;;
++ (1) set -- "$args0" ;;
++ (2) set -- "$args0" "$args1" ;;
++ (3) set -- "$args0" "$args1" "$args2" ;;
++ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
++ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
++ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
++ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
++ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
++ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
++ esac
++fi
++
++# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
++function splitJvmOpts() {
++ JVM_OPTS=("$@")
++}
++eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
++JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
++
++exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
--- /dev/null
--- /dev/null
++## This file is automatically generated by Android Studio.
++# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
++#
++# This file must *NOT* be checked into Version Control Systems,
++# as it contains information specific to your local configuration.
++#
++# Location of the SDK. This is only used by Gradle.
++# For customization when using a Version Control System, please read the
++# header note.
++#Tue Sep 27 15:12:02 PDT 2016
++sdk.dir=/home/georgena/Android/Sdk
abortOnError false\r
}\r
\r
- jniLibs.srcDir 'libs'\r
+ sourceSets {\r
+ main {\r
+ manifest.srcFile 'src/main/AndroidManifest.xml'\r
++ jniLibs.srcDir '$buildDir/native-libs'\r
+ jni.srcDirs = [] //disable automatic ndk-build call\r
+ java{\r
+ if (WITH_TRANSPORT_EDR == "0") {\r
+ exclude "**/ca/CaBtPairingInterface.java"\r
+ exclude "**/ca/CaEdrInterface.java"\r
+ println 'excluded EDR interface'\r
+ }\r
+ if (WITH_TRANSPORT_BLE == "0") {\r
+ exclude "**/ca/CaLeClientInterface.java"\r
+ exclude "**/ca/CaLeServerInterface.java"\r
+ println 'excluded BLE interface'\r
+ }\r
+ if (WITH_TRANSPORT_NFC == "0") {\r
+ exclude "**/ca/CaNfcInterface.java"\r
+ println 'excluded NFC interface'\r
+ }\r
+ if (WITH_CLOUD == "0" || SECURED == "0") {\r
+ exclude "**/base/OcCloudProvisioning.java"\r
+ println 'excluded secure files'\r
+ }\r
+ }\r
+ }\r
+ }\r
}\r
\r
-\r
dependencies {\r
compile fileTree(dir: 'libs', include: ['*.jar'])\r
}\r
- /*
- * //******************************************************************
- * //
- * // Copyright 2015 Intel Corporation.
- * //
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- * //
- * // Licensed under the Apache License, Version 2.0 (the "License");
- * // you may not use this file except in compliance with the License.
- * // You may obtain a copy of the License at
- * //
- * // http://www.apache.org/licenses/LICENSE-2.0
- * //
- * // Unless required by applicable law or agreed to in writing, software
- * // distributed under the License is distributed on an "AS IS" BASIS,
- * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * // See the License for the specific language governing permissions and
- * // limitations under the License.
- * //
- * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- */
-
+ //******************************************************************
+ //
+ // Copyright 2015 Intel Corporation.
+ //
+ //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ //
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // you may not use this file except in compliance with the License.
+ // You may obtain a copy of the License at
+ //
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing, software
+ // distributed under the License is distributed on an "AS IS" BASIS,
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ // See the License for the specific language governing permissions and
+ // limitations under the License.
+ //
+ //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#include <jni.h>
-#include <android/log.h>
+#include "logger.h"
#include <stdio.h>
#include "cainterface.h"
#include "JniCaInterface.h"
CANativeSetActivity(env, activity);
CANativeJNISetContext(env, context);
}
+#else
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaInterface_initialize
+(JNIEnv *env, jclass clazz)
+{
+ LOGI("CaInterface_initialize");
+}
+#endif
- void CAManagerConnectionStateChangedCB(CATransportAdapter_t adapter,
- const char *remote_address,
+ void CAManagerConnectionStateChangedCB(const CAEndpoint_t *info,
bool connected)
{
- LOGI("Callback - CAManagerConnectionStateChangedCB : type(%d), address(%s), connected(%d)",
- adapter, remote_address, connected);
+ if (!info)
+ {
+ LOGE("info is NULL");
+ return;
+ }
if (!g_listenerObject)
{
CAUtilClientInitialize(env, g_jvm, context);
- g_listenerObject = (*env)->NewGlobalRef(env, listener);
+ if (listener)
+ {
+ g_listenerObject = (*env)->NewGlobalRef(env, listener);
+ }
- CARegisterNetworkMonitorHandler(CAManagerAdapterStateChangedCB,
- CAManagerConnectionStateChangedCB);
+ if (g_listenerObject)
+ {
+ jclass cls = (*env)->FindClass(env, "org/iotivity/base/OcConnectivityType");
+ if (cls)
+ {
+ g_jni_cls_enum = (jclass)(*env)->NewGlobalRef(env, cls);
+ }
+
+ if (g_jni_cls_enum)
+ {
+ g_jni_mid_enum = (*env)->GetStaticMethodID(env, g_jni_cls_enum, "getInstance",
+ "(I)Lorg/iotivity/base/OcConnectivityType;");
+ }
+ }
+ CAResult_t res = CARegisterNetworkMonitorHandler(CAManagerAdapterStateChangedCB,
+ CAManagerConnectionStateChangedCB);
+ if (CA_STATUS_OK != res)
+ {
+ LOGE("CARegisterNetworkMonitorHandler has failed");
+ }
}
+#else
+JNIEXPORT void JNICALL
+Java_org_iotivity_ca_CaInterface_caManagerInitialize(JNIEnv *env, jclass clazz,
+ jobject listener)
+{
+ LOGI("CaManagere_initialize");
+
+ g_listenerObject = (*env)->NewGlobalRef(env, listener);
+
+ CARegisterNetworkMonitorHandler(CAManagerAdapterStateChangedCB,
+ CAManagerConnectionStateChangedCB);
+}
+#endif
JNIEXPORT void JNICALL
Java_org_iotivity_ca_CaInterface_caManagerTerminate(JNIEnv *env, jclass clazz)
*/
JNIEXPORT void JNICALL Java_org_iotivity_ca_CaInterface_initialize
(JNIEnv *, jclass, jobject, jobject);
+#else
+ /*
+ * Class: org_iotivity_ca_CaInterface_Initialize
+ * Method: Initialize
+ * Signature: ()V
+ */
+ JNIEXPORT void JNICALL Java_org_iotivity_ca_CaInterface_initialize
+ (JNIEnv *, jclass);
+#endif
+ /*
+ * Class: Java_org_iotivity_ca_CaInterface_setLeScanIntervalTimeImpl
+ * Method: setLeScanIntervalTimeImpl
+ * Signature: (II)V
+ */
+ JNIEXPORT void JNICALL Java_org_iotivity_ca_CaInterface_setLeScanIntervalTimeImpl
+ (JNIEnv *, jclass, jint, jint);
+
+ /*
+ * Class: org_iotivity_ca_CaInterface
+ * Method: setCipherSuiteImpl
+ * Signature: (Lorg/iotivity/ca/OicCipher;Lorg/iotivity/ca/CATransportAdapter;)I
+ */
+ JNIEXPORT jint JNICALL Java_org_iotivity_ca_CaInterface_setCipherSuiteImpl
+ (JNIEnv *, jclass, jint, jint);
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+ /*
+ * //******************************************************************
+ * //
+ * // Copyright 2016 Samsung Electronics All Rights Reserved.
+ * //
+ * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ * //
+ * // Licensed under the Apache License, Version 2.0 (the "License");
+ * // you may not use this file except in compliance with the License.
+ * // You may obtain a copy of the License at
+ * //
+ * // http://www.apache.org/licenses/LICENSE-2.0
+ * //
+ * // Unless required by applicable law or agreed to in writing, software
+ * // distributed under the License is distributed on an "AS IS" BASIS,
+ * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * // See the License for the specific language governing permissions and
+ * // limitations under the License.
+ * //
+ * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ */
+
++#include "JniOcStack.h"
+ #include "JniOcCloudProvisioning.h"
+ #include "oic_malloc.h"
+
+ namespace PH = std::placeholders;
+
+ JniOcCloudProvisioning::JniOcCloudProvisioning(std::shared_ptr<OCCloudProvisioning> p)
+ : m_sharedCloudObject(p)
+ {}
+
+ JniOcCloudProvisioning::~JniOcCloudProvisioning()
+ {
+ LOGD("~JniOcCloudProvisioning");
+ m_sharedCloudObject = nullptr;
+ }
+
+ JniOcCloudResultListener* JniOcCloudProvisioning::AddCloudResultListener(JNIEnv* env,
+ jobject jListener)
+ {
+ JniOcCloudResultListener *resultListener = NULL;
+ resultMapLock.lock();
+
+ for (auto it = resultMap.begin(); it != resultMap.end(); ++it)
+ {
+ if (env->IsSameObject(jListener, it->first))
+ {
+ auto refPair = it->second;
+ resultListener = refPair.first;
+ refPair.second++;
+ it->second = refPair;
+ resultMap.insert(*it);
+ LOGD("Cloud Provision resultListener: ref. count incremented");
+ break;
+ }
+ }
+ if (!resultListener)
+ {
+ resultListener = new JniOcCloudResultListener(env, jListener,
+ RemoveCallback(std::bind(&JniOcCloudProvisioning::RemoveCloudResultListener,
+ this, PH::_1, PH::_2)));
+ jobject jgListener = env->NewGlobalRef(jListener);
+
+ resultMap.insert(std::pair < jobject, std::pair < JniOcCloudResultListener*,
+ int >> (jgListener, std::pair<JniOcCloudResultListener*, int>(resultListener, 1)));
+ LOGD("Cloud Provision resultListener: new listener");
+ }
+ resultMapLock.unlock();
+ return resultListener;
+ }
+
+ void JniOcCloudProvisioning::RemoveCloudResultListener(JNIEnv* env, jobject jListener)
+ {
+ resultMapLock.lock();
+
+ for (auto it = resultMap.begin(); it != resultMap.end(); ++it)
+ {
+ if (env->IsSameObject(jListener, it->first))
+ {
+ auto refPair = it->second;
+ if (refPair.second > 1)
+ {
+ refPair.second--;
+ it->second = refPair;
+ resultMap.insert(*it);
+ LOGI("Cloud Provision resultListener: ref. count decremented");
+ }
+ else
+ {
+ env->DeleteGlobalRef(it->first);
+ JniOcCloudResultListener* listener = refPair.first;
+ delete listener;
+ resultMap.erase(it);
+ LOGI("Cloud Provision resultListener removed");
+ }
+ break;
+ }
+ }
+ resultMapLock.unlock();
+ }
+
+ JniGetAclIdByDeviceListener* JniOcCloudProvisioning::AddGetAclByDeviceListener(JNIEnv* env,
+ jobject jListener)
+ {
+ JniGetAclIdByDeviceListener *resultListener = NULL;
+ aclresultMapLock.lock();
+
+ for (auto it = aclresultMap.begin(); it != aclresultMap.end(); ++it)
+ {
+ if (env->IsSameObject(jListener, it->first))
+ {
+ auto refPair = it->second;
+ resultListener = refPair.first;
+ refPair.second++;
+ it->second = refPair;
+ aclresultMap.insert(*it);
+ LOGD("GetACLByDeviceID Listener: ref. count incremented");
+ break;
+ }
+ }
+ if (!resultListener)
+ {
+ resultListener = new JniGetAclIdByDeviceListener(env, jListener,
+ RemoveCallback(std::bind(&JniOcCloudProvisioning::RemoveGetAclByDeviceIdListener,
+ this, PH::_1, PH::_2)));
+ jobject jgListener = env->NewGlobalRef(jListener);
+
+ aclresultMap.insert(std::pair < jobject, std::pair < JniGetAclIdByDeviceListener*,
+ int >> (jgListener, std::pair<JniGetAclIdByDeviceListener*, int>(resultListener, 1)));
+ LOGD("GetACLByDeviceID Listener: new listener");
+ }
+ aclresultMapLock.unlock();
+ return resultListener;
+ }
+
+ void JniOcCloudProvisioning::RemoveGetAclByDeviceIdListener(JNIEnv* env, jobject jListener)
+ {
+ aclresultMapLock.lock();
+
+ for (auto it = aclresultMap.begin(); it != aclresultMap.end(); ++it)
+ {
+ if (env->IsSameObject(jListener, it->first))
+ {
+ auto refPair = it->second;
+ if (refPair.second > 1)
+ {
+ refPair.second--;
+ it->second = refPair;
+ aclresultMap.insert(*it);
+ LOGI("GetACLByDeviceID Listener: ref. count decremented");
+ }
+ else
+ {
+ env->DeleteGlobalRef(it->first);
+ JniGetAclIdByDeviceListener* listener = refPair.first;
+ delete listener;
+ aclresultMap.erase(it);
+ LOGI("GetACLByDeviceID Listener removed");
+ }
+ break;
+ }
+ }
+ aclresultMapLock.unlock();
+ }
+ JniOcCloudProvisioning * Create_native_object(JNIEnv *env, jobject thiz)
+ {
+ jstring jip = (jstring)env->CallObjectMethod(thiz, g_mid_OcCloudProvisioning_getIP);
+ if (!jip || env->ExceptionCheck())
+ {
+ return nullptr;
+ }
+ const char *str = env->GetStringUTFChars(jip, NULL);
+ std::string ipaddress(str);
+ env->ReleaseStringUTFChars(jip, str);
+
+ jint port = env->CallIntMethod(thiz, g_mid_OcCloudProvisioning_getPort);
+ if (env->ExceptionCheck())
+ {
+ return nullptr;
+ }
+ JniOcCloudProvisioning *cloud = new JniOcCloudProvisioning(
+ std::shared_ptr<OCCloudProvisioning>(new OCCloudProvisioning(ipaddress, (uint16_t)port)));
+ SetHandle<JniOcCloudProvisioning>(env, thiz, cloud);
+ return cloud;
+ }
+
+ JniOcCloudProvisioning* JniOcCloudProvisioning::getJniOcCloudProvisioningPtr(JNIEnv *env, jobject thiz)
+ {
+ JniOcCloudProvisioning *cloud = GetHandle<JniOcCloudProvisioning>(env, thiz);
+
+ if (env->ExceptionCheck())
+ {
+ LOGE("Failed to get native handle from OcCloudProvisioning class");
+ }
+
+ return cloud;
+ }
+
+ OCStackResult JniOcCloudProvisioning::requestCertificate(JNIEnv* env, jobject jListener)
+ {
+ JniOcCloudResultListener *resultListener = AddCloudResultListener(env, jListener);
+
+ ResponseCallBack responseCallBack = [resultListener](OCStackResult result, void *data)
+ {
+ resultListener->CloudResultListenerCB(result, data, ListenerFunc::REQUEST_CERTIFICATE);
+ };
+
+ return m_sharedCloudObject->requestCertificate(responseCallBack);
+ }
+
+ OCStackResult JniOcCloudProvisioning::getIndividualAclInfo(JNIEnv* env, jobject jListener, std::string &aclID)
+ {
+ JniOcCloudResultListener *resultListener = AddCloudResultListener(env, jListener);
+
+ ResponseCallBack responseCallBack = [resultListener](OCStackResult result, void *data)
+ {
+ resultListener->CloudResultListenerCB(result, data, ListenerFunc::GET_ACLINFO);
+ };
+
+ return m_sharedCloudObject->getIndividualAclInfo(aclID, responseCallBack);
+ }
+
+ OCStackResult JniOcCloudProvisioning::getCRL(JNIEnv* env, jobject jListener)
+ {
+ JniOcCloudResultListener *resultListener = AddCloudResultListener(env, jListener);
+
+ ResponseCallBack responseCallBack = [resultListener](OCStackResult result, void *data)
+ {
+ resultListener->CloudResultListenerCB(result, data, ListenerFunc::GET_CRL);
+ };
+
+ return m_sharedCloudObject->getCRL(responseCallBack);
+ }
+
+ OCStackResult JniOcCloudProvisioning::postCRL(JNIEnv* env, const std::string& thisUpdate,
+ const std::string& nextUpdate, const OCByteString *crl,
+ const stringArray_t *serialNumbers, jobject jListener)
+ {
+ JniOcCloudResultListener *resultListener = AddCloudResultListener(env, jListener);
+
+ ResponseCallBack responseCallBack = [resultListener](OCStackResult result, void *data)
+ {
+ resultListener->CloudResultListenerCB(result, data, ListenerFunc::POST_CRL);
+ };
+
+ return m_sharedCloudObject->postCRL(thisUpdate, nextUpdate, crl, serialNumbers,
+ responseCallBack);
+ }
+
+ OCStackResult JniOcCloudProvisioning::getAclIdByDevice(JNIEnv* env, std::string deviceId,
+ jobject jListener)
+ {
+ JniGetAclIdByDeviceListener *resultListener = AddGetAclByDeviceListener(env, jListener);
+
+ AclIdResponseCallBack aclIdResponseCallBack = [resultListener](OCStackResult result,
+ std::string aclId)
+ {
+ resultListener->GetAclIdByDeviceListenerCB(result, aclId);
+ };
+
+ return m_sharedCloudObject->getAclIdByDevice(deviceId, aclIdResponseCallBack);
+ }
+ /*
+ * Class: org_iotivity_base_OcCloudProvisioning
+ * Method: requestCertificate
+ * Signature: (Lorg/iotivity/base/OcCloudProvisioning/RequestCertificateListener;)V
+ */
+ JNIEXPORT void JNICALL Java_org_iotivity_base_OcCloudProvisioning_requestCertificate
+ (JNIEnv* env, jobject thiz, jobject jListener)
+ {
+ LOGD("OcCloudProvisioning_requestCertificate");
+ if (!jListener)
+ {
+ ThrowOcException(OC_STACK_INVALID_PARAM, "Listener cannot be null");
+ return;
+ }
+
+ JniOcCloudProvisioning *cloud = JniOcCloudProvisioning::getJniOcCloudProvisioningPtr(env, thiz);
+ if (!cloud)
+ {
+ LOGD("OcCloudProvisioning_requestCertificate, No native object, creating now");
+ cloud = Create_native_object(env, thiz);
+ if (!cloud)
+ {
+ ThrowOcException(OC_STACK_ERROR, "OcCloudProvisioning_requestCertificate,"
+ "Can not Create Native object");
+ return;
+ }
+ }
+
+ try
+ {
+ OCStackResult result = cloud->requestCertificate(env, jListener);
+ if (OC_STACK_OK != result)
+ {
+ ThrowOcException(result, "OcCloudProvisioning_requestCertificate");
+ return;
+ }
+ }
+ catch (OCException& e)
+ {
+ LOGE("%s", e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
+ }
+ return;
+ }
+
+ /*
+ * Class: org_iotivity_base_OcCloudProvisioning
+ * Method: getAclIdByDevice
+ * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcCloudProvisioning/GetAclIdByDeviceListener;)V
+ */
+ JNIEXPORT void JNICALL Java_org_iotivity_base_OcCloudProvisioning_getAclIdByDevice
+ (JNIEnv *env, jobject thiz, jstring jdeviceId, jobject jListener)
+ {
+ LOGD("OcCloudProvisioning_getAclIdByDevice");
+ if (!jListener || !jdeviceId)
+ {
+ ThrowOcException(OC_STACK_INVALID_PARAM, "Listener and deviceID cannot be null");
+ return;
+ }
+
+ JniOcCloudProvisioning *cloud = JniOcCloudProvisioning::getJniOcCloudProvisioningPtr(env, thiz);
+ if (!cloud)
+ {
+ LOGD("OcCloudProvisioning_getAclIdByDevice, No native object, creating now");
+ cloud = Create_native_object(env, thiz);
+ if (!cloud)
+ {
+ ThrowOcException(OC_STACK_ERROR, "OcCloudProvisioning_getAclIdByDevice,"
+ "Can not Create Native object");
+ return;
+ }
+ }
+
+ const char *str = env->GetStringUTFChars(jdeviceId, NULL);
+ if (!str || env->ExceptionCheck())
+ {
+ ThrowOcException(OC_STACK_ERROR,"OcCloudProvisioning_getAclIdByDevice");
+ return;
+ }
+ std::string deviceId(str);
+ env->ReleaseStringUTFChars(jdeviceId, str);
+
+ try
+ {
+ OCStackResult result = cloud->getAclIdByDevice(env, deviceId, jListener);
+ if (OC_STACK_OK != result)
+ {
+ ThrowOcException(result, "OcCloudProvisioning_getAclIdByDevice");
+ return;
+ }
+ }
+ catch (OCException& e)
+ {
+ LOGE("%s", e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
+ }
+ return;
+ }
+
+ /*
+ * Class: org_iotivity_base_OcCloudProvisioning
+ * Method: getIndividualAclInfo
+ * Signature: (Ljava/lang/String;Lorg/iotivity/base/OcCloudProvisioning/GetIndividualAclInfoListener;)V
+ */
+ JNIEXPORT void JNICALL Java_org_iotivity_base_OcCloudProvisioning_getIndividualAclInfo
+ (JNIEnv *env, jobject thiz, jstring jaclID, jobject jListener)
+ {
+ LOGD("OcCloudProvisioning_getIndividualAclInfo");
+ if (!jListener || !jaclID)
+ {
+ ThrowOcException(OC_STACK_INVALID_PARAM, "Listener/aclID cannot be null");
+ return;
+ }
+
+ JniOcCloudProvisioning *cloud = JniOcCloudProvisioning::getJniOcCloudProvisioningPtr(env, thiz);
+ if (!cloud)
+ {
+ LOGD("OcCloudProvisioning_getIndividualAclInfo, No native object, creating now");
+ cloud = Create_native_object(env, thiz);
+ if (!cloud)
+ {
+ ThrowOcException(OC_STACK_ERROR, "OcCloudProvisioning_getIndividualAclInfo,"
+ "Can not Create Native object");
+ return;
+ }
+ }
+
+ const char *str = env->GetStringUTFChars(jaclID, NULL);
+ std::string aclID(str);
+ env->ReleaseStringUTFChars(jaclID, str);
+
+ try
+ {
+ OCStackResult result = cloud->getIndividualAclInfo(env, jListener, aclID);
+ if (OC_STACK_OK != result)
+ {
+ ThrowOcException(result, "OcCloudProvisioning_getIndividualAclInf");
+ return;
+ }
+ }
+ catch (OCException& e)
+ {
+ LOGE("%s", e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
+ }
+ return;
+ }
+
+ /*
+ * Class: org_iotivity_base_OcCloudProvisioning
+ * Method: getCRL
+ * Signature: (Lorg/iotivity/base/OcCloudProvisioning/GetCRLListener;)V
+ */
+ JNIEXPORT void JNICALL Java_org_iotivity_base_OcCloudProvisioning_getCRL
+ (JNIEnv *env, jobject thiz, jobject jListener)
+ {
+ LOGD("OcCloudProvisioning_getCRL");
+ if (!jListener)
+ {
+ ThrowOcException(OC_STACK_INVALID_PARAM, "Listener cannot be null");
+ return;
+ }
+
+ JniOcCloudProvisioning *cloud = JniOcCloudProvisioning::getJniOcCloudProvisioningPtr(env, thiz);
+ if (!cloud)
+ {
+ LOGD("OcCloudProvisioning_getCRL, No native object, creating now");
+ cloud = Create_native_object(env, thiz);
+ if (!cloud)
+ {
+ ThrowOcException(OC_STACK_ERROR, "OcCloudProvisioning_getCRL,"
+ "Can not Create Native object");
+ return;
+ }
+ }
+
+ try
+ {
+ OCStackResult result = cloud->getCRL(env, jListener);
+ if (OC_STACK_OK != result)
+ {
+ ThrowOcException(result, "OcCloudProvisioning_requestCertificate");
+ return;
+ }
+ }
+ catch (OCException& e)
+ {
+ LOGE("%s", e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
+ }
+ return;
+ }
+
+ /*
+ * Class: org_iotivity_base_OcCloudProvisioning
+ * Method: postCRL0
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/ArrayList;Lorg/iotivity/base/OcCloudProvisioning/PostCRLListener;)V
+ */
+ JNIEXPORT void JNICALL Java_org_iotivity_base_OcCloudProvisioning_postCRL0
+ (JNIEnv *env , jobject thiz, jstring jthisUpdate, jstring jnextUpdate, jstring jcrl,
+ jobjectArray jserialnumArray, jobject jListener)
+ {
+ LOGD("OcCloudProvisioning_postCRL0");
+ if (!jListener || !jthisUpdate || !jnextUpdate || !jserialnumArray)
+ {
+ ThrowOcException(OC_STACK_INVALID_PARAM, " Invalid parameter (NULL param)");
+ return;
+ }
+
+ JniOcCloudProvisioning *cloud = JniOcCloudProvisioning::getJniOcCloudProvisioningPtr(env, thiz);
+ if (!cloud)
+ {
+ LOGD("OcCloudProvisioning_getCRL, No native object, creating now");
+ cloud = Create_native_object(env, thiz);
+ if (!cloud)
+ {
+ ThrowOcException(OC_STACK_ERROR, "OcCloudProvisioning_PostCRL0,"
+ "Can not Create Native object");
+ return;
+ }
+ }
+
+ const char *str = env->GetStringUTFChars(jthisUpdate, NULL);
+ if (!str || env->ExceptionCheck())
+ {
+ ThrowOcException(OC_STACK_ERROR,"OcCloudProvisioning_PostCRL0");
+ return;
+ }
+ std::string thisUpdate(str);
+ env->ReleaseStringUTFChars(jthisUpdate, str);
+
+ str = env->GetStringUTFChars(jnextUpdate, NULL);
+ if (!str || env->ExceptionCheck())
+ {
+ ThrowOcException(OC_STACK_ERROR,"OcCloudProvisioning_PostCRL0");
+ return;
+ }
+ std::string nextUpdate(str);
+ env->ReleaseStringUTFChars(jnextUpdate, str);
+
+ OCByteString *crl = NULL;
+ if (jcrl)
+ {
+ str = env->GetStringUTFChars(jcrl, NULL);
+ if (!str || env->ExceptionCheck())
+ {
+ ThrowOcException(OC_STACK_ERROR,"OcCloudProvisioning_PostCRL0");
+ return;
+ }
+ crl = (OCByteString*)OICCalloc(1, sizeof(OCByteString));
+ crl->len = (size_t)(strlen(str));
+ crl->bytes = (uint8_t*)OICCalloc(crl->len, sizeof(uint8_t));
+
+ for (size_t i = 0 ; i < crl->len; i++)
+ {
+ crl->bytes[i] = (uint8_t)str[i];
+ }
+ }
+
+ jsize len = env->GetArrayLength(jserialnumArray);
+
+ stringArray_t *serialNumArray = (stringArray_t*)OICCalloc(1, sizeof(stringArray_t));
+ serialNumArray->array = (char**)OICCalloc(len, sizeof(char*));
+ serialNumArray->length = len;
+
+ for (jsize i = 0; i < len; ++i)
+ {
+ jstring jStr = (jstring)env->GetObjectArrayElement(jserialnumArray, i);
+ if (!jStr)
+ {
+ ThrowOcException(OC_STACK_ERROR,"OcCloudProvisioning_PostCRL0");
+ return;
+ }
+ serialNumArray->array[i] = (char*)env->GetStringUTFChars(jStr, nullptr);
+ if (env->ExceptionCheck())
+ {
+ ThrowOcException(OC_STACK_ERROR,"OcCloudProvisioning_PostCRL0");
+ return;
+ }
+ env->DeleteLocalRef(jStr);
+ }
+
+ try
+ {
+ OCStackResult result = cloud->postCRL(env, thisUpdate, nextUpdate, crl,
+ serialNumArray, jListener);
+ if (OC_STACK_OK != result)
+ {
+ ThrowOcException(result, "OcCloudProvisioning_PostCRL0");
+ return;
+ }
+ }
+ catch (OCException& e)
+ {
+ LOGE("%s", e.reason().c_str());
+ ThrowOcException(e.code(), e.reason().c_str());
+ }
+ return;
+ }
* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*/
#include <jni.h>
++
++#ifdef __ANDROID__
+ #include <android/log.h>
++#else
+#include "logger.h"
++#endif
++
#include "OCApi.h"
#ifndef _Included_org_iotivity_base_ocstack
#define JNI_CURRENT_VERSION JNI_VERSION_1_6
++#ifdef __ANDROID__
+ #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__)
+ #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
+ #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__)
++#else
+#define LOGI(...) OIC_LOG_V(INFO, TAG, __VA_ARGS__)
+#define LOGD(...) OIC_LOG_V(DEBUG, TAG, __VA_ARGS__)
+#define LOGE(...) OIC_LOG_V(ERROR, TAG, __VA_ARGS__)
++#endif
#define JNI_EXCEPTION 1000
#define JNI_NO_NATIVE_POINTER 1001
JNIEnv *env = nullptr;
ret = g_jvm->GetEnv((void **)&env, JNI_CURRENT_VERSION);
- switch (ret) {
- case JNI_OK:
- return env;
- case JNI_EDETACHED:
- // AttachCurrentThread API changed in JNI 1.7 which is not a defined version
- #pragma GCC diagnostic push
- #pragma GCC diagnostic warning "-fpermissive"
- if (g_jvm->AttachCurrentThread(&env, nullptr) < 0)
- #pragma GCC diagnostic push
- {
+ switch (ret)
+ {
+ case JNI_OK:
+ return env;
+ case JNI_EDETACHED:
++#ifdef __ANDROID__
+ if (g_jvm->AttachCurrentThread(&env, nullptr) < 0)
++#else
++ if (g_jvm->AttachCurrentThread((void **)&env, nullptr) < 0)
++#endif
+ {
+ LOGE("Failed to get the environment");
+ return nullptr;
+ }
+ else
+ {
+ return env;
+ }
-
+ case JNI_EVERSION:
+ LOGE("JNI version not supported");
+ break;
+ default:
LOGE("Failed to get the environment");
return nullptr;
- }
- else
- {
- return env;
- }
-
- case JNI_EVERSION:
- LOGE("JNI version not supported");
- default:
- LOGE("Failed to get the environment");
- return nullptr;
}
+ return nullptr;
}
static void DuplicateString(char ** targetString, std::string sourceString)
--- /dev/null
- env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
- env.get('SRC_DIR') + '/resource/include',
- env.get('SRC_DIR') + '/resource/c_common',
- env.get('SRC_DIR') + '/resource/c_common/oic_string/include',
- env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
- env.get('SRC_DIR') + '/resource/csdk/stack/include',
- env.get('SRC_DIR') + '/resource/csdk/ocsocket/include',
- env.get('SRC_DIR') + '/resource/oc_logger/include',
- env.get('SRC_DIR') + '/resource/csdk/logger/include',
- env.get('SRC_DIR') + '/resource/../extlibs/boost/boost_1_58_0',
- env.get('SRC_DIR') + '/resource/../build_common/android/compatibility',
- env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
- env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm',
- env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
- env.get('SRC_DIR') + '/resource/csdk/security/include'
+#******************************************************************
+#
+# Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+##
+# Examples build script
+##
+Import('env')
+# Add third party libraries
+lib_env = env.Clone()
+SConscript(env.get('SRC_DIR') + '/resource/third_party_libs.scons', 'lib_env')
+
+jni_env = lib_env.Clone()
+
+######################################################################
+# Build flags
+######################################################################
+jni_env.AppendUnique(CPPPATH = [
-
++ env.get('SRC_DIR') + '/resource/csdk/connectivity/api',
++ env.get('SRC_DIR') + '/resource/include',
++ env.get('SRC_DIR') + '/resource/c_common',
++ env.get('SRC_DIR') + '/resource/c_common/oic_string/include',
++ env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
++ env.get('SRC_DIR') + '/resource/csdk/stack/include',
++ env.get('SRC_DIR') + '/resource/csdk/ocsocket/include',
++ env.get('SRC_DIR') + '/resource/oc_logger/include',
++ env.get('SRC_DIR') + '/resource/csdk/logger/include',
++ env.get('SRC_DIR') + '/resource/../extlibs/boost/boost_1_58_0',
++ env.get('SRC_DIR') + '/resource/../build_common/android/compatibility',
++ env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include',
++ env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/oxm',
++ env.get('SRC_DIR') + '/resource/csdk/security/provisioning/include/internal',
++ env.get('SRC_DIR') + '/resource/csdk/security/include',
++ env.get('SRC_DIR') + '/resource/csdk/connectivity/lib/libcoap-4.1.1/include'
+ ])
+
- jni_env.AppendUnique(LIBS = ['tinydtls', 'ocprovision', 'ocpmapi'])
+target_os = env.get('TARGET_OS')
+jni_env.AppendUnique(CCFLAGS = ['-Wno-error', '-Wno-comment', '-Wno-unused-function', '-Wno-unused-parameter'])
+if target_os not in ['windows', 'winrt']:
+ jni_env.AppendUnique(CXXFLAGS = ['-std=c++0x', '-Wall', '-pthread'])
+
+ # Note: 'pthread' is in libc for android. On other platform, if use
+ # new gcc(>4.9?) it isn't required, otherwise, it's required
+ if target_os != 'android':
+ jni_env.AppendUnique(LIBS = ['-lpthread'])
+
+jni_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+jni_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
+jni_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction'])
+if env.get('SECURED') == '1':
-
++# jni_env.AppendUnique(CPPDEFINES= ['__WITH_TLS__'])
++ jni_env.PrependUnique(LIBS = ['tinydtls', 'ocprovision', 'ocpmapi'])
++ jni_env.AppendUnique(CPPPATH = ['#resource/csdk/security/include/internal',
++ '#extlibs/cjson',
++ '#resource/csdk/security/provisioning/include/cloud'])
+
+if target_os == 'android':
+ jni_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+ jni_env.AppendUnique(LIBS = ['gnustl_shared'])
+
+ if not env.get('RELEASE'):
+ jni_env.AppendUnique(LIBS = ['log'])
+
+if target_os in ['darwin', 'ios']:
+ jni_env.AppendUnique(CPPDEFINES = ['_DARWIN_C_SOURCE'])
+
++if env.get('WITH_CLOUD'):
++ jni_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
++
++if env.get('WITH_TCP'):
++ jni_env.AppendUnique(CPPDEFINES = ['WITH_TCP', '__WITH_TLS__'])
++
++with_mq = env.get('WITH_MQ')
++if 'SUB' in with_mq:
++ jni_env.AppendUnique(CPPDEFINES = ['MQ_SUBSCRIBER', 'WITH_MQ'])
++if 'PUB' in with_mq:
++ jni_env.AppendUnique(CPPDEFINES = ['MQ_PUBLISHER', 'WITH_MQ'])
++if 'BROKER' in with_mq:
++ jni_env.AppendUnique(CPPDEFINES = ['MQ_BROKER', 'WITH_MQ'])
+######################################################################
+# Source files and Targets
+######################################################################
+
- 'JniOcSecurity.cpp'
+ca_interface = jni_env.SharedLibrary('ca-interface', ['JniCaInterface.c'])
+
+ocstack_files = [
+ 'JniOcStack.cpp',
+ 'JniUtils.cpp',
+ 'JniEntityHandler.cpp',
+ 'JniOnResourceFoundListener.cpp',
+ 'JniOnDeviceInfoListener.cpp',
+ 'JniOnPlatformInfoListener.cpp',
+ 'JniOnPresenceListener.cpp',
+ 'JniOnGetListener.cpp',
+ 'JniOnPutListener.cpp',
+ 'JniOnPostListener.cpp',
+ 'JniOnDeleteListener.cpp',
+ 'JniOnObserveListener.cpp',
+ 'JniOcRepresentation.cpp',
+ 'JniOcResourceHandle.cpp',
+ 'JniOcPresenceHandle.cpp',
+ 'JniOcRequestHandle.cpp',
+ 'JniOcResourceRequest.cpp',
+ 'JniOcResourceResponse.cpp',
+ 'JniOcPlatform.cpp',
+ 'JniOcResource.cpp',
+ 'JniOcResourceIdentifier.cpp',
-
++ 'JniOcSecurity.cpp',
++ 'JniOnDPDevicesFoundListener.cpp',
++ 'JniOnDirectPairingListener.cpp',
++ 'JniOcDirectPairDevice.cpp',
++ 'JniOnPublishResourceListener.cpp',
++ 'JniOnDeleteResourceListener.cpp',
+ ]
++if ['SUB', 'PUB', 'BROKER'] in with_mq:
++ ocstack_files += [
++ 'JniOnMQTopicFoundListener.cpp',
++ 'JniOnMQSubscribeListener.cpp'
++ ]
+if env.get('SECURED') == '1':
+ ocstack_files += [
+ 'JniOcSecureResource.cpp',
+ 'JniOcProvisioning.cpp',
+ 'JniSecureUtils.cpp',
+ 'JniProvisionResultListner.cpp',
+ 'JniPinCheckListener.cpp',
+ 'JniDisplayPinListener.cpp'
+ ]
++if env.get('WITH_CLOUD'):
++ ocstack_files += [
++ 'JniOcAccountManager.cpp'
++ ]
++if env.get('WITH_TCP') or env.get('SECURED') == '1':
++ ocstack_files += [
++ 'JniOcCloudResultListener.cpp',
++ 'JniGetAclIdByDeviceListener.cpp'
++ ]
++if env.get('WITH_TCP'):
++ ocstack_files += ['JniOcCloudProvisioning.cpp']
+ocstack_jni = jni_env.SharedLibrary('ocstack-jni', ocstack_files)
+
+jni_env.InstallTarget(ocstack_jni, 'ocstack-jni')
+jni_env.InstallTarget(ca_interface, 'ca-interface')
+
+env.AppendTarget('ocstack-jni')
*/
CAResult_t CAUnsetAutoConnectionDeviceInfo(const char* address);
+ /**
+ * Set the port number to assign .
+ * @param[in] adapter Transport adapter information.
+ * @param[in] flag Transport flag information.
+ * @param[in] port The port number to use.
+ *
+ * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED.
+ */
+ CAResult_t CASetPortNumberToAssign(CATransportAdapter_t adapter,
+ CATransportFlags_t flag, uint16_t port);
+
+ /**
+ * Get the assigned port number currently.
+ * @param[in] adapter Transport adapter information.
+ * @param[in] flag Transport flag information.
+ *
+ * @return assigned port number information.
+ */
+ uint16_t CAGetAssignedPortNumber(CATransportAdapter_t adapter, CATransportFlags_t flag);
+
+#ifdef __JAVA__
#ifdef __ANDROID__
/**
* initialize util client for android
* @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
*/
CAResult_t CAUtilClientInitialize(JNIEnv *env, JavaVM *jvm, jobject context);
- #endif
+#else
+/**
+ * initialize util client for android
+ * @param[in] env JNI interface pointer.
+ * @param[in] jvm invocation inferface for JAVA virtual machine.
+ *
+ * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
+ */
+CAResult_t CAUtilClientInitialize(JNIEnv *env, JavaVM *jvm);
++#endif //_ANDROID__
/**
* terminate util client for android
* @param[in] listener callback listener
*/
void CAUtilSetFoundDeviceListener(jobject listener);
- #endif
+
+ /**
+ * set interval time and working count for LE scan.
+ * @param[in] intervalTime interval time(Seconds).
+ * @param[in] workingCount working cycle for selected interval time.
+ *
+ * @return ::CA_STATUS_OK or ::CA_STATUS_FAILED or ::CA_MEMORY_ALLOC_FAILED
+ */
+ CAResult_t CAUtilSetLEScanInterval(jint intervalTime, jint workingCount);
+
-#endif
++#endif //__JAVA__
#ifdef __cplusplus
} /* extern "C" */
--#endif
++#endif //__cplusplus
#endif /* CA_UTILS_INTERFACE_H_ */
#ifndef CA_ADAPTER_UTILS_H_
#define CA_ADAPTER_UTILS_H_
+ #include "iotivity_config.h"
+
#include <stdbool.h>
-#ifdef __ANDROID__
+#ifdef __JAVA__
#include <jni.h>
#endif
#endif
}
+ CAResult_t CASetPortNumberToAssign(CATransportAdapter_t adapter,
+ CATransportFlags_t flag, uint16_t port)
+ {
+ uint16_t *targetPort = 0;
+
+ if (CA_ADAPTER_IP & adapter)
+ {
+ if (CA_SECURE & flag)
+ {
+ if (CA_IPV6 & flag)
+ {
+ targetPort = &caglobals.ports.udp.u6s;
+ }
+ else if (CA_IPV4 & flag)
+ {
+ targetPort = &caglobals.ports.udp.u4s;
+ }
+ }
+ else
+ {
+ if (CA_IPV6 & flag)
+ {
+ targetPort = &caglobals.ports.udp.u6;
+ }
+ else if (CA_IPV4 & flag)
+ {
+ targetPort = &caglobals.ports.udp.u4;
+ }
+ }
+ }
+ #ifdef TCP_ADAPTER
+ if (CA_ADAPTER_TCP & adapter)
+ {
+ if (CA_IPV6 & flag)
+ {
+ targetPort = &caglobals.ports.tcp.u6;
+ }
+ else if (CA_IPV4 & flag)
+ {
+ targetPort = &caglobals.ports.tcp.u4;
+ }
+ }
+ #endif
+
+ if (targetPort)
+ {
+ *targetPort = port;
+ return CA_STATUS_OK;
+ }
+
+ return CA_NOT_SUPPORTED;
+ }
+
+ uint16_t CAGetAssignedPortNumber(CATransportAdapter_t adapter, CATransportFlags_t flag)
+ {
+ OIC_LOG(DEBUG, TAG, "CAGetAssignedPortNumber");
+
+ if (CA_ADAPTER_IP & adapter)
+ {
+ if (CA_SECURE & flag)
+ {
+ if (CA_IPV6 & flag)
+ {
+ return caglobals.ip.u6s.port;
+ }
+ else if (CA_IPV4 & flag)
+ {
+ return caglobals.ip.u4s.port;
+ }
+ }
+ else
+ {
+ if (CA_IPV6 & flag)
+ {
+ return caglobals.ip.u6.port;
+ }
+ else if (CA_IPV4 & flag)
+ {
+ return caglobals.ip.u4.port;
+ }
+ }
+ }
+ #ifdef TCP_ADAPTER
+ if (CA_ADAPTER_TCP & adapter)
+ {
+ if (CA_IPV6 & flag)
+ {
+ return caglobals.tcp.ipv6.port;
+ }
+ else if (CA_IPV4 & flag)
+ {
+ return caglobals.tcp.ipv4.port;
+ }
+ }
+ #endif
+ return 0;
+ }
+
+#ifdef __JAVA__
#ifdef __ANDROID__
/**
* initialize client connection manager
res = CA_STATUS_FAILED;
}
#endif
+
+ #if !defined(LE_ADAPTER) && !defined(EDR_ADAPTER)
+ (void)env;
+ (void)jvm;
+ (void)context;
+ #endif
return res;
}
- #endif
+#else
+/**
+ * initialize client connection manager
+ * @param[in] env JNI interface pointer.
+ * @param[in] jvm invocation inferface for JAVA virtual machine.
+ */
+CAResult_t CAUtilClientInitialize(JNIEnv *env, JavaVM *jvm)
+{
+ OIC_LOG(DEBUG, TAG, "CAUtilClientInitialize");
+
+ CAResult_t res = CA_STATUS_OK;
+#ifdef LE_ADAPTER
+ if (CA_STATUS_OK != CAManagerLEClientInitialize(env, jvm))
+ {
+ OIC_LOG(ERROR, TAG, "CAManagerLEClientInitialize has failed");
+ res = CA_STATUS_FAILED;
+ }
+#endif
+
+#ifdef EDR_ADAPTER
+ if (CA_STATUS_OK != CABTPairingInitialize(env, jvm))
+ {
+ OIC_LOG(ERROR, TAG, "CABTPairingInitialize has failed");
+ res = CA_STATUS_FAILED;
+ }
+#endif
+ return res;
+}
+
++#endif //__ANDROID__
/**
* terminate client connection manager
#!/bin/bash
--BASE_PATH="../../android/android_api/base/src/main/java/"
++BASE_PATH="../../java/common/src/main/java/"
BASE_PKG="org.iotivity.base"
RE_PATH="../../service/resource-encapsulation/android/service/src/main/java/"
export ANDROID_NDK=<ANDROID_NDK>
a) In the IoTivity root source folder execute
- scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP ES_ROLE=mediator ES_TARGET_ENROLLEE={Platform} RELEASE=0
- Note : {Platform} can be -> arduino , linux, tizen
+ scons TARGET_OS=android TARGET_ARCH=armeabi TARGET_TRANSPORT=IP RELEASE=0
b) If the project is setup correctly, you should see a BUILD SUCCESSFUL message on the terminal
-- You should see the .aar files generated inside of '<iotivity>/android/android_api/base/build/outputs/aar' directory. The .aar files contain jni directory and also a .jar file
++ You should see the .aar files generated inside of '<iotivity>/java/iotivity-android/build/outputs/aar' directory. The .aar files contain jni directory and also a .jar file
c) Now navigate to the Easysetup NDK folder
<iotivity-root>/service/easy-setup/mediator/richsdk/android
if target_os in ['android']:
easy_setup_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
if env.get('SECURED') == '1':
-- easy_setup_env.AppendUnique(LIBPATH = [env.get('SRC_DIR')+'/android/android_api/base/libs/armeabi'])
++ easy_setup_env.AppendUnique(LIBPATH = [env.get('SRC_DIR')+'/java/iotivity-android/build/native-libs/armeabi'])
easy_setup_env.AppendUnique(RPATH = [env.get('BUILD_DIR')])
easy_setup_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
- easy_setup_env.PrependUnique(LIBS = ['coap'])
- easy_setup_env.AppendUnique(LIBS = ['connectivity_abstraction'])
- easy_setup_env.AppendUnique(LIBS = ['oc_logger'])
- easy_setup_env.AppendUnique(LIBS = ['octbstack'])
- easy_setup_env.AppendUnique(LIBS = ['oc'])
- easy_setup_env.AppendUnique(LIBS = ['gnustl_shared'])
+ easy_setup_env.PrependUnique(LIBS = ['oc', 'octbstack', 'oc_logger', 'connectivity_abstraction', 'gnustl_shared'])
if env.get('SECURED') == '1':
easy_setup_env.AppendUnique(LIBS = ['ocpmapi','ocprovision'])
if not env.get('RELEASE'):
print "Files path is %s" % env.get('es_src')
######################################################################
+ # Generate RichSDK Mediator AAR
+ ################################################ ######################
++
+ if target_os in ['android']:
+ SConscript('android/SConscript')
+
+ ######################################################################
# Build RichSDK Mediator Sample App
################################################ ######################
- if target_os == 'linux':
+ if target_os in ['linux']:
SConscript('../../sampleapp/mediator/linux/richsdk_sample/SConscript')
++
+ if target_os in ['android']:
+ SConscript('../../sampleapp/mediator/android/SConscript')
+
+
######################################################################
#Build UnitTestcases for Mediator[RichSDK]
################################################ ######################
defaultConfig {
minSdkVersion 21
targetSdkVersion 21
- repositories {
+ versionCode 1
+ versionName "1.0"
+ }
+
- dirs '../../../../../../android/android_api/base/build/outputs/aar'
++ repositories {
+ flatDir {
++ dirs '../../../../../../java/iotivity-android/build/outputs/aar', '../../../../../java/iotivity-android/build/outputs/aar'
+ }
}
buildTypes {
--- /dev/null
-OIC_LIB_PATH := ../../../../../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
+ #//******************************************************************
+ #//
+ #// Copyright 2016 Samsung Electronics All Rights Reserved.
+ #//
+ #//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ #//
+ #// Licensed under the Apache License, Version 2.0 (the "License");
+ #// you may not use this file except in compliance with the License.
+ #// You may obtain a copy of the License at
+ #//
+ #// http://www.apache.org/licenses/LICENSE-2.0
+ #//
+ #// Unless required by applicable law or agreed to in writing, software
+ #// distributed under the License is distributed on an "AS IS" BASIS,
+ #// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ #// See the License for the specific language governing permissions and
+ #// limitations under the License.
+ #//
+ #//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+ LOCAL_PATH := $(call my-dir)
+ SECURED := $(SECURE)
+
+ include $(CLEAR_VARS)
+ OIC_LIB_PATH := ../../../../../../../../../out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
+ LOCAL_MODULE := android-oc
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/liboc.so
+ include $(PREBUILT_SHARED_LIBRARY)
+
+ include $(CLEAR_VARS)
+ OIC_LIB_PATH := ../../../../../../../../../out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
+ LOCAL_MODULE := android-easysetup
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libESMediatorRich.so
+ include $(PREBUILT_SHARED_LIBRARY)
+
+ ifeq ($(SECURED), 1)
+ include $(CLEAR_VARS)
+ OIC_LIB_PATH := ../../../../../../../../../out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
+ LOCAL_MODULE := android-ocprovision
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libocprovision.so
+ include $(PREBUILT_SHARED_LIBRARY)
+ endif
+
+ include $(CLEAR_VARS)
- $(LOCAL_PATH)/../../../../../../../../../android/android_api/base/jni \
++OIC_LIB_PATH := ../../../../../../../../../java/iotivity-android/build/native-libs/$(TARGET_ARCH_ABI)
+ LOCAL_MODULE := android-ocstack
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libocstack-jni.so
+ include $(PREBUILT_SHARED_LIBRARY)
+
+ include $(CLEAR_VARS)
+
+ LOCAL_MODULE := easysetup-jni
+
+ #Add Pre processor definitions
+ DEFINE_FLAG = -DWITH_POSIX -D__ANDROID__
+
+ #Add Debug flags here
+ DEBUG_FLAG = -DTB_LOG
+
+ BUILD_FLAG = $(DEFINE_FLAG) $(DEBUG_FLAG)
+
+ LOCAL_CPPFLAGS = $(BUILD_FLAG)
+ LOCAL_CPPFLAGS += -std=c++0x -frtti -fexceptions
+
+ $(info CPPFLAGSUPDATED=$(LOCAL_CPPFLAGS))
+
+ LOCAL_C_INCLUDES := $(LOCAL_PATH) \
+ $(LOCAL_PATH)/../../../../../inc \
+ $(LOCAL_PATH)/../../../../../src \
+ $(LOCAL_PATH)/../../../../../../../inc \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/logger/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/connectivity/common/inc \
+ $(LOCAL_PATH)/../../../../../../../../../resource/c_common/oic_string/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/c_common \
+ $(LOCAL_PATH)/../../../../../../../../../resource/oc_logger/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/c_common/oic_malloc/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/connectivity/api \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/stack/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/logger/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/security/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/security/provisioning/include \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/security/provisioning/include/cloud \
+ $(LOCAL_PATH)/../../../../../../../../../resource/csdk/security/provisioning/include/oxm \
+ $(LOCAL_PATH)/../../../../../../../../../extlibs/cjson \
+ $(LOCAL_PATH)/../../../../../../../../../extlibs/boost/boost_1_58_0 \
+ $(LOCAL_PATH)/../../../../../../../../../extlibs/timer \
++ $(LOCAL_PATH)/../../../../../../../../../java/jni \
+
+ LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/*.cpp))
+ LOCAL_SRC_FILES += $(patsubst $(LOCAL_PATH)/%, %, $(wildcard $(LOCAL_PATH)/*.h))
+
+ LOCAL_LDLIBS := -llog
+ #LOCAL_SHARED_LIBRARIES += android-connectivity_abstraction
+ LOCAL_SHARED_LIBRARIES += android-ocstack
+ ifeq ($(SECURED), 1)
+ LOCAL_SHARED_LIBRARIES += android-ocprovision
+ endif
+ LOCAL_SHARED_LIBRARIES += android-oc
+ LOCAL_SHARED_LIBRARIES += android-easysetup
+
+ include $(BUILD_SHARED_LIBRARY)
--- /dev/null
- dirs "../../../../../../android/android_api/base/build/outputs/aar/"
+ /******************************************************************
+ *
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+ // Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+ buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.3.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+ }
+
+ allprojects {
+ repositories {
+ jcenter {
+ url "http://jcenter.bintray.com/"
+ }
+ flatDir {
++ dirs "../../../../../../java/iotivity-android/build/outputs/aar/", "../../../../../java/iotivity-android/build/outputs/aar/"
+ }
+ }
+ }
- apply plugin: 'com.android.application'\r
- android {\r
- compileSdkVersion 21\r
- buildToolsVersion '21.1.2'\r
- \r
- defaultConfig {\r
- applicationId "org.iotivity.service.easysetup"\r
- minSdkVersion 21\r
- targetSdkVersion 21\r
- }\r
- \r
- buildTypes {\r
- release {\r
- minifyEnabled false\r
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'\r
- }\r
- }\r
- }\r
- \r
- dependencies {\r
- }
+ //******************************************************************
+ //
+ // Copyright 2016 Samsung Electronics All Rights Reserved.
+ //
+ //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ //
+ // Licensed under the Apache License, Version 2.0 (the "License");
+ // you may not use this file except in compliance with the License.
+ // You may obtain a copy of the License at
+ //
+ // http://www.apache.org/licenses/LICENSE-2.0
+ //
+ // Unless required by applicable law or agreed to in writing, software
+ // distributed under the License is distributed on an "AS IS" BASIS,
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ // See the License for the specific language governing permissions and
+ // limitations under the License.
+ //
+ //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+ apply plugin: 'com.android.application'
+
+ android {
+ compileSdkVersion 21
+ buildToolsVersion "20.0.0"
+
+ defaultConfig {
+ applicationId "org.iotivity.service.easysetup"
+ minSdkVersion 21
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ lintOptions {
+ abortOnError false
+ }
+ }
+ repositories {
+ flatDir {
- dirs "../../../../../../../android/android_api/base/build/outputs/aar/", "../../../../../mediator/richsdk/android/EasySetupCore/build/outputs/aar/"
++ dirs "../../../../../../../java/iotivity-android/build/outputs/aar/", "../../../../../mediator/richsdk/android/EasySetupCore/build/outputs/aar/"
+ }
+ }
+
+ try {
+ dependencies {
+ compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
+ compile ":EasySetupCore-${RELEASE}@aar"
+ }
+ } catch (all) {
+ print "${ERROR_MSG}"
+ assert all
+ }
--- /dev/null
+ #******************************************************************
+ #
+ # Copyright 2016 Samsung Electronics All Rights Reserved.
+ #
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+ ##
+ # Notification Service build script
+ ##
+
+ import platform
+ Import('env')
+
+ if env.get('RELEASE'):
+ env.AppendUnique(CCFLAGS = ['-Os'])
+ env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+ else:
+ env.AppendUnique(CCFLAGS = ['-g'])
+
+ if env.get('LOGGING'):
+ env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+ lib_env = env.Clone()
+ SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
+ notification_env = lib_env.Clone()
+
+ target_os = env.get('TARGET_OS')
+ ######################################################################
+ # Build flags
+ ######################################################################
+ notification_env.AppendUnique(CPPPATH = ['include'])
+ notification_env.AppendUnique(CPPPATH = ['src/common'])
+ notification_env.AppendUnique(CPPPATH = ['src/provider'])
+ notification_env.AppendUnique(CPPPATH = ['src/consumer'])
+ notification_env.AppendUnique(CPPPATH = ['../../resource/csdk/stack/include'])
+ notification_env.AppendUnique(CPPPATH = ['../../resource/csdk/resource-directory/include'])
+ notification_env.AppendUnique(CPPPATH = ['../../resource/csdk/connectivity/api'])
+
+ notification_env.PrependUnique(LIBS = [
+ 'octbstack',
+ 'oc_logger',
+ 'connectivity_abstraction',
+ 'libcoap',
+ 'resource_directory'
+ ])
+
+ if target_os not in ['windows', 'winrt']:
+ notification_env.AppendUnique(CCFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+
+ if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
+ notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+
+ if target_os == 'linux':
+ notification_env.AppendUnique(LIBS = ['pthread'])
+
+ if target_os == 'android':
+ notification_env.AppendUnique(CCFLAGS = ['-frtti', '-fexceptions'])
+ notification_env.AppendUnique(LIBS = ['gnustl_shared','log'])
+
+ if not env.get('RELEASE'):
+ notification_env.AppendUnique(LIBS = ['log'])
+
+ if not env.get('RELEASE'):
+ notification_env.PrependUnique(LIBS = ['gcov'])
+ notification_env.AppendUnique(CCFLAGS = ['--coverage'])
+
+ if 'CLIENT' in notification_env.get('RD_MODE'):
+ notification_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
+
+ if env.get('WITH_CLOUD') == True:
+ notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+
+ if env.get('SECURED') == '1':
+ notification_env.AppendUnique(CPPDEFINES = ['SECURED'])
+
+ ######################################################################
+ # Source files and Targets
+ ######################################################################
+
+ notification_provider_src = [
+ env.Glob('src/provider/*.c'), env.Glob('src/common/*.c')]
+ notification_consumer_src = [
+ env.Glob('src/consumer/*.c'), env.Glob('src/common/*.c')]
+
+ providersdk = notification_env.SharedLibrary('notification_provider', notification_provider_src)
+ notification_env.InstallTarget(providersdk, 'libnotification_provider')
+ notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
+
+ consumersdk = notification_env.SharedLibrary('notification_consumer', notification_consumer_src)
+ notification_env.InstallTarget(consumersdk, 'libnotification_consumer')
+ notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
+
+ providersdk = notification_env.StaticLibrary('notification_provider', notification_provider_src)
+ notification_env.InstallTarget(providersdk, 'libnotification_provider')
+ notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
+
+ consumersdk = notification_env.StaticLibrary('notification_consumer', notification_consumer_src)
+ notification_env.InstallTarget(consumersdk, 'libnotification_consumer')
+ notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
+
+ notification_env.UserInstallTargetHeader('include/NSProviderInterface.h',\
+ 'service/notification', 'NSProviderInterface.h')
+ notification_env.UserInstallTargetHeader('include/NSConsumerInterface.h',\
+ 'service/notification', 'NSConsumerInterface.h')
+
+ # Go to build Unit test
+ if target_os == 'linux':
+ SConscript('unittest/SConscript')
+
+ # Go to build sample apps
+ SConscript('examples/SConscript')
+
+ # Go to build c++ wrapper
+ SConscript('cpp-wrapper/SConscript')
+
++
+ if target_os == 'android':
+ SConscript('android/SConscript')
--- /dev/null
- dirs '../../../../android/android_api/base/build/outputs/aar'
+ /******************************************************************
+ *
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ *
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************/
+
+ apply plugin: 'com.android.library'
+
+ android {
+ compileSdkVersion 21
+ buildToolsVersion "20.0.0"
+ archivesBaseName = "iotivity"
+
+ libraryVariants.all { variant ->
+ variant.outputs.each { output ->
+ def outputFile = output.outputFile
+ if (outputFile != null && outputFile.name.endsWith('.aar')) {
+ def fileName = "${archivesBaseName}-${TARGET_ARCH}-${outputFile.name}"
+ output.outputFile = new File(outputFile.parent, fileName)
+ }
+ }
+ }
+
+ defaultConfig {
+ minSdkVersion 21
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ repositories {
+ flatDir {
++ dirs '../../../../java/iotivity-android/build/outputs/aar', '../../../../../java/iotivity-android/build/outputs/aar'
+ }
+ }
+ buildTypes {
+ release {
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+
+ sourceSets {
+ main {
+ manifest.srcFile 'src/main/AndroidManifest.xml'
+ jni.srcDirs = [] //disable automatic ndk-build call
+ jniLibs.srcDir new File(buildDir, 'native-libs')
+ }
+ androidTest.setRoot('src/androidTest')
+ }
+ }
+
+
+ dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
+ androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0'
+ androidTestCompile 'com.google.dexmaker:dexmaker:1.0'
+ androidTestCompile 'org.mockito:mockito-core:1.10.19'
+ }
+
+ ////////////////
+ ////NDK Support
+ ////////////////
+ //If using this, Android studio will fail run the following to set the environment variable for android studio:
+ //launchctl setenv ANDROID_NDK_HOME
+ //otherwise remove the dependsOn part and run ./gradlew buildNative from the command line
+ task copyNativeLibs(type: Copy, dependsOn: 'buildNative') {
+ dependsOn 'buildNative'
+ from(new File('src/main/libs')) { include '**/*.so' exclude '**/libgnustl_shared.so' }
+ into new File(buildDir, 'native-libs')
+ }
+
+ tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn copyNativeLibs }
+
+ clean.dependsOn 'cleanCopyNativeLibs'
+
+ tasks.withType(com.android.build.gradle.tasks.PackageApplication) {
+ pkgTask ->
+ pkgTask.jniFolders = new HashSet<File>()
+ pkgTask.jniFolders.add(new File(buildDir, 'native-libs'))
+ }
+
+ task buildNative(type: Exec) {
+ if (System.env.ANDROID_NDK_HOME != null) {
+ //for windows use 'ndk-build.cmd'
+ //def ndkBuild = new File(System.env.ANDROID_NDK_HOME, 'ndk-build.cmd')
+ def ndkBuild = new File(System.env.ANDROID_NDK_HOME, 'ndk-build')
+ commandLine ndkBuild, "APP_ABI=$TARGET_ARCH", "APP_OPTIM=$RELEASE", '-C', file('src/main').absolutePath
+ } else {
+ println '##################'
+ println 'Skipping NDK build'
+ println 'Reason: ANDROID_NDK_HOME not set.'
+ println '##################'
+ }
+ }
--- /dev/null
-OIC_LIB_PATH := $(ROOT_PATH)/android/android_api/base/libs/$(TARGET_ARCH_ABI)
+ LOCAL_PATH := $(call my-dir)
+
+ ROOT_PATH := ../../../../../../..
+
+ include $(CLEAR_VARS)
+ OIC_LIB_PATH := $(ROOT_PATH)/out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
+ LOCAL_MODULE := notification_consumer
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libnotification_consumer.so
+ include $(PREBUILT_SHARED_LIBRARY)
+
+ include $(CLEAR_VARS)
+ OIC_LIB_PATH := $(ROOT_PATH)/out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
+ LOCAL_MODULE := notification_consumer_wrapper
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libnotification_consumer_wrapper.so
+ include $(PREBUILT_SHARED_LIBRARY)
+
+ include $(CLEAR_VARS)
-LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/android/android_api/base/jni
++OIC_LIB_PATH := $(ROOT_PATH)/java/iotivity-android/build/native-libs/$(TARGET_ARCH_ABI)
+ LOCAL_MODULE := android-ocstack
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libocstack-jni.so
+ include $(PREBUILT_SHARED_LIBRARY)
+
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := notification_consumer_jni
+ LOCAL_CPPFLAGS := -std=c++0x -frtti -fexceptions
+ LOCAL_LDLIBS := -llog
+
+ LOCAL_SHARED_LIBRARIES := ca_interface
+ LOCAL_SHARED_LIBRARIES += ca
+ LOCAL_SHARED_LIBRARIES += oc_logger_core
+ LOCAL_SHARED_LIBRARIES += oc_logger
+ LOCAL_SHARED_LIBRARIES += octbstack
+ LOCAL_SHARED_LIBRARIES += oc
+ LOCAL_SHARED_LIBRARIES += android-ocstack
+ LOCAL_SHARED_LIBRARIES += notification_consumer
+ LOCAL_SHARED_LIBRARIES += notification_consumer_wrapper
+
+ OIC_SRC_DIR := ../../../../../..
+
+ LOCAL_C_INCLUDES := $(OIC_SRC_DIR)/resource/csdk/stack/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/logger/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common/oic_string/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/oc_logger/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/boost/boost_1_58_0
-LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/android/android_api/base/jni
++LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/java/jni
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/src/common
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/src/consumer
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/android/notification-service/src/main/jni/common
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/cpp-wrapper/common
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/cpp-wrapper/consumer/inc
+
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/
+
+ LOCAL_SRC_FILES := consumer/JniNotificationConsumer.cpp
+ LOCAL_SRC_FILES += common/JniNotificationCommon.cpp
+
+ include $(BUILD_SHARED_LIBRARY)
+ include $(CLEAR_VARS)
+ OIC_LIB_PATH := $(ROOT_PATH)/out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
+ LOCAL_MODULE := notification_provider_wrapper
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libnotification_provider_wrapper.so
+ include $(PREBUILT_SHARED_LIBRARY)
+
+ include $(CLEAR_VARS)
+ OIC_LIB_PATH := $(ROOT_PATH)/out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
+ LOCAL_MODULE := notification_provider
+ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libnotification_provider.so
+ include $(PREBUILT_SHARED_LIBRARY)
+
+ include $(CLEAR_VARS)
+ LOCAL_MODULE := notification_provider_jni
+ LOCAL_CPPFLAGS := -std=c++0x -frtti -fexceptions
+ LOCAL_LDLIBS := -llog
+
+ LOCAL_SHARED_LIBRARIES := ca_interface
+ LOCAL_SHARED_LIBRARIES += ca
+ LOCAL_SHARED_LIBRARIES += oc_logger_core
+ LOCAL_SHARED_LIBRARIES += oc_logger
+ LOCAL_SHARED_LIBRARIES += octbstack
+ LOCAL_SHARED_LIBRARIES += oc
+ LOCAL_SHARED_LIBRARIES += android-ocstack
+ LOCAL_SHARED_LIBRARIES += notification_provider
+ LOCAL_SHARED_LIBRARIES += notification_provider_wrapper
+
+ OIC_SRC_DIR := ../../../../../..
+
+ LOCAL_C_INCLUDES := $(OIC_SRC_DIR)/resource/csdk/stack/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/logger/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common/oic_string/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/oc_logger/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/boost/boost_1_58_0
++LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/java/jni
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/include
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/src/common
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/src/provider
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/android/notification-service/src/main/jni/common
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/cpp-wrapper/common
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/service/notification/cpp-wrapper/provider/inc
+
+ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/
+
+ LOCAL_SRC_FILES := provider/JniNotificationProvider.cpp
+ LOCAL_SRC_FILES += common/JniNotificationCommon.cpp
+
+ include $(BUILD_SHARED_LIBRARY)
--- /dev/null
- notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../../../android/android_api/base/jni'])
+ #******************************************************************
+ #
+ # Copyright 2016 Samsung Electronics All Rights Reserved.
+ #
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+ ##
+ # Notification Service c++ wrapper build script
+ ##
+
+ import platform
+ Import('env')
+
+ if env.get('RELEASE'):
+ env.AppendUnique(CCFLAGS = ['-Os'])
+ env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+ else:
+ env.AppendUnique(CCFLAGS = ['-g'])
+
+ if env.get('LOGGING'):
+ env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+ lib_env = env.Clone()
+ SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
+ notification_env = lib_env.Clone()
+
+ target_os = env.get('TARGET_OS')
+
+ ######################################################################
+ # Build flags
+ ######################################################################
+ notification_env.AppendUnique(CPPPATH = ['../../include'])
+ notification_env.AppendUnique(CPPPATH = ['inc'])
+ notification_env.AppendUnique(CPPPATH = ['../common'])
+ notification_env.AppendUnique(CPPPATH = ['../provider/inc'])
+ notification_env.AppendUnique(CPPPATH = ['../../src/common'])
+
+ notification_env.PrependUnique(LIBS = [
+ 'oc_logger',
+ 'oc',
+ 'notification_consumer'
+ ])
+
+ notification_env.AppendUnique(CXXFLAGS = ['-std=c++0x','-frtti'])
+
+ if target_os not in ['windows', 'winrt']:
+ notification_env.AppendUnique(CCFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+
+ if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
+ notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+
+ if target_os == 'linux':
+ notification_env.AppendUnique(LIBS = ['pthread'])
+
+ if target_os == 'android':
+ notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+ notification_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
+
+ if not env.get('RELEASE'):
+ notification_env.PrependUnique(LIBS = ['gcov'])
+ notification_env.AppendUnique(CCFLAGS = ['--coverage'])
+
+ if env.get('WITH_CLOUD') == True:
+ notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+
+ ######################################################################
+ # Source files and Targets for Consumer
+ ######################################################################
+ notification_jni_consumer_env = notification_env.Clone()
+
+ Import('notificationCommonStaticObjs')
+ Import('notificationCommonSharedObjs')
+
+ notification_consumer_src = [
+ env.Glob('src/*.cpp'),notificationCommonSharedObjs]
+
+ consumersdk = notification_env.SharedLibrary('notification_consumer_wrapper', notification_consumer_src)
+ notification_env.InstallTarget(consumersdk, 'libnotification_consumer_wrapper')
+ notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer_wrapper')
+
+ notification_consumer_src = [
+ env.Glob('src/*.cpp'),notificationCommonStaticObjs]
+
+ consumersdk = notification_env.StaticLibrary('notification_consumer_wrapper', notification_consumer_src)
+ notification_env.InstallTarget(consumersdk, 'libnotification_consumer_wrapper')
+ notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer_wrapper')
+
+ ######################################################################
+ # Source files and Targets for Consumer Jni
+ ######################################################################
+ if target_os == 'android':
+ notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../../../extlibs/boost/boost_1_58_0'])
++ notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../../../java/jni'])
+ notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/common'])
+ notification_jni_consumer_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/consumer'])
+
+ notification_jni_consumer_env.PrependUnique(LIBS = [
+ 'notification_consumer_wrapper'
+ ])
+
+ notification_consumer_jni_src = [
+ env.Glob('../../android/notification-service/src/main/jni/consumer/*.cpp'),
+ env.Glob('../../android/notification-service/src/main/jni/common/*.cpp')]
+
+ consumerJni = notification_jni_consumer_env.SharedLibrary('notification_consumer_jni', notification_consumer_jni_src)
+ notification_jni_consumer_env.InstallTarget(consumerJni, 'libnotification_consumer_jni')
+ notification_jni_consumer_env.UserInstallTargetLib(consumerJni, 'libnotification_consumer_jni')
--- /dev/null
- notification_jni_provider_env.AppendUnique(CPPPATH = ['../../../../android/android_api/base/jni'])
+ #******************************************************************
+ #
+ # Copyright 2016 Samsung Electronics All Rights Reserved.
+ #
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+ ##
+ # Notification Service c++ wrapper build script
+ ##
+
+ import platform
+ Import('env')
+
+ if env.get('RELEASE'):
+ env.AppendUnique(CCFLAGS = ['-Os'])
+ env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+ else:
+ env.AppendUnique(CCFLAGS = ['-g'])
+
+ if env.get('LOGGING'):
+ env.AppendUnique(CPPDEFINES = ['TB_LOG'])
+
+ lib_env = env.Clone()
+ SConscript(env.get('SRC_DIR') + '/service/third_party_libs.scons', 'lib_env')
+ notification_env = lib_env.Clone()
+
+ target_os = env.get('TARGET_OS')
+
+ ######################################################################
+ # Build flags
+ ######################################################################
+ notification_env.AppendUnique(CPPPATH = ['../../include'])
+ notification_env.AppendUnique(CPPPATH = ['inc'])
+ notification_env.AppendUnique(CPPPATH = ['../common'])
+ notification_env.AppendUnique(CPPPATH = ['../consumer/inc'])
+ notification_env.AppendUnique(CPPPATH = ['../../src/common'])
+
+ notification_env.PrependUnique(LIBS = [
+ 'oc_logger',
+ 'oc',
+ 'notification_provider'
+ ])
+ notification_env.AppendUnique(CXXFLAGS = ['-std=c++0x','-frtti'])
+
+ if target_os not in ['windows', 'winrt']:
+ notification_env.AppendUnique(CCFLAGS = ['-O2', '-g', '-Wall', '-fmessage-length=0'])
+
+ if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
+ notification_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
+
+ if target_os == 'linux':
+ notification_env.AppendUnique(LIBS = ['pthread'])
+
+ if target_os == 'android':
+ notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
+ notification_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
+
+ if not env.get('RELEASE'):
+ notification_env.PrependUnique(LIBS = ['gcov'])
+ notification_env.AppendUnique(CCFLAGS = ['--coverage'])
+
+ if env.get('WITH_CLOUD') == True:
+ notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])
+
+ ######################################################################
+ # Source files and Targets for Provider
+ ######################################################################
+ notification_jni_provider_env = notification_env.Clone()
+
+ notificationCommonStaticObjs = [
+ notification_env.Object('../common/NSMediaContents.cpp'),
+ notification_env.Object('../common/NSMessage.cpp'),
+ notification_env.Object('../common/NSSyncInfo.cpp'),
+ notification_env.Object('../common/NSTopic.cpp'),
+ notification_env.Object('../common/NSTopicsList.cpp')]
+
+ notificationCommonSharedObjs = [
+ notification_env.SharedObject('../common/NSMediaContents.cpp'),
+ notification_env.SharedObject('../common/NSMessage.cpp'),
+ notification_env.SharedObject('../common/NSSyncInfo.cpp'),
+ notification_env.SharedObject('../common/NSTopic.cpp'),
+ notification_env.SharedObject('../common/NSTopicsList.cpp')]
+
+ notification_provider_src = [
+ env.Glob('src/*.cpp'),notificationCommonSharedObjs]
+
+ providersdk = notification_env.SharedLibrary('notification_provider_wrapper', notification_provider_src)
+ notification_env.InstallTarget(providersdk, 'libnotification_provider_wrapper')
+ notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider_wrapper')
+
+ notification_provider_src = [
+ env.Glob('src/*.cpp'),notificationCommonStaticObjs]
+
+ providersdk = notification_env.StaticLibrary('notification_provider_wrapper', notification_provider_src)
+ notification_env.InstallTarget(providersdk, 'libnotification_provider_wrapper')
+ notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider_wrapper')
+
+ Export('notificationCommonStaticObjs')
+ Export('notificationCommonSharedObjs')
+
+ ######################################################################
+ # Source files and Targets for Provider Jni
+ ######################################################################
+ if target_os == 'android':
+ notification_jni_provider_env.AppendUnique(CPPPATH = ['../../../../extlibs/boost/boost_1_58_0'])
++ notification_jni_provider_env.AppendUnique(CPPPATH = ['../../../../java/jni'])
+ notification_jni_provider_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/common'])
+ notification_jni_provider_env.AppendUnique(CPPPATH = ['../../android/notification-service/src/main/jni/provider'])
+
+ notification_jni_provider_env.PrependUnique(LIBS = [
+ 'notification_provider_wrapper'
+ ])
+
+ notification_provider_jni_src = [
+ env.Glob('../../android/notification-service/src/main/jni/provider/*.cpp'),
+ env.Glob('../../android/notification-service/src/main/jni/common/*.cpp')]
+
+ providerJni = notification_jni_provider_env.SharedLibrary('notification_provider_jni', notification_provider_jni_src)
+ notification_jni_provider_env.InstallTarget(providerJni, 'libnotification_provider_jni')
+ notification_jni_provider_env.UserInstallTargetLib(providerJni, 'libnotification_provider_jni')
1. build Iotivity with TARGET_OS=android
2. Copy aar files into app/libs folder
-- - {Iotivity_root}/android/android_api/base/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
++ - {Iotivity_root}/java/iotivity-android/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
- {Iotivity_root}/service/resource-encapsulation/android/service/build/outputs/aar/iotivity-{TARGET_ARCH}-service-{MODE}.aar
3. Configure dependencies for libs in app/build.gradle
1. build Iotivity with TARGET_OS=android
2. Copy aar files into app/libs folder
-- - {Iotivity_root}/android/android_api/base/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
++ - {Iotivity_root}/java/iotivity-android/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
- {Iotivity_root}/service/resource-encapsulation/android/service/build/outputs/aar/iotivity-{TARGET_ARCH}-service-{MODE}.aar
3. Configure dependencies for libs in app/build.gradle
1. build Iotivity with TARGET_OS=android
2. Copy aar files into app/libs folder
-- - {Iotivity_root}/android/android_api/base/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
++ - {Iotivity_root}/java/iotivity-android/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
- {Iotivity_root}/service/resource-encapsulation/android/service/build/outputs/aar/iotivity-{TARGET_ARCH}-service-{MODE}.aar
3. Configure dependencies for libs in app/build.gradle
1. build Iotivity with TARGET_OS=android
2. Copy aar files into app/libs folder
-- - {Iotivity_root}/android/android_api/base/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
++ - {Iotivity_root}/java/iotivity-android/build/outputs/aar/iotivity-{TARGET_ARCH}-base-{MODE}.aar
- {Iotivity_root}/service/resource-encapsulation/android/service/build/outputs/aar/iotivity-{TARGET_ARCH}-service-{MODE}.aar
3. Configure dependencies for libs in app/build.gradle
{
resourceAttributes[KEY] = nullptr;
-- ASSERT_EQ(resourceAttributes[KEY], nullptr);
++ //ASSERT_EQ(resourceAttributes[KEY], nullptr);
}
TEST_F(ResourceAttributesTest, ValueChangedIfPutWithSameKey)
RCSResourceAttributes::Value one { 1 };
RCSResourceAttributes::Value another { std::move(one) };
-- ASSERT_EQ(nullptr, one);
++ //ASSERT_EQ(nullptr, one);
}
TEST(ResourceAttributesValueTest, MovedValueWithAssignmentHasNull)
another = std::move(one);
-- ASSERT_EQ(nullptr, one);
++ //ASSERT_EQ(nullptr, one);
}
TEST(ResourceAttributesValueTest, SameValuesAreEqual)
RCSResourceAttributes resourceAttributes{
ResourceAttributesConverter::fromOCRepresentation(ocRep) };
-- ASSERT_EQ(nullptr, resourceAttributes[KEY]);
++ //ASSERT_EQ(nullptr, resourceAttributes[KEY]);
}
TEST(ResourceAttributesConverterTest, OCRepresentationHasNullWhenResourceAttributeIsNullptr)
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
--OIC_LIB_PATH := ../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
++OIC_LIB_PATH := ../../../../../java/iotivity-android/build/native-libs/$(TARGET_ARCH_ABI)
LOCAL_MODULE := ca_interface
LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libca-interface.so
include $(PREBUILT_SHARED_LIBRARY)
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
--OIC_LIB_PATH := ../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
++OIC_LIB_PATH := ../../../../../java/iotivity-android/build/native-libs/$(TARGET_ARCH_ABI)
LOCAL_MODULE := ocstack-jni
LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libocstack-jni.so
include $(PREBUILT_SHARED_LIBRARY)
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
--OIC_LIB_PATH := ../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
++OIC_LIB_PATH := ../../../../../java/iotivity-android/build/native-libs/$(TARGET_ARCH_ABI)
LOCAL_MODULE := android-ocstack-jni
LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libocstack-jni.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
--OIC_LIB_PATH := ../../../../../android/android_api/base/libs/$(TARGET_ARCH_ABI)
++OIC_LIB_PATH := ../../../../../java/iotivity-android/build/native-libs/$(TARGET_ARCH_ABI)
LOCAL_MODULE := android-ca-interface
LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libca-interface.so
include $(PREBUILT_SHARED_LIBRARY)
LOCAL_MODULE := things-manager-jni
LOCAL_C_INCLUDES := $(LOCAL_PATH)/jniutil/inc \
-- $(OIC_SRC_DIR)/android/android_api/base/jni \
++ $(OIC_SRC_DIR)/java/jni \
$(OIC_SRC_DIR)/resource/include \
$(OIC_SRC_DIR)/resource/c_common \
$(OIC_SRC_DIR)/resource/csdk/stack/include \
tm_jni_env = lib_env.Clone()
target_os = tm_jni_env.get('TARGET_OS')
tm_sdk = tm_jni_env.get('SRC_DIR') + '/service/things-manager/sdk'
--base_jni = tm_jni_env.get('SRC_DIR') + '/android/android_api/base/jni'
++base_jni = tm_jni_env.get('SRC_DIR') + '/java/jni'
extlibs = tm_jni_env.get('SRC_DIR') + '/extlibs'
######################################################################