From: jihwan.seo Date: Wed, 7 Oct 2015 05:30:56 +0000 (+0900) Subject: modified build option for CoAP/TCP X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=140db8eb74dcc1a35586e76bbdcf5ecc87e960a7;p=contrib%2Fiotivity.git modified build option for CoAP/TCP - There is no way to select ALL option without TCP in previous build option. - CoAP/TCP should be also used WITH_TCP option like WITH_RA. - and CoAP/TCP can be supported optionally more easy for Non-IP Transfer. Change-Id: I39473e0c05c8f3950e9df78d118b9986dda42362 Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/3677 Tested-by: jenkins-iotivity Reviewed-by: Patrick Lankswert --- diff --git a/build_common/SConscript b/build_common/SConscript index 9f06e12..6bbdbde 100644 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -79,6 +79,7 @@ help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map help_vars.Add(BoolVariable('WITH_RA', 'Build with Remote Access module', False)) +help_vars.Add(BoolVariable('WITH_TCP', 'Build with TCP adapter', False)) help_vars.Add(EnumVariable('WITH_RD', 'Build including Resource Directory', '0', allowed_values=('0', '1'))) help_vars.Add(BoolVariable('SIMULATOR', 'Build with simulator module', False)) @@ -89,7 +90,7 @@ help_vars.Add(BoolVariable('WITH_RA_IBB', 'Build with Remote Access module(works if target_os in targets_disallow_multitransport: help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'IP', ['BT', 'BLE', 'IP'])) else: - help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP', 'TCP'])) + help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP'])) help_vars.Add(EnumVariable('TARGET_ARCH', 'Target architecture', default_arch, os_arch_map[target_os])) help_vars.Add(EnumVariable('SECURED', 'Build with DTLS', '0', allowed_values=('0', '1'))) diff --git a/resource/csdk/connectivity/SConscript b/resource/csdk/connectivity/SConscript index fbcbe66..0e37d4b 100644 --- a/resource/csdk/connectivity/SConscript +++ b/resource/csdk/connectivity/SConscript @@ -8,6 +8,7 @@ target_os = env.get('TARGET_OS') transport = env.get('TARGET_TRANSPORT') build_sample = env.get('BUILD_SAMPLE') with_ra = env.get('WITH_RA') +with_tcp = env.get('WITH_TCP') print "Given Transport is %s" % transport print "Given OS is %s" % target_os @@ -24,8 +25,10 @@ if target_os in targets_disallow_multitransport: if 'ALL' in transport: if with_ra == True: env.AppendUnique(CPPDEFINES = ['RA_ADAPTER']) + if with_tcp == True: + env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER']) if target_os == 'linux': - env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','LE_ADAPTER', 'TCP_ADAPTER']) + env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','NO_EDR_ADAPTER','LE_ADAPTER']) elif target_os == 'tizen': env.AppendUnique(CPPDEFINES = ['IP_ADAPTER','EDR_ADAPTER','LE_ADAPTER']) elif target_os in['darwin','ios']: @@ -56,7 +59,7 @@ else: else: env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER']) - if 'TCP' in transport: + if with_tcp == True: if target_os in['linux']: env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER']) print "CA Transport is TCP" diff --git a/resource/csdk/connectivity/lib/libcoap-4.1.1/SConscript b/resource/csdk/connectivity/lib/libcoap-4.1.1/SConscript index 2f42239..ded6fd0 100644 --- a/resource/csdk/connectivity/lib/libcoap-4.1.1/SConscript +++ b/resource/csdk/connectivity/lib/libcoap-4.1.1/SConscript @@ -8,6 +8,7 @@ libcoap_env = env.Clone() target_os = env.get('TARGET_OS') ca_transport = env.get('TARGET_TRANSPORT') +with_tcp = env.get('WITH_TCP') # As in the source code(C) includes arduino Time library head file(C++) # It requires compile the .c with g++ if target_os == 'arduino': @@ -37,7 +38,7 @@ if target_os not in ['windows', 'winrt']: '-fdata-sections', '-fno-exceptions']) if target_os == 'linux': - if (('TCP' in ca_transport) or ('ALL' in ca_transport)): + if with_tcp == True: libcoap_env.AppendUnique(CPPDEFINES = ['WITH_TCP']) if target_os == 'android': diff --git a/resource/csdk/connectivity/src/SConscript b/resource/csdk/connectivity/src/SConscript index 95a8076..8c4309c 100755 --- a/resource/csdk/connectivity/src/SConscript +++ b/resource/csdk/connectivity/src/SConscript @@ -10,6 +10,7 @@ ca_os = env.get('TARGET_OS') ca_transport = env.get('TARGET_TRANSPORT') secured = env.get('SECURED') with_ra = env.get ('WITH_RA') +with_tcp = env.get('WITH_TCP') root_dir = os.pardir ca_path = os.curdir @@ -112,6 +113,7 @@ env.AppendUnique(CA_SRC = ca_common_src) if 'ALL' in ca_transport: transports = [ 'ip_adapter', 'bt_edr_adapter', 'bt_le_adapter'] if ca_os == 'linux': + if with_tcp: transports.append ('tcp_adapter') if with_ra: transports.append ('ra_adapter') @@ -127,8 +129,6 @@ if 'BT' in ca_transport: if 'BLE' in ca_transport: env.SConscript(os.path.join(ca_path, 'bt_le_adapter/SConscript')) -if 'TCP' in ca_transport: - env.SConscript(os.path.join(ca_path, 'tcp_adapter/SConscript')) print "Include path is %s" % env.get('CPPPATH') print "Files path is %s" % env.get('CA_SRC') diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 60b036b..46a110b 100755 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -4197,6 +4197,10 @@ CAResult_t OCSelectNetwork() #ifdef RA_ADAPTER ,CA_ADAPTER_REMOTE_ACCESS #endif + +#ifdef TCP_ADAPTER + ,CA_ADAPTER_TCP +#endif }; int numConnTypes = sizeof(connTypes)/sizeof(connTypes[0]);