env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
if with_tcp == True:
- if target_os in['linux']:
+ if target_os in ['linux', 'tizen']:
env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER'])
print "CA Transport is TCP"
else:
help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
help_vars.Add(BoolVariable('LOGGING', 'Enable stack logging', False))
help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
-help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'BT', 'BLE', 'IP', 'TCP']))
+help_vars.Add(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')))
help_vars.Add(BoolVariable('UPLOAD', 'Upload binary ? (For Arduino)', require_upload))
help_vars.Add(EnumVariable('ROUTING', 'Enable routing', 'EP', allowed_values=('GW', 'EP')))
help_vars.Add(EnumVariable('BUILD_SAMPLE', 'Build with sample', 'ON', allowed_values=('ON', 'OFF')))
+help_vars.Add(BoolVariable('WITH_TCP', 'Enable TCP', False))
help_vars.AddVariables(('DEVICE_NAME', 'Network display name for device', 'OIC-DEVICE', None, None),)
release_mode = env.get('RELEASE')
secured = env.get('SECURED')
logging = env.get('LOGGING')
+with_tcp = env.get('WITH_TCP')
print "Given Transport is %s" % transport
print "Given OS is %s" % target_os
if target_os == 'tizen':
- command = "sh resource/csdk/connectivity/build/tizen/gbsbuild.sh %s %s %s %s %s" % (transport, secured, buildsample, release_mode, logging)
+ command = "sh resource/csdk/connectivity/build/tizen/gbsbuild.sh %s %s %s %s %s %s" % (transport, secured, buildsample, release_mode, logging, with_tcp)
print "Created Command is %s" % command
gbs_script = env.Command('gbs_build', None, command)
AlwaysBuild ('gbs_script')
\ No newline at end of file
echo $5
export LOGGING=$5
+echo $6
+export WITH_TCP=$6
+
echo $TARGET_TRANSPORT
echo $BUILD_SAMPLE
+echo $WITH_TCP
rm -rf $name-$version
fi
echo "Calling core gbs build command"
-gbscommand="gbs build -A armv7l --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5'"
+gbscommand="gbs build -A armv7l --include-all --repository ./ --define 'TARGET_TRANSPORT $1' --define 'SECURED $2' --define 'RELEASE $4' --define 'LOGGING $5' --define 'WITH_TCP $6'"
echo $gbscommand
if eval $gbscommand; then
echo "Core build is successful"
echo %{ROOTDIR}
scons TARGET_OS=tizen -c
-scons TARGET_OS=tizen TARGET_TRANSPORT=%{TARGET_TRANSPORT} SECURED=%{SECURED} RELEASE=%{RELEASE} LOGGING=%{LOGGING}
+scons TARGET_OS=tizen TARGET_TRANSPORT=%{TARGET_TRANSPORT} SECURED=%{SECURED} RELEASE=%{RELEASE} LOGGING=%{LOGGING} WITH_TCP=%{WITH_TCP}
%install
mkdir -p %{DEST_INC_DIR}
target_os = env.get('TARGET_OS')
transport = env.get('TARGET_TRANSPORT')
+with_tcp = env.get('WITH_TCP')
print "Given Transport is %s" % transport
else:
env.AppendUnique(CPPDEFINES = ['NO_WIFI_ADAPTER'])
+ if with_tcp == True:
+ env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER'])
+ print "CA Transport is TCP"
+ else:
+ env.AppendUnique(CPPDEFINES = ['NO_TCP_ADAPTER'])
+
env.SConscript(['../con/lib/libcoap-4.1.1/SConscript'])
env.SConscript(['../con/SConscript'])
libcoap_env.AppendUnique(CFLAGS = ['-Wall', '-ffunction-sections',
'-fdata-sections', '-fno-exceptions'])
-if target_os == 'linux':
+if target_os in ['linux', 'tizen']:
if with_tcp == True:
libcoap_env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
#define COAPS_PREFIX "coaps://"
#define COAPS_PREFIX_LEN 8
+#define COAP_TCP_PREFIX "coap+tcp://"
+#define COAP_TCP_PREFIX_LEN 11
+
// Iotivity Device Identity.
const unsigned char IDENTITY[] = ("1111111111111111");
printf("Enter the URI like below....\n");
printf("coap://10.11.12.13:4545/resource_uri ( for IP )\n");
printf("coap://10:11:12:13:45:45/resource_uri ( for BT )\n");
+ printf("coap+tcp://10:11:12:13:45:45/resource_uri ( for TCP )\n");
}
else
{
printf("IP : 0\n");
printf("GATT : 1\n");
printf("RFCOMM : 2\n");
+ printf("TCP : 4\n");
printf("select : ");
char buf[MAX_BUF_LEN] = { 0 };
int number = buf[0] - '0';
- if (number < 0 || number > 3)
+ if (number < 0 || number > 4)
{
printf("Invalid network type\n");
return;
printf("IP : 0\n");
printf("GATT : 1\n");
printf("RFCOMM : 2\n");
+ printf("TCP : 4\n");
printf("select : ");
char buf[MAX_BUF_LEN] = { 0 };
int number = buf[0] - '0';
- if (number < 0 || number > 3)
+ if (number < 0 || number > 4)
{
printf("Invalid network type\n");
return;
printf("IP : 0\n");
printf("GATT : 1\n");
printf("RFCOMM : 2\n");
+ printf("TCP : 4\n");
printf("select : ");
char buf[MAX_BUF_LEN] = { 0 };
}
int number = buf[0] - '0';
- if (0 > number || 2 < number)
+ if (0 > number || 4 < number)
{
printf("\nInvalid Network type");
return CA_NOT_SUPPORTED;
startIndex = COAP_PREFIX_LEN;
*flags = CA_IPV4;
}
+ else if (strncmp(COAP_TCP_PREFIX, uri, COAP_TCP_PREFIX_LEN) == 0)
+ {
+ printf("uri has '%s' prefix\n", COAP_TCP_PREFIX);
+ startIndex = COAP_TCP_PREFIX_LEN;
+ *flags = CA_IPV4;
+ }
// #2. copy uri for parse
int32_t len = strlen(uri) - startIndex;
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')
env.SConscript(dirs = [
if 'BLE' in ca_transport:
env.SConscript(os.path.join(ca_path, 'bt_le_adapter/SConscript'))
+if ca_os in ['linux', 'tizen']:
+ if with_tcp == True:
+ 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')
# Source files to build common for all platforms
common_files = None
-if target_os == 'linux':
+if target_os in ['linux', 'tizen']:
common_files = [
os.path.join(src_dir, 'catcpadapter.c'),
os.path.join(src_dir, 'catcpserver.c') ]