removed CASample App for CA 81/7381/7
authorjihwanseo <jihwan.seo@samsung.com>
Mon, 28 Mar 2016 07:16:18 +0000 (16:16 +0900)
committerJon A. Cruz <jon@joncruz.org>
Wed, 30 Mar 2016 09:01:29 +0000 (09:01 +0000)
since simpleserver and simpleclient can be covered it.
remove all sample sources.

Change-Id: Ib5960c0e9ee3ef8093718f0dd5f0e93b3db8e16f
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Signed-off-by: Abhishek Sharma <ce.abhishek@samsung.com>
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/7381
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Tim Kourt <tim.a.kourt@intel.com>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
65 files changed:
auto_build.sh
resource/csdk/connectivity/samples/android/SConscript [deleted file]
resource/csdk/connectivity/samples/android/casample/.gitignore [deleted file]
resource/csdk/connectivity/samples/android/casample/SConscript [deleted file]
resource/csdk/connectivity/samples/android/casample/build.gradle [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/.gitignore [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/build.gradle [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/cAInterface.iml [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/.gitignore [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/AndroidManifest.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaEdrInterface.java [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaIpInterface.java [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaLeClientInterface.java [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaLeServerInterface.java [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaNfcInterface.java [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-hdpi/ic_launcher.png [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-mdpi/ic_launcher.png [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-xhdpi/ic_launcher.png [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values-v11/styles.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values-v14/styles.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values/strings.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values/styles.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/casample.iml [deleted file]
resource/csdk/connectivity/samples/android/casample/gradle.properties [deleted file]
resource/csdk/connectivity/samples/android/casample/gradle/wrapper/gradle-wrapper.jar [deleted file]
resource/csdk/connectivity/samples/android/casample/gradle/wrapper/gradle-wrapper.properties [deleted file]
resource/csdk/connectivity/samples/android/casample/gradlew [deleted file]
resource/csdk/connectivity/samples/android/casample/gradlew.bat [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/.gitignore [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/build.gradle [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/sampleService.iml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/.gitignore [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/AndroidManifest.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/DLog.java [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/FileChooser.java [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/MainActivity.java [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/RMInterface.java [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/Android.mk [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/Application.mk [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/ResourceModel.c [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/org_iotivity_ca_service_RMInterface.h [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/layout/activity_main.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/menu/main.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-v11/styles.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-v14/styles.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-w820dp/dimens.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/dimens.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/strings.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/styles.xml [deleted file]
resource/csdk/connectivity/samples/android/casample/settings.gradle [deleted file]
resource/csdk/connectivity/samples/arduino/SConscript [deleted file]
resource/csdk/connectivity/samples/arduino/casample.cpp [deleted file]
resource/csdk/connectivity/samples/linux/README [deleted file]
resource/csdk/connectivity/samples/linux/SConscript [deleted file]
resource/csdk/connectivity/samples/linux/sample_main.c [deleted file]
resource/csdk/connectivity/samples/linux/threadpool/main.c [deleted file]
resource/csdk/connectivity/samples/tizen/README.txt [deleted file]
resource/csdk/connectivity/samples/tizen/SConscript [deleted file]
resource/csdk/connectivity/samples/tizen/SConstruct [deleted file]
resource/csdk/connectivity/samples/tizen/casample.c [deleted file]
resource/csdk/connectivity/samples/tizen/com.oic.ca.sample.manifest [deleted file]
resource/csdk/connectivity/samples/tizen/com.oic.ca.sample.xml [deleted file]
resource/csdk/connectivity/samples/tizen/gbsbuild.sh [deleted file]
resource/csdk/connectivity/samples/tizen/packaging/com.oic.ca.sample.spec [deleted file]
resource/csdk/connectivity/samples/tizen/scons/SConscript [deleted file]

index 1a279d0..aa2dcd4 100755 (executable)
@@ -142,12 +142,6 @@ function build_tizen()
        echo "*********** Build for Tizen *************"
        ./gbsbuild.sh
 
-       echo "*********** Build for Tizen CA lib and sample *************"
-       scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
-
-       echo "*********** Build for Tizen CA lib and sample with Security *************"
-       scons -f resource/csdk/connectivity/build/tizen/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true SECURED=1 RELEASE=$1 $2
-
        echo "*********** Build for Tizen octbstack lib and sample *************"
        scons -f resource/csdk/stack/samples/tizen/build/SConscript TARGET_OS=tizen TARGET_TRANSPORT=IP LOGGING=true RELEASE=$1 $2
 
diff --git a/resource/csdk/connectivity/samples/android/SConscript b/resource/csdk/connectivity/samples/android/SConscript
deleted file mode 100644 (file)
index 6fe7388..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-##
-# Building sample application
-##
-
-Import('env')
-
-app_env = env.Clone()
-
-ca_os = app_env.get('TARGET_OS')
-ca_transport = app_env.get('TARGET_TRANSPORT')
-secured = app_env.get('SECURED')
-
-root_dir = './../../'
-main_dir  = Dir('.').srcnode().abspath
-jni_dir = main_dir + '/sample_serivce/android/jni'
-env.PrependUnique(CPPPATH = ['jni_dir'])
-app_env.PrependUnique(CPPDEFINES = ['__ANDROID__'])
-
-#####################################################################
-# Source files and Target(s)
-######################################################################
-
-print"Reading ca script %s"%ca_transport
-
-app_env.AppendUnique(CPPPATH = [root_dir + '/api/'])
-app_env.AppendUnique(CPPPATH = [root_dir + '/inc/'])
-app_env.AppendUnique(CPPPATH = [root_dir + '/common/inc/'])
-app_env.AppendUnique(CPPPATH = [root_dir + 'lib/libcoap-4.1.1'])
-
-print "Reading sample application build script"
-
-build_dir = app_env.get('BUILD_DIR')
-secured = app_env.get('SECURED')
-
-print "Sample secured flag is %s" % secured
-
-sample_dir = 'casample/sampleService/src/main/jni/'
-sample_src = [sample_dir + 'ResourceModel.c',]
-
-print " sample src %s" % sample_src
-
-app_env.AppendUnique(LIBPATH = [app_env.get('BUILD_DIR'), '.',])
-app_env.AppendUnique(CPPPATH = ['lib/android'])
-app_env.PrependUnique(LIBS = ['connectivity_abstraction'])
-app_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
-
-
-if secured == '1':
-       app_env.AppendUnique(CPPPATH = [root_dir + 'external/inc/'])
-       app_env.PrependUnique(CPPDEFINES = ['__WITH_DTLS__'])
-
-libRMInterface = app_env.SharedLibrary('RMInterface', sample_src, OBJPREFIX='libRMInterface_')
-app_env.InstallTarget(libRMInterface, 'RMInterface')
-
-
diff --git a/resource/csdk/connectivity/samples/android/casample/.gitignore b/resource/csdk/connectivity/samples/android/casample/.gitignore
deleted file mode 100644 (file)
index 6f9b76a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-local.properties
-import-summary.txt
-/.idea/
-/.gradle/
-/build/
diff --git a/resource/csdk/connectivity/samples/android/casample/SConscript b/resource/csdk/connectivity/samples/android/casample/SConscript
deleted file mode 100644 (file)
index e285068..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-import os
-import platform
-Import('env')
-
-ANDROID_TARGET_ARCH = env.get('TARGET_ARCH')
-if env.get('RELEASE'):
-       ANDROID_RELEASE="release"
-else:
-       ANDROID_RELEASE="debug"
-
-print '''
-***************************************** Info ********************************
-* NOTE: If you have a problem in downloading the gradle-core-1.1.0.jar file   *
-*       please do one time setup as below                                     *
-*                                                                             *
-* Edit resource/csdk/connectivity/samples/android/casample/gradle.properties  *
-* Add the proxy information as below :                                        *
-*    systemProp.http.proxyPort=<YOUR_PORT_NUMBER>                             *
-*    systemProp.http.proxyHost=<YOUR_HTTP_PROXY_ADDRESS>                      *
-*    systemProp.https.proxyPort=<YOUR_PORT_NUMBER>                            *
-*    systemProp.https.proxyHost=<YOUR_HTTP_PROXY_ADDRESS>                     *
-*                                                                             *
-*******************************************************************************
-'''
-jdk_env = Environment(ENV=os.environ)
-jdk_env['BUILDERS']['Gradle'] = Builder(action = env.get('ANDROID_GRADLE') + ' build -b' + Dir('.').srcnode().abspath + '/build.gradle -PTARGET_ARCH=%s -PRELEASE=%s' %(ANDROID_TARGET_ARCH, ANDROID_RELEASE))
-jdk_env.Gradle(target="base/objs", source="sampleService/src/main/java/org/iotivity/ca/service/MainActivity.java")
-
diff --git a/resource/csdk/connectivity/samples/android/casample/build.gradle b/resource/csdk/connectivity/samples/android/casample/build.gradle
deleted file mode 100755 (executable)
index 2712137..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-buildscript {
-    repositories {
-        jcenter()
-               {
-                       url "http://jcenter.bintray.com"
-               }
-    }
-    dependencies {
-        classpath 'com.android.tools.build:gradle:1.3.0'
-    }
-}
-
-allprojects {
-    repositories {
-        jcenter()
-               {
-                       url "http://jcenter.bintray.com"
-               }
-    }
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/.gitignore b/resource/csdk/connectivity/samples/android/casample/cAInterface/.gitignore
deleted file mode 100644 (file)
index 84c048a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/build.gradle b/resource/csdk/connectivity/samples/android/casample/cAInterface/build.gradle
deleted file mode 100755 (executable)
index 6ca1fe0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-apply plugin: 'com.android.library'
-
-android {
-    compileSdkVersion 21
-    buildToolsVersion "20.0.0"
-
-    defaultConfig {
-        minSdkVersion 21
-        targetSdkVersion 21
-    }
-
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
-        }
-    }
-
-    lintOptions {
-       abortOnError false
-    }
-}
-
-dependencies {
-//    compile 'com.android.support:support-v4:21.0.3'
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/cAInterface.iml b/resource/csdk/connectivity/samples/android/casample/cAInterface/cAInterface.iml
deleted file mode 100755 (executable)
index 217b60e..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="MainActivity" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
-  <component name="FacetManager">
-    <facet type="android-gradle" name="Android-Gradle">
-      <configuration>
-        <option name="GRADLE_PROJECT_PATH" value=":cAInterface" />
-      </configuration>
-    </facet>
-    <facet type="android" name="Android">
-      <configuration>
-        <option name="SELECTED_BUILD_VARIANT" value="debug" />
-        <option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
-        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
-        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
-        <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
-        <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
-        <option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
-        <option name="ALLOW_USER_CONFIGURATION" value="false" />
-        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
-        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
-        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
-        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
-        <option name="LIBRARY_PROJECT" value="true" />
-      </configuration>
-    </facet>
-  </component>
-  <component name="NewModuleRootManager" inherit-compiler-output="false">
-    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
-    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
-      <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
-      <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
-    </content>
-    <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
-    <orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
-  </component>
-</module>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/.gitignore b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/.gitignore
deleted file mode 100644 (file)
index 7cf58ac..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/assets/
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/AndroidManifest.xml b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/AndroidManifest.xml
deleted file mode 100755 (executable)
index 4bc64f6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="org.iotivity.ca"
-    android:versionCode="1"
-    android:versionName="1.0" >
-
-    <uses-sdk
-        android:minSdkVersion="21"
-        android:targetSdkVersion="21" />
-
-    <application
-        android:allowBackup="true"
-        android:icon="@drawable/ic_launcher"
-        android:label="@string/app_name"
-        android:theme="@style/AppTheme" >
-    </application>
-
-</manifest>
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaEdrInterface.java b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaEdrInterface.java
deleted file mode 100644 (file)
index 7a07b24..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/******************************************************************
- *
- * Copyright 2014 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.
- *
- ******************************************************************/
-
-package org.iotivity.ca;
-
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-
-public class CaEdrInterface {
-    private static Context mContext;
-
-    private CaEdrInterface(Context context) {
-        mContext = context;
-        registerIntentFilter();
-    }
-
-    private static IntentFilter registerIntentFilter() {
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
-        filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
-        mContext.registerReceiver(mReceiver, filter);
-        return filter;
-    }
-
-    public static void destroyEdrInterface() {
-        mContext.unregisterReceiver(mReceiver);
-    }
-
-    // Network Monitor
-    private native static void caEdrStateChangedCallback(int state);
-
-    private native static void caEdrBondStateChangedCallback(String addr);
-
-    private static final BroadcastReceiver mReceiver = new BroadcastReceiver() {
-
-        @Override
-        public void onReceive(Context context, Intent intent) {
-
-            String action = intent.getAction();
-
-            if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
-
-                int state =
-                        intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
-
-                // STATE_ON:12, STATE_OFF:10
-                if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_OFF)
-                {
-                    caEdrStateChangedCallback(state);
-                }
-            }
-
-            if (action != null && action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {
-
-                int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,
-                                                   BluetoothDevice.ERROR);
-
-                if (bondState == BluetoothDevice.BOND_NONE) {
-                    if ((intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
-                                            BluetoothDevice.ERROR)
-                                                == BluetoothDevice.BOND_BONDED)) {
-                        BluetoothDevice device
-                            = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
-
-                        caEdrBondStateChangedCallback(device.getAddress());
-                    }
-                }
-            }
-        }
-    };
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaIpInterface.java b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaIpInterface.java
deleted file mode 100644 (file)
index 1b85af5..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/******************************************************************
- *
- * Copyright 2014 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.
- *
- ******************************************************************/
-
-package org.iotivity.ca;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.net.wifi.WifiManager;
-
-public class CaIpInterface {
-    private static Context mContext;
-
-    private CaIpInterface(Context context) {
-        mContext = context;
-        registerIpStateReceiver();
-    }
-
-    private void registerIpStateReceiver() {
-        IntentFilter intentFilter = new IntentFilter();
-        intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
-        intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
-
-        mContext.registerReceiver(mReceiver, intentFilter);
-    }
-
-    public static void destroyIpInterface() {
-        mContext.unregisterReceiver(mReceiver);
-    }
-
-    private static BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            if (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,
-                WifiManager.WIFI_STATE_UNKNOWN) == WifiManager.WIFI_STATE_DISABLED) {
-                caIpStateDisabled();
-            } else if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
-                ConnectivityManager manager = (ConnectivityManager)
-                        mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
-                NetworkInfo nwInfo = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
-
-                if(nwInfo.isConnected()) {
-                    caIpStateEnabled();
-                }
-            }
-        }
-    };
-
-    private native static void caIpStateEnabled();
-
-    private native static void caIpStateDisabled();
-}
\ No newline at end of file
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaLeClientInterface.java b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaLeClientInterface.java
deleted file mode 100644 (file)
index 019438a..0000000
+++ /dev/null
@@ -1,276 +0,0 @@
-/******************************************************************
- *
- * Copyright 2014 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.
- *
- ******************************************************************/
-
-package org.iotivity.ca;
-
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothGatt;
-import android.bluetooth.BluetoothGattCallback;
-import android.bluetooth.BluetoothGattCharacteristic;
-import android.bluetooth.BluetoothGattDescriptor;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.util.Log;
-
-public class CaLeClientInterface {
-
-    private static String SERVICE_UUID = "ADE3D529-C784-4F63-A987-EB69F70EE816";
-    private static String TAG          = "Sample_Service : CaLeClientInterface";
-    private static Context mContext;
-
-    private CaLeClientInterface(Context context) {
-        caLeRegisterLeScanCallback(mLeScanCallback);
-        caLeRegisterGattCallback(mGattCallback);
-        mContext = context;
-        registerIntentFilter();
-    }
-
-    public static void getLeScanCallback() {
-        caLeRegisterLeScanCallback(mLeScanCallback);
-    }
-
-    public static void getLeGattCallback() {
-        caLeRegisterGattCallback(mGattCallback);
-    }
-
-    private static IntentFilter registerIntentFilter() {
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
-        filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
-        mContext.registerReceiver(mReceiver, filter);
-        return filter;
-    }
-
-    public static void destroyLeInterface() {
-        mContext.unregisterReceiver(mReceiver);
-    }
-
-    private native static void caLeRegisterLeScanCallback(BluetoothAdapter.LeScanCallback callback);
-
-    private native static void caLeRegisterGattCallback(BluetoothGattCallback callback);
-
-    // BluetoothAdapter.LeScanCallback
-    private native static void caLeScanCallback(BluetoothDevice device);
-
-    // BluetoothGattCallback
-    private native static void caLeGattConnectionStateChangeCallback(
-            BluetoothGatt gatt, int status, int newState);
-
-    private native static void caLeGattServicesDiscoveredCallback(BluetoothGatt gatt, int status);
-
-    private native static void caLeGattCharacteristicWriteCallback(
-            BluetoothGatt gatt, byte[] data, int status);
-
-    private native static void caLeGattCharacteristicChangedCallback(
-            BluetoothGatt gatt, byte[] data);
-
-    private native static void caLeGattDescriptorWriteCallback(BluetoothGatt gatt, int status);
-
-    private native static void caLeGattReliableWriteCompletedCallback(BluetoothGatt gatt,
-                                                                     int status);
-
-    private native static void caLeGattReadRemoteRssiCallback(BluetoothGatt gatt, int rssi,
-                                                             int status);
-
-    // Network Monitor
-    private native static void caLeStateChangedCallback(int state);
-
-    // bond state
-    private native static void caLeBondStateChangedCallback(String address);
-
-    // Callback
-    private static BluetoothAdapter.LeScanCallback mLeScanCallback =
-                   new BluetoothAdapter.LeScanCallback() {
-
-        @Override
-        public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) {
-
-            try {
-                List<UUID> uuids = getUuids(scanRecord);
-                for (UUID uuid : uuids) {
-                    Log.d(TAG, "UUID : " + uuid.toString());
-                    if(uuid.toString().contains(SERVICE_UUID.toLowerCase())) {
-                        Log.d(TAG, "we found that has the Device");
-                        caLeScanCallback(device);
-                    }
-                }
-            } catch(UnsatisfiedLinkError e) {
-
-            }
-        }
-    };
-
-    private static List<UUID> getUuids(final byte[] scanRecord) {
-        List<UUID> uuids = new ArrayList<UUID>();
-
-        int offset = 0;
-        while (offset < (scanRecord.length - 2)) {
-            int len = scanRecord[offset++];
-            if (len == 0)
-                break;
-
-            int type = scanRecord[offset++];
-
-            switch (type) {
-            case 0x02:
-            case 0x03:
-                while (len > 1) {
-                    int uuid16 = scanRecord[offset++];
-                    uuid16 += (scanRecord[offset++] << 8);
-                    len -= 2;
-                    uuids.add(UUID.fromString(String.format(
-                            "%08x-0000-1000-8000-00805f9b34fb", uuid16)));
-                }
-                break;
-            case 0x06:
-            case 0x07:
-                while (len >= 16) {
-                    try {
-                        ByteBuffer buffer = ByteBuffer.wrap(scanRecord, offset++, 16).
-                                                            order(ByteOrder.LITTLE_ENDIAN);
-                        long mostSigBits = buffer.getLong();
-                        long leastSigBits = buffer.getLong();
-                        uuids.add(new UUID(leastSigBits, mostSigBits));
-                    } catch (IndexOutOfBoundsException e) {
-                        Log.e(TAG, e.toString());
-                        continue;
-                    } finally {
-                        offset += 15;
-                        len -= 16;
-                    }
-                }
-                break;
-            default:
-                offset += (len - 1);
-                break;
-            }
-        }
-        return uuids;
-    }
-
-    private static final BluetoothGattCallback mGattCallback = new BluetoothGattCallback() {
-
-        @Override
-        public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
-            super.onConnectionStateChange(gatt, status, newState);
-
-            caLeGattConnectionStateChangeCallback(gatt, status, newState);
-        }
-
-        @Override
-        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
-            super.onServicesDiscovered(gatt, status);
-
-            caLeGattServicesDiscoveredCallback(gatt, status);
-        }
-
-        @Override
-        public void onCharacteristicRead(BluetoothGatt gatt,
-                BluetoothGattCharacteristic characteristic, int status) {
-            super.onCharacteristicRead(gatt, characteristic, status);
-        }
-
-        @Override
-        public void onCharacteristicWrite(BluetoothGatt gatt,
-                BluetoothGattCharacteristic characteristic, int status) {
-            super.onCharacteristicWrite(gatt, characteristic, status);
-
-            caLeGattCharacteristicWriteCallback(gatt, characteristic.getValue(), status);
-        }
-
-        @Override
-        public void onCharacteristicChanged(BluetoothGatt gatt,
-                BluetoothGattCharacteristic characteristic) {
-            super.onCharacteristicChanged(gatt, characteristic);
-
-            caLeGattCharacteristicChangedCallback(gatt, characteristic.getValue());
-        }
-
-        @Override
-        public void onDescriptorRead(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
-                int status) {
-            super.onDescriptorRead(gatt, descriptor, status);
-        }
-
-        @Override
-        public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor,
-                int status) {
-            super.onDescriptorWrite(gatt, descriptor, status);
-
-            caLeGattDescriptorWriteCallback(gatt, status);
-        }
-
-        @Override
-        public void onReliableWriteCompleted(BluetoothGatt gatt, int status) {
-            super.onReliableWriteCompleted(gatt, status);
-        }
-
-        @Override
-        public void onReadRemoteRssi(BluetoothGatt gatt, int rssi, int status) {
-            super.onReadRemoteRssi(gatt, rssi, status);
-        }
-    };
-
-    private static final BroadcastReceiver mReceiver = new BroadcastReceiver() {
-
-        @Override
-        public void onReceive(Context context, Intent intent) {
-
-            String action = intent.getAction();
-
-            if (action != null && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
-
-                int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
-                                               BluetoothAdapter.ERROR);
-
-                if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_OFF)
-                {
-                    caLeStateChangedCallback(state);
-                }
-            }
-
-            if (action != null && action.equals(BluetoothDevice.ACTION_BOND_STATE_CHANGED)) {
-
-                int bondState = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,
-                                                   BluetoothDevice.ERROR);
-
-                if (bondState == BluetoothDevice.BOND_NONE) {
-                    if ((intent.getIntExtra(BluetoothDevice.EXTRA_PREVIOUS_BOND_STATE,
-                            BluetoothDevice.ERROR) == BluetoothDevice.BOND_BONDED)) {
-                            BluetoothDevice device = intent
-                                .getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
-
-                        caLeBondStateChangedCallback(device.getAddress());
-                    }
-                }
-            }
-        }
-    };
-}
-
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaLeServerInterface.java b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaLeServerInterface.java
deleted file mode 100644 (file)
index b2ed163..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-/******************************************************************
- *
- * Copyright 2014 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.
- *
- ******************************************************************/
-
-package org.iotivity.ca;
-
-import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothGattCharacteristic;
-import android.bluetooth.BluetoothGattDescriptor;
-import android.bluetooth.BluetoothGattServerCallback;
-import android.bluetooth.BluetoothGattService;
-import android.bluetooth.le.AdvertiseCallback;
-import android.bluetooth.le.AdvertiseSettings;
-
-public class CaLeServerInterface {
-
-    private CaLeServerInterface() {
-
-        caLeRegisterGattServerCallback(mGattServerCallback);
-        caLeRegisterBluetoothLeAdvertiseCallback(mAdvertiseCallback);
-    }
-
-    public static void getLeGattServerCallback() {
-        caLeRegisterGattServerCallback(mGattServerCallback);
-    }
-
-    public static void getBluetoothLeAdvertiseCallback() {
-        caLeRegisterBluetoothLeAdvertiseCallback(mAdvertiseCallback);
-    }
-
-    private native static void caLeRegisterGattServerCallback(BluetoothGattServerCallback callback);
-
-    private native static void caLeRegisterBluetoothLeAdvertiseCallback(AdvertiseCallback callback);
-
-    // BluetoothGattServerCallback
-    private native static void caLeGattServerConnectionStateChangeCallback(
-            BluetoothDevice device, int status, int newState);
-
-    private native static void caLeGattServerServiceAddedCallback(int status,
-                                                                  BluetoothGattService service);
-
-    private native static void caLeGattServerCharacteristicReadRequestCallback(
-            BluetoothDevice device, byte[] data);
-
-    private native static void caLeGattServerCharacteristicWriteRequestCallback(
-            BluetoothDevice device, byte[] data);
-
-    private native static void caLeGattServerNotificationSentCallback(BluetoothDevice device,
-                                                                     int status);
-
-    // AdvertiseCallback
-    private native static void caLeAdvertiseStartSuccessCallback(
-            AdvertiseSettings settingsInEffect);
-
-    private native static void caLeAdvertiseStartFailureCallback(int errorCode);
-
-    private static final BluetoothGattServerCallback mGattServerCallback =
-                         new BluetoothGattServerCallback() {
-
-        @Override
-        public void onConnectionStateChange(BluetoothDevice device, int status,
-                int newState) {
-            super.onConnectionStateChange(device, status, newState);
-
-            caLeGattServerConnectionStateChangeCallback(device, status, newState);
-        }
-
-        @Override
-        public void onServiceAdded(int status, BluetoothGattService service) {
-            super.onServiceAdded(status, service);
-
-            caLeGattServerServiceAddedCallback(status, service);
-        }
-
-        @Override
-        public void onCharacteristicReadRequest(
-                BluetoothDevice device, int requestId, int offset,
-                BluetoothGattCharacteristic characteristic) {
-            super.onCharacteristicReadRequest(device, requestId, offset, characteristic);
-
-            caLeGattServerCharacteristicReadRequestCallback(device, characteristic.getValue());
-        }
-
-        @Override
-        public void onCharacteristicWriteRequest(
-                BluetoothDevice device, int requestId, BluetoothGattCharacteristic characteristic,
-                boolean preparedWrite, boolean responseNeeded, int offset, byte[] value) {
-            super.onCharacteristicWriteRequest(device, requestId, characteristic,
-                    preparedWrite, responseNeeded, offset, value);
-
-            caLeGattServerCharacteristicWriteRequestCallback(device, value);
-        }
-
-        @Override
-        public void onDescriptorReadRequest(
-                BluetoothDevice device,
-                int requestId, int offset, BluetoothGattDescriptor descriptor) {
-            super.onDescriptorReadRequest(device, requestId, offset, descriptor);
-        }
-
-        @Override
-        public void onDescriptorWriteRequest(
-                BluetoothDevice device, int requestId, BluetoothGattDescriptor descriptor,
-                boolean preparedWrite, boolean responseNeeded, int offset,
-                byte[] value) {
-            super.onDescriptorWriteRequest(device, requestId, descriptor, preparedWrite,
-                                           responseNeeded, offset, value);
-        }
-
-        @Override
-        public void onExecuteWrite(BluetoothDevice device, int requestId, boolean execute) {
-            super.onExecuteWrite(device, requestId, execute);
-        }
-
-        @Override
-        public void onNotificationSent(BluetoothDevice device, int status) {
-            super.onNotificationSent(device, status);
-
-            caLeGattServerNotificationSentCallback(device, status);
-        }
-    };
-
-    private static final AdvertiseCallback mAdvertiseCallback = new AdvertiseCallback() {
-
-        @Override
-        public void onStartSuccess(AdvertiseSettings settingsInEffect) {
-            super.onStartSuccess(settingsInEffect);
-
-            caLeAdvertiseStartSuccessCallback(settingsInEffect);
-        }
-
-        @Override
-        public void onStartFailure(int errorCode) {
-            super.onStartFailure(errorCode);
-
-            caLeAdvertiseStartFailureCallback(errorCode);
-        }
-    };
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaNfcInterface.java b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/java/org/iotivity/ca/CaNfcInterface.java
deleted file mode 100644 (file)
index ebb273b..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/* *****************************************************************
- *
- * 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.
- *
- ******************************************************************/
-
-package org.iotivity.ca;
-
-import java.util.ArrayList;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.app.PendingIntent;
-import android.content.IntentFilter.MalformedMimeTypeException;
-import android.net.NetworkInfo;
-import android.nfc.NdefMessage;
-import android.nfc.NdefRecord;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcEvent;
-import android.os.Parcelable;
-import android.util.Log;
-
-
-
-public class CaNfcInterface implements NfcAdapter.CreateNdefMessageCallback {
-    private final static String MYTAG = CaNfcInterface.class.getSimpleName();
-    private static Context mContext;
-    private Activity  mActivity;
-    private NfcAdapter mAdapter;
-    private NdefMessage mMessage;
-    private boolean misInvokeBeam;
-
-    private CaNfcInterface(Context context, Activity activity) {
-        Log.d(MYTAG, "NFC  registerNfcReceiver");
-        mContext = context;
-        mActivity = activity;
-
-        mAdapter = NfcAdapter.getDefaultAdapter(mContext);
-        if (null == mAdapter)
-        {
-            Log.e(MYTAG, "Failed to get the Adapter");
-            return;
-        }
-    }
-
-    private native static void caNativeNfcPacketReceived(byte[] receivedData);
-    private native static NdefMessage caNativeNfcCreateNdefMessage(byte[] sendData);
-    private native static boolean caNativeNfcInvokeBeam();
-
-    @Override
-    public NdefMessage createNdefMessage(NfcEvent event) {
-        Log.d(MYTAG, "NFC  createNdefMessage");
-
-        // Returns the already created message
-        return mMessage;
-    }
-
-    public void processSendRquest(byte[] sendData) {
-
-        Log.d(MYTAG, "NFC  processSendRquest IN");
-
-        mMessage = caNativeNfcCreateNdefMessage(sendData);
-        misInvokeBeam = caNativeNfcInvokeBeam();
-
-        if (!misInvokeBeam)
-        {
-            Log.e(MYTAG, "NFC  Beam error");
-        }
-    }
-
-    public void caNfcInitialize() {
-        Log.d(MYTAG, "caNfcInitialize");
-
-        if ((null == mActivity) || (null == mContext) || (null == mAdapter)) {
-            Log.e(MYTAG, "caNfcInitialize failed, invalid parameters");
-            return;
-        }
-
-        PendingIntent pendingIntent = PendingIntent.getActivity(mActivity, 0,
-                                                    new Intent(mActivity, mActivity.getClass())
-                                                    .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP
-                                                    | Intent.FLAG_ACTIVITY_CLEAR_TOP), 0);
-
-        IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
-
-        try {
-            ndef.addDataType("*/*");    /* Handles all MIME based dispatches.
-                                           You should specify only the ones that you need. */
-        } catch (MalformedMimeTypeException e) {
-            throw new RuntimeException("fail", e);
-        }
-
-        IntentFilter[] intentFiltersArray = new IntentFilter[] {ndef, };
-
-        mAdapter.enableForegroundDispatch(mActivity, pendingIntent, intentFiltersArray, null);
-        Log.d(MYTAG, " enableForegroundDispatch ");
-
-        mContext.registerReceiver(mReceiver, new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED));
-        Log.d(MYTAG, "NFC  caNfcInitialize OUT");
-    }
-
-    private static BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            Log.d(MYTAG, "onReceive broadcast intent updated - disable callback");
-
-            if (intent.getAction().equals(NfcAdapter.ACTION_NDEF_DISCOVERED))
-            {
-                processIntent(intent);
-            }
-        }
-
-        private void processIntent(Intent intent) {
-
-            Log.d(MYTAG, "processIntent");
-            Parcelable[] rawMsgs = intent
-                    .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
-            NdefMessage msg = (NdefMessage) rawMsgs[0];
-            Log.d(MYTAG, msg.getRecords()[0].toMimeType().toString());
-            caNativeNfcPacketReceived(msg.getRecords()[0].getPayload());
-        }
-    };
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-hdpi/ic_launcher.png b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100755 (executable)
index 96a442e..0000000
Binary files a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-mdpi/ic_launcher.png b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100755 (executable)
index 359047d..0000000
Binary files a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-xhdpi/ic_launcher.png b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100755 (executable)
index 71c6d76..0000000
Binary files a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values-v11/styles.xml b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values-v11/styles.xml
deleted file mode 100755 (executable)
index 3c02242..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme for API 11+. This theme completely replaces
-        AppBaseTheme from res/values/styles.xml on API 11+ devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
-        <!-- API 11 theme customizations can go here. -->
-    </style>
-
-</resources>
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values-v14/styles.xml b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values-v14/styles.xml
deleted file mode 100755 (executable)
index a91fd03..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme for API 14+. This theme completely replaces
-        AppBaseTheme from BOTH res/values/styles.xml and
-        res/values-v11/styles.xml on API 14+ devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
-        <!-- API 14 theme customizations can go here. -->
-    </style>
-
-</resources>
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values/strings.xml b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values/strings.xml
deleted file mode 100755 (executable)
index 0e63d00..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
-
-    <string name="app_name">CAInterface</string>
-
-</resources>
diff --git a/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values/styles.xml b/resource/csdk/connectivity/samples/android/casample/cAInterface/src/main/res/values/styles.xml
deleted file mode 100755 (executable)
index 6ce89c7..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme, dependent on API level. This theme is replaced
-        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Light">
-        <!--
-            Theme customizations available in newer API levels can go in
-            res/values-vXX/styles.xml, while customizations related to
-            backward-compatibility can go here.
-        -->
-    </style>
-
-    <!-- Application theme. -->
-    <style name="AppTheme" parent="AppBaseTheme">
-        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
-    </style>
-
-</resources>
diff --git a/resource/csdk/connectivity/samples/android/casample/casample.iml b/resource/csdk/connectivity/samples/android/casample/casample.iml
deleted file mode 100755 (executable)
index ed92464..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
-  <component name="FacetManager">
-    <facet type="java-gradle" name="Java-Gradle">
-      <configuration>
-        <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/../MainActivity/build" />
-      </configuration>
-    </facet>
-    <facet type="android-gradle" name="Android-Gradle">
-      <configuration>
-        <option name="GRADLE_PROJECT_PATH" value=":" />
-      </configuration>
-    </facet>
-    <facet type="android" name="Android">
-      <configuration>
-        <option name="ALLOW_USER_CONFIGURATION" value="false" />
-      </configuration>
-    </facet>
-  </component>
-  <component name="NewModuleRootManager" inherit-compiler-output="true">
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <excludeFolder url="file://$MODULE_DIR$/.gradle" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-  </component>
-</module>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/gradle.properties b/resource/csdk/connectivity/samples/android/casample/gradle.properties
deleted file mode 100755 (executable)
index b0f079c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# //******************************************************************
-# //
-# // 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.
-# //
-# //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-#
-
-# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-
-# 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: -Xmx10248m -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
-
diff --git a/resource/csdk/connectivity/samples/android/casample/gradle/wrapper/gradle-wrapper.jar b/resource/csdk/connectivity/samples/android/casample/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100755 (executable)
index 8c0fb64..0000000
Binary files a/resource/csdk/connectivity/samples/android/casample/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/resource/csdk/connectivity/samples/android/casample/gradle/wrapper/gradle-wrapper.properties b/resource/csdk/connectivity/samples/android/casample/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100755 (executable)
index 0c71e76..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#Wed Apr 10 15:27:10 PDT 2013
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
diff --git a/resource/csdk/connectivity/samples/android/casample/gradlew b/resource/csdk/connectivity/samples/android/casample/gradlew
deleted file mode 100755 (executable)
index 91a7e26..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-#!/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
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
-    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# 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\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
-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"`
-
-    # 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 "$@"
diff --git a/resource/csdk/connectivity/samples/android/casample/gradlew.bat b/resource/csdk/connectivity/samples/android/casample/gradlew.bat
deleted file mode 100755 (executable)
index 8a0b282..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem  Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/.gitignore b/resource/csdk/connectivity/samples/android/casample/sampleService/.gitignore
deleted file mode 100644 (file)
index 84c048a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/build.gradle b/resource/csdk/connectivity/samples/android/casample/sampleService/build.gradle
deleted file mode 100755 (executable)
index 1e31192..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-apply plugin: 'com.android.application'
-
-android {
-    compileSdkVersion 21
-    buildToolsVersion "20.0.0"
-
-    defaultConfig {
-        applicationId "org.iotivity.ca.sample_service"
-        minSdkVersion 21
-        targetSdkVersion 21
-
-        ndk {
-            moduleName "RMInterface"
-        }
-    }
-
-    buildTypes {
-        release {
-            minifyEnabled false
-            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
-        }
-    }
-
-    lintOptions {
-       abortOnError false
-    }
-
-    sourceSets {
-        main {
-            manifest.srcFile 'src/main/AndroidManifest.xml'
-            jniLibs.srcDir 'libs'
-            jni.srcDirs = [] //disable automatic ndk-build call
-        }
-    }
-}
-
-dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
-    compile project(':cAInterface')
-}
-
-task copyNativeLibs(type: Copy, dependsOn: 'buildNative') {
-    dependsOn 'buildNative'
-    from(new File('src/main/libs')) { include '**/*.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, "-C", file("src/main"), "-B", "-j", Runtime.runtime.availableProcessors(),
-                              "APP_ABI=$TARGET_ARCH", "APP_OPTIM=$RELEASE"
-    } else {
-        println '##################'
-        println 'Skipping NDK build'
-        println 'Reason: ANDROID_NDK_HOME not set.'
-        println '##################'
-    }
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/sampleService.iml b/resource/csdk/connectivity/samples/android/casample/sampleService/sampleService.iml
deleted file mode 100755 (executable)
index 145e474..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="casample" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
-  <component name="FacetManager">
-    <facet type="android-gradle" name="Android-Gradle">
-      <configuration>
-        <option name="GRADLE_PROJECT_PATH" value=":sampleService" />
-      </configuration>
-    </facet>
-    <facet type="android" name="Android">
-      <configuration>
-        <option name="SELECTED_BUILD_VARIANT" value="debug" />
-        <option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
-        <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
-        <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
-        <option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugAndroidTest" />
-        <option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
-        <option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugAndroidTestSources" />
-        <option name="ALLOW_USER_CONFIGURATION" value="false" />
-        <option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
-        <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
-        <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
-        <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
-      </configuration>
-    </facet>
-  </component>
-  <component name="NewModuleRootManager" inherit-compiler-output="false">
-    <output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
-    <output-test url="file://$MODULE_DIR$/build/intermediates/classes/androidTest/debug" />
-    <exclude-output />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/androidTest/debug" isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/androidTest/debug" isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/androidTest/debug" isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/androidTest/debug" isTestSource="true" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/androidTest/debug" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/androidTest/debug" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
-      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
-      <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
-    </content>
-    <orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
-    <orderEntry type="sourceFolder" forTests="false" />
-    <orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
-    <orderEntry type="module" module-name="cAInterface" exported="" />
-  </component>
-</module>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/.gitignore b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/.gitignore
deleted file mode 100644 (file)
index 89a3c7d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/libs/
-/obj/
-/assets/
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/AndroidManifest.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/AndroidManifest.xml
deleted file mode 100755 (executable)
index 60a2aad..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="org.iotivity.ca.sample_service"
-    android:versionCode="1"
-    android:versionName="1.0" >
-
-    <uses-feature android:name="android.hardware.nfc" />
-
-    <uses-sdk
-        android:minSdkVersion="21"
-        android:targetSdkVersion="21" />
-
-    <application
-        android:allowBackup="true"
-        android:label="@string/app_name"
-        android:theme="@style/AppTheme" >
-        <activity
-            android:name="org.iotivity.ca.service.MainActivity"
-            android:label="@string/app_name"
-            android:windowSoftInputMode="stateHidden"
-            android:launchMode="singleInstance" >
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-    </application>
-
-    <uses-permission android:name="android.permission.BLUETOOTH" />
-    <uses-permission android:name="android.permission.NFC" />
-    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
-    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
-    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-</manifest>
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/DLog.java b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/DLog.java
deleted file mode 100644 (file)
index 9fe8422..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-
-package org.iotivity.ca.service;
-
-import android.os.Handler;
-import android.widget.TextView;
-
-public final class DLog {
-
-    private final static String MAIN_TAG = "Sample_Service : DLog";
-
-    private static TextView mLogView = null;
-
-    private static Handler mHandler = null;
-
-    public static void setTextView(Handler handler, TextView logView) {
-        mHandler = handler;
-        mLogView = logView;
-    }
-
-    private static void addLogText(final String msg) {
-
-        mHandler.post(new Runnable() {
-
-            @Override
-            public void run() {
-
-                if (mLogView == null)
-                    return;
-
-                StringBuilder builder = new StringBuilder(mLogView.getText());
-                // add front
-                builder.append(msg + "\n");
-
-                mLogView.setText(builder.toString());
-            }
-
-        });
-
-    }
-
-    public static final void v(String className, String msg) {
-        android.util.Log.v(MAIN_TAG, className + "." + msg);
-
-        if (mLogView != null) {
-            addLogText(msg);
-        }
-    }
-
-    public static final void d(String className, String msg) {
-        android.util.Log.d(MAIN_TAG, className + "." + msg);
-
-        if (mLogView != null) {
-            addLogText(msg);
-        }
-    }
-
-    public static final void i(String className, String msg) {
-        android.util.Log.i(MAIN_TAG, className + "." + msg);
-
-        if (mLogView != null) {
-            addLogText(msg);
-        }
-    }
-
-    public static final void w(String className, String msg) {
-        android.util.Log.w(MAIN_TAG, className + "." + msg);
-
-        if (mLogView != null) {
-            addLogText(msg);
-        }
-    }
-
-    public static final void w(String className, String msg, Exception ex) {
-        android.util.Log.w(MAIN_TAG, className + "." + msg + ":" + ex.getMessage());
-
-        if (mLogView != null) {
-            addLogText(msg);
-        }
-    }
-
-    public static final void w(String className, String msg, Error e) {
-        android.util.Log.w(MAIN_TAG, className + "." + msg + ":" + e.getMessage());
-
-        if (mLogView != null) {
-            addLogText(msg);
-        }
-    }
-
-}
-
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/FileChooser.java b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/FileChooser.java
deleted file mode 100644 (file)
index d2e50d8..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.iotivity.ca.service;
-
-import android.app.Activity;
-import android.app.Dialog;
-import android.os.Environment;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.WindowManager.LayoutParams;
-import android.widget.AdapterView;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.TextView;
-import java.io.File;
-import java.io.FileFilter;
-import java.util.Arrays;
-
-public class FileChooser {
-    private static final String PARENT_DIR = "..";
-
-    private final Activity activity;
-    private ListView list;
-    private Dialog dialog;
-    private File currentPath;
-
-    // filter on file extension
-    private String extension = null;
-    public void setExtension(String extension) {
-        this.extension = (extension == null) ? null :
-                extension.toLowerCase();
-    }
-
-    // file selection event handling
-    public interface FileSelectedListener {
-        void fileSelected(File file);
-    }
-    public FileChooser setFileListener(FileSelectedListener fileListener) {
-        this.fileListener = fileListener;
-        return this;
-    }
-    private FileSelectedListener fileListener;
-
-    public FileChooser(Activity activity) {
-        this.activity = activity;
-        dialog = new Dialog(activity);
-        list = new ListView(activity);
-        list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-            @Override public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
-                String fileChosen = (String) list.getItemAtPosition(which);
-                File chosenFile = getChosenFile(fileChosen);
-                if (chosenFile.isDirectory()) {
-                    refresh(chosenFile);
-                } else {
-                    if (fileListener != null) {
-                        fileListener.fileSelected(chosenFile);
-                    }
-                    dialog.dismiss();
-                }
-            }
-        });
-        dialog.setContentView(list);
-        dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
-        refresh(Environment.getExternalStorageDirectory());
-    }
-
-    public void showDialog() {
-        dialog.show();
-    }
-
-
-    /**
-     * Sort, filter and display the files for the given path.
-     */
-    private void refresh(File path) {
-        this.currentPath = path;
-        if (path.exists()) {
-            File[] dirs = path.listFiles(new FileFilter() {
-                @Override public boolean accept(File file) {
-                    return (file.isDirectory() && file.canRead());
-                }
-            });
-            File[] files = path.listFiles(new FileFilter() {
-                @Override public boolean accept(File file) {
-                    if (!file.isDirectory()) {
-                        if (!file.canRead()) {
-                            return false;
-                        } else if (extension == null) {
-                            return true;
-                        } else {
-                            return file.getName().toLowerCase().endsWith(extension);
-                        }
-                    } else {
-                        return false;
-                    }
-                }
-            });
-
-            // convert to an array
-            int i = 0;
-            String[] fileList;
-            if (path.getParentFile() == null) {
-                fileList = new String[dirs.length + files.length];
-            } else {
-                fileList = new String[dirs.length + files.length + 1];
-                fileList[i++] = PARENT_DIR;
-            }
-            Arrays.sort(dirs);
-            Arrays.sort(files);
-            for (File dir : dirs) { fileList[i++] = dir.getName(); }
-            for (File file : files ) { fileList[i++] = file.getName(); }
-
-            // refresh the user interface
-            dialog.setTitle(currentPath.getPath());
-            list.setAdapter(new ArrayAdapter(activity,
-                   android.R.layout.simple_list_item_1, fileList) {
-                       @Override public View getView(int pos, View view, ViewGroup parent) {
-                           view = super.getView(pos, view, parent);
-                           ((TextView) view).setSingleLine(true);
-                           return view;
-                       }
-                   });
-        }
-    }
-
-
-    /**
-     * Convert a relative filename into an actual File object.
-     */
-    private File getChosenFile(String fileChosen) {
-        if (fileChosen.equals(PARENT_DIR)) {
-            return currentPath.getParentFile();
-        } else {
-            return new File(currentPath, fileChosen);
-        }
-    }
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/MainActivity.java b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/MainActivity.java
deleted file mode 100644 (file)
index d7dd726..0000000
+++ /dev/null
@@ -1,775 +0,0 @@
-package org.iotivity.ca.service;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.Intent;
-import android.nfc.NfcAdapter;
-import android.os.Bundle;
-import android.os.Handler;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.EditText;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-import java.io.File;
-
-import org.iotivity.ca.sample_service.R;
-import org.iotivity.ca.service.FileChooser;
-import org.iotivity.ca.service.FileChooser.FileSelectedListener;
-
-public class MainActivity extends Activity {
-
-    static RMInterface RM = new RMInterface();
-
-    private final static String TAG = "Sample_Service : MainActivity";
-
-    private final CharSequence[] mNetworkCheckBoxItems = { Network.IP.name(),
-            Network.LE.name(), Network.EDR.name(), Network.TCP.name(), Network.NFC.name()};
-
-    private final CharSequence[] mDTLSCheckBoxItems = { DTLS.UNSECURED.name(),
-            DTLS.SECURED.name() };
-
-    private final CharSequence[] mMsgTyleCheckBoxItems = { MsgType.CON.name(),
-            MsgType.NON.name(), MsgType.ACK.name(), MsgType.RESET.name() };
-
-    private final CharSequence[] mResponseResultCheckBoxItems = {
-            ResponseResult.CA_CREATED.name(), ResponseResult.CA_DELETED.name(),
-            ResponseResult.CA_VALID.name(), ResponseResult.CA_CHANGED.name(),
-            ResponseResult.CA_CONTENT.name(), ResponseResult.CA_EMPTY.name(),
-            ResponseResult.CA_BAD_REQ.name(), ResponseResult.CA_BAD_OPT.name(),
-            ResponseResult.CA_NOT_FOUND.name(), ResponseResult.CA_INTERNAL_SERVER_ERROR.name(),
-            ResponseResult.CA_RETRANSMIT_TIMEOUT.name() };
-
-    private enum Mode {
-        SERVER, CLIENT, BOTH, UNKNOWN
-    };
-
-    private enum Network {
-        IP, LE, EDR, TCP, NFC
-    };
-
-    private enum DTLS {
-        UNSECURED, SECURED
-    };
-
-    private enum MsgType {
-        CON, NON, ACK, RESET
-    };
-
-    private enum ResponseResult {
-        CA_CREATED, CA_DELETED, CA_VALID, CA_CHANGED, CA_CONTENT, CA_EMPTY,
-        CA_BAD_REQ, CA_BAD_OPT, CA_NOT_FOUND, CA_INTERNAL_SERVER_ERROR, CA_RETRANSMIT_TIMEOUT
-    }
-
-    private boolean mCheckedItems[] = {
-            false, false, false, false, false
-    };
-
-    private int mSelectedItems[] = { 0, 0, 0, 0, 0, 0};
-
-    private int mUnSelectedItems[] = { 0, 0, 0, 0, 0, 0};
-
-    private Mode mCurrentMode = Mode.UNKNOWN;
-
-    private RelativeLayout mSendNotificationLayout = null;
-
-    private RelativeLayout mSendRequestLayout = null;
-
-    private RelativeLayout mSendRequestToAllLayout = null;
-
-    private RelativeLayout mSendRequestSettingLayout = null;
-
-    private RelativeLayout mSendRequestToAllSettingLayout = null;
-
-    private RelativeLayout mSendResponseNotiSettingLayout = null;
-
-    private RelativeLayout mReceiveLayout = null;
-
-    private RelativeLayout mRequestTitleLayout = null;
-
-    private RelativeLayout mRequestToAllTitleLayout = null;
-
-    private RelativeLayout mResponseNotificationTitleLayout = null;
-
-    private RelativeLayout mHandleTitleLayout = null;
-
-    private TextView mMode_tv = null;
-
-    private TextView mNetwork_tv = null;
-
-    private EditText mNotification_ed = null;
-
-    private EditText mReqData_ed = null;
-
-    private EditText mReqToAllData_ed = null;
-
-    private Button mNotify_btn = null;
-
-    private Button mReqeust_btn = null;
-
-    private Button mReqeust_setting_btn = null;
-
-    private Button mReqeustToAll_btn = null;
-
-    private Button mReqeustToAll_setting_btn = null;
-
-    private Button mResponse_Notify_setting_btn = null;
-
-    private Button mResponse_btn = null;
-
-    private Button mGetNetworkInfo_btn = null;
-
-    private Button mRecv_btn = null;
-
-    private Button mBig_btn = null;
-
-    private Handler mLogHandler = null;
-
-    /**
-     * Defined ConnectivityType in cacommon.c
-     *
-     * CA_IP = (1 << 0) CA_LE = (1 << 1) CA_EDR = (1 << 2) CA_TCP = (1 << 4) CA_NFC= (1 << 5)
-     */
-    private int CA_IP = (1 << 0);
-    private int CA_LE = (1 << 1);
-    private int CA_EDR = (1 << 2);
-    private int CA_TCP = (1 << 4);
-    private int CA_NFC = (1 << 5);
-    private int isSecured = 0;
-    private int msgType = 1;
-    private int responseValue = 0;
-    private int selectedNetworkType = -1;
-    private int selectedMsgType = 1;
-    private int selectedMsgSecured = 0;
-    private int selectedResponseValue = 0;
-    int selectedNetwork = -1;
-    int interestedNetwork = 0;
-    int uninterestedNetwork = 0;
-    private boolean isSendResponseSetting = false;
-    private boolean isSendRequestToAllSetting = false;
-    private boolean isBigData = false;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_main);
-
-        RM.setResponseListener(this);
-
-        mLogHandler = new Handler();
-        TextView logView = (TextView) findViewById(R.id.tv_result);
-        DLog.setTextView(mLogHandler, logView);
-
-        // Initialize UI
-        // common
-        mReceiveLayout = (RelativeLayout) findViewById(R.id.layout_receive);
-
-        // client
-        mSendRequestLayout = (RelativeLayout) findViewById(R.id.layout_request);
-        mSendRequestToAllLayout = (RelativeLayout) findViewById(R.id.layout_request_to_all);
-        mSendRequestSettingLayout = (RelativeLayout)
-                findViewById(R.id.layout_request_setting_for_client);
-        mSendRequestToAllSettingLayout = (RelativeLayout)
-                findViewById(R.id.layout_request_to_all_setting_for_client);
-        mRequestTitleLayout = (RelativeLayout) findViewById(R.id.layout_request_title);
-        mRequestToAllTitleLayout = (RelativeLayout) findViewById(R.id.layout_request_to_all_title);
-        mHandleTitleLayout = (RelativeLayout) findViewById(R.id.layout_handle_title);
-
-        // server
-        mSendNotificationLayout = (RelativeLayout) findViewById(R.id.layout_notify);
-        mSendResponseNotiSettingLayout = (RelativeLayout)
-                findViewById(R.id.layout_request_setting_for_server);
-        mResponseNotificationTitleLayout = (RelativeLayout)
-                findViewById(R.id.layout_Response_Noti_title);
-
-        mMode_tv = (TextView) findViewById(R.id.tv_mode);
-        mNetwork_tv = (TextView) findViewById(R.id.tv_network);
-
-        mNotification_ed = (EditText) findViewById(R.id.et_notification);
-        mReqData_ed = (EditText) findViewById(R.id.et_req_data);
-        mReqToAllData_ed = (EditText) findViewById(R.id.et_req_to_all_data);
-
-        mResponse_btn = (Button) findViewById(R.id.btn_sendresponse);
-        mNotify_btn = (Button) findViewById(R.id.btn_notify);
-        mReqeust_btn = (Button) findViewById(R.id.btn_Request);
-        mReqeust_setting_btn = (Button) findViewById(R.id.btn_Request_setting_for_client);
-        mReqeustToAll_btn = (Button) findViewById(R.id.btn_request_to_all);
-        mReqeustToAll_setting_btn = (Button)
-                findViewById(R.id.btn_request_to_all_setting_for_client);
-        mResponse_Notify_setting_btn = (Button) findViewById(R.id.btn_Request_setting_for_server);
-        mGetNetworkInfo_btn = (Button) findViewById(R.id.btn_get_network_info);
-        mRecv_btn = (Button) findViewById(R.id.btn_receive);
-        mBig_btn = (Button) findViewById(R.id.btn_big_data);
-        mBig_btn.setOnClickListener(mSelectLargeDataButtonHandler);
-
-        mResponse_btn.setOnClickListener(mSendResponseHandler);
-        mNotify_btn.setOnClickListener(mNotifyHandler);
-        mReqeust_btn.setOnClickListener(mSendRequestHandler);
-        mReqeust_setting_btn.setOnClickListener(mSendRequestSettingHandler);
-        mReqeustToAll_btn.setOnClickListener(mSendRequestToAllHandler);
-        mReqeustToAll_setting_btn.setOnClickListener(mSendRequestToAllSettingHandler);
-        mResponse_Notify_setting_btn
-                .setOnClickListener(mSendResponseNotiSettingHandler);
-        mRecv_btn.setOnClickListener(mResponseHandler);
-        mGetNetworkInfo_btn.setOnClickListener(mGetNetworkInfoHandler);
-
-        showSelectModeView();
-
-        // Initialize Connectivity Abstraction
-        RM.RMInitialize(getApplicationContext(), this);
-        // set handler
-        RM.RMRegisterHandler();
-    }
-
-    private void showSelectModeView() {
-
-        mSendNotificationLayout.setVisibility(View.INVISIBLE);
-        mSendRequestLayout.setVisibility(View.INVISIBLE);
-        mSendRequestToAllLayout.setVisibility(View.INVISIBLE);
-        mSendRequestSettingLayout.setVisibility(View.INVISIBLE);
-        mSendRequestToAllSettingLayout.setVisibility(View.INVISIBLE);
-        mReceiveLayout.setVisibility(View.INVISIBLE);
-        mRequestTitleLayout.setVisibility(View.INVISIBLE);
-        mRequestToAllTitleLayout.setVisibility(View.INVISIBLE);
-        mHandleTitleLayout.setVisibility(View.INVISIBLE);
-        mResponseNotificationTitleLayout.setVisibility(View.INVISIBLE);
-        mSendResponseNotiSettingLayout.setVisibility(View.INVISIBLE);
-
-        mMode_tv.setText("Select Mode (Server or Client)");
-        Log.i(TAG, "Select Mode (Server or Client)");
-    }
-
-    private void showNetworkView() {
-
-        mNetwork_tv.setText("Select Network Type");
-        Log.i(TAG, "Select Network Type");
-    }
-
-    private void showModeView() {
-
-        mReceiveLayout.setVisibility(View.VISIBLE);
-        mSendRequestToAllLayout.setVisibility(View.VISIBLE);
-        mSendRequestToAllSettingLayout.setVisibility(View.VISIBLE);
-        mRequestToAllTitleLayout.setVisibility(View.VISIBLE);
-        mHandleTitleLayout.setVisibility(View.VISIBLE);
-
-        if (mCurrentMode == Mode.SERVER) {
-
-            mSendNotificationLayout.setVisibility(View.VISIBLE);
-            mSendRequestLayout.setVisibility(View.INVISIBLE);
-            mSendRequestSettingLayout.setVisibility(View.INVISIBLE);
-
-            mRequestTitleLayout.setVisibility(View.INVISIBLE);
-
-            mResponseNotificationTitleLayout.setVisibility(View.VISIBLE);
-            mSendResponseNotiSettingLayout.setVisibility(View.VISIBLE);
-
-        } else if (mCurrentMode == Mode.CLIENT) {
-
-            mSendNotificationLayout.setVisibility(View.INVISIBLE);
-            mSendRequestLayout.setVisibility(View.VISIBLE);
-            mSendRequestSettingLayout.setVisibility(View.VISIBLE);
-
-            mRequestTitleLayout.setVisibility(View.VISIBLE);
-
-            mResponseNotificationTitleLayout.setVisibility(View.INVISIBLE);
-            mSendResponseNotiSettingLayout.setVisibility(View.INVISIBLE);
-        }
-        mNetwork_tv.setText("");
-    }
-
-    @Override
-    public void onNewIntent(Intent intent) {
-        super.onNewIntent(intent);
-        Intent i = new Intent();
-        i.setAction(intent.getAction());
-        i.putExtra(NfcAdapter.EXTRA_NDEF_MESSAGES,
-                   intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES));
-        sendBroadcast(i);
-        Log.d(TAG, "Broadcast intent complete");
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-
-        // Terminate Connectivity Abstraction
-        RM.RMTerminate();
-        android.os.Process.killProcess(android.os.Process.myPid());
-    }
-
-    @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-
-        menu.add(0, 1, Menu.NONE, "Start Server");
-        menu.add(0, 2, Menu.NONE, "Start Client");
-        menu.add(0, 3, Menu.NONE, "Select Network");
-
-        return true;
-    }
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-
-        switch (item.getItemId()) {
-
-        case 1:
-
-            RM.RMStartListeningServer();
-
-            if (interestedNetwork == 0) {
-                mCurrentMode = Mode.SERVER;
-                mMode_tv.setText("MODE: " + mCurrentMode.toString());
-                Log.i(TAG, "MODE: " + mCurrentMode.toString());
-                showNetworkView();
-
-            } else {
-                mCurrentMode = Mode.SERVER;
-                mMode_tv.setText("MODE: " + mCurrentMode.toString());
-                Log.i(TAG, "MODE: " + mCurrentMode.toString());
-                showModeView();
-            }
-
-            break;
-
-        case 2:
-
-            RM.RMStartDiscoveryServer();
-
-            if (interestedNetwork == 0) {
-                mCurrentMode = Mode.CLIENT;
-                mMode_tv.setText("MODE: " + mCurrentMode.toString());
-                Log.i(TAG, "MODE: " + mCurrentMode.toString());
-                showNetworkView();
-
-            } else {
-                mCurrentMode = Mode.CLIENT;
-                mMode_tv.setText("MODE: " + mCurrentMode.toString());
-                Log.i(TAG, "MODE: " + mCurrentMode.toString());
-                showModeView();
-            }
-
-            break;
-
-        case 3:
-
-            checkInterestedNetwork("Select Network");
-
-            break;
-        }
-
-        return super.onOptionsItemSelected(item);
-    }
-
-    private OnClickListener mSendResponseHandler = new OnClickListener() {
-
-        @Override
-        public void onClick(View v) {
-
-            DLog.v(TAG, "SendResponse click");
-            if ( selectedNetwork != -1) {
-                RM.RMSendResponse(selectedNetwork, isSecured, msgType, responseValue);
-            }
-            else {
-                DLog.v(TAG, "Please Select Network Type");
-            }
-        }
-    };
-
-    private OnClickListener mNotifyHandler = new OnClickListener() {
-
-        @Override
-        public void onClick(View v) {
-
-            DLog.v(TAG, "SendNotification click");
-            if ( selectedNetwork != -1) {
-                RM.RMSendNotification(mNotification_ed.getText().toString(),
-                    null, selectedNetwork, isSecured, msgType);
-            }
-            else {
-                DLog.v(TAG, "Please Select Network Type");
-            }
-        }
-    };
-
-    private OnClickListener mSendRequestHandler = new OnClickListener() {
-
-        @Override
-        public void onClick(View v) {
-
-            DLog.v(TAG, "SendRequest click");
-            if ( selectedNetwork != -1) {
-                RM.RMSendRequest(mReqData_ed.getText().toString(), null,
-                    selectedNetwork, isSecured, msgType, false);
-            }
-            else {
-                DLog.v(TAG, "Please Select Network Type");
-            }
-        }
-    };
-
-    private OnClickListener mSendRequestSettingHandler = new OnClickListener() {
-
-        @Override
-        public void onClick(View v) {
-            checkSendNetworkType("Select Send Network Type");
-        }
-    };
-
-    private OnClickListener mSendRequestToAllHandler = new OnClickListener() {
-
-        @Override
-        public void onClick(View v) {
-
-            DLog.v(TAG, "SendRequestToAll click");
-            if ( selectedNetwork != -1) {
-                RM.RMSendReqestToAll(mReqToAllData_ed.getText().toString(), selectedNetwork);
-            }
-            else {
-                DLog.v(TAG, "Please Select Network Type");
-            }
-        }
-    };
-
-    private OnClickListener mSendRequestToAllSettingHandler = new OnClickListener() {
-
-        @Override
-        public void onClick(View v) {
-            isSendRequestToAllSetting = true;
-            checkSendNetworkType("Select Send Network Type");
-        }
-    };
-
-    private OnClickListener mSendResponseNotiSettingHandler = new OnClickListener() {
-
-        @Override
-        public void onClick(View v) {
-            isSendResponseSetting = true;
-            checkSendNetworkType("Select Send Network Type");
-        }
-    };
-
-    private OnClickListener mGetNetworkInfoHandler = new OnClickListener() {
-        @Override
-        public void onClick(View v) {
-
-            RM.RMGetNetworkInfomation();
-        }
-    };
-
-    private OnClickListener mResponseHandler = new OnClickListener() {
-
-        @Override
-        public void onClick(View v) {
-
-            RM.RMHandleRequestResponse();
-        }
-    };
-
-    private OnClickListener mSelectLargeDataButtonHandler = new OnClickListener() {
-        @Override
-        public void onClick(View v) {
-
-            isBigData = true;
-            checkSendNetworkType("Select Send Network Type");
-        }
-    };
-
-    private void checkInterestedNetwork(String title) {
-
-        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
-        builder.setTitle(title)
-                .setMultiChoiceItems(mNetworkCheckBoxItems, mCheckedItems,
-                        new DialogInterface.OnMultiChoiceClickListener() {
-
-                            @Override
-                            public void onClick(DialogInterface dialog,
-                                    int which, boolean isChecked) {
-
-                                // in case of TCP increase value,
-                                // because CASample not support RA.
-                                // which: 0(IP), 1(BT), 2(BLE), 3(TCP)
-                                if (which == 3) {
-                                    which = 4;
-                                }
-                                if (isChecked) {
-                                    mSelectedItems[which] = 1;
-                                    mUnSelectedItems[which] = 0;
-
-                                } else if (mSelectedItems[which] == 1) {
-
-                                    mSelectedItems[which] = 0;
-                                    mUnSelectedItems[which] = 1;
-                                }
-                            }
-                        })
-                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-
-                        interestedNetwork = 0;
-
-                        for (int i = 0; i < mSelectedItems.length; i++) {
-                            if (mSelectedItems[i] == 1) {
-                                interestedNetwork |= (1 << i);
-                            }
-                        }
-                        if(0 != interestedNetwork)
-                            RM.RMSelectNetwork(interestedNetwork);
-
-                        uninterestedNetwork = 0;
-
-                        for (int i = 0; i < mUnSelectedItems.length; i++) {
-                            if (mUnSelectedItems[i] == 1) {
-                                uninterestedNetwork |= (1 << i);
-                            }
-                        }
-                        if(0 != uninterestedNetwork)
-                            RM.RMUnSelectNetwork(uninterestedNetwork);
-
-                    }
-                }).show();
-    }
-
-    private void checkMsgSecured(String title) {
-
-        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
-
-        builder.setTitle(title)
-                .setSingleChoiceItems(mDTLSCheckBoxItems, selectedMsgSecured,
-                        new DialogInterface.OnClickListener() {
-
-                            @Override
-                            public void onClick(DialogInterface dialog,
-                                    int which) {
-                                selectedMsgSecured = which;
-                            }
-                        })
-                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-
-                        if (selectedMsgSecured == DTLS.SECURED.ordinal()) {
-                            isSecured = 1;
-                            DLog.v(TAG, "Send secured message");
-
-                        } else if (selectedMsgSecured == DTLS.UNSECURED.ordinal()) {
-                            isSecured = 0;
-                            DLog.v(TAG, "Send unsecured message");
-                        }
-                        checkMsgType("Select Msg Type");
-                    }
-
-                }).show();
-    }
-
-    private void checkMsgType(String title) {
-
-        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
-        builder.setTitle(title)
-                .setSingleChoiceItems(mMsgTyleCheckBoxItems, selectedMsgType,
-                        new DialogInterface.OnClickListener() {
-
-                            @Override
-                            public void onClick(DialogInterface dialog,
-                                    int which) {
-                                selectedMsgType = which;
-                            }
-                        })
-                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-
-                        if (selectedMsgType == MsgType.CON.ordinal()) {
-                            msgType = 0;
-                            DLog.v(TAG, "Message Type is CON");
-
-                        } else if (selectedMsgType == MsgType.NON.ordinal()) {
-                            msgType = 1;
-                            DLog.v(TAG, "Message Type is NON");
-                        } else if (selectedMsgType == MsgType.ACK.ordinal()) {
-                            msgType = 2;
-                            DLog.v(TAG, "Message Type is ACK");
-                        } else if (selectedMsgType == MsgType.RESET.ordinal()) {
-                            msgType = 3;
-                            DLog.v(TAG, "Message Type is RESET");
-                            }
-
-                        if (isSendResponseSetting == true && msgType != 3) {
-                            checkResponseResult("Select Value of Response Result");
-                            isSendResponseSetting = false;
-                        }
-                    }
-                }).show();
-    }
-
-    private void checkResponseResult(String title) {
-
-        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
-        builder.setTitle(title)
-                .setSingleChoiceItems(mResponseResultCheckBoxItems, selectedResponseValue,
-                        new DialogInterface.OnClickListener() {
-
-                            @Override
-                            public void onClick(DialogInterface dialog,
-                                    int which) {
-                                selectedResponseValue = which;
-                            }
-                        })
-                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-
-                        if (selectedResponseValue == ResponseResult.CA_CREATED.ordinal()) {
-                            responseValue = 201;
-                            DLog.v(TAG, "Response Value is CA_CREATED");
-                        } else if (selectedResponseValue == ResponseResult.CA_DELETED
-                                .ordinal()) {
-                            responseValue = 202;
-                            DLog.v(TAG, "Response Value is CA_DELETED");
-                        } else if (selectedResponseValue == ResponseResult.CA_VALID
-                                .ordinal()) {
-                            responseValue = 203;
-                            DLog.v(TAG, "Response Value is CA_VALID");
-                        } else if (selectedResponseValue == ResponseResult.CA_CHANGED
-                                .ordinal()) {
-                            responseValue = 204;
-                            DLog.v(TAG, "Response Value is CA_CHANGED");
-                        } else if (selectedResponseValue == ResponseResult.CA_CONTENT
-                                .ordinal()) {
-                            responseValue = 205;
-                            DLog.v(TAG, "Response Value is CA_CONTENT");
-                        } else if (selectedResponseValue == ResponseResult.CA_EMPTY
-                                .ordinal()) {
-                            responseValue = 0;
-                            DLog.v(TAG, "Response Value is CA_EMPTY");
-                        } else if (selectedResponseValue == ResponseResult.CA_BAD_REQ
-                                .ordinal()) {
-                            responseValue = 400;
-                            DLog.v(TAG, "Response Value is CA_BAD_REQ");
-                        } else if (selectedResponseValue == ResponseResult.CA_BAD_OPT
-                                .ordinal()) {
-                            responseValue = 402;
-                            DLog.v(TAG, "Response Value is CA_BAD_OPT");
-                        } else if (selectedResponseValue == ResponseResult.CA_NOT_FOUND
-                                .ordinal()) {
-                            responseValue = 404;
-                            DLog.v(TAG, "Response Value is CA_NOT_FOUND");
-                        } else if (selectedResponseValue ==
-                                ResponseResult.CA_INTERNAL_SERVER_ERROR
-                                .ordinal()) {
-                            responseValue = 500;
-                            DLog.v(TAG, "Response Value is CA_INTERNAL_SERVER_ERROR");
-                        } else if (selectedResponseValue == ResponseResult.CA_RETRANSMIT_TIMEOUT
-                                .ordinal()) {
-                            responseValue = 504;
-                            DLog.v(TAG, "Response Value is CA_RETRANSMIT_TIMEOUT");
-                        }
-                    }
-                }).show();
-    }
-
-    private void checkSendNetworkType(String title) {
-        selectedNetworkType = -1;
-        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
-
-        builder.setTitle(title)
-                .setSingleChoiceItems(mNetworkCheckBoxItems, -1,
-                        new DialogInterface.OnClickListener() {
-
-                            @Override
-                            public void onClick(DialogInterface dialog,
-                                    int which) {
-                                selectedNetworkType = which;
-                            }
-                        })
-                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
-
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-
-                        if (selectedNetworkType == Network.IP.ordinal()) {
-                            selectedNetwork = CA_IP;
-                            DLog.v(TAG, "Selected Network is IP");
-                        } else if (selectedNetworkType == Network.LE.ordinal()) {
-                            selectedNetwork = CA_LE;
-                            DLog.v(TAG, "Selected Network is LE");
-                        } else if (selectedNetworkType == Network.EDR.ordinal()) {
-                            selectedNetwork = CA_EDR;
-                            DLog.v(TAG, "Selected Network is EDR");
-                        } else if (selectedNetworkType == Network.TCP.ordinal()) {
-                            selectedNetwork = CA_TCP;
-                            DLog.v(TAG, "Selected Network is TCP");
-                        } else if (selectedNetworkType == Network.NFC.ordinal()) {
-                            selectedNetwork = CA_NFC;
-                            DLog.v(TAG, "Selected Network is NFC");
-                        } else {
-                            DLog.v(TAG, "Selected Network is NULL");
-                            selectedNetwork = -1;
-                        }
-
-                        if (isBigData)
-                        {
-                            new FileChooser(MainActivity.this).setFileListener(
-                                    new FileSelectedListener() {
-                                public void fileSelected(final File file) {
-                                    if (selectedNetwork != -1) {
-
-                                        String path = file.getAbsolutePath();
-                                        Log.d(TAG, "File Path: " + path);
-
-                                        RM.RMSendRequest(mReqData_ed.getText().toString(), path,
-                                                         selectedNetwork, isSecured, msgType, true);
-                                    } else {
-                                        Toast.makeText(getApplicationContext(),
-                                                       "Request Setting Fisrt!!",
-                                                        Toast.LENGTH_LONG).show();
-                                    }
-                                }
-                            } ).showDialog();
-                            isBigData = false;
-                        } else {
-                            if (isSendRequestToAllSetting != true) {
-                                checkMsgSecured("Select DTLS Type");
-                            }
-                        }
-
-                        isSendRequestToAllSetting = false;
-                        isBigData = false;
-                    }
-                }).show();
-    }
-
-    public void OnResponseReceived(String subject, String receivedData) {
-        String callbackData = subject + receivedData;
-        DLog.v(TAG, callbackData);
-
-        if (subject.equals(getString(R.string.remote_address))) {
-            StringBuilder sb = new StringBuilder();
-            sb.append(getString(R.string.coap_prefix)).append(receivedData);
-            mReqData_ed.setText(sb.toString());
-            mNotification_ed.setText(sb.toString());
-        } else if (subject.equals(getString(R.string.remote_port))) {
-            StringBuilder sb = new StringBuilder();
-            String uri = mReqData_ed.getText().toString();
-            sb.append(uri);
-            if (null != receivedData && uri.contains("."))
-            {
-                sb.append(":").append(receivedData);
-            }
-            sb.append(getString(R.string.uri));
-            mReqData_ed.setText(sb.toString());
-            mNotification_ed.setText(sb.toString());
-        }
-    }
-}
\ No newline at end of file
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/RMInterface.java b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/java/org/iotivity/ca/service/RMInterface.java
deleted file mode 100644 (file)
index 18f1b64..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.iotivity.ca.service;
-
-import android.content.Context;
-import android.app.Activity;
-
-public class RMInterface {
-
-    static {
-        // Load RI JNI interface
-        System.loadLibrary("RMInterface");
-    }
-
-    private org.iotivity.ca.service.MainActivity mResponseListener = null;
-
-    public native void setNativeResponseListener(Object listener);
-
-    public native void RMInitialize(Context context, Activity activity);
-
-    public native void RMTerminate();
-
-    public native void RMStartListeningServer();
-
-    public native void RMStartDiscoveryServer();
-
-    public native void RMRegisterHandler();
-
-    public native void RMFindResource(String uri);
-
-    public native void RMSendRequest(String uri, String payload,
-            int selectedNetwork, int isSecured, int msgType, boolean isBigData);
-
-    public native void RMSendReqestToAll(String uri, int selectedNetwork);
-
-    public native void RMSendResponse(int selectedNetwork, int isSecured,
-            int msgType, int responseValue);
-
-    public native void RMAdvertiseResource(String advertiseResource);
-
-    public native void RMSendNotification(String uri, String payload,
-            int selectedNetwork, int isSecured, int msgType);
-
-    public native void RMSelectNetwork(int interestedNetwork);
-
-    public native void RMUnSelectNetwork(int uninterestedNetwork);
-
-    public native void RMGetNetworkInfomation();
-
-    public native void RMHandleRequestResponse();
-
-    public void setResponseListener(org.iotivity.ca.service.MainActivity listener) {
-        mResponseListener = listener;
-        setNativeResponseListener(this);
-    }
-
-    private void OnResponseReceived(String subject, String receivedData) {
-        if (null != mResponseListener) {
-            mResponseListener.OnResponseReceived(subject, receivedData);
-        }
-    }
-
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/Android.mk b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/Android.mk
deleted file mode 100755 (executable)
index be764d8..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-APP_PATH := $(call my-dir)
-#specify project root path here wrt make file directory
-PROJECT_ROOT_PATH      = ../../../../../../
-include $(CLEAR_VARS)
-LOCAL_PATH= $(PROJECT_ROOT_PATH)/../../../out/android/$(APP_ABI)/$(APP_OPTIM)/resource/csdk/connectivity/src
-LOCAL_SRC_FILES = libconnectivity_abstraction.so
-LOCAL_MODULE = CA
-include $(PREBUILT_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_PATH= $(PROJECT_ROOT_PATH)/../../../out/android/$(APP_ABI)/$(APP_OPTIM)/resource/csdk/connectivity/samples/android
-LOCAL_SRC_FILES = libRMInterface.so
-LOCAL_MODULE = CASAMPLE
-include $(PREBUILT_SHARED_LIBRARY)
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/Application.mk b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/Application.mk
deleted file mode 100755 (executable)
index ed9b8b6..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-
-APP_PROJECT_PATH = ./
-APP_STL := gnustl_shared
-
-APP_PLATFORM = android-21
-APP_CPPFLAGS += -fexceptions
-APP_CPPFLAGS += -frtti
-APP_CFLAGS = -Wno-error=format-security
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/ResourceModel.c b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/ResourceModel.c
deleted file mode 100644 (file)
index d74d25c..0000000
+++ /dev/null
@@ -1,1765 +0,0 @@
-#include <jni.h>
-#include <android/log.h>
-#include <stdio.h>
-#include <dlfcn.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "cainterface.h"
-#include "cacommon.h"
-#include "caadapterutils.h"
-#include "oic_string.h"
-
-#include "org_iotivity_ca_service_RMInterface.h"
-
-#define  LOG_TAG   "JNI_INTERFACE_SAMPLE"
-#define  LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
-#define  LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
-
-// Iotivity Device Identity.
-const unsigned char IDENTITY[] = ("1111111111111111");
-
-// PSK between this device and peer device.
-const unsigned char RS_CLIENT_PSK[] = ("AAAAAAAAAAAAAAAA");
-
-#define PORT_LENGTH 6
-#define SECURE_DEFAULT_PORT 5684
-#define RESOURCE_URI_LENGTH 14
-#define OPTION_INFO_LENGTH 1024
-#define NETWORK_INFO_LENGTH 1024
-#define BIG_PAYLOAD_LENGTH 1024
-#define RECEIVED_FILE_NAME_PREFIX_LENGTH 7
-#define RECEIVED_FILE_NAME_LENGTH 14
-
-typedef struct
-{
-    char ipAddress[CA_IPADDR_SIZE];
-    uint16_t port;
-} addressSet_t;
-
-static void request_handler(const CAEndpoint_t* object, const CARequestInfo_t* requestInfo);
-static void response_handler(const CAEndpoint_t* object, const CAResponseInfo_t* responseInfo);
-static void error_handler(const CAEndpoint_t *object, const CAErrorInfo_t* errorInfo);
-static void get_resource_uri(const char *URI, char *resourceURI, int32_t length);
-static uint32_t get_secure_information(CAPayload_t payLoad);
-static CAResult_t get_network_type(uint32_t selectedNetwork, CATransportFlags_t *flags);
-static void callback(char *subject, char *receivedData);
-static CAResult_t get_remote_address(const char *address);
-static void parsing_coap_uri(const char* uri, addressSet_t* address, CATransportFlags_t *flags);
-static void delete_global_references(JNIEnv *env, jobject obj);
-static int get_address_set(const char *pAddress, addressSet_t* outAddress);
-bool read_file(const char* name, char** bytes, size_t* length);
-uint32_t gettodaydate();
-void saveFile(const char *payload, size_t payloadSize);
-
-uint16_t g_localSecurePort = SECURE_DEFAULT_PORT;
-CATransportAdapter_t g_selectedNwType = CA_ADAPTER_IP;
-static CAToken_t g_lastRequestToken = NULL;
-static uint8_t g_lastRequestTokenLength = 0;
-
-static const char COAP_PREFIX[] =  "coap://";
-static const char COAPS_PREFIX[] = "coaps://";
-static const char COAP_TCP_PREFIX[] =  "coap+tcp://";
-
-static const uint16_t COAP_PREFIX_LEN = sizeof(COAP_PREFIX) - 1;
-static const uint16_t COAPS_PREFIX_LEN = sizeof(COAPS_PREFIX) - 1;
-static const uint16_t COAP_TCP_PREFIX_LEN = sizeof(COAP_TCP_PREFIX) - 1;
-
-static const char RECEIVED_FILE_PATH[] = "/storage/emulated/0/Download/%d%s.txt";
-
-static const char SECURE_INFO_DATA[]
-                                   = "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
-                                     "\"if\":[\"oic.if.baseline\"],\"obs\":1,\"sec\":1,\"port\":"
-                                     "%d}}]}";
-static const char NORMAL_INFO_DATA[]
-                                   = "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
-                                     "\"if\":[\"oic.if.baseline\"],\"obs\":1}}]}";
-
-static jobject g_responseListenerObject = NULL;
-static JavaVM *g_jvm;
-
-static CAEndpoint_t *g_clientEndpoint = NULL;
-static char *g_resourceUri = NULL;
-static CAToken_t g_clientToken = NULL;
-static uint8_t g_clientTokenLength = 0;
-
-static uint16_t g_clientMsgId = 0;
-static char *g_remoteAddress = NULL;
-
-// init
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_setNativeResponseListener(JNIEnv *env, jobject obj,
-                                                                   jobject listener)
-{
-    LOGI("setNativeResponseListener");
-    if (!env || !obj || !listener)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    g_responseListenerObject = (*env)->NewGlobalRef(env, listener);
-}
-
-#ifdef __WITH_DTLS__
-// Internal API. Invoked by OC stack to retrieve credentials from this module
-int32_t CAGetDtlsPskCredentials( CADtlsPskCredType_t type,
-              const unsigned char *desc, size_t desc_len,
-              unsigned char *result, size_t result_length)
-{
-    LOGI("CAGetDtlsPskCredentials IN");
-
-    int32_t ret = -1;
-
-    if (NULL == result)
-    {
-        return ret;
-    }
-
-    switch (type)
-    {
-        case CA_DTLS_PSK_HINT:
-        case CA_DTLS_PSK_IDENTITY:
-
-            if (result_length < sizeof(IDENTITY))
-            {
-                LOGE("ERROR : Wrong value for result for storing IDENTITY");
-                return ret;
-            }
-
-            memcpy(result, IDENTITY, sizeof(IDENTITY));
-            ret = sizeof(IDENTITY);
-            break;
-
-        case CA_DTLS_PSK_KEY:
-
-            if ((desc_len == sizeof(IDENTITY)) &&
-                memcmp(desc, IDENTITY, sizeof(IDENTITY)) == 0)
-            {
-                if (result_length < sizeof(RS_CLIENT_PSK))
-                {
-                    LOGE("ERROR : Wrong value for result for storing RS_CLIENT_PSK");
-                    return ret;
-                }
-
-                memcpy(result, RS_CLIENT_PSK, sizeof(RS_CLIENT_PSK));
-                ret = sizeof(RS_CLIENT_PSK);
-            }
-            break;
-
-        default:
-
-            LOGE("Wrong value passed for PSK_CRED_TYPE.");
-            ret = -1;
-    }
-
-    LOGI("CAGetDtlsPskCredentials OUT\n");
-    return ret;
-}
-
-#endif
-
-JNIEXPORT jint JNI_OnLoad(JavaVM *jvm, void *reserved)
-{
-    LOGI("JNI_OnLoad");
-    (void)reserved;
-
-    JNIEnv* env;
-    if (JNI_OK != (*jvm)->GetEnv(jvm, (void**) &env, JNI_VERSION_1_6))
-    {
-        return -1;
-    }
-    g_jvm = jvm; /* cache the JavaVM pointer */
-
-    CANativeJNISetJavaVM(g_jvm);
-
-    return JNI_VERSION_1_6;
-}
-
-void JNI_OnUnload(JavaVM *jvm, void *reserved)
-{
-    LOGI("JNI_OnUnload");
-    (void)reserved;
-
-    JNIEnv* env;
-    if (JNI_OK != (*jvm)->GetEnv(jvm, (void**) &env, JNI_VERSION_1_6))
-    {
-        return;
-    }
-    g_jvm = 0;
-    return;
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMInitialize(JNIEnv *env, jobject obj, jobject context,
-                                                      jobject activity)
-{
-    LOGI("RMInitialize");
-    if (!env || !obj || !context || !activity)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    //Currently set context for Android Platform
-    CANativeJNISetContext(env, context);
-    CANativeSetActivity(env, activity);
-
-    CAResult_t res = CAInitialize();
-
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("Could not Initialize");
-    }
-
-#ifdef __WITH_DTLS__
-    res = CARegisterDTLSCredentialsHandler(CAGetDtlsPskCredentials);
-    if(CA_STATUS_OK != res)
-    {
-        LOGE("Set credential handler fail");
-        return;
-    }
-#endif
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMTerminate(JNIEnv *env, jobject obj)
-{
-    LOGI("RMTerminate");
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    CADestroyToken(g_lastRequestToken);
-    CATerminate();
-    delete_global_references(env, obj);
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMStartListeningServer(JNIEnv *env, jobject obj)
-{
-    LOGI("RMStartListeningServer");
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    if (CA_STATUS_OK != CAStartListeningServer())
-    {
-        LOGE("Could not start Listening server");
-    }
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMStartDiscoveryServer(JNIEnv *env, jobject obj)
-{
-    LOGI("RMStartDiscoveryServer");
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    if (CA_STATUS_OK != CAStartDiscoveryServer())
-    {
-        LOGE("Could not start discovery server");
-    }
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMRegisterHandler(JNIEnv *env, jobject obj)
-{
-    LOGI("RMRegisterHandler");
-    if(!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    CARegisterHandler(request_handler, response_handler, error_handler);
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMSendRequest(JNIEnv *env, jobject obj, jstring uri,
-                                                       jstring payload, jint selectedNetwork,
-                                                       jint isSecured, jint msgType,
-                                                       jboolean isBigData)
-{
-    LOGI("selectedNetwork - %d", selectedNetwork);
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    if (!uri)
-    {
-        LOGE("Invalid input parameter : uri");
-        return;
-    }
-
-    CATransportFlags_t flags = CA_DEFAULT_FLAGS;
-    CAResult_t res = get_network_type(selectedNetwork, &flags);
-    if (CA_STATUS_OK != res)
-    {
-        return;
-    }
-
-    const char* strUri = (*env)->GetStringUTFChars(env, uri, NULL);
-    LOGI("RMSendRequest - %s", strUri);
-
-    addressSet_t address = {{0}, 0};
-    parsing_coap_uri(strUri, &address, &flags);
-
-    //create remote endpoint
-    CAEndpoint_t* endpoint = NULL;
-    res = CACreateEndpoint(flags, g_selectedNwType, (const char*)(address.ipAddress),
-                           address.port, &endpoint);
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("Could not create remote end point");
-        (*env)->ReleaseStringUTFChars(env, uri, strUri);
-        return;
-    }
-
-    CAMessageType_t messageType = msgType;
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if ((CA_STATUS_OK != res) || (!token))
-    {
-        LOGE("token generate error!!");
-        // destroy remote endpoint
-        CADestroyEndpoint(endpoint);
-        (*env)->ReleaseStringUTFChars(env, uri, strUri);
-        return;
-    }
-
-    char resourceURI[RESOURCE_URI_LENGTH + 1] = { 0 };
-
-    get_resource_uri((const CAURI_t) strUri, resourceURI, RESOURCE_URI_LENGTH);
-    (*env)->ReleaseStringUTFChars(env, uri, strUri);
-
-    CAInfo_t requestData = { 0 };
-    requestData.token = token;
-    requestData.tokenLength = tokenLength;
-
-    size_t payloadLength = 0;
-    if (isBigData)
-    {
-        const char* path = NULL;
-        if (payload)
-        {
-            path = (*env)->GetStringUTFChars(env, payload, NULL);
-            if(path)
-            {
-                char* bigData = NULL;
-                bool result = read_file(path, &bigData, &payloadLength);
-                if (!result)
-                {
-                    LOGE("read has failed");
-                    (*env)->ReleaseStringUTFChars(env, payload, path);
-                    CADestroyToken(token);
-                    CADestroyEndpoint(endpoint);
-                    return;
-                }
-                (*env)->ReleaseStringUTFChars(env, payload, path);
-
-                requestData.payload = (CAPayload_t) malloc(payloadLength);
-                if (NULL == requestData.payload)
-                {
-                    LOGE("Memory allocation failed!");
-                    // destroy token
-                    CADestroyToken(token);
-                    // destroy remote endpoint
-                    CADestroyEndpoint(endpoint);
-                    return;
-                }
-                memcpy(requestData.payload, bigData, payloadLength);
-                requestData.payloadSize = payloadLength;
-            }
-        }
-    }
-    else
-    {
-        if (isSecured)
-        {
-            payloadLength = sizeof(SECURE_INFO_DATA) + strlen(resourceURI);
-            requestData.payload = (CAPayload_t) malloc(payloadLength);
-            if (NULL == requestData.payload)
-            {
-                LOGE("Memory allocation failed!");
-                // destroy token
-                CADestroyToken(token);
-                // destroy remote endpoint
-                CADestroyEndpoint(endpoint);
-                return;
-            }
-            snprintf((char *) requestData.payload, payloadLength, SECURE_INFO_DATA,
-                     resourceURI, g_localSecurePort);
-            requestData.payloadSize = payloadLength;
-        }
-        else
-        {
-            payloadLength = sizeof(NORMAL_INFO_DATA) + strlen(resourceURI);
-            requestData.payload = (CAPayload_t) malloc(payloadLength);
-            if (NULL == requestData.payload)
-            {
-                LOGE("Memory allocation failed!");
-                // destroy token
-                CADestroyToken(token);
-                // destroy remote endpoint
-                CADestroyEndpoint(endpoint);
-                return;
-            }
-            snprintf((char *) requestData.payload, payloadLength, NORMAL_INFO_DATA, resourceURI);
-            requestData.payloadSize = payloadLength;
-        }
-    }
-
-    requestData.type = messageType;
-    requestData.resourceUri = (CAURI_t) malloc(sizeof(resourceURI));
-    if (NULL == requestData.resourceUri)
-    {
-        LOGE("Memory allocation failed!");
-        // destroy token
-        CADestroyToken(token);
-        // destroy remote endpoint
-        CADestroyEndpoint(endpoint);
-        free(requestData.payload);
-        return;
-    }
-    memcpy(requestData.resourceUri, resourceURI, sizeof(resourceURI));
-
-    CARequestInfo_t requestInfo = { 0 };
-    requestInfo.method = CA_GET;
-    requestInfo.isMulticast = false;
-    requestInfo.info = requestData;
-
-    // send request
-    if (CA_STATUS_OK != CASendRequest(endpoint, &requestInfo))
-    {
-        LOGE("Could not send request");
-    }
-
-    // destroy token
-    CADestroyToken(token);
-
-    // destroy remote endpoint
-    CADestroyEndpoint(endpoint);
-
-    free(requestData.payload);
-    free(requestData.resourceUri);
-    LOGI("send request success");
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMSendReqestToAll(JNIEnv *env, jobject obj, jstring uri,
-                                                           jint selectedNetwork)
-{
-    LOGI("selectedNetwork - %d", selectedNetwork);
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    CATransportFlags_t flags = CA_DEFAULT_FLAGS;
-    CAResult_t res = get_network_type(selectedNetwork, &flags);
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("Not supported network type");
-        return;
-    }
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    res = CACreateEndpoint(flags, g_selectedNwType, NULL, 0, &endpoint);
-
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("create remote endpoint error, error code: %d", res);
-        return;
-    }
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if ((CA_STATUS_OK != res) || (!token))
-    {
-        LOGE("token generate error!!");
-        // destroy remote endpoint
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    LOGI("generated token %s", token);
-
-    CAInfo_t requestData = { 0 };
-    requestData.token = token;
-    requestData.tokenLength = tokenLength;
-    requestData.payload = (CAPayload_t) "TempJsonPayload";
-    requestData.payloadSize = strlen((const char *) requestData.payload);
-    requestData.type = CA_MSG_NONCONFIRM;
-
-    const char* strUri = (*env)->GetStringUTFChars(env, uri, NULL);
-    LOGI("resourceUri - %s", strUri);
-    requestData.resourceUri = (CAURI_t)strUri;
-
-    uint8_t optionNum = 2;
-    CAHeaderOption_t *headerOpt = (CAHeaderOption_t*) calloc(1,
-                                                             sizeof(CAHeaderOption_t) * optionNum);
-    if (NULL == headerOpt)
-    {
-        LOGE("Memory allocation failed");
-        // destroy remote endpoint
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    char* FirstOptionData = "Hello";
-    headerOpt[0].optionID = 3000;
-    memcpy(headerOpt[0].optionData, FirstOptionData, strlen(FirstOptionData));
-    headerOpt[0].optionLength = (uint16_t) strlen(FirstOptionData);
-
-    char* SecondOptionData2 = "World";
-    headerOpt[1].optionID = 3001;
-    memcpy(headerOpt[1].optionData, SecondOptionData2, strlen(SecondOptionData2));
-    headerOpt[1].optionLength = (uint16_t) strlen(SecondOptionData2);
-
-    requestData.numOptions = optionNum;
-    requestData.options = headerOpt;
-
-    CARequestInfo_t requestInfo = { 0 };
-    requestInfo.method = CA_GET;
-    requestInfo.isMulticast = true;
-    requestInfo.info = requestData;
-
-    // send request to all
-    res = CASendRequest(endpoint, &requestInfo);
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("Could not send request to all");
-        //destroy token
-        CADestroyToken(token);
-    }
-    else
-    {
-        CADestroyToken(g_lastRequestToken);
-        g_lastRequestToken = token;
-        g_lastRequestTokenLength = tokenLength;
-    }
-
-    //ReleaseStringUTFChars for strUri
-    (*env)->ReleaseStringUTFChars(env, uri, strUri);
-
-    free(headerOpt);
-
-    // destroy remote endpoint
-    CADestroyEndpoint(endpoint);
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMSendResponse(JNIEnv *env, jobject obj,
-                                                        jint selectedNetwork,
-                                                        jint isSecured, jint msgType,
-                                                        jint responseValue)
-{
-    LOGI("RMSendResponse");
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    LOGI("selectedNetwork - %d", selectedNetwork);
-
-    CATransportFlags_t flags = CA_DEFAULT_FLAGS;
-    CAResult_t res = get_network_type(selectedNetwork, &flags);
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("Not supported network type");
-        return;
-    }
-
-    if (NULL == g_clientEndpoint)
-    {
-        LOGE("No Request received");
-        return;
-    }
-
-    CAMessageType_t messageType = msgType;
-
-    CAInfo_t responseData = { 0 };
-    responseData.type = messageType;
-    responseData.messageId = g_clientMsgId;
-    responseData.resourceUri = (CAURI_t)g_resourceUri;
-
-    CAResponseInfo_t responseInfo = { 0 };
-
-    if (CA_MSG_RESET == msgType ||
-        (CA_MSG_ACKNOWLEDGE == msgType && CA_EMPTY == responseValue))
-    {
-        printf("RESET or ACK/EMPTY. there will be not payload/option\n");
-        responseInfo.result = CA_EMPTY;
-    }
-    else
-    {
-        responseData.token = g_clientToken;
-        responseData.tokenLength = g_clientTokenLength;
-        responseInfo.result = responseValue;
-
-        if (1 == isSecured)
-        {
-            uint32_t length = strlen(SECURE_INFO_DATA) + strlen(g_resourceUri) + 1;
-            responseData.payload = (CAPayload_t) malloc(length);
-            snprintf((char *) responseData.payload, length, SECURE_INFO_DATA,
-                     g_resourceUri, g_localSecurePort);
-            responseData.payloadSize = length;
-        }
-        else
-        {
-            uint32_t length = strlen(NORMAL_INFO_DATA) + strlen(g_resourceUri) + 1;
-            responseData.payload = (CAPayload_t) malloc(length);
-            snprintf((char *) responseData.payload, length, NORMAL_INFO_DATA, g_resourceUri);
-            responseData.payloadSize = length;
-        }
-    }
-
-    responseInfo.info = responseData;
-
-    // send response
-    res = CASendResponse(g_clientEndpoint, &responseInfo);
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("Could not send response");
-    }
-
-    // destroy token
-    CADestroyToken(g_clientToken);
-    g_clientToken = NULL;
-    g_clientTokenLength = 0;
-
-    // destroy remote endpoint
-    CADestroyEndpoint(g_clientEndpoint);
-    g_clientEndpoint = NULL;
-    free(responseData.payload);
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMSendNotification(JNIEnv *env, jobject obj, jstring uri,
-                                                            jstring payload, jint selectedNetwork,
-                                                            jint isSecured, jint msgType)
-{
-    LOGI("selectedNetwork - %d", selectedNetwork);
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    if (!payload)
-    {
-        LOGE("payload is NULL");
-    }
-
-    if (!uri)
-    {
-        LOGE("Invalid input parameter : uri");
-        return;
-    }
-
-    CATransportFlags_t flags = CA_DEFAULT_FLAGS;
-    CAResult_t res = get_network_type(selectedNetwork, &flags);
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("Not supported network type");
-        return;
-    }
-
-    const char* strUri = (*env)->GetStringUTFChars(env, uri, NULL);
-    LOGI("RMSendNotification - %s", strUri);
-
-    addressSet_t address = {{0}, 0};
-    parsing_coap_uri(strUri, &address, &flags);
-
-    //create remote endpoint
-    CAEndpoint_t* endpoint = NULL;
-    if (CA_STATUS_OK != CACreateEndpoint(flags, g_selectedNwType,
-                                         (const char*)address.ipAddress,
-                                         address.port, &endpoint))
-    {
-        //ReleaseStringUTFChars for strUri
-        (*env)->ReleaseStringUTFChars(env, uri, strUri);
-        LOGE("Could not create remote end point");
-        return;
-    }
-
-    char resourceURI[RESOURCE_URI_LENGTH + 1] = { 0 };
-    get_resource_uri(strUri, resourceURI, RESOURCE_URI_LENGTH);
-
-    //ReleaseStringUTFChars for strUri
-    (*env)->ReleaseStringUTFChars(env, uri, strUri);
-
-    CAMessageType_t messageType = msgType;
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if ((CA_STATUS_OK != res) || (!token))
-    {
-        LOGE("token generate error!");
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    CAInfo_t requestData = { 0 };
-    requestData.token = token;
-    requestData.tokenLength = tokenLength;
-    requestData.resourceUri = (CAURI_t) malloc(sizeof(resourceURI));
-    if (NULL == requestData.resourceUri)
-    {
-        LOGE("Memory allocation failed!");
-        // destroy token
-        CADestroyToken(token);
-        // destroy remote endpoint
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-    memcpy(requestData.resourceUri, resourceURI, sizeof(resourceURI));
-
-    if (1 == isSecured)
-    {
-        uint32_t length = sizeof(SECURE_INFO_DATA) + strlen(resourceURI);
-        requestData.payload = (CAPayload_t) malloc(length);
-        if (NULL == requestData.payload)
-        {
-            LOGE("Memory allocation failed!");
-            // destroy token
-            CADestroyToken(token);
-            // destroy remote endpoint
-            CADestroyEndpoint(endpoint);
-
-            free(requestData.resourceUri);
-            return;
-        }
-        snprintf((char *) requestData.payload, length, SECURE_INFO_DATA,
-                 resourceURI, g_localSecurePort);
-        requestData.payloadSize = length;
-    }
-    else
-    {
-        uint32_t length = sizeof(NORMAL_INFO_DATA) + strlen(resourceURI);
-        requestData.payload = (CAPayload_t) malloc(length);
-        if (NULL == requestData.payload)
-        {
-            LOGE("Memory allocation failed!");
-            // destroy token
-            CADestroyToken(token);
-            // destroy remote endpoint
-            CADestroyEndpoint(endpoint);
-
-            free(requestData.resourceUri);
-            return;
-        }
-        snprintf((char *) requestData.payload, length, NORMAL_INFO_DATA, resourceURI);
-        requestData.payloadSize = length;
-    }
-
-    requestData.type = messageType;
-
-    CARequestInfo_t requestInfo = { 0 };
-    requestInfo.method = CA_GET;
-    requestInfo.info = requestData;
-
-    // send notification
-    if (CA_STATUS_OK != CASendRequest(endpoint, &requestInfo))
-    {
-        LOGE("Could not send notification");
-    }
-
-    LOGI("Send Notification");
-
-    // destroy token
-    CADestroyToken(token);
-
-    // destroy remote endpoint
-    CADestroyEndpoint(endpoint);
-
-    free(requestData.payload);
-    free(requestData.resourceUri);
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMSelectNetwork(JNIEnv *env, jobject obj,
-                                                         jint networkType)
-{
-    LOGI("RMSelectNetwork Type : %d", networkType);
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    if (CA_STATUS_OK != CASelectNetwork(networkType))
-    {
-        LOGE("Could not select network");
-    }
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMUnSelectNetwork(JNIEnv *env, jobject obj,
-                                                           jint networkType)
-{
-    LOGI("RMUnSelectNetwork Type : %d", networkType);
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    if (CA_STATUS_OK != CAUnSelectNetwork(networkType))
-    {
-        LOGE("Could not unselect network");
-    }
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMGetNetworkInfomation(JNIEnv *env, jobject obj)
-{
-    LOGI("RMGetNetworkInfomation");
-    if (!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    CAEndpoint_t *tempInfo = NULL;
-    uint32_t tempSize = 0;
-
-    CAResult_t res = CAGetNetworkInformation(&tempInfo, &tempSize);
-    if (CA_STATUS_OK != res)
-    {
-        LOGE("Could not start get network information");
-        free(tempInfo);
-        return;
-    }
-
-    LOGI("################## Network Information #######################");
-    callback("######## Network Information", "#######");
-    LOGI("Network info total size is %d", tempSize);
-
-    uint32_t index;
-    for (index = 0; index < tempSize; index++)
-    {
-        res = get_remote_address(tempInfo[index].addr);
-        if (CA_STATUS_OK != res)
-        {
-            free(tempInfo);
-            return;
-        }
-        if (NULL != g_responseListenerObject)
-        {
-            char networkInfo[NETWORK_INFO_LENGTH];
-            LOGI("Type: %d", tempInfo[index].adapter);
-            snprintf(networkInfo, NETWORK_INFO_LENGTH, "%d",tempInfo[index].adapter);
-            callback("Type :", networkInfo);
-            if (CA_ADAPTER_IP == tempInfo[index].adapter)
-            {
-                LOGI("Port: %d", tempInfo[index].port);
-                snprintf(networkInfo, NETWORK_INFO_LENGTH, "%d",tempInfo[index].port);
-                callback("Port: ", networkInfo);
-            }
-            LOGI("Secured: %d", (tempInfo[index].flags & CA_SECURE));
-            LOGI("Address: %s", g_remoteAddress);
-            callback("Address: ", g_remoteAddress);
-            free(g_remoteAddress);
-        }
-        if (tempInfo[index].flags & CA_SECURE)
-        {
-            g_localSecurePort = tempInfo[index].port;
-        }
-    }
-
-    // free
-    free(tempInfo);
-
-    LOGI("##############################################################");
-}
-
-JNIEXPORT void JNICALL
-Java_org_iotivity_ca_service_RMInterface_RMHandleRequestResponse(JNIEnv *env, jobject obj)
-{
-    LOGI("RMHandleRequestResponse");
-    if(!env || !obj)
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    if (CA_STATUS_OK != CAHandleRequestResponse())
-    {
-        LOGE("Could not handle request and response");
-    }
-}
-
-void request_handler(const CAEndpoint_t* object, const CARequestInfo_t* requestInfo)
-{
-
-    if (!object)
-    {
-        LOGE("Remote endpoint is NULL!");
-        return;
-    }
-
-    if (!requestInfo)
-    {
-        LOGE("Request info is NULL!");
-        return;
-    }
-
-    if ((NULL != g_lastRequestToken) && (NULL != requestInfo->info.token) &&
-            (strncmp(g_lastRequestToken, requestInfo->info.token,
-                     requestInfo->info.tokenLength) == 0))
-    {
-        LOGI("token is same. received request of it's own. skip.. ");
-        return;
-    }
-
-    CAResult_t res = get_remote_address(object->addr);
-    if (CA_STATUS_OK != res)
-    {
-        return;
-    }
-
-    LOGI("##########received request from remote device #############");
-    LOGI("Remote Address: %s", g_remoteAddress);
-    LOGI("Remote Port: %d", object->port);
-    LOGI("Uri: %s", requestInfo->info.resourceUri);
-    LOGI("Data: %s", requestInfo->info.payload);
-    LOGI("Token: %s", requestInfo->info.token);
-    LOGI("Code: %d", requestInfo->method);
-    LOGI("MessageType: %d", requestInfo->info.type);
-
-    if (NULL != g_responseListenerObject)
-    {
-        char *cloneUri = NULL;
-        uint32_t len = 0;
-
-        if (NULL != requestInfo->info.resourceUri)
-        {
-            len = strlen(requestInfo->info.resourceUri);
-            cloneUri = (char *)malloc(sizeof(char) * (len + 1));
-
-            if (NULL == cloneUri)
-            {
-                LOGE("cloneUri Out of memory");
-                free(g_remoteAddress);
-                return;
-            }
-
-            memcpy(cloneUri, requestInfo->info.resourceUri, len + 1);
-            callback("Uri: ", cloneUri);
-        }
-
-        len = strlen(g_remoteAddress);
-        char *cloneRemoteAddress = (char *) malloc(sizeof(char) * (len + 1));
-
-        if (NULL == cloneRemoteAddress)
-        {
-            LOGE("cloneRemoteAddress Out of memory");
-            free(g_remoteAddress);
-            free(cloneUri);
-            return;
-        }
-
-        memcpy(cloneRemoteAddress, g_remoteAddress, len + 1);
-
-        callback("Remote Address: ", cloneRemoteAddress);
-        free(cloneRemoteAddress);
-        free(g_remoteAddress);
-
-        char portInfo[PORT_LENGTH] = { 0, };
-        snprintf(portInfo, PORT_LENGTH, "%d", object->port);
-        callback("Remote Port: ", portInfo);
-
-        //clone g_clientEndpoint
-        g_clientEndpoint = (CAEndpoint_t *) malloc(sizeof(CAEndpoint_t));
-        if (NULL == g_clientEndpoint)
-        {
-            LOGE("g_clientEndpoint Out of memory");
-            free(cloneUri);
-            return;
-        }
-        memcpy(g_clientEndpoint, object, sizeof(CAEndpoint_t));
-
-        if (NULL != cloneUri)
-        {
-            len = strlen(cloneUri);
-            g_resourceUri = (char *) malloc(sizeof(char) * (len + 1));
-            if (NULL == g_resourceUri)
-            {
-                LOGE("g_clientEndpoint->resourceUri Out of memory");
-                free(g_clientEndpoint);
-                free(cloneUri);
-                return;
-            }
-            memcpy(g_resourceUri, cloneUri, len + 1);
-            free(cloneUri);
-        }
-        //clone g_clientToken
-        len = requestInfo->info.tokenLength;
-
-        g_clientToken = (char *) malloc(sizeof(char) * len);
-        if (NULL == g_clientToken)
-        {
-            LOGE("g_clientToken Out of memory");
-            free(g_clientEndpoint);
-            return;
-        }
-
-        if (NULL != requestInfo->info.token)
-        {
-            memcpy(g_clientToken, requestInfo->info.token, len);
-            g_clientTokenLength = len;
-
-        }
-
-        //clone g_clientMsgId
-        g_clientMsgId = requestInfo->info.messageId;
-
-        if (NULL != requestInfo->info.payload && requestInfo->info.payloadSize > 0)
-        {
-            len = requestInfo->info.payloadSize;
-            char *clonePayload = (char *) malloc(len + 1);
-            if (NULL == clonePayload)
-            {
-                LOGE("clonePayload Out of memory");
-                free(g_clientEndpoint);
-                return;
-            }
-
-            memcpy(clonePayload, requestInfo->info.payload, len);
-            clonePayload[len] = '\0';
-
-            if (len > BIG_PAYLOAD_LENGTH)
-            {
-                saveFile(clonePayload, len);
-            }
-            else
-            {
-                callback("Data: ", clonePayload);
-            }
-            free(clonePayload);
-        }
-    }
-
-    if (requestInfo->info.options)
-    {
-        uint32_t len = requestInfo->info.numOptions;
-        uint32_t i;
-
-        LOGI("Option count: %d", requestInfo->info.numOptions);
-
-        for (i = 0; i < len; i++)
-        {
-            LOGI("Option %d", i + 1);
-            LOGI("ID : %d", requestInfo->info.options[i].optionID);
-            LOGI("Data[%d]: %s", requestInfo->info.options[i].optionLength,
-                 requestInfo->info.options[i].optionData);
-
-            if (NULL != g_responseListenerObject)
-            {
-                char optionInfo[OPTION_INFO_LENGTH] = { 0, };
-                snprintf(optionInfo, OPTION_INFO_LENGTH,
-                         "Num[%d] - ID : %d, Option Length : %d", i + 1,
-                         requestInfo->info.options[i].optionID,
-                         requestInfo->info.options[i].optionLength);
-
-                callback("Option info: ", optionInfo);
-
-                size_t optionDataLen = strlen(requestInfo->info.options[i].optionData);
-                char *cloneOptionData = (char *) malloc(sizeof(char) * (optionDataLen + 1));
-                if (NULL == cloneOptionData)
-                {
-                    LOGE("cloneOptionData Out of memory");
-                    free(g_clientEndpoint);
-                    return;
-                }
-
-                memcpy(cloneOptionData, requestInfo->info.options[i].optionData,
-                       optionDataLen + 1);
-
-                callback("Option Data: ", cloneOptionData);
-                free(cloneOptionData);
-            }
-        }
-    }
-    LOGI("############################################################");
-
-    //Check if this has secure communication information
-    if (requestInfo->info.payload && CA_ADAPTER_IP == object->adapter)
-    {
-        uint32_t securePort = get_secure_information(requestInfo->info.payload);
-        if (0 < securePort) //Set the remote endpoint secure details and send response
-        {
-            LOGI("This is secure resource...");
-
-            CAEndpoint_t *endpoint = NULL;
-            if (CA_STATUS_OK != CACreateEndpoint(CA_SECURE,
-                        object->adapter, object->addr, securePort, &endpoint))
-            {
-                LOGE("Failed to create duplicate of remote endpoint!");
-                return;
-            }
-            object = endpoint;
-        }
-    }
-}
-
-void response_handler(const CAEndpoint_t* object, const CAResponseInfo_t* responseInfo)
-{
-    if (!object || !responseInfo)
-    {
-        LOGE("Invalid input parameter");
-        return;
-    }
-
-    CAResult_t res = get_remote_address(object->addr);
-    if (CA_STATUS_OK != res)
-    {
-        return;
-    }
-
-    LOGI("##########Received response from remote device #############");
-    LOGI("Uri: %s", responseInfo->info.resourceUri);
-    LOGI("Remote Address: %s", g_remoteAddress);
-    LOGI("Remote Port: %d", object->port);
-    LOGI("response result: %d", responseInfo->result);
-    LOGI("Data: %s", responseInfo->info.payload);
-    LOGI("Token: %s", responseInfo->info.token);
-    LOGI("MessageType: %d", responseInfo->info.type);
-
-    if (NULL != g_responseListenerObject)
-    {
-        uint32_t len = 0;
-
-        if (NULL != responseInfo->info.resourceUri)
-        {
-            len = strlen(responseInfo->info.resourceUri);
-            char *cloneUri = (char *) malloc(sizeof(char) * (len + 1));
-
-            if (NULL == cloneUri)
-            {
-                LOGE("cloneUri Out of memory");
-                free(g_remoteAddress);
-                return;
-            }
-
-            memcpy(cloneUri, responseInfo->info.resourceUri, len + 1);
-
-            callback("Uri: ", cloneUri);
-            free(cloneUri);
-        }
-
-        len = strlen(g_remoteAddress);
-        char *cloneRemoteAddress = (char *) malloc(sizeof(char) * (len + 1));
-
-        if (NULL == cloneRemoteAddress)
-        {
-            LOGE("cloneRemoteAddress Out of memory");
-            free(g_remoteAddress);
-            return;
-        }
-
-        memcpy(cloneRemoteAddress, g_remoteAddress, len + 1);
-
-        callback("Remote Address: ", cloneRemoteAddress);
-        free(cloneRemoteAddress);
-        free(g_remoteAddress);
-
-        char portInfo[PORT_LENGTH] = { 0, };
-        snprintf(portInfo, PORT_LENGTH, "%d", object->port);
-        callback("Remote Port: ", portInfo);
-
-        if (NULL != responseInfo->info.payload && responseInfo->info.payloadSize)
-        {
-            len = responseInfo->info.payloadSize;
-            char *clonePayload = (char *) malloc(len + 1);
-            if (NULL == clonePayload)
-            {
-                LOGE("clonePayload Out of memory");
-                return;
-            }
-
-            memcpy(clonePayload, responseInfo->info.payload, len);
-            clonePayload[len] = '\0';
-
-            if (len > BIG_PAYLOAD_LENGTH)
-            {
-                saveFile(clonePayload, len);
-            }
-            else
-            {
-                callback("Data: ", clonePayload);
-            }
-            free(clonePayload);
-        }
-    }
-
-    if (responseInfo->info.options)
-    {
-        uint32_t len = responseInfo->info.numOptions;
-        uint32_t i;
-        for (i = 0; i < len; i++)
-        {
-            LOGI("Option %d", i + 1);
-            LOGI("ID : %d", responseInfo->info.options[i].optionID);
-            LOGI("Data[%d]: %s", responseInfo->info.options[i].optionLength,
-                 responseInfo->info.options[i].optionData);
-
-            if (NULL != g_responseListenerObject)
-            {
-                char optionInfo[OPTION_INFO_LENGTH] = { 0, };
-                snprintf(optionInfo, OPTION_INFO_LENGTH,
-                         "Num[%d] - ID : %d, Option Length : %d", i + 1,
-                         responseInfo->info.options[i].optionID,
-                         responseInfo->info.options[i].optionLength);
-
-                callback("Option info: ", optionInfo);
-
-                size_t optionDataLen = strlen(responseInfo->info.options[i].optionData);
-                char *cloneOptionData = (char *) malloc(sizeof(char) * (optionDataLen + 1));
-                if (NULL == cloneOptionData)
-                {
-                    LOGE("cloneOptionData Out of memory");
-                    return;
-                }
-                memcpy(cloneOptionData, responseInfo->info.options[i].optionData,
-                       optionDataLen + 1);
-                callback("Option Data: ", cloneOptionData);
-                free(cloneOptionData);
-            }
-        }
-    }
-    LOGI("############################################################");
-
-    //Check if this has secure communication information
-    if (responseInfo->info.payload && CA_ADAPTER_IP == object->adapter)
-    {
-        uint32_t securePort = get_secure_information(responseInfo->info.payload);
-        if (0 < securePort) //Set the remote endpoint secure details and send response
-        {
-            LOGI("This is secure resource...");
-        }
-    }
-}
-
-void error_handler(const CAEndpoint_t *rep, const CAErrorInfo_t* errorInfo)
-{
-    LOGI("+++++++++++++++++++++++++++++++++++ErrorInfo+++++++++++++++++++++++++++++++++++");
-
-    if (rep)
-    {
-        LOGI("Error Handler, Adapter Type : %d", rep->adapter);
-        LOGI("Error Handler, Adapter Type : %s", rep->addr);
-    }
-
-    if (errorInfo)
-    {
-        const CAInfo_t *info = &errorInfo->info;
-        LOGI("Error Handler, ErrorInfo :");
-        LOGI("Error Handler result    : %d", errorInfo->result);
-        LOGI("Error Handler token     : %s", info->token);
-        LOGI("Error Handler messageId : %d", (uint16_t) info->messageId);
-        LOGI("Error Handler resourceUri : %s", info->resourceUri);
-        LOGI("Error Handler type      : %d", info->type);
-        LOGI("Error Handler payload   : %s", info->payload);
-
-        if(CA_ADAPTER_NOT_ENABLED == errorInfo->result)
-        {
-            LOGE("CA_ADAPTER_NOT_ENABLED, enable the adapter");
-        }
-        else if(CA_SEND_FAILED == errorInfo->result)
-        {
-            LOGE("CA_SEND_FAILED, unable to send the message, check parameters");
-        }
-        else if(CA_MEMORY_ALLOC_FAILED == errorInfo->result)
-        {
-            LOGE("CA_MEMORY_ALLOC_FAILED, insufficient memory");
-        }
-        else if(CA_SOCKET_OPERATION_FAILED == errorInfo->result)
-        {
-            LOGE("CA_SOCKET_OPERATION_FAILED, socket operation failed");
-        }
-        else if(CA_STATUS_FAILED == errorInfo->result)
-        {
-            LOGE("CA_STATUS_FAILED, message could not be delivered, internal error");
-        }
-    }
-    LOGI("++++++++++++++++++++++++++++++++End of ErrorInfo++++++++++++++++++++++++++++++++");
-
-    return;
-}
-
-void get_resource_uri(const char *URI, char *resourceURI, int32_t length)
-{
-    const char *startPos = URI;
-    const char *temp = strstr(URI, "://");
-    if (NULL != temp)
-    {
-        startPos = strchr(temp + 3, '/');
-        if (!startPos)
-        {
-            LOGE("Resource URI is missing");
-            return;
-        }
-    }
-
-    const char *endPos = strchr(startPos, '?');
-    if (!endPos)
-    {
-        endPos = URI + strlen(URI);
-    }
-    --endPos;
-
-    if (endPos - startPos <= length)
-    {
-        memcpy(resourceURI, startPos + 1, endPos - startPos);
-    }
-
-    LOGI("URI: %s, ResourceURI: %s", URI, resourceURI);
-}
-
-uint32_t get_secure_information(CAPayload_t payLoad)
-{
-    LOGI("entering get_secure_information");
-
-    if (!payLoad)
-    {
-        LOGE("Payload is NULL");
-        return -1;
-    }
-
-    const char *subString = NULL;
-    if (NULL == (subString = strstr((const char *) payLoad, "\"sec\":1")))
-    {
-        LOGE("This is not secure resource");
-        return -1;
-    }
-
-    if (NULL == (subString = strstr((const char *) payLoad, "\"port\":")))
-    {
-        LOGE("This secure resource does not have port information");
-        return -1;
-    }
-
-    const char *startPos = strstr(subString, ":");
-    if (!startPos)
-    {
-        LOGE("Parsing failed !");
-        return -1;
-    }
-
-    const char *endPos = strstr(startPos, "}");
-    if (!endPos)
-    {
-        LOGE("Parsing failed !");
-        return -1;
-    }
-
-    char portStr[6] = { 0 };
-    memcpy(portStr, startPos + 1, (endPos - 1) - startPos);
-
-    LOGI("secured port is: %s", portStr);
-    return atoi(portStr);
-}
-
-CAResult_t get_network_type(uint32_t selectedNetwork, CATransportFlags_t *flags)
-{
-
-    uint32_t number = selectedNetwork;
-
-    if (!(number & CA_ALL_ADAPTERS))
-    {
-        LOGE("get_network_type Out of range");
-        return CA_NOT_SUPPORTED;
-    }
-    if ((number & CA_ADAPTER_IP) == CA_ADAPTER_IP)
-    {
-        *flags = CA_IPV4;
-        g_selectedNwType = CA_ADAPTER_IP;
-        return CA_STATUS_OK;
-    }
-    if ((number & CA_ADAPTER_RFCOMM_BTEDR) == CA_ADAPTER_RFCOMM_BTEDR)
-    {
-        g_selectedNwType = CA_ADAPTER_RFCOMM_BTEDR;
-        return CA_STATUS_OK;
-    }
-    if ((number & CA_ADAPTER_GATT_BTLE) == CA_ADAPTER_GATT_BTLE)
-    {
-        g_selectedNwType = CA_ADAPTER_GATT_BTLE;
-        return CA_STATUS_OK;
-    }
-    if ((number & CA_ADAPTER_TCP) == CA_ADAPTER_TCP)
-    {
-        g_selectedNwType = CA_ADAPTER_TCP;
-        return CA_STATUS_OK;
-    }
-    if ((number & CA_ADAPTER_NFC) == CA_ADAPTER_NFC)
-    {
-        g_selectedNwType = CA_ADAPTER_NFC;
-        return CA_STATUS_OK;
-    }
-
-   LOGE("Invalid transport");
-   return CA_NOT_SUPPORTED;
-}
-
-void callback(char *subject, char *receivedData)
-{
-    bool isAttached = false;
-    JNIEnv* env;
-
-    if (!g_responseListenerObject)
-    {
-        LOGE("g_responseListenerObject is NULL, cannot have callback");
-        return;
-    }
-
-    jint res = (*g_jvm)->GetEnv(g_jvm, (void**) &env, JNI_VERSION_1_6);
-    if (JNI_OK != res)
-    {
-        LOGI("Could not get JNIEnv pointer");
-        res = (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);
-
-        if (JNI_OK != res)
-        {
-            LOGE("AttachCurrentThread has failed");
-            return;
-        }
-        isAttached = true;
-    }
-
-    jclass cls = (*env)->GetObjectClass(env, g_responseListenerObject);
-    if (!cls)
-    {
-        LOGE("could not get class");
-        goto detach_thread;
-    }
-
-    jmethodID mid = (*env)->GetMethodID(env, cls, "OnResponseReceived",
-                                        "(Ljava/lang/String;Ljava/lang/String;)V");
-    if (!mid)
-    {
-        LOGE("could not get Method ID");
-        goto detach_thread;
-    }
-
-    jstring jsubject = (*env)->NewStringUTF(env, (char*) subject);
-    if (!jsubject)
-    {
-        LOGE("NewStringUTF failed");
-        goto detach_thread;
-    }
-
-    jstring jreceivedData = (*env)->NewStringUTF(env, (char*) receivedData);
-    if (!jreceivedData)
-    {
-        LOGE("NewStringUTF failed");
-        goto detach_thread;
-    }
-
-    (*env)->CallVoidMethod(env, g_responseListenerObject, mid, jsubject, jreceivedData);
-
-detach_thread :
-    if (isAttached)
-    {
-        (*g_jvm)->DetachCurrentThread(g_jvm);
-        LOGI("DetachCurrentThread");
-    }
-}
-
-CAResult_t get_remote_address(const char *address)
-{
-    uint32_t len = strlen(address);
-
-    g_remoteAddress = (char *)malloc(sizeof (char) * (len + 1));
-    if (NULL == g_remoteAddress)
-    {
-        LOGE("g_remoteAddress Out of memory");
-        return CA_MEMORY_ALLOC_FAILED;
-    }
-
-    memcpy(g_remoteAddress, address, len + 1);
-
-    return CA_STATUS_OK;
-}
-
-
-void parsing_coap_uri(const char* uri, addressSet_t* address, CATransportFlags_t *flags)
-{
-    if (NULL == uri || NULL == address)
-    {
-        LOGE("parameter is null");
-        return;
-    }
-
-    // parse uri
-    // #1. check prefix
-    uint8_t startIndex = 0;
-    if (strncmp(COAPS_PREFIX, uri, COAPS_PREFIX_LEN) == 0)
-    {
-        LOGI("uri has '%s' prefix", COAPS_PREFIX);
-        startIndex = COAPS_PREFIX_LEN;
-        *flags = CA_SECURE;
-    }
-    else if (strncmp(COAP_PREFIX, uri, COAP_PREFIX_LEN) == 0)
-    {
-        LOGI("uri has '%s' prefix", COAP_PREFIX);
-        startIndex = COAP_PREFIX_LEN;
-    }
-    else if (strncmp(COAP_TCP_PREFIX, uri, COAP_TCP_PREFIX_LEN) == 0)
-    {
-        LOGI("uri has '%s' prefix\n", COAP_TCP_PREFIX);
-        startIndex = COAP_TCP_PREFIX_LEN;
-        *flags = CA_IPV4;
-    }
-
-    // #2. copy uri for parse
-    size_t len = strlen(uri) - startIndex;
-
-    if (len <= 0)
-    {
-        LOGE("uri length is 0!");
-        return;
-    }
-
-    char *cloneUri = (char *) calloc(len + 1, sizeof(char));
-    if (NULL == cloneUri)
-    {
-        LOGE("Out of memory");
-        return;
-    }
-
-    OICStrcpy(cloneUri, len+1, &uri[startIndex]);
-
-    char *pstr = NULL;
-    //filter out the resource uri
-    char *pUrl = strtok_r(cloneUri, "/", &pstr);
-
-    if (pUrl)
-    {
-        LOGI("pAddress : %s", pUrl);
-        int res = get_address_set(pUrl, address);
-        if (res == -1)
-        {
-            LOGE("address parse error");
-            return;
-        }
-    }
-    else
-    {
-        LOGE("strtok_r error, could not get the address");
-    }
-
-    return;
-}
-
-int get_address_set(const char *pAddress, addressSet_t* outAddress)
-{
-    if (NULL == pAddress || NULL == outAddress)
-    {
-        LOGE("parameter is null");
-        return -1;
-    }
-
-    size_t len = strlen(pAddress);
-    int isIp = 0;
-    size_t ipLen = 0;
-
-    for (size_t i = 0; i < len; i++)
-    {
-        if (pAddress[i] == '.')
-        {
-            isIp = 1;
-        }
-
-        // found port number start index
-        if (isIp && pAddress[i] == ':')
-        {
-            ipLen = i;
-            break;
-        }
-    }
-
-    if (isIp)
-    {
-        if(ipLen && (ipLen <  sizeof(outAddress->ipAddress)))
-        {
-            strncpy(outAddress->ipAddress, pAddress, ipLen);
-            outAddress->ipAddress[ipLen] = '\0';
-        }
-        else if (!ipLen && (len <  sizeof(outAddress->ipAddress)))
-        {
-            strncpy(outAddress->ipAddress, pAddress, len);
-            outAddress->ipAddress[len] = '\0';
-        }
-        else
-        {
-            LOGE("IP Address too long: %d", ipLen==0 ? len : ipLen);
-            return -1;
-        }
-
-        if (ipLen > 0)
-        {
-            outAddress->port = atoi(pAddress + ipLen + 1);
-        }
-    }
-    else
-    {
-        strncpy(outAddress->ipAddress, pAddress, len);
-        outAddress->ipAddress[len] = '\0';
-    }
-
-    return isIp;
-}
-
-void delete_global_references(JNIEnv *env, jobject obj)
-{
-    LOGI("delete_global_references");
-    if (!env || !obj )
-    {
-        LOGI("Invalid input parameter");
-        return;
-    }
-
-    CADeleteGlobalReferences(env);
-    (*env)->DeleteGlobalRef(env, g_responseListenerObject);
-}
-
-
-bool read_file(const char* name, char** bytes, size_t* length)
-{
-    if (NULL == name)
-    {
-        LOGE("parameter is null");
-        return false;
-    }
-
-    FILE* file;
-    char* buffer;
-    long fileLen;
-
-    // Open file
-    file = fopen(name, "rt");
-    if (!file)
-    {
-        fprintf(stderr, "Unable to open file %s", name);
-        return false;
-    }
-
-    // Get file length
-    fseek(file, 0, SEEK_END);
-    fileLen = ftell(file);
-    if (-1 == fileLen)
-    {
-        fprintf(stderr, "Failed to read file length");
-        fclose(file);
-        return false;
-    }
-    fseek(file, 0, SEEK_SET);
-
-    LOGI("file size: %ld", fileLen);
-
-    // Allocate memory
-    buffer = calloc(1, sizeof(char) * fileLen + 1);
-    if (!buffer)
-    {
-        fprintf(stderr, "Memory error!");
-        fclose(file);
-        return false;
-    }
-
-    // Read file contents into buffer
-    size_t ret = fread(buffer, fileLen, 1, file);
-    if (ret != 1)
-    {
-        printf("Failed to read data from file, %s\n", name);
-        fclose(file);
-        free(buffer);
-        return false;
-    }
-
-    fclose(file);
-
-    LOGI("file bytes: %s", buffer);
-
-    *bytes = buffer;
-    *length = fileLen;
-
-    return true;
-}
-
-void saveFile(const char *payload, size_t payloadSize)
-{
-    // 1. get day
-    uint32_t day = gettodaydate();
-
-    // 2. get time
-    time_t current_time;
-    struct tm * time_info;
-    char timeString[RECEIVED_FILE_NAME_PREFIX_LENGTH];
-
-    time(&current_time);
-    time_info = localtime(&current_time);
-
-    strftime(timeString, sizeof(timeString), "%H%M%S", time_info);
-
-    uint32_t path_length = strlen(RECEIVED_FILE_PATH) + RECEIVED_FILE_NAME_LENGTH + 1;
-    char* path = calloc(1, sizeof(char) * path_length);
-    if (path != NULL)
-    {
-        snprintf(path, path_length, RECEIVED_FILE_PATH, day, timeString);
-        LOGI("received file path: %s", path);
-
-        FILE *fp = fopen(path, "wt");
-        fwrite(payload, 1, payloadSize, fp);
-        fclose(fp);
-
-        callback("File Path: ", path);
-    }
-    else
-    {
-        LOGE("path Out of memory");
-    }
-}
-
-uint32_t gettodaydate()
-{
-    uint32_t ldate;
-    time_t clock;
-    struct tm *date;
-
-    clock = time(0);
-    date = localtime(&clock);
-    ldate = date->tm_year * 100000;
-    ldate += (date->tm_mon + 1) * 1000;
-    ldate += date->tm_mday * 10;
-    ldate += date->tm_wday;
-    ldate += 190000000;
-    ldate /= 10;
-
-    return(ldate);
-}
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/org_iotivity_ca_service_RMInterface.h b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/jni/org_iotivity_ca_service_RMInterface.h
deleted file mode 100644 (file)
index cdf6a99..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#include <jni.h>
-/* Header for class org_iotivity_ca_service_RMInterface */
-
-#ifndef _Included_org_iotivity_ca_service_RMInterface
-#define _Included_org_iotivity_ca_service_RMInterface
-#ifdef __cplusplus
-extern "C" {
-#endif
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_setNativeResponseListener
-  (JNIEnv *, jobject, jobject);
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMInitialize
- * Signature: (Landroid/content/Context;Landroid/app/activity;)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMInitialize
-  (JNIEnv *, jobject, jobject, jobject);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMTerminate
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMTerminate
-  (JNIEnv *, jobject);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMStartListeningServer
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMStartListeningServer
-  (JNIEnv *, jobject);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMStartDiscoveryServer
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMStartDiscoveryServer
-  (JNIEnv *, jobject);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMRegisterHandler
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMRegisterHandler
-  (JNIEnv *, jobject);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMSendRequest
- * Signature: (Ljava/lang/String;Ljava/lang/String;III)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSendRequest
-  (JNIEnv *, jobject, jstring, jstring, jint, jint, jint, jboolean);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMSendReqestToAll
- * Signature: (Ljava/lang/String;I)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSendReqestToAll
-  (JNIEnv *, jobject, jstring, jint);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMSendResponse
- * Signature: (IIII)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSendResponse
-  (JNIEnv *, jobject, jint, jint, jint, jint);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMSendNotification
- * Signature: (Ljava/lang/String;Ljava/lang/String;IIII)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSendNotification
-  (JNIEnv *, jobject, jstring, jstring, jint, jint, jint);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMSelectNetwork
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMSelectNetwork
-  (JNIEnv *, jobject, jint);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMUnSelectNetwork
- * Signature: (I)V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMUnSelectNetwork
-  (JNIEnv *, jobject, jint);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMGetNetworkInfomation
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMGetNetworkInfomation
-  (JNIEnv *, jobject);
-
-/*
- * Class:     org_iotivity_ca_service_RMInterface
- * Method:    RMHandleRequestResponse
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMHandleRequestResponse
-  (JNIEnv *, jobject);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/layout/activity_main.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/layout/activity_main.xml
deleted file mode 100755 (executable)
index 69642b6..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:paddingBottom="@dimen/activity_vertical_margin"
-    android:paddingLeft="@dimen/activity_horizontal_margin"
-    android:paddingRight="@dimen/activity_horizontal_margin"
-    android:paddingTop="@dimen/activity_vertical_margin"
-    tools:context="org.iotivity.ca.service.MainActivity" >
-
-    <RelativeLayout
-        android:id="@+id/sample_service_layout"
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-        android:layout_alignParentTop="true"
-        android:background="#cccccc" >
-
-        <LinearLayout
-            android:id="@+id/layout_mode"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:orientation="horizontal" >
-
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-
-            <TextView
-                android:id="@+id/tv_mode"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content" />
-        </LinearLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_network"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_mode"
-            android:orientation="horizontal" >
-
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
-
-            <TextView
-                android:id="@+id/tv_network"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content" />
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_Response_Noti_title"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_mode" >
-
-            <TextView
-                android:id="@+id/tv_Response_Noti"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="[Send Response / Send Notification]"
-                />
-
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_notify"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_Response_Noti_title" >
-
-            <EditText
-                android:id="@+id/et_notification"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_alignParentRight="true"
-                android:text="@string/notification" />
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_request_setting_for_server"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_notify" >
-
-            <Button
-                android:id="@+id/btn_Request_setting_for_server"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:text="@string/request_setting" />
-
-            <Button
-                android:id="@+id/btn_notify"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toRightOf="@id/btn_Request_setting_for_server"
-                android:text="@string/notify" />
-
-            <Button
-                android:id="@+id/btn_sendresponse"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toRightOf="@id/btn_notify"
-                android:text="@string/sendresponse" />
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_request_title"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_mode" >
-
-            <TextView
-                android:id="@+id/tv_request"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="[Send Request]" />
-
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_request"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_request_title" >
-
-            <EditText
-                android:id="@+id/et_req_data"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_centerVertical="true"
-                android:text="@string/req_data" />
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_request_setting_for_client"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_request" >
-
-            <Button
-                android:id="@+id/btn_Request_setting_for_client"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:text="@string/request_setting" />
-
-            <Button
-                android:id="@+id/btn_Request"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toRightOf="@id/btn_Request_setting_for_client"
-                android:text="@string/request" />
-
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_request_to_all_title"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_request_setting_for_client" >
-
-            <TextView
-                android:id="@+id/tv_request_to_all"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content" 
-                android:text="[Send Request to All]"
-                />
-
-         </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_request_to_all"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_request_to_all_title" >
-
-            <EditText
-                android:id="@+id/et_req_to_all_data"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:layout_centerVertical="true"
-                android:text="@string/uri" />
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_request_to_all_setting_for_client"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_request_to_all" >
-
-            <Button
-                android:id="@+id/btn_request_to_all_setting_for_client"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:text="@string/request_setting" />
-
-            <Button
-                android:id="@+id/btn_request_to_all"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toRightOf="@id/btn_request_to_all_setting_for_client"
-                android:text="@string/request_to_all" />
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_handle_title"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_request_to_all_setting_for_client" >
-
-            <TextView
-                android:id="@+id/tv_handle"
-                android:layout_width="fill_parent"
-                android:layout_height="wrap_content"
-                android:text="[Handle Reqeust,Response data / Get NetworkInfo]"/>
-        </RelativeLayout>
-
-        <RelativeLayout
-            android:id="@+id/layout_receive"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/layout_handle_title" >
-
-            <Button
-                android:id="@+id/btn_receive"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_alignParentLeft="true"
-                android:text="@string/receive" />
-
-            <Button
-                android:id="@+id/btn_get_network_info"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toRightOf="@id/btn_receive"
-                android:text="@string/get_network_info" />
-
-            <Button
-                android:id="@+id/btn_big_data"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_toRightOf="@id/btn_get_network_info"
-                android:text="big data" />
-
-        </RelativeLayout>
-    </RelativeLayout>
-
-    <ScrollView
-        android:id="@+id/sv_result_scoll"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:layout_below="@id/sample_service_layout"
-        android:layout_marginTop="10pt" >
-
-        <TextView
-            android:id="@+id/tv_result"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content" />
-    </ScrollView>
-
-</RelativeLayout>
\ No newline at end of file
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/menu/main.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/menu/main.xml
deleted file mode 100755 (executable)
index e0d03f4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:context="org.iotivity.ca.sample_service.MainActivity" >
-
-    <item
-        android:id="@+id/action_settings"
-        android:orderInCategory="100"
-        android:showAsAction="never"
-        android:title="@string/action_settings"/>
-
-</menu>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-v11/styles.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-v11/styles.xml
deleted file mode 100755 (executable)
index 3df0c14..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme for API 11+. This theme completely replaces
-        AppBaseTheme from res/values/styles.xml on API 11+ devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
-        <!-- API 11 theme customizations can go here. -->
-    </style>
-
-</resources>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-v14/styles.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-v14/styles.xml
deleted file mode 100755 (executable)
index 13d7045..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme for API 14+. This theme completely replaces
-        AppBaseTheme from BOTH res/values/styles.xml and
-        res/values-v11/styles.xml on API 14+ devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
-        <!-- API 14 theme customizations can go here. -->
-    </style>
-
-</resources>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-w820dp/dimens.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values-w820dp/dimens.xml
deleted file mode 100755 (executable)
index efaa062..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
-    <!--
-         Example customization of dimensions originally defined in res/values/dimens.xml
-         (such as screen margins) for screens with more than 820dp of available width. This
-         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively).
-    -->
-    <dimen name="activity_horizontal_margin">64dp</dimen>
-
-</resources>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/dimens.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/dimens.xml
deleted file mode 100755 (executable)
index 6ed10f5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<resources>
-
-    <!-- Default screen margins, per the Android Design guidelines. -->
-    <dimen name="activity_horizontal_margin">16dp</dimen>
-    <dimen name="activity_vertical_margin">16dp</dimen>
-
-</resources>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/strings.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/strings.xml
deleted file mode 100755 (executable)
index 1dcde2c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
-    <string name="app_name">CA Android Sample</string>
-    <string name="sendresponse">Response</string>
-    <string name="notify">Notification</string>
-    <string name="request_setting">Setting</string>
-    <string name="request">Request</string>
-    <string name="request_to_all">Request to All</string>
-    <string name="response">Response</string>
-    <string name="uri">/a/light</string>
-    <string name="coap_prefix">coap://</string>
-    <string name="notification"></string>
-    <string name="req_data"></string>
-    <string name="resp_data">resourceUri/response</string>
-    <string name="get_network_info">Network Info</string>
-    <string name="receive">Receive</string>
-    <string name="received">Received Message</string>
-    <string name="remote_address">"Remote Address: "</string>
-    <string name="remote_port">"Remote Port: "</string>
-    <string name="action_settings">Settings</string>
-</resources>
\ No newline at end of file
diff --git a/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/styles.xml b/resource/csdk/connectivity/samples/android/casample/sampleService/src/main/res/values/styles.xml
deleted file mode 100755 (executable)
index d77df4e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme, dependent on API level. This theme is replaced
-        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Light">
-        <!--
-            Theme customizations available in newer API levels can go in
-            res/values-vXX/styles.xml, while customizations related to
-            backward-compatibility can go here.
-        -->
-    </style>
-
-    <!-- Application theme. -->
-    <style name="AppTheme" parent="AppBaseTheme">
-        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
-    </style>
-
-</resources>
-
diff --git a/resource/csdk/connectivity/samples/android/casample/settings.gradle b/resource/csdk/connectivity/samples/android/casample/settings.gradle
deleted file mode 100644 (file)
index 97b651e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-include ':cAInterface'
-include ':sampleService'
diff --git a/resource/csdk/connectivity/samples/arduino/SConscript b/resource/csdk/connectivity/samples/arduino/SConscript
deleted file mode 100644 (file)
index 0722421..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-Import('env')
-
-sample_env= env.Clone()
-root_dir = './../../'
-
-sample_env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
-sample_env.PrependUnique(LIBS = ['connectivity_abstraction', 'coap'])
-
-sample_env.PrependUnique(CPPPATH = [root_dir + '/api/'])
-sample_env.AppendUnique(CPPPATH = [root_dir + '/inc/'])
-sample_env.AppendUnique(CPPPATH = [root_dir + '/lib/libcoap-4.1.1/'])
-sample_env.AppendUnique(CPPPATH = [root_dir + 'common/inc/'])
-
-if env.get('SHIELD') == 'WIFI':
-       sample_env.AppendUnique(CPPDEFINES = ['ARDUINOWIFI'])
-elif env.get('SHIELD') == 'ETH':
-       sample_env.AppendUnique(CPPDEFINES = ['ARDUINOETH'])
-
-sample_dir = './samples/arduino/'
-arduino_simplecs = sample_env.Program('CASample', 'casample.cpp')
-env.CreateBin('CASample')
-
-i_arduino_simplecs = sample_env.Install(env.get('BUILD_DIR'), arduino_simplecs)
-
-Alias('arduino_simplecs', i_arduino_simplecs)
-sample_env.Default('CASample.hex')
-
-if(sample_env['UPLOAD'] == True):
-       sample_env.Upload(env.get('BUILD_DIR') + 'resource/csdk/connectivity/samples/arduino/' + 'CASample.hex')
-
diff --git a/resource/csdk/connectivity/samples/arduino/casample.cpp b/resource/csdk/connectivity/samples/arduino/casample.cpp
deleted file mode 100644 (file)
index 273ed08..0000000
+++ /dev/null
@@ -1,874 +0,0 @@
-/******************************************************************
- *
- * Copyright 2014 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 <ctype.h>
-#include <errno.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "cacommon.h"
-#include "cainterface.h"
-#include "Arduino.h"
-
-#ifdef ARDUINOWIFI
-#include "WiFi.h"
-#elif defined ARDUINOETH
-#include "Ethernet.h"
-#endif
-
-#include "oic_malloc.h"
-
-#define MAX_BUF_LEN 100 //1024
-#define MAX_OPT_LEN 16
-#define PORT_LENGTH 5
-
-static bool g_isLeSelected = false;
-
-static void PrintMenu();
-static void Process();
-static void Initialize();
-static void StartListeningServer();
-static void StartDiscoveryServer();
-static void SendRequest();
-static void SendRequestAll();
-static void SendResponse(CAEndpoint_t *endpoint, const CAInfo_t* info);
-static void SendNotification();
-static void SelectNetwork();
-static void UnselectNetwork();
-static void HandleRequestResponse();
-static void GetNetworkInfo();
-
-static void RequestHandler(const CAEndpoint_t *object, const CARequestInfo_t *requestInfo);
-static void ResponseHandler(const CAEndpoint_t *object, const CAResponseInfo_t *responseInfo);
-static void ErrorHandler(const CAEndpoint_t *object, const CAErrorInfo_t* errorInfo);
-static void Terminate();
-
-void GetData(char *readInput, size_t bufferLength, size_t *dataLength)
-{
-    if (!readInput || bufferLength == 0 || !dataLength)
-    {
-        Serial.println("Invalid buffer");
-        return;
-    }
-
-    while (!Serial.available())
-    {
-        delay(500);
-    }
-    int len = 0;
-    while (Serial.available())
-    {
-        delay(100);
-        char c = Serial.read();
-        if ('\n' != c && '\r' != c && len < bufferLength - 1)
-        {
-            readInput[len++] = c;
-        }
-        else
-        {
-            break;
-        }
-    }
-
-    readInput[len] = '\0';
-    Serial.flush();
-    Serial.print("PD: ");
-    Serial.println(readInput);
-    (*dataLength) = len;
-}
-
-bool ParseData(char *buf, char *url, char *port, char *resourceUri)
-{
-    char *slash = strchr(buf, '/');
-    if (!slash)
-    {
-        return false;
-    }
-
-    strcpy(resourceUri, slash);
-
-    char *dot = strchr(buf, '.');
-    if (dot && dot < slash)
-    {
-        char *colon = strchr(buf, ':');
-
-        if (colon)
-        {
-            strncpy(port, colon, slash - colon);
-            memmove(port, port+1, strlen(port));
-        }
-        if (colon && colon < slash)
-        {
-            strncpy(url, buf, colon - buf);
-            return true;
-        }
-    }
-
-    strncpy(url, buf, slash - buf);
-    return true;
-}
-
-CATransportAdapter_t GetConnectivityType()
-{
-    char type[2] = {0};
-    Serial.println("Select network");
-    Serial.println("IP: 0");
-    Serial.println("GATT (BLE): 1");
-    Serial.println("RFCOMM (EDR): 2");
-
-    size_t typeLen = 0;
-    GetData(type, sizeof(type), &typeLen);
-    if (0 >= typeLen)
-    {
-        Serial.println("i/p err,default ethernet");
-        return CA_ADAPTER_IP;
-    }
-    switch (type[0])
-    {
-        case '0':
-            return CA_ADAPTER_IP;
-        case '1':
-            return CA_ADAPTER_GATT_BTLE;
-        case '2':
-            return CA_ADAPTER_RFCOMM_BTEDR;
-    }
-    return CA_ADAPTER_IP;
-}
-
-void setup()
-{
-    Serial.begin (115200);
-
-    Serial.println("============");
-    Serial.println("CA SAMPLE");
-    Serial.println("============");
-    PrintMenu();
-}
-
-void loop()
-{
-    char buffer[5] = {0};
-    size_t len;
-    if (Serial.available() > 0)
-    {
-        GetData(buffer, sizeof(buffer), &len);
-        if (0 >= len)
-        {
-            Serial.println("i/p err");
-            return;
-        }
-        switch (toupper(buffer[0]))
-        {
-            case 'M': // menu
-                PrintMenu();
-                break;
-
-            case 'Q': // quit
-                Serial.println("quit");
-                return;
-
-            case 'I': // Initialize interface
-                Initialize();
-                break;
-
-            case 'S': // start listening server
-                StartListeningServer();
-                break;
-
-            case 'D': // start discovery server
-                StartDiscoveryServer();
-                break;
-
-            case 'R': // send request
-                SendRequest();
-                break;
-
-            case 'E': //send request to all
-                SendRequestAll();
-                break;
-            case 'B': // send notification
-                SendNotification();
-                break;
-            case 'G': // Get network info
-                GetNetworkInfo();
-                break;
-
-            case 'N': // select network
-                SelectNetwork();
-                break;
-
-            case 'X': // unselect network
-                UnselectNetwork();
-                break;
-
-            case 'H': // handle request response
-                HandleRequestResponse();
-                break;
-
-            case 'T': // handle request response
-                Terminate();
-                break;
-
-            default:
-                Serial.println("wrong menu");
-                break;
-        }
-    }
-    //1:Add check for startserver before calling below api
-    if (g_isLeSelected)
-    {
-        HandleRequestResponse();
-    }
-    delay(1000);
-}
-
-void Initialize()
-{
-    if(CAInitialize() != CA_STATUS_OK)
-    {
-        Serial.println("Initialize failed");
-        return;
-    }
-    SelectNetwork();
-    // set handler.
-    CARegisterHandler(RequestHandler, ResponseHandler, ErrorHandler);
-}
-
-void StartListeningServer()
-{
-    Serial.println("listening server");
-    CAResult_t ret = CAStartListeningServer();
-    if(ret != CA_STATUS_OK)
-    {
-        Serial.print("listening failed: ");
-        Serial.println(ret);
-        return;
-    }
-}
-
-void StartDiscoveryServer()
-{
-    Serial.println("discovery server");
-    CAResult_t ret = CAStartDiscoveryServer();
-    if(ret != CA_STATUS_OK)
-    {
-        Serial.print("discovery failed: ");
-        Serial.println(ret);
-        return;
-    }
-}
-
-void SendRequest()
-{
-    char buf[MAX_BUF_LEN] = {0};
-    char address[MAX_BUF_LEN] = {0};
-    char resourceUri[MAX_BUF_LEN] = {0};
-    char port[PORT_LENGTH] = {0};
-    CATransportAdapter_t selectedNetwork;
-    selectedNetwork = GetConnectivityType();
-
-    Serial.println("============");
-    Serial.println("10.11.12.13:4545/res_uri (for IP)");
-    Serial.println("10:11:12:13:45:45/res_uri (for BT)");
-    Serial.println("uri: ");
-
-    size_t len = 0;
-    GetData(buf, sizeof(buf), &len);
-    if (0 >= len)
-    {
-        Serial.println("i/p err");
-        return;
-    }
-
-    if (!ParseData(buf, address, port, resourceUri))
-    {
-        Serial.println("bad uri");
-        return;
-    }
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    CAResult_t res = CACreateEndpoint(CA_DEFAULT_FLAGS, selectedNetwork, address, atoi(port),
-                                      &endpoint);
-    if (res != CA_STATUS_OK)
-    {
-        Serial.println("Out of memory");
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    memset(buf, 0, sizeof(buf));
-
-    Serial.println("\n=============================================\n");
-    Serial.println("0:CON, 1:NON\n");
-    Serial.println("select message type : ");
-    GetData(buf, sizeof(buf), &len);
-    CAMessageType_t msgType = CA_MSG_CONFIRM;
-
-    if (0 >= len)
-    {
-        Serial.println("i/p err,default: 0");
-    }
-    else if(buf[0] == '1')
-    {
-        msgType = CA_MSG_NONCONFIRM;
-    }
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if (res != CA_STATUS_OK || (!token))
-    {
-        Serial.println("token error");
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    Serial.println(token);
-    CAInfo_t requestData = {CA_MSG_RESET};
-    requestData.token = token;
-    requestData.tokenLength = tokenLength;
-    requestData.payload = (CAPayload_t)"Json Payload";
-    requestData.payloadSize = strlen((const char *) requestData.payload);
-
-    requestData.type = msgType;
-    requestData.resourceUri = (char *)OICMalloc(strlen(resourceUri) + 1);
-    strcpy(requestData.resourceUri, resourceUri);
-
-    CARequestInfo_t requestInfo = {CA_GET, {CA_MSG_RESET}};
-    requestInfo.method = CA_GET;
-    requestInfo.isMulticast = false;
-    requestInfo.info = requestData;
-    requestInfo.isMulticast = false;
-
-    // send request
-    CASendRequest(endpoint, &requestInfo);
-    if (NULL != token)
-    {
-        CADestroyToken(token);
-    }
-
-    // destroy remote endpoint
-    if (endpoint != NULL)
-    {
-        CADestroyEndpoint(endpoint);
-    }
-
-    Serial.println("============");
-}
-
-void SendRequestAll()
-{
-    char buf[MAX_BUF_LEN] = {0};
-    char address[MAX_BUF_LEN] = {0};
-    char resourceUri[MAX_BUF_LEN] = {0};
-    char port[PORT_LENGTH] = {0};
-
-    CATransportAdapter_t selectedNetwork;
-    selectedNetwork = GetConnectivityType();
-
-    Serial.println("\n=============================================\n");
-    Serial.println("ex) /a/light\n");
-    Serial.println("resource uri : ");
-
-    size_t len = 0;
-    GetData(buf, sizeof(buf), &len);
-    if (0 >= len)
-    {
-        Serial.println("i/p err");
-        return;
-    }
-
-    if (!ParseData(buf, address, port, resourceUri))
-    {
-        Serial.println("bad uri");
-        return;
-    }
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    CAResult_t res = CACreateEndpoint(CA_IPV4, selectedNetwork, address, atoi(port),
-                                        &endpoint);
-
-    if (res != CA_STATUS_OK)
-    {
-        Serial.println("create remote endpoint error");
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if (res != CA_STATUS_OK || (!token))
-    {
-        Serial.println("token error");
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    Serial.println(token);
-
-    CAInfo_t requestData = {CA_MSG_RESET};
-    requestData.token = token;
-    requestData.tokenLength = tokenLength;
-    requestData.payload = (CAPayload_t)"Temp Json Payload";
-    requestData.payloadSize = strlen((const char *) requestData.payload);
-    requestData.type = CA_MSG_NONCONFIRM;
-    requestData.resourceUri = (char *)OICMalloc(strlen(resourceUri) + 1);
-    strcpy(requestData.resourceUri, resourceUri);
-
-    CARequestInfo_t requestInfo = {CA_GET, {CA_MSG_RESET}};
-    requestInfo.method = CA_GET;
-    requestInfo.isMulticast = true;
-    requestInfo.info = requestData;
-
-    // send request
-    CASendRequest(endpoint, &requestInfo);
-
-    if (NULL != token)
-    {
-        CADestroyToken(token);
-    }
-
-    // destroy remote endpoint
-    if (endpoint != NULL)
-    {
-        CADestroyEndpoint(endpoint);
-    }
-
-    Serial.println("==========");
-}
-
-void SendNotification()
-{
-    char buf[MAX_BUF_LEN] = {0};
-    char address[MAX_BUF_LEN] = {0};
-    char resourceUri[MAX_BUF_LEN] = {0};
-    char port[PORT_LENGTH] = {0};
-    CATransportAdapter_t selectedNetwork;
-    selectedNetwork = GetConnectivityType();
-
-    Serial.println("============");
-    Serial.println("10.11.12.13:4545/res_uri (for IP)");
-    Serial.println("10:11:12:13:45:45/res_uri (for BT)");
-    Serial.println("uri: ");
-
-    size_t len = 0;
-    GetData(buf, sizeof(buf), &len);
-    if (0 >= len)
-    {
-        Serial.println("i/p err");
-        return;
-    }
-
-    if (!ParseData(buf, address, port, resourceUri))
-    {
-        Serial.println("bad uri");
-        return;
-    }
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    CAResult_t res = CACreateEndpoint(CA_DEFAULT_FLAGS, selectedNetwork, address, atoi(port),
-                                      &endpoint);
-    if (CA_STATUS_OK != res)
-    {
-        Serial.println("Out of memory");
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if (res != CA_STATUS_OK || (!token))
-    {
-        Serial.println("token error");
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    CAInfo_t requestData = {CA_MSG_NONCONFIRM};
-    requestData.token = token;
-    requestData.tokenLength = tokenLength;
-    requestData.payload = (CAPayload_t)"Notification Data";
-    requestData.payloadSize = strlen((const char *) requestData.payload);
-    requestData.resourceUri = (char *)OICMalloc(strlen(resourceUri) + 1);
-    strcpy(requestData.resourceUri, resourceUri);
-
-    CARequestInfo_t requestInfo = {CA_GET, {CA_MSG_RESET}};
-    requestInfo.method = CA_GET;
-    requestInfo.info = requestData;
-
-    // send request
-    CASendRequest(endpoint, &requestInfo);
-    // destroy remote endpoint
-    if (NULL != endpoint)
-    {
-        CADestroyEndpoint(endpoint);
-    }
-
-    CADestroyToken(token);
-    Serial.println("============");
-}
-
-void SelectNetwork()
-{
-    char buf[MAX_BUF_LEN] = {0};
-
-    Serial.println("============");
-    Serial.println("Select network");
-    Serial.println("IP: 0");
-    Serial.println("LE: 1");
-    Serial.println("EDR: 2\n");
-
-    size_t len = 0;
-    GetData(buf, sizeof(buf), &len);
-    int number = buf[0] - '0';
-    if (0 >= len || number < 0 || number > 3)
-    {
-        Serial.println("Wrong i/p. WIFI selected");
-        number = 1;
-    }
-
-    switch (number)
-    {
-        case 0:
-            {
-#ifdef ARDUINOWIFI
-                const char ssid[] = "SSID";              // your network SSID (name)
-                const char pass[] = "SSID_Password";     // your network password
-                int16_t status = WL_IDLE_STATUS;         // the Wifi radio's status
-
-                if (WiFi.status() == WL_NO_SHIELD)
-                {
-                    Serial.println("ERROR:No Shield");
-                    return;
-                }
-
-                while (status != WL_CONNECTED)
-                {
-                    Serial.print("connecting: ");
-                    Serial.println(ssid);
-                    // WiFi.begin api is weird. ssid should also be taken as const char *
-                    // Connect to WPA/WPA2 network:
-                    status = WiFi.begin((char *)ssid, pass);
-                }
-#elif defined ARDUINOETH
-                // Note: ****Update the MAC address here with your shield's MAC address****
-                uint8_t ETHERNET_MAC[] = {0x90, 0xA2, 0xDA, 0x0E, 0xC4, 0x05};
-                uint8_t error = Ethernet.begin(ETHERNET_MAC);
-                if (error  == 0)
-                {
-                    Serial.print("Failed: ");
-                    Serial.println(error);
-                    return;
-                }
-#endif
-            }
-            break;
-        case 1:
-            g_isLeSelected = true;
-            break;
-        case 2:
-            // Nothing TBD here
-            break;
-    }
-
-    CASelectNetwork(CATransportAdapter_t(1<<number));
-    Serial.println("============");
-}
-
-void UnselectNetwork()
-{
-    char buf[MAX_BUF_LEN] = {0};
-
-    Serial.println("============");
-    Serial.println("Unselect network");
-    Serial.println("IPv4: 0");
-    Serial.println("LE: 1");
-    Serial.println("EDR: 2\n");
-
-    size_t len = 0;
-    GetData(buf, sizeof(buf), &len);
-    int number = buf[0] - '0';
-    Serial.println(number);
-    if (0 >= len || number < 0 || number > 3)
-    {
-        Serial.println("Wrong i/p. WIFI selected");
-        number = 1;
-    }
-    if (number == 3)
-    {
-        g_isLeSelected = false;
-    }
-    CAUnSelectNetwork((CATransportAdapter_t)(1 << number));
-    Serial.println("Terminate");
-    CATerminate();
-    Serial.println("============");
-}
-
-void GetNetworkInfo()
-{
-    CAEndpoint_t *tempInfo = NULL;
-    uint32_t tempSize = 0;
-    CAResult_t res = CAGetNetworkInformation(&tempInfo, &tempSize);
-    if (CA_STATUS_OK != res || NULL == tempInfo || 0 >= tempSize)
-    {
-        Serial.println("Network not connected");
-        free(tempInfo);
-        return;
-    }
-    Serial.println("=========");
-    Serial.print("Network info total size is ");
-    Serial.println(tempSize);
-    int index;
-    for (index = 0; index < tempSize; index++)
-    {
-        Serial.print("Type: ");
-        Serial.println(tempInfo[index].adapter);
-        if (CA_ADAPTER_IP == tempInfo[index].adapter)
-        {
-            Serial.print("Address: ");
-            Serial.println(tempInfo[index].addr);
-            Serial.print("Port: ");
-            Serial.println(tempInfo[index].port);
-        }
-    }
-    free(tempInfo);
-    Serial.println("=======");
-}
-
-void PrintMenu()
-{
-
-    Serial.println("============");
-    Serial.println("i: Initialize");
-    Serial.println("s: start listening server");
-    Serial.println("d: start discovery server");
-    Serial.println("r: send request");
-    Serial.println("e: send request to all");
-    Serial.println("b: send notification");
-    Serial.println("g: get network info");
-    Serial.println("n: select network");
-    Serial.println("x: unselect network");
-    Serial.println("h: handle request response");
-    Serial.println("t: terminate");
-    Serial.println("q: quit");
-    Serial.println("============");
-}
-
-void HandleRequestResponse()
-{
-    CAHandleRequestResponse();
-}
-
-void RequestHandler(const CAEndpoint_t *object, const CARequestInfo_t *requestInfo)
-{
-    if (!object)
-    {
-        Serial.println("endpoint is NULL!");
-        return;
-    }
-
-    if (!requestInfo)
-    {
-        Serial.println("Request info is NULL!");
-        return;
-    }
-
-    Serial.print("RAddr: ");
-    Serial.println(object->addr);
-    Serial.print("Port: ");
-    Serial.println(object->port);
-    Serial.print("uri: ");
-    Serial.println(requestInfo->info.resourceUri);
-    Serial.print("data: ");
-    Serial.println((char*)requestInfo->info.payload);
-    Serial.print("data size: ");
-    Serial.println(requestInfo->info.payloadSize);
-    Serial.print("Type: ");
-    Serial.println(requestInfo->info.type);
-
-    if (requestInfo->info.options)
-    {
-        uint32_t len = requestInfo->info.numOptions;
-        uint32_t i;
-        for (i = 0; i < len; i++)
-        {
-            Serial.print("Option: ");
-            Serial.println(i+1);
-            Serial.print("ID: ");
-            Serial.println(requestInfo->info.options[i].optionID);
-            Serial.print("Data: ");
-            Serial.println((char*)requestInfo->info.options[i].optionData);
-        }
-    }
-    Serial.println("send response");
-    SendResponse((CAEndpoint_t *)object, (requestInfo != NULL) ? &requestInfo->info : NULL);
-}
-
-void ResponseHandler(const CAEndpoint_t *object, const CAResponseInfo_t *responseInfo)
-{
-    if (object)
-    {
-        Serial.print("uri: ");
-        Serial.println(object->addr);
-    }
-
-    if (responseInfo)
-    {
-        Serial.print("uri: ");
-        Serial.println(responseInfo->info.resourceUri);
-        Serial.print("data: ");
-        Serial.println((char*)responseInfo->info.payload);
-        Serial.print("data size: ");
-        Serial.println(responseInfo->info.payloadSize);
-        Serial.print("Type: ");
-        Serial.println(responseInfo->info.type);
-        Serial.print("res result=");
-        Serial.println(responseInfo->result);
-    }
-}
-
-void ErrorHandler(const CAEndpoint_t *rep, const CAErrorInfo_t* errorInfo)
-{
-    Serial.println("ErrorInfo");
-
-    if(errorInfo)
-    {
-        const CAInfo_t *info = &errorInfo->info;
-        Serial.print("result: ");
-        Serial.println(errorInfo->result);
-        Serial.print("token: ");
-        Serial.println(info->token);
-        Serial.print("messageId: ");
-        Serial.println(info->messageId);
-        Serial.print("type: ");
-        Serial.println(info->type);
-        Serial.print("resourceUri: ");
-        Serial.println(info->resourceUri);
-        Serial.print("payload: ");
-        Serial.println((char*)info->payload);
-    }
-
-    return;
-}
-
-void SendResponse(CAEndpoint_t *endpoint, const CAInfo_t* info)
-{
-    char buf[MAX_BUF_LEN] = {0};
-
-    Serial.println("============");
-    Serial.println("Select Message Type");
-    Serial.println("CON: 0");
-    Serial.println("NON: 1");
-    Serial.println("ACK: 2");
-    Serial.println("RESET: 3");
-
-    size_t len = 0;
-    int messageType = 0;
-    while(1)
-    {
-        GetData(buf, sizeof(buf), &len);
-        if(len >= 1)
-        {
-            messageType = buf[0] - '0';
-            if (messageType >= 0 && messageType <= 3)
-            {
-                break;
-            }
-        }
-        Serial.println("Invalid type");
-    }
-
-    int respCode = 0;
-    if(messageType != 3)
-    {
-        Serial.println("============");
-        Serial.println("Enter Resp Code:");
-        Serial.println("For Ex: Empty  : 0");
-        Serial.println("Created: 201");
-        Serial.println("Deleted: 202");
-        Serial.println("Valid  : 203");
-        Serial.println("Changed: 204");
-        Serial.println("Content: 205");
-        Serial.println("BadReq : 400");
-        Serial.println("BadOpt : 402");
-        Serial.println("NotFnd : 404");
-        Serial.println("Internal Srv Err:500");
-        Serial.println("Timeout: 504");
-        while(1)
-        {
-            GetData(buf, sizeof(buf), &len);
-            if(len >= 1)
-            {
-                respCode = atoi(buf);
-                if (respCode >= 0 && respCode <= 504)
-                {
-                    break;
-                }
-            }
-            Serial.println("Invalid response");
-        }
-    }
-
-    CAInfo_t responseData = {CA_MSG_RESET};
-    responseData.type = static_cast<CAMessageType_t>(messageType);
-    responseData.messageId = (info != NULL) ? info->messageId : 0;
-    responseData.resourceUri = (info != NULL) ? info->resourceUri : 0;
-    if(messageType != 3)
-    {
-        responseData.token = (info != NULL) ? info->token : NULL;
-        responseData.tokenLength = (info != NULL) ? info->tokenLength : 0;
-        responseData.payload = reinterpret_cast<CAPayload_t>(const_cast<char*>("response payload"));
-        responseData.payloadSize = strlen((const char *) responseData.payload);
-    }
-    CAResponseInfo_t responseInfo = {CA_BAD_REQ, {CA_MSG_RESET}};
-    responseInfo.result = static_cast<CAResponseResult_t>(respCode);
-    responseInfo.info = responseData;
-    // send request (transportType from remoteEndpoint of request Info)
-    CAResult_t res = CASendResponse(endpoint, &responseInfo);
-    if(res != CA_STATUS_OK)
-    {
-        Serial.println("Snd Resp error");
-    }
-    else
-    {
-        Serial.println("Snd Resp success");
-    }
-
-    Serial.println("============");
-}
-
-void Terminate()
-{
-    UnselectNetwork();
-}
-
diff --git a/resource/csdk/connectivity/samples/linux/README b/resource/csdk/connectivity/samples/linux/README
deleted file mode 100644 (file)
index bc122b4..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-The build steps used in continuous integration can be found
-in auto_build.sh which is also in the the repository root directory.
-
-Go to the top directory of 'iotivity' project(Note: should always run 'scons'
-command in this directory)
-
-#1. build "connectivity" project (for release mode)
-       - execute 'scons resource/csdk/connectivity/' command
-
-#2. build "example" for linux
-       - execute 'scons resource/csdk/connectivity/samples/linux/' command
-
-#3. execute sample program
-       - you should link the "connectivity_abstraction" library.
-       ex. cd out/linux/x86/release/resource/csdk/connectivity/samples/linux
-           ./casample
-
diff --git a/resource/csdk/connectivity/samples/linux/SConscript b/resource/csdk/connectivity/samples/linux/SConscript
deleted file mode 100644 (file)
index 68f4f16..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-##
-# Building sample application
-##
-
-Import('env')
-
-sample_env = env.Clone()
-
-ca_os = sample_env.get('TARGET_OS')
-ca_transport = sample_env.get('TARGET_TRANSPORT')
-secured = sample_env.get('SECURED')
-with_ra = sample_env.get('WITH_RA')
-with_ra_ibb = sample_env.get('WITH_RA_IBB')
-root_dir = './../../'
-
-#####################################################################
-# Source files and Target(s)
-######################################################################
-
-print"Reading ca script %s"%ca_transport
-
-sample_env.PrependUnique(CPPPATH = [root_dir + '/api/'])
-sample_env.AppendUnique(CPPPATH = [root_dir + '/inc/'])
-sample_env.AppendUnique(CPPPATH = [root_dir + '/lib/libcoap-4.1.1/'])
-sample_env.AppendUnique(CPPPATH = [root_dir + 'common/inc/'])
-
-print "Reading sample application build script"
-
-build_dir = sample_env.get('BUILD_DIR')
-sample_dir = './samples/linux/'
-
-secured = sample_env.get('SECURED')
-
-print "Sample secured flag is %s" % secured
-
-sample_src = ['./sample_main.c',]
-print " sample src %s" % sample_src
-#env.StaticLibrary('casample', sample_src)
-
-sample_env.PrependUnique(LIBPATH = [sample_env.get('BUILD_DIR'), '.'])
-sample_env.PrependUnique(RPATH = [sample_env.get('BUILD_DIR'), '.',])
-sample_env.PrependUnique(LIBS = ['connectivity_abstraction'])
-if with_ra_ibb:
-       sample_env.AppendUnique(LIBPATH = sample_env['RALIBPATH'], RPATH = sample_env['RARPATH'], LIBS = sample_env['RALIBS'])
-else :
-       if with_ra:
-               sample_env.AppendUnique(LIBS = ['ra_xmpp'])
-sample_env.AppendUnique(LIBS = ['coap', 'pthread'])
-
-if ca_os not in ['darwin']:
-       sample_env.PrependUnique(LIBS = ['rt'])
-
-if secured == '1':
-       current_dir=env.get('SRC_DIR')
-       sample_env.AppendUnique(CPPPATH = [root_dir + 'external/inc/'])
-       sample_env.AppendUnique(LIBS = ['timer','tinydtls'])
-       casample =sample_env.Program('casample', [sample_src])
-else:
-       casample =sample_env.Program('casample', [sample_src])
-env.InstallTarget(casample, 'casample')
-env.UserInstallTargetBin(casample, 'casample')
-
-
-
-
diff --git a/resource/csdk/connectivity/samples/linux/sample_main.c b/resource/csdk/connectivity/samples/linux/sample_main.c
deleted file mode 100644 (file)
index c3ef1b2..0000000
+++ /dev/null
@@ -1,1650 +0,0 @@
-/* ****************************************************************
- *
- * Copyright 2014 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <stdbool.h>
-
-#include "cacommon.h"
-#include "cainterface.h"
-#include "oic_string.h"
-
-#define MAX_BUF_LEN 1024
-#define MAX_OPT_LEN 16
-
-#define PORT_LENGTH 5
-
-#define SECURE_DEFAULT_PORT 5684
-
-#define RESOURCE_URI_LENGTH 14
-
-#define SYSTEM_INVOKE_ERROR 127
-#define SYSTEM_ERROR -1
-
-#ifdef WITH_BWT
-#define BLOCK_SIZE(arg) (1 << ((arg) + 4))
-#endif
-
-// Iotivity Device Identity.
-const unsigned char IDENTITY[] = ("1111111111111111");
-
-// PSK between this device and peer device.
-const unsigned char RS_CLIENT_PSK[] = ("AAAAAAAAAAAAAAAA");
-
-int g_received;
-uint16_t g_local_secure_port = SECURE_DEFAULT_PORT;
-CATransportAdapter_t g_selected_nw_type = CA_ADAPTER_IP;
-const char *MESSAGE_TYPE[] = {"CON", "NON", "ACK", "RESET"};
-
-typedef struct
-{
-    char ipAddress[CA_IPADDR_SIZE];
-    uint16_t port;
-} addressSet_t;
-
-char get_menu();
-void process();
-CAResult_t get_network_type(CATransportFlags_t *flags);
-CAResult_t get_input_data(char *buf, int32_t length);
-
-bool select_payload_type();
-CAPayload_t get_binary_payload(size_t *payloadLength);
-bool read_file(const char* name, CAPayload_t* bytes, size_t* length);
-void create_file(CAPayload_t bytes, size_t length);
-
-void start_listening_server();
-void start_discovery_server();
-void send_request();
-void send_request_all();
-void send_notification();
-void select_network();
-void unselect_network();
-void handle_request_response();
-void get_network_info();
-void send_secure_request();
-
-void request_handler(const CAEndpoint_t *object, const CARequestInfo_t *requestInfo);
-void response_handler(const CAEndpoint_t *object, const CAResponseInfo_t *responseInfo);
-void error_handler(const CAEndpoint_t *object, const CAErrorInfo_t* errorInfo);
-void send_response(const CAEndpoint_t *endpoint, const CAInfo_t *info);
-void get_resource_uri(char *URI, char *resourceURI, int length);
-int get_secure_information(CAPayload_t payLoad);
-bool get_address_set(const char *pAddress, addressSet_t* outAddress);
-void parsing_coap_uri(const char* uri, addressSet_t* address, CATransportFlags_t *flags);
-CAHeaderOption_t* get_option_data(CAInfo_t* requestData);
-
-static CAToken_t g_last_request_token = NULL;
-
-static const char COAP_PREFIX[] =  "coap://";
-static const char COAPS_PREFIX[] = "coaps://";
-static const char COAP_TCP_PREFIX[] =  "coap+tcp://";
-
-static const uint16_t COAP_PREFIX_LEN = sizeof(COAP_PREFIX) - 1;
-static const uint16_t COAPS_PREFIX_LEN = sizeof(COAPS_PREFIX) - 1;
-static const uint16_t COAP_TCP_PREFIX_LEN = sizeof(COAP_TCP_PREFIX) - 1;
-
-static const char SECURE_INFO_DATA[] =
-                                    "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
-                                     "\"if\":[\"oic.if.baseline\"],\"obs\":1,\"sec\":1,\"port\":"
-                                     "%d}}]}";
-static const char NORMAL_INFO_DATA[] =
-                                    "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
-                                     "\"if\":[\"oic.if.baseline\"],\"obs\":1}}]}";
-
-#ifdef __WITH_DTLS__
-#ifdef __WITH_X509__
-int GetDtlsX509Credentials(CADtlsX509Creds_t *credInfo)
-{
-    (void) credInfo;
-    return -1;
-}
-int * GetCRLResource()
-{
-    return (int*) NULL;
-}
-#endif //__WITH_X509__
-
-// Internal API. Invoked by CA stack to retrieve credentials from this module
-int32_t CAGetDtlsPskCredentials( CADtlsPskCredType_t type,
-              const unsigned char *desc, size_t desc_len,
-              unsigned char *result, size_t result_length)
-{
-    printf("CAGetDtlsPskCredentials IN\n");
-
-    int32_t ret = -1;
-
-    if (NULL == result)
-    {
-        return ret;
-    }
-
-    switch (type)
-    {
-        case CA_DTLS_PSK_HINT:
-        case CA_DTLS_PSK_IDENTITY:
-
-            if (result_length < sizeof(IDENTITY))
-            {
-                printf("ERROR : Wrong value for result for storing IDENTITY");
-                return ret;
-            }
-
-            memcpy(result, IDENTITY, sizeof(IDENTITY));
-            ret = sizeof(IDENTITY);
-            break;
-
-        case CA_DTLS_PSK_KEY:
-
-            if ((desc_len == sizeof(IDENTITY)) &&
-                memcmp(desc, IDENTITY, sizeof(IDENTITY)) == 0)
-            {
-                if (result_length < sizeof(RS_CLIENT_PSK))
-                {
-                    printf("ERROR : Wrong value for result for storing RS_CLIENT_PSK");
-                    return ret;
-                }
-
-                memcpy(result, RS_CLIENT_PSK, sizeof(RS_CLIENT_PSK));
-                ret = sizeof(RS_CLIENT_PSK);
-            }
-            break;
-
-        default:
-
-            printf("Wrong value passed for PSK_CRED_TYPE.");
-            ret = -1;
-    }
-
-    printf("CAGetDtlsPskCredentials OUT\n");
-    return ret;
-}
-
-#endif //__WITH_DTLS__
-
-int main()
-{
-    int ret = system("clear");
-    // shell invoke error: 127, others: -1
-    if (SYSTEM_INVOKE_ERROR == ret || SYSTEM_ERROR == ret)
-    {
-        printf("Terminal Clear Error: %d\n", ret);
-        return -1;
-    }
-
-    printf("=============================================\n");
-    printf("\t\tsample main\n");
-    printf("=============================================\n");
-
-    CAResult_t res = CAInitialize();
-    if (CA_STATUS_OK != res)
-    {
-        printf("CAInitialize fail\n");
-        return -1;
-    }
-
-    // Set the PSK Credentials callback handler.
-#ifdef __WITH_DTLS__
-    res = CARegisterDTLSCredentialsHandler(CAGetDtlsPskCredentials);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Register credential handler fail\n");
-        return -1;
-    }
-#endif
-
-    // set handler.
-    CARegisterHandler(request_handler, response_handler, error_handler);
-
-    process();
-
-    CADestroyToken(g_last_request_token);
-
-    g_last_request_token = NULL;
-
-    CATerminate();
-    return 0;
-}
-
-void process()
-{
-    while (1)
-    {
-        char menu = get_menu();
-
-        switch (menu)
-        {
-            case 'm': // menu
-            case 'M':
-                break;
-
-            case 'q': // quit
-            case 'Q':
-                printf("quit..!!\n");
-                return;
-
-            case 's': // start server
-            case 'S':
-                start_listening_server();
-                break;
-
-            case 't': // send request
-            case 'T':
-                send_request_all();
-                break;
-
-            case 'c': // start client
-            case 'C':
-                start_discovery_server();
-                break;
-
-            case 'r': // send request
-            case 'R':
-                send_request();
-                break;
-
-            case 'b': // send notification
-            case 'B':
-                send_notification();
-                break;
-
-            case 'n': // select network
-            case 'N':
-                select_network();
-                break;
-
-            case 'x': // unselect network
-            case 'X':
-                unselect_network();
-                break;
-
-            case 'h': // handle request response
-            case 'H':
-                handle_request_response();
-                break;
-
-            case 'w':
-            case 'W':
-                g_received = 0;
-                start_discovery_server();
-                send_secure_request();
-                while (g_received == 0)
-                {
-                    sleep(1);
-                    handle_request_response();
-                }
-                break;
-
-            case 'z':
-            case 'Z':
-                start_listening_server();
-                while (1)
-                {
-                    sleep(1);
-                    handle_request_response();
-                }
-                break;
-
-            case 'g': // get network information
-            case 'G':
-                get_network_info();
-                break;
-
-            default:
-                printf("not supported menu!!\n");
-                break;
-        }
-    }
-}
-
-void start_listening_server()
-{
-    printf("start listening server!!\n");
-
-    CAResult_t res = CAStartListeningServer();
-    if (CA_STATUS_OK != res)
-    {
-        printf("start listening server fail, error code : %d\n", res);
-    }
-    else
-    {
-        printf("start listening server success\n");
-    }
-}
-
-void start_discovery_server()
-{
-    printf("start discovery client!!\n");
-
-    CAResult_t res = CAStartDiscoveryServer();
-    if (CA_STATUS_OK != res)
-    {
-        printf("start discovery client fail, error code : %d\n", res);
-    }
-    else
-    {
-        printf("start discovery client success\n");
-    }
-}
-
-bool select_payload_type()
-{
-    char buf[MAX_BUF_LEN]={0};
-    printf("\n=============================================\n");
-    printf("Normal Payload  : 0\nBig Payload   : 1\n");
-    printf("select Payload type : ");
-
-    CAResult_t res = get_input_data(buf, sizeof(buf));
-    if (CA_STATUS_OK != res)
-    {
-        printf("Payload type selection error\n");
-        printf("Default: Using normal Payload\n");
-        return false;
-    }
-
-    return (buf[0] == '1') ? true : false;
-}
-
-CAPayload_t get_binary_payload(size_t *payloadLength)
-{
-    CAPayload_t binaryPayload = NULL;
-    bool result = read_file("sample_input.txt", &binaryPayload, payloadLength);
-    if (false == result)
-    {
-        return NULL;
-    }
-
-    return binaryPayload;
-}
-
-void send_request()
-{
-    CATransportFlags_t flags = CA_DEFAULT_FLAGS;
-    CAResult_t res = get_network_type(&flags);
-    if (CA_STATUS_OK != res)
-    {
-        return;
-    }
-
-    printf("Do you want to send secure request ?.... enter (0/1): ");
-
-    char secureRequest[MAX_BUF_LEN] = {0};
-    if (CA_STATUS_OK != get_input_data(secureRequest, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    if (strcmp(secureRequest, "1") == 0)
-    {
-        printf("Enter the URI like below....\n");
-        printf("coaps://10.11.12.13:4545/resource_uri ( for IP secure)\n");
-    }
-    else if (strcmp(secureRequest, "0") == 0)
-    {
-        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("Input data is wrong value\n");
-        return;
-    }
-
-    char uri[MAX_BUF_LEN] = {'\0'};
-    if (CA_STATUS_OK != get_input_data(uri, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    printf("URI : %s\n", uri);
-    addressSet_t address = {{}, 0};
-    parsing_coap_uri(uri, &address, &flags);
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    res = CACreateEndpoint(flags, g_selected_nw_type,
-                           (const char*)address.ipAddress, address.port, &endpoint);
-    if (CA_STATUS_OK != res || !endpoint)
-    {
-        printf("Failed to create remote endpoint, error code : %d\n", res);
-        return;
-    }
-
-    printf("\n=============================================\n");
-    printf("0:CON, 1:NON\n");
-    printf("select message type : ");
-
-    char buf[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(buf, MAX_BUF_LEN))
-    {
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    CAMessageType_t msgType = (buf[0] == '1') ? 1 : 0;
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if ((CA_STATUS_OK != res) || (!token))
-    {
-        printf("Token generate error, error code : %d\n", res);
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    // extract relative resourceuri from give uri
-    char resourceURI[RESOURCE_URI_LENGTH + 1] = {0};
-    get_resource_uri(uri, resourceURI, RESOURCE_URI_LENGTH);
-    printf("resourceURI : %s\n", resourceURI);
-
-    // create request data
-    CAInfo_t requestData = { .type = msgType,
-                             .messageId = 0,
-                             .token = token,
-                             .tokenLength = tokenLength,
-                             .options = NULL,
-                             .numOptions = 0,
-                             .payload = NULL,
-                             .payloadSize = 0,
-                             .resourceUri = (CAURI_t)resourceURI };
-
-    if (strcmp(secureRequest, "1") == 0)
-    {
-        size_t length = sizeof(SECURE_INFO_DATA) + strlen(resourceURI);
-        requestData.payload = (CAPayload_t) calloc(length,  sizeof(char));
-        if (NULL == requestData.payload)
-        {
-            printf("Memory allocation fail\n");
-            goto exit;
-        }
-        snprintf((char *) requestData.payload, length, SECURE_INFO_DATA,
-                 (const char *) resourceURI, g_local_secure_port);
-        requestData.payloadSize = length;
-    }
-    else
-    {
-        bool useBigPayload = select_payload_type();
-        if (useBigPayload)
-        {
-            size_t payloadLength = 0;
-            CAPayload_t binaryPayload = get_binary_payload(&payloadLength);
-            if (!binaryPayload)
-            {
-                free(binaryPayload);
-                goto exit;
-            }
-
-            requestData.payload = (CAPayload_t) malloc(payloadLength);
-            if (NULL == requestData.payload)
-            {
-                printf("Memory allocation failed!");
-                free(binaryPayload);
-                goto exit;
-            }
-            memcpy(requestData.payload, binaryPayload, payloadLength);
-            requestData.payloadSize = payloadLength;
-
-            // memory free
-            free(binaryPayload);
-        }
-        else
-        {
-            size_t length = sizeof(NORMAL_INFO_DATA) + strlen(resourceURI);
-            requestData.payload = (CAPayload_t) calloc(length, sizeof(char));
-            if (NULL == requestData.payload)
-            {
-                printf("Memory allocation fail\n");
-                goto exit;
-            }
-            snprintf((char *) requestData.payload, length, NORMAL_INFO_DATA,
-                     (const char *) resourceURI);
-            requestData.payloadSize = length;
-        }
-    }
-
-    CAHeaderOption_t* headerOpt = get_option_data(&requestData);
-
-    CARequestInfo_t requestInfo = { .method = CA_GET,
-                                    .info = requestData,
-                                    .isMulticast = false };
-
-    // send request
-    res = CASendRequest(endpoint, &requestInfo);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Could not send request : %d\n", res);
-    }
-
-    free(headerOpt);
-    free(requestData.payload);
-
-exit:
-    // cleanup
-    CADestroyToken(token);
-    CADestroyEndpoint(endpoint);
-    printf("=============================================\n");
-}
-
-void send_secure_request()
-{
-    char uri[MAX_BUF_LEN];
-    char ipv4addr[CA_IPADDR_SIZE];
-
-    printf("\n=============================================\n");
-    printf("Enter IPv4 address of the source hosting secure resource (Ex: 11.12.13.14)\n");
-
-    if (CA_STATUS_OK != get_input_data(ipv4addr, CA_IPADDR_SIZE))
-    {
-        return;
-    }
-    snprintf(uri, MAX_BUF_LEN, "%s%s:5684/a/light", COAPS_PREFIX, ipv4addr);
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    CAResult_t res = CACreateEndpoint(0, CA_ADAPTER_IP, ipv4addr, SECURE_DEFAULT_PORT, &endpoint);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Failed to create remote endpoint, error code: %d\n", res);
-        goto exit;
-    }
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Token generate error, error code : %d\n", res);
-        goto exit;
-    }
-
-    // create request data
-    CAInfo_t requestData = { .type = CA_MSG_NONCONFIRM,
-                             .messageId = 0,
-                             .token = token,
-                             .tokenLength = tokenLength,
-                             .options = NULL,
-                             .numOptions = 0,
-                             .payload = NULL,
-                             .payloadSize = 0,
-                             .resourceUri = NULL };
-
-    CARequestInfo_t requestInfo = { .method = CA_GET,
-                                    .info = requestData,
-                                    .isMulticast = false };
-
-    // send request
-    CASendRequest(endpoint, &requestInfo);
-
-exit:
-    // cleanup
-    CADestroyToken(token);
-    CADestroyEndpoint(endpoint);
-    printf("=============================================\n");
-}
-
-
-void send_request_all()
-{
-    CATransportFlags_t flags = CA_DEFAULT_FLAGS;
-    CAResult_t res = get_network_type(&flags);
-    if (CA_STATUS_OK != res)
-    {
-        return;
-    }
-
-    printf("\n=============================================\n");
-    printf("ex) /a/light\n");
-    printf("resource uri : ");
-
-    char resourceURI[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(resourceURI, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    // create remote endpoint
-    CAEndpoint_t *group = NULL;
-    res = CACreateEndpoint(flags, g_selected_nw_type, NULL, 0, &group);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Create remote endpoint error, error code: %d\n", res);
-        return;
-    }
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if ((CA_STATUS_OK != res) || (!token))
-    {
-        printf("Token generate error!!\n");
-        CADestroyEndpoint(group);
-        return;
-    }
-
-    // create request data
-    CAPayload_t payload = (CAPayload_t) "TempJsonPayload";
-    size_t payloadSize = strlen((const char *) payload);
-
-    CAInfo_t requestData = { .type = CA_MSG_NONCONFIRM,
-                             .messageId = 0,
-                             .token = token,
-                             .tokenLength = tokenLength,
-                             .options = NULL,
-                             .numOptions = 0,
-                             .payload = payload,
-                             .payloadSize = payloadSize,
-                             .resourceUri = (CAURI_t) resourceURI };
-
-    CARequestInfo_t requestInfo = { .method = CA_GET,
-                                    .info = requestData,
-                                    .isMulticast = true };
-
-    CAHeaderOption_t* headerOpt = get_option_data(&requestData);
-
-    // send request
-    res = CASendRequest(group, &requestInfo);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Could not send request to all\n");
-        CADestroyToken(token);
-    }
-    else
-    {
-        CADestroyToken(g_last_request_token);
-        g_last_request_token = token;
-    }
-
-    free(headerOpt);
-    // destroy remote endpoint
-    CADestroyEndpoint(group);
-
-    printf("=============================================\n");
-}
-
-void send_notification()
-{
-    CATransportFlags_t flags = CA_DEFAULT_FLAGS;
-    CAResult_t res = get_network_type(&flags);
-    if (CA_STATUS_OK != res)
-    {
-        return;
-    }
-
-    printf("\n=============================================\n");
-    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");
-    printf("uri : ");
-
-    char uri[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(uri, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    printf("\n=============================================\n");
-    printf("\tselect message type\n");
-    printf("CON     : 0\n");
-    printf("NON     : 1\n");
-    printf("ACK     : 2\n");
-    printf("RESET   : 3\n");
-    printf("select : ");
-
-    char messageTypeBuf[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(messageTypeBuf, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    int messageType = messageTypeBuf[0] - '0';
-
-    addressSet_t address = {{}, 0};
-    parsing_coap_uri(uri, &address, &flags);
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    res = CACreateEndpoint(flags, g_selected_nw_type, address.ipAddress, address.port, &endpoint);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Create remote endpoint error, error code: %d\n", res);
-        return;
-    }
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if ((CA_STATUS_OK != res) || (!token))
-    {
-        printf("Token generate error!!\n");
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    // create response data
-    CAPayload_t payload = (CAPayload_t) "TempNotificationData";
-    size_t payloadSize = strlen((const char *) payload);
-
-    CAInfo_t requestData = { .type = messageType,
-                             .messageId = 0,
-                             .token = token,
-                             .tokenLength = tokenLength,
-                             .options = NULL,
-                             .numOptions = 0,
-                             .payload = payload,
-                             .payloadSize = payloadSize,
-                             .resourceUri = (CAURI_t) uri };
-
-    CARequestInfo_t requestInfo = { .method = CA_GET,
-                                    .info = requestData };
-
-    // send request
-    res = CASendRequest(endpoint, &requestInfo);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Send notification error, error code: %d\n", res);
-    }
-    else
-    {
-        printf("Send notification success\n");
-    }
-
-    // destroy token
-    CADestroyToken(token);
-    // destroy remote endpoint
-    CADestroyEndpoint(endpoint);
-
-    printf("\n=============================================\n");
-}
-
-void select_network()
-{
-    printf("\n=============================================\n");
-    printf("\tselect network\n");
-    printf("IP     : 0\n");
-    printf("GATT   : 1\n");
-    printf("RFCOMM : 2\n");
-    printf("TCP    : 4\n");
-    printf("select : ");
-
-    char buf[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(buf, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    int number = buf[0] - '0';
-
-    if (number < 0 || number > 4)
-    {
-        printf("Invalid network type\n");
-        return;
-    }
-
-    CAResult_t res = CASelectNetwork(1 << number);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Select network error\n");
-    }
-    else
-    {
-        printf("Select network success\n");
-    }
-
-    printf("=============================================\n");
-}
-
-void unselect_network()
-{
-    printf("\n=============================================\n");
-    printf("\tunselect enabled network\n");
-    printf("IP     : 0\n");
-    printf("GATT   : 1\n");
-    printf("RFCOMM : 2\n");
-    printf("TCP    : 4\n");
-    printf("select : ");
-
-    char buf[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(buf, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    int number = buf[0] - '0';
-
-    if (number < 0 || number > 4)
-    {
-        printf("Invalid network type\n");
-        return;
-    }
-
-    CAResult_t res = CAUnSelectNetwork(1 << number);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Unselect network error\n");
-    }
-    else
-    {
-        printf("Unselect network success\n");
-    }
-
-    printf("=============================================\n");
-}
-
-char get_menu()
-{
-    printf("\n=============================================\n");
-    printf("\t\tMenu\n");
-    printf("\ts : start server\n");
-    printf("\tc : start client\n");
-    printf("\tr : send request\n");
-    printf("\tt : send request to all\n");
-    printf("\tb : send notification\n");
-    printf("\tn : select network\n");
-    printf("\tx : unselect network\n");
-    printf("\tg : get network information\n");
-    printf("\th : handle request response\n");
-    printf("\tz : run static server\n");
-    printf("\tw : send secure request\n");
-    printf("\tq : quit\n");
-    printf("=============================================\n");
-    printf("select : ");
-
-    char buf[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(buf, MAX_BUF_LEN))
-    {
-        printf("Failed to get input data\n");
-    }
-
-    return buf[0];
-}
-
-void handle_request_response()
-{
-    printf("Handle_request_response\n");
-
-    CAResult_t res = CAHandleRequestResponse();
-    if (CA_STATUS_OK != res)
-    {
-        printf("Handle request error, error code: %d\n", res);
-    }
-    else
-    {
-        printf("Handle request success\n");
-    }
-}
-
-void get_network_info()
-{
-    CAEndpoint_t *tempInfo = NULL;
-    uint32_t tempSize = 0;
-
-    CAResult_t res = CAGetNetworkInformation(&tempInfo, &tempSize);
-    if (CA_STATUS_OK != res || NULL == tempInfo || 0 >= tempSize)
-    {
-        printf("Network not connected\n");
-        free(tempInfo);
-        return;
-    }
-
-    printf("################## Network Information #######################\n");
-    printf("Network info total size is %d\n\n", tempSize);
-
-    for (uint32_t index = 0; index  < tempSize; index++)
-    {
-        printf("Type: %d\n", tempInfo[index].adapter);
-        printf("Address: %s\n", tempInfo[index].addr);
-        if (CA_ADAPTER_IP == tempInfo[index].adapter)
-        {
-            printf("Port: %d\n", tempInfo[index].port);
-            printf("Secured: %s flag : %x\n\n", (tempInfo[index].flags & CA_SECURE) ? "true" :
-                   "false", tempInfo[index].flags);
-
-            if (tempInfo[index].flags & CA_SECURE)
-            {
-                g_local_secure_port = tempInfo[index].port;
-                printf("Secured: in global %d\n\n", g_local_secure_port);
-            }
-        }
-    }
-
-    free(tempInfo);
-    printf("##############################################################");
-}
-
-void request_handler(const CAEndpoint_t *object, const CARequestInfo_t *requestInfo)
-{
-    if (NULL == object || NULL == requestInfo)
-    {
-        printf("Input parameter is NULL\n");
-        return;
-    }
-
-    if ((NULL != g_last_request_token) && (NULL != requestInfo->info.token)
-        && (memcmp(g_last_request_token, requestInfo->info.token,
-                   CA_MAX_TOKEN_LEN) == 0))
-    {
-        printf("token is same. received request of it's own. skip.. \n");
-        return;
-    }
-
-    printf("##########received request from remote device #############\n");
-    if (CA_ADAPTER_IP == object->adapter || CA_ADAPTER_TCP == object->adapter)
-    {
-        printf("Remote Address: %s Port: %d secured:%d\n", object->addr,
-               object->port, object->flags & CA_SECURE);
-    }
-    else
-    {
-        printf("Remote Address: %s \n", object->addr);
-    }
-    printf("Data: %s\n", requestInfo->info.payload);
-    printf("Message type: %s\n", MESSAGE_TYPE[requestInfo->info.type]);
-    printf("Resource URI: %s \n", requestInfo->info.resourceUri);
-
-    if (requestInfo->info.options)
-    {
-        uint32_t len = requestInfo->info.numOptions;
-        uint32_t i;
-        for (i = 0; i < len; i++)
-        {
-            printf("Option %d\n", i + 1);
-            printf("ID : %d\n", requestInfo->info.options[i].optionID);
-            printf("Data[%d]: %s\n", requestInfo->info.options[i].optionLength,
-                   requestInfo->info.options[i].optionData);
-        }
-    }
-    printf("############################################################\n");
-
-    //Check if this has secure communication information
-    if (requestInfo->info.payload && (CA_ADAPTER_IP == object->adapter))
-    {
-        int securePort = get_secure_information(requestInfo->info.payload);
-        if (0 < securePort) //Set the remote endpoint secure details and send response
-        {
-            printf("This is secure resource...\n");
-
-            CAEndpoint_t *endpoint = NULL;
-            if (CA_STATUS_OK != CACreateEndpoint(0, object->adapter, object->addr,
-                                                 object->port, &endpoint))
-            {
-                printf("Failed to create duplicate of remote endpoint!\n");
-                return;
-            }
-            endpoint->flags = CA_SECURE;
-            object = endpoint;
-        }
-    }
-
-#ifdef WITH_BWT
-    // if received message is bulk data, create output file
-    if ((requestInfo->info.payload) &&
-            (requestInfo->info.payloadSize > BLOCK_SIZE(CA_DEFAULT_BLOCK_SIZE)))
-    {
-        create_file(requestInfo->info.payload, requestInfo->info.payloadSize);
-    }
-#endif
-
-    printf("Send response with URI\n");
-    send_response(object, &requestInfo->info);
-
-    g_received = 1;
-}
-
-void response_handler(const CAEndpoint_t *object, const CAResponseInfo_t *responseInfo)
-{
-    printf("##########Received response from remote device #############\n");
-    if (CA_ADAPTER_IP == object->adapter)
-    {
-        printf("Remote Address: %s Port: %d secured:%d\n", object->addr,
-               object->port, object->flags & CA_SECURE);
-    }
-    else
-    {
-        printf("Remote Address: %s \n", object->addr);
-    }
-    printf("response result : %d\n", responseInfo->result);
-    printf("Data: %s\n", responseInfo->info.payload);
-    printf("Message type: %s\n", MESSAGE_TYPE[responseInfo->info.type]);
-    printf("Token: %s\n", responseInfo->info.token);
-    printf("Resource URI: %s \n", responseInfo->info.resourceUri);
-
-    if (responseInfo->info.options)
-    {
-        uint32_t len = responseInfo->info.numOptions;
-        uint32_t i;
-        for (i = 0; i < len; i++)
-        {
-            printf("Option %d\n", i + 1);
-            printf("ID : %d\n", responseInfo->info.options[i].optionID);
-            printf("Data[%d]: %s\n", responseInfo->info.options[i].optionLength,
-                   responseInfo->info.options[i].optionData);
-        }
-    }
-    printf("############################################################\n");
-    g_received = 1;
-
-    //Check if this has secure communication information
-    if (responseInfo->info.payload)
-    {
-        int securePort = get_secure_information(responseInfo->info.payload);
-        if (0 < securePort) //Set the remote endpoint secure details and send response
-        {
-            printf("This is secure resource...\n");
-        }
-    }
-
-#ifdef WITH_BWT
-    // if received message is bulk data, create output file
-    if ((responseInfo->info.payload) &&
-            (responseInfo->info.payloadSize > BLOCK_SIZE(CA_DEFAULT_BLOCK_SIZE)))
-    {
-        create_file(responseInfo->info.payload, responseInfo->info.payloadSize);
-    }
-#endif
-}
-
-void error_handler(const CAEndpoint_t *rep, const CAErrorInfo_t* errorInfo)
-{
-    (void)rep;
-    printf("+++++++++++++++++++++++++++++++++++ErrorInfo+++++++++++++++++++++++++++++++++++\n");
-
-    if(errorInfo)
-    {
-        const CAInfo_t *info = &errorInfo->info;
-        printf("Error Handler, ErrorInfo :\n");
-        printf("Error Handler result    : %d\n", errorInfo->result);
-        printf("Error Handler token     : %s\n", info->token);
-        printf("Error Handler messageId : %d\n", (uint16_t) info->messageId);
-        printf("Error Handler type      : %d\n", info->type);
-        printf("Error Handler resourceUri : %s\n", info->resourceUri);
-        printf("Error Handler payload   : %s\n", info->payload);
-
-        if(CA_ADAPTER_NOT_ENABLED == errorInfo->result)
-        {
-            printf("CA_ADAPTER_NOT_ENABLED, enable the adapter\n");
-        }
-        else if(CA_SEND_FAILED == errorInfo->result)
-        {
-            printf("CA_SEND_FAILED, unable to send the message, check parameters\n");
-        }
-        else if(CA_MEMORY_ALLOC_FAILED == errorInfo->result)
-        {
-            printf("CA_MEMORY_ALLOC_FAILED, insufficient memory\n");
-        }
-        else if(CA_SOCKET_OPERATION_FAILED == errorInfo->result)
-        {
-            printf("CA_SOCKET_OPERATION_FAILED, socket operation failed\n");
-        }
-        else if(CA_STATUS_FAILED == errorInfo->result)
-        {
-            printf("CA_STATUS_FAILED, message could not be delivered, internal error\n");
-        }
-    }
-    printf("++++++++++++++++++++++++++++++++End of ErrorInfo++++++++++++++++++++++++++++++++\n");
-
-    return;
-}
-
-void send_response(const CAEndpoint_t *endpoint, const CAInfo_t *info)
-{
-    printf("entering send_response\n");
-
-    printf("\n=============================================\n");
-    printf("\tselect message type\n");
-    printf("CON     : 0\n");
-    printf("NON     : 1\n");
-    printf("ACK     : 2\n");
-    printf("RESET   : 3\n");
-    printf("select : ");
-
-    char buf[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(buf, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    int messageType = buf[0] - '0';
-    if (0 > messageType || 3 < messageType)
-    {
-        printf("Invalid message type\n");
-        return;
-    }
-
-    int responseCode = 0 ;
-    char responseCodeBuf[MAX_BUF_LEN] = { 0 };
-    if (CA_MSG_RESET != messageType)
-    {
-        printf("\n=============================================\n");
-        printf("\tselect response code\n");
-        printf("EMPTY                    :   0\n");
-        printf("CREATED                  : 201\n");
-        printf("DELETED                  : 202\n");
-        printf("VALID                    : 203\n");
-        printf("CHANGED                  : 204\n");
-        printf("CONTENT                  : 205\n");
-        printf("BAD_REQ                  : 400\n");
-        printf("BAD_OPT                  : 402\n");
-        printf("NOT_FOUND                : 404\n");
-        printf("INTERNAL_SERVER_ERROR    : 500\n");
-        printf("RETRANSMIT_TIMEOUT       : 504\n");
-        printf("select : ");
-
-        if (CA_STATUS_OK != get_input_data(responseCodeBuf, MAX_BUF_LEN))
-        {
-            return;
-        }
-        responseCode = atoi(responseCodeBuf);
-    }
-
-    // create response data
-    uint16_t messageId = (info != NULL) ? info->messageId : 0;
-    CAURI_t resourceUri = (info != NULL) ? info->resourceUri : 0;
-
-    CAInfo_t responseData = { .type = messageType,
-                              .messageId = messageId,
-                              .token = NULL,
-                              .tokenLength = 0,
-                              .options = NULL,
-                              .numOptions = 0,
-                              .payload = NULL,
-                              .payloadSize = 0,
-                              .resourceUri = resourceUri };
-
-    if (CA_MSG_RESET == messageType ||
-        (CA_MSG_ACKNOWLEDGE == messageType && CA_EMPTY == responseCode))
-    {
-        printf("RESET or ACK/EMPTY. there will be not payload/option\n");
-
-    }
-    else
-    {
-        responseData.token = (info != NULL) ? info->token : NULL;
-        responseData.tokenLength = (info != NULL) ? info->tokenLength : 0;
-
-        if (endpoint->flags & CA_SECURE)
-        {
-            if(!responseData.resourceUri)
-            {
-               printf("resourceUri not available in SECURE\n");
-               return;
-            }
-            printf("Sending response on secure communication\n");
-
-            uint32_t length = sizeof(SECURE_INFO_DATA) + strlen(responseData.resourceUri);
-            responseData.payload = (CAPayload_t) calloc(length,  sizeof(char));
-            if (NULL == responseData.payload)
-            {
-                printf("Memory allocation fail\n");
-                return;
-            }
-            snprintf((char *) responseData.payload, length, SECURE_INFO_DATA,
-                     (const char *) responseData.resourceUri, g_local_secure_port);
-            responseData.payloadSize = length;
-        }
-        else
-        {
-            printf("Sending response on non-secure communication\n");
-
-            bool useBigPayload = select_payload_type();
-            if (useBigPayload)
-            {
-                size_t payloadLength = 0;
-                CAPayload_t binaryPayload = get_binary_payload(&payloadLength);
-                if (NULL == binaryPayload)
-                {
-                    printf("Failed to read binary file");
-                    return;
-                }
-
-                responseData.payload = (CAPayload_t) malloc(payloadLength);
-                if (NULL == responseData.payload)
-                {
-                    printf("Memory allocation failed!");
-                    free(binaryPayload);
-                    return;
-                }
-                memcpy(responseData.payload, binaryPayload, payloadLength);
-                responseData.payloadSize = payloadLength;
-
-                // memory free
-                free(binaryPayload);
-            }
-            else
-            {
-                if(!responseData.resourceUri)
-                {
-                   printf("resourceUri not available in NON-SECURE\n");
-                   return;
-                }
-                uint32_t length = sizeof(NORMAL_INFO_DATA) + strlen(responseData.resourceUri);
-                responseData.payload = (CAPayload_t) calloc(length, sizeof(char));
-                if (NULL == responseData.payload)
-                {
-                    printf("Memory allocation fail\n");
-                    return;
-                }
-                snprintf((char *) responseData.payload, length, NORMAL_INFO_DATA,
-                         (const char *) responseData.resourceUri);
-                responseData.payloadSize = length;
-            }
-        }
-    }
-
-    CAResponseInfo_t responseInfo = { .result = responseCode,
-                                      .info = responseData };
-
-    // send response (transportType from remoteEndpoint of request Info)
-    CAResult_t res = CASendResponse(endpoint, &responseInfo);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Send response error\n");
-    }
-    else
-    {
-        printf("Send response success\n");
-    }
-
-    free(responseData.payload);
-
-    printf("=============================================\n");
-}
-
-int get_secure_information(CAPayload_t payLoad)
-{
-    printf("Entering get_secure_information\n");
-
-    if (!payLoad)
-    {
-        printf("Payload is NULL\n");
-        return -1;
-    }
-
-    char *subString = NULL;
-    if (NULL == (subString = strstr((const char *) payLoad, "\"sec\":1")))
-    {
-        printf("This is not secure resource\n");
-        return -1;
-    }
-
-    if (NULL == (subString = strstr((const char *) payLoad, "\"port\":")))
-    {
-        printf("This secure resource does not have port information\n");
-        return -1;
-    }
-
-    char *startPos = strstr(subString, ":");
-    if (!startPos)
-    {
-        printf("Parsing failed !\n");
-        return -1;
-    }
-
-    char *endPos = strstr(startPos, "}");
-    if (!endPos)
-    {
-        printf("Parsing failed !\n");
-        return -1;
-    }
-
-    char portStr[6] = {0};
-    OICStrcpyPartial(portStr, sizeof(portStr), startPos + 1, (endPos - 1) - startPos);
-    printf("secured port is: %s\n", portStr);
-    return atoi(portStr);
-}
-
-void get_resource_uri(char *URI, char *resourceURI, int length)
-{
-    char *startPos = URI;
-    char *temp = NULL;
-    if (NULL != (temp = strstr(URI, "://")))
-    {
-        startPos = strchr(temp + 3, '/');
-        if (!startPos)
-        {
-            printf("Resource URI is missing\n");
-            return;
-        }
-    }
-
-    char *endPos = strchr(startPos, '?');
-    if (!endPos)
-    {
-        endPos = URI + strlen(URI);
-    }
-    endPos -= 1;
-
-    if (endPos - startPos <= length)
-    {
-        OICStrcpyPartial(resourceURI, length, startPos + 1, endPos - startPos);
-    }
-
-    printf("URI: %s, ResourceURI:%s\n", URI, resourceURI);
-}
-
-CAResult_t get_network_type(CATransportFlags_t *flags)
-{
-    char buf[MAX_BUF_LEN] = { 0 };
-
-    printf("\n=============================================\n");
-    printf("\tselect network type\n");
-    printf("IP     : 0\n");
-    printf("GATT   : 1\n");
-    printf("RFCOMM : 2\n");
-    printf("TCP    : 4\n");
-    printf("select : ");
-
-    if (CA_STATUS_OK != get_input_data(buf, MAX_BUF_LEN))
-    {
-        return CA_NOT_SUPPORTED ;
-    }
-
-    int number = buf[0] - '0';
-
-    number = (number < 0 || number > 4) ? 0 : 1 << number;
-
-    switch (number)
-    {
-        case CA_ADAPTER_IP:
-            *flags = CA_IPV4;
-        case CA_ADAPTER_GATT_BTLE:
-        case CA_ADAPTER_RFCOMM_BTEDR:
-        case CA_ADAPTER_TCP:
-            g_selected_nw_type = number;
-            return CA_STATUS_OK;
-        default:
-            return CA_NOT_SUPPORTED;
-    }
-}
-
-CAResult_t get_input_data(char *buf, int32_t length)
-{
-    if (!fgets(buf, length, stdin))
-    {
-        printf("fgets error\n");
-        return CA_STATUS_FAILED;
-    }
-
-    char *p = NULL;
-    if ( (p = strchr(buf, '\n')) != NULL )
-    {
-        *p = '\0';
-    }
-
-    return CA_STATUS_OK;
-}
-
-CAHeaderOption_t* get_option_data(CAInfo_t* requestData)
-{
-    char optionNumBuf[MAX_BUF_LEN] = { 0 };
-    char optionData[MAX_OPT_LEN] = { 0 } ;
-
-    printf("Option Num : ");
-    if (CA_STATUS_OK != get_input_data(optionNumBuf, MAX_BUF_LEN))
-    {
-        return NULL;
-    }
-    int optionNum = atoi(optionNumBuf);
-
-    CAHeaderOption_t * headerOpt = NULL;
-    if (0 >= optionNum)
-    {
-        printf("there is no headerOption!\n");
-        return NULL;
-    }
-    else if (optionNum > MAX_OPT_LEN)
-    {
-        printf("Too many header options!\n");
-        return NULL;
-    }
-    else
-    {
-        headerOpt = (CAHeaderOption_t *)calloc(optionNum, sizeof(CAHeaderOption_t));
-        if (NULL == headerOpt)
-        {
-            printf("Memory allocation failed!\n");
-            return NULL;
-        }
-
-        int i;
-        for (i = 0; i < optionNum; i++)
-        {
-            char getOptionID[MAX_BUF_LEN] = { 0 } ;
-
-            printf("[%d] Option ID : ", i + 1);
-            if (CA_STATUS_OK != get_input_data(getOptionID, MAX_BUF_LEN))
-            {
-                free(headerOpt);
-                return NULL;
-            }
-            int optionID = atoi(getOptionID);
-            headerOpt[i].optionID = optionID;
-
-            printf("[%d] Option Data : ", i + 1);
-            if (CA_STATUS_OK != get_input_data(optionData, MAX_OPT_LEN))
-            {
-                free(headerOpt);
-                return NULL;
-            }
-
-            OICStrcpy(headerOpt[i].optionData, sizeof(headerOpt[i].optionData), optionData);
-
-            headerOpt[i].optionLength = (uint16_t) strlen(optionData);
-        }
-        requestData->numOptions = optionNum;
-        requestData->options = headerOpt;
-    }
-    return headerOpt;
-}
-
-void parsing_coap_uri(const char* uri, addressSet_t* address, CATransportFlags_t *flags)
-{
-    if (NULL == uri)
-    {
-        printf("parameter is null\n");
-        return;
-    }
-
-    // parse uri
-    // #1. check prefix
-    uint8_t startIndex = 0;
-    if (strncmp(COAPS_PREFIX, uri, COAPS_PREFIX_LEN) == 0)
-    {
-        printf("uri has '%s' prefix\n", COAPS_PREFIX);
-        startIndex = COAPS_PREFIX_LEN;
-        *flags = CA_SECURE;
-    }
-    else if (strncmp(COAP_PREFIX, uri, COAP_PREFIX_LEN) == 0)
-    {
-        printf("uri has '%s' prefix\n", COAP_PREFIX);
-        startIndex = COAP_PREFIX_LEN;
-    }
-    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;
-    }
-
-    // #2. copy uri for parse
-    int32_t len = strlen(uri) - startIndex;
-
-    if (len <= 0)
-    {
-        printf("uri length is 0!\n");
-        return;
-    }
-
-    char *cloneUri = (char *) calloc(len + 1, sizeof(char));
-    if (NULL == cloneUri)
-    {
-        printf("Out of memory\n");
-        return;
-    }
-
-    memcpy(cloneUri, &uri[startIndex], sizeof(char) * len);
-    cloneUri[len] = '\0';
-
-    char *pAddress = cloneUri;
-    printf("pAddress : %s\n", pAddress);
-
-    if (!get_address_set(pAddress, address))
-    {
-        printf("address parse error\n");
-    }
-
-    free(cloneUri);
-    return;
-}
-
-bool get_address_set(const char *pAddress, addressSet_t* outAddress)
-{
-    if (NULL == pAddress)
-    {
-        printf("parameter is null !\n");
-        return false;
-    }
-
-    size_t len = strlen(pAddress);
-    bool isIp = false;
-    size_t ipLen = 0;
-
-    for (size_t i = 0; i < len; i++)
-    {
-        if (pAddress[i] == '.')
-        {
-            isIp = true;
-        }
-
-        // found port number start index
-        if (isIp && pAddress[i] == ':')
-        {
-            ipLen = i;
-            break;
-        }
-    }
-
-    if (isIp)
-    {
-        if(ipLen && ipLen < sizeof(outAddress->ipAddress))
-        {
-            OICStrcpyPartial(outAddress->ipAddress, sizeof(outAddress->ipAddress),
-                             pAddress, ipLen);
-        }
-        else if (!ipLen && len < sizeof(outAddress->ipAddress))
-        {
-            OICStrcpyPartial(outAddress->ipAddress, sizeof(outAddress->ipAddress),
-                             pAddress, len);
-        }
-        else
-        {
-            printf("IP Address too long: %zu\n", (ipLen == 0) ? len : ipLen);
-            return false;
-        }
-
-        if (ipLen > 0)
-        {
-            outAddress->port = atoi(pAddress + ipLen + 1);
-        }
-        return true;
-    }
-
-    return false;
-}
-
-void create_file(CAPayload_t bytes, size_t length)
-{
-    FILE *fp = fopen("sample_output.txt", "wb");
-    if (fp)
-    {
-        fwrite(bytes, 1, length, fp);
-        fclose(fp);
-    }
-}
-
-bool read_file(const char* name, CAPayload_t* bytes, size_t* length)
-{
-    if (NULL == name)
-    {
-        printf("parameter is null\n");
-        return false;
-    }
-
-    FILE* file = NULL;
-    CAPayload_t buffer = NULL;
-    long fileLen = 0;
-
-    // Open file
-    file = fopen(name, "rb");
-    if (!file)
-    {
-        fprintf(stderr, "Unable to open file, %s\n", name);
-        return false;
-    }
-
-    // Get file length
-    fseek(file, 0, SEEK_END);
-    fileLen = ftell(file);
-    if (-1 == fileLen)
-    {
-        fprintf(stderr, "Failed to get file length\n");
-        fclose(file);
-        return false;
-    }
-    fseek(file, 0, SEEK_SET);
-
-    // Allocate memory
-    buffer = calloc(1, sizeof(uint8_t) * fileLen + 1);
-    if (!buffer)
-    {
-        fprintf(stderr, "Memory error\n");
-        fclose(file);
-        return false;
-    }
-
-    // Read file contents into buffer
-    size_t ret = fread(buffer, fileLen, 1, file);
-    if (ret != 1)
-    {
-        printf("Failed to read data from file, %s\n", name);
-        fclose(file);
-        free(buffer);
-        return false;
-    }
-
-    fclose(file);
-
-    *bytes = buffer;
-    *length = fileLen;
-
-    return true;
-}
diff --git a/resource/csdk/connectivity/samples/linux/threadpool/main.c b/resource/csdk/connectivity/samples/linux/threadpool/main.c
deleted file mode 100644 (file)
index 2e90d8c..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/******************************************************************
- *
- * Copyright 2014 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 <stdio.h>
-#include <stdlib.h>
-
-#include "cathreadpool.h"
-#include "camutex.h"
-
-ca_thread_pool_t g_threadPoolHandle = NULL;
-
-ca_mutex g_mutex = NULL;
-ca_cond g_cond = NULL;
-bool g_condFlag = false;
-
-void task(void *data)
-{
-    printf("[TASK] Task is executing: data: %s\n", (char *) data);
-
-    //Signal the condition that task has been completed
-    printf("[TASK] Signaling the condition\n");
-    ca_mutex_lock(g_mutex);
-    g_condFlag = true;
-    ca_cond_signal(g_cond);
-    ca_mutex_unlock(g_mutex);
-}
-
-void testThreadPool(void)
-{
-    char *string = "Test thread pool";
-
-    //Initialize the mutex
-    printf("[testThreadPool] Initializing mutex\n");
-
-    //Initialize the thread pool
-    printf("[testThreadPool] Initializing thread pool\n");
-    if (CA_STATUS_OK != ca_thread_pool_init(2, &g_threadPoolHandle))
-    {
-        printf("thread_pool_init failed!\n");
-        return;
-    }
-
-    //Create the mutex
-    printf("[testThreadPool] Creating mutex\n");
-    g_mutex = ca_mutex_new();
-    if (NULL == g_mutex)
-    {
-        printf("[testThreadPool] Failed to create mutex!\n");
-        ca_thread_pool_free(g_threadPoolHandle);
-        return;
-    }
-
-    //Create the condition
-    printf("[testThreadPool] Creating Condition\n");
-    g_cond = ca_cond_new();
-    if (NULL == g_cond)
-    {
-        printf("[testThreadPool] Failed to create condition!\n");
-        ca_mutex_free(g_mutex);
-        ca_thread_pool_free(g_threadPoolHandle);
-        return;
-    }
-
-    //Lock the mutex
-    printf("[testThreadPool] Locking the mutex\n");
-    ca_mutex_lock(g_mutex);
-
-    g_condFlag = false;
-    //Add task to thread pool
-    printf("[testThreadPool] Adding the task to thread pool\n");
-    if (CA_STATUS_OK != ca_thread_pool_add_task(g_threadPoolHandle, task, (void *) string))
-    {
-        printf("[testThreadPool] thread_pool_add_task failed!\n");
-        ca_thread_pool_free(g_threadPoolHandle);
-        ca_mutex_unlock(g_mutex);
-        ca_mutex_free(g_mutex);
-        ca_cond_free(g_cond);
-        return;
-    }
-
-    //Wait for the task to be executed
-    printf("[testThreadPool] Waiting for the task to be completed\n");
-
-    while (!g_condFlag)
-    {
-        ca_cond_wait(g_cond, g_mutex);
-    }
-
-    //Unlock the mutex
-    printf("[testThreadPool] Got the signal and unlock the mutex\n");
-    ca_mutex_unlock(g_mutex);
-
-    printf("[testThreadPool] Task is completed and terminating threadpool\n");
-    ca_cond_free(g_cond);
-    ca_mutex_free(g_mutex);
-    ca_thread_pool_free(g_threadPoolHandle);
-
-    printf("Exiting from testThreadPool\n");
-}
-
-static void menu()
-{
-    printf(" =====================================================================\n");
-    printf("|                 Welcome to Theadpool testing                        |\n");
-    printf("|---------------------------------------------------------------------|\n");
-    printf("|                           ** Options **                             |\n");
-    printf("|  1 - Test Threadpool functionality                                  |\n");
-    printf("|  0 - Terminate test                                                 |\n");
-}
-
-static void startTesting(void)
-{
-    while (1)
-    {
-        int choice = -1;
-        if(scanf("%d", &choice) == 1)
-        {
-            switch (choice)
-            {
-                case 0:
-                    printf("Terminating test.\n");
-                    return;
-                case 1:
-                    testThreadPool();
-                    break;
-                default:
-                    printf("Invalid input.\n");
-                    menu();
-                    break;
-            }
-        }
-        else
-        {
-            printf("Invalid input.\n");
-            menu();
-        }
-
-        // clear input buffer
-        while (getchar() != '\n');
-    }
-}
-
-int main()
-{
-    menu();
-    startTesting();
-    return 0;
-}
-
diff --git a/resource/csdk/connectivity/samples/tizen/README.txt b/resource/csdk/connectivity/samples/tizen/README.txt
deleted file mode 100644 (file)
index a5e4283..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-Procedure to Execute Sample App:
-================================
-    1) Copy the generated rpm(com-oic-ca-sample-0.1-1.armv7l.rpm) to Tizen Device
-       (say /opt/usr/media/xxx/)
-    2) sdb shell
-    3) su
-    4) cd  /opt/usr/media/xxx/
-
-    5) change-booting-mode.sh --update
-
-    6) Install casample(console app). It contains Interface API libs and OIC-CORE Libs
-        i) rpm -Uvh com-oic-ca-sample-0.1-1.armv7l.rpm --force --nodeps
-
-    7) RPM will be installed in "/usr/apps/"
-       Execute the sample app by below commands
-        i) cd /usr/apps/com.oic.ca.sample/bin
-        ii) ./ca_sample (for CA Sample)
-
-Apply smack rule[ONLY for WIFI]
-===============================
-
-    1) After installing the RPMs, apply the following smack rule
-        a) chsmack -a "net-config" /usr/apps/com.oic.ca.sample/bin/ca_sample
-        b) chsmack -e "net-config" /usr/apps/com.oic.ca.sample/bin/ca_sample
-
-    Note: EDR adapter will give permission issues if these rules are applied.
-          So to test EDR adapter, delete the "/usr/apps/com.oic.ca.sample" folder
-          and again install the RPMs.
-
-Install Dependent RPMS(Only for EDR Adapter Testing)
-====================================================
-
-    1) In su(super user) mode, install Bluetooth related RPMs present in
-    "connectivity/lib/tizen/edr/rpms" on Tizen v2.3 mobile device
-    (Currently only SM Z910F Device is supported).
-    2) Install the Sample as given above in "Procedure to Execute Sample App"
-
-Install Dependent RPMS(Only for BLE Adapter Testing)
-====================================================
-
-    1) Flash the system image present in connectivity/lib/tizen/ble/image/ folder on SM Z910F Tizen v2.3
-    2) In su(super user) mode, Install Bluetooth related rpms Present in connectivity/lib/tizen/ble/rpms on
-    Tizen v2.3 mobile device (Currently only SM Z910F Device is supported)
-    3) Install the Sample as given above in "Procedure to Execute Sample App" [ Till Step 6 ]
-    4) Open another sdb shell, in su (super user) mode follow the below steps:
-            (i)   cd /var/lib/bluetooth
-            (ii)  Turn off Bluetooth in the device
-            (iii) rm -rf *
-            (iv)  Run the command ./usr/lib/bluetooth/bluetoothd -ndE &. for OIC Server device and
-            run the command ./usr/lib/bluetooth/bluetoothd -nd &. for OIC Client device.
-            (v)   Turn on the Bluetooth.
-    5) Run the sample as given in Step 8 of "Procedure to Execute Sample App"
-
diff --git a/resource/csdk/connectivity/samples/tizen/SConscript b/resource/csdk/connectivity/samples/tizen/SConscript
deleted file mode 100644 (file)
index 8ec6194..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-##
-# This script includes generic build options:
-#    release/debug, target os, target arch, cross toolchain, build environment etc
-##
-import os
-import platform
-
-# Map of host os and allowed target os (host: allowed target os)
-host_target_map = {
-               'linux': ['linux', 'android', 'arduino', 'yocto', 'tizen'],
-               'windows': ['windows', 'winrt', 'android', 'arduino', 'tizen'],
-               'darwin': ['darwin', 'ios', 'android', 'arduino'],
-               }
-
-# Map of os and allowed archs (os: allowed archs)
-os_arch_map = {
-               'linux': ['x86', 'x86_64', 'arm', 'arm64'],
-               'android': ['x86', 'x86_64', 'armeabi', 'armeabi-v7a', 'armeabi-v7a-hard', 'arm64-v8a'],
-               'windows': ['x86', 'amd64', 'arm'],
-               'winrt': ['arm'],
-               'darwin': ['i386', 'x86_64'],
-               'ios': ['i386', 'x86_64', 'armv7', 'armv7s', 'arm64'],
-               'arduino': ['avr', 'arm'],
-                'yocto': ['x86', 'x86_64'],
-               'tizen': ['armv7'],
-               }
-
-host = platform.system().lower()
-
-if not host_target_map.has_key(host):
-       print "\nError: Current system (%s) isn't supported\n" % host
-       Exit(1)
-
-######################################################################
-# Get build options (the optins from command line)
-######################################################################
-target_os = ARGUMENTS.get('TARGET_OS', host).lower() # target os
-
-if target_os not in host_target_map[host]:
-       print "\nError: Unknown target os: %s (Allow values: %s)\n" % (target_os, host_target_map[host])
-       Exit(1)
-
-default_arch = platform.machine()
-if default_arch not in os_arch_map[target_os]:
-       default_arch = os_arch_map[target_os][0].lower()
-
-target_arch = ARGUMENTS.get('TARGET_ARCH', default_arch) # target arch
-
-######################################################################
-# Common build options (release, target os, target arch)
-######################################################################
-help_vars = Variables()
-help_vars.Add(BoolVariable('RELEASE', 'Build for release?', True)) # set to 'no', 'false' or 0 for debug
-help_vars.Add(EnumVariable('TARGET_OS', 'Target platform', host, host_target_map[host]))
-help_vars.Add(ListVariable('TARGET_TRANSPORT', 'Target transport', 'ALL', ['ALL', 'IP', 'BT', 'BLE']))
-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')))
-
-
-AddOption('--prefix',
-                  dest='prefix',
-                  type='string',
-                  nargs=1,
-                  action='store',
-                  metavar='DIR',
-                  help='installation prefix')
-
-######################################################################
-# Platform(build target) specific options: SDK/NDK & toolchain
-######################################################################
-targets_support_cc = ['linux', 'arduino', 'tizen']
-
-if target_os in targets_support_cc:
-       # Set cross compile toolchain
-       help_vars.Add('TC_PREFIX', "Toolchain prefix (Generally only be required for cross-compiling)", os.environ.get('TC_PREFIX'))
-       help_vars.Add(PathVariable('TC_PATH',
-                       'Toolchain path (Generally only be required for cross-compiling)',
-                       os.environ.get('TC_PATH')))
-
-if target_os in ['android', 'arduino']: # Android/Arduino always uses GNU compiler regardless of the host
-       env = Environment(variables = help_vars,
-                       tools = ['gnulink', 'gcc', 'g++', 'ar', 'as']
-                       )
-else:
-       env = Environment(variables = help_vars, TARGET_ARCH = target_arch, TARGET_OS = target_os, PREFIX = GetOption('prefix'))
-
-Help(help_vars.GenerateHelpText(env))
-
-tc_set_msg = '''
-************************************ Warning **********************************
-*   Enviornment variable TC_PREFIX/TC_PATH is set. It will change the default *
-* toolchain, if it isn't what you expect you should unset it, otherwise it may*
-* cause inexplicable errors.                                                  *
-*******************************************************************************
-'''
-
-if target_os in targets_support_cc:
-       prefix = env.get('TC_PREFIX')
-       tc_path = env.get('TC_PATH')
-       if prefix:
-               env.Replace(CC = prefix + 'gcc')
-               env.Replace(CXX = prefix + 'g++')
-               env.Replace(AR = prefix + 'ar')
-               env.Replace(AS = prefix + 'as')
-               env.Replace(LINK = prefix + 'ld')
-               env.Replace(RANLIB = prefix + 'ranlib')
-
-       if tc_path:
-               env.PrependENVPath('PATH', tc_path)
-               sys_root = os.path.abspath(tc_path + '/../')
-               env.AppendUnique(CCFLAGS = ['--sysroot=' + sys_root])
-               env.AppendUnique(LINKFLAGS = ['--sysroot=' + sys_root])
-
-       if prefix or tc_path:
-               print tc_set_msg
-
-# Ensure scons be able to change its working directory
-env.SConscriptChdir(1)
-
-# Set the source directory and build directory
-#   Source directory: 'dir'
-#   Build directory: 'dir'/out/<target_os>/<target_arch>/<release or debug>/
-#
-# You can get the directory as following:
-#   env.get('SRC_DIR')
-#   env.get('BUILD_DIR')
-
-def __set_dir(env, dir):
-       if not os.path.exists(dir + '/SConstruct'):
-               print '''
-*************************************** Error *********************************
-* The directory(%s) seems isn't a source code directory, no SConstruct file is
-* found. *
-*******************************************************************************
-''' % dir
-               Exit(1)
-
-       if env.get('RELEASE'):
-               build_dir = dir + '/out/' + target_os + '/' + target_arch + '/release/'
-       else:
-               build_dir = dir + '/out/' + target_os + '/' + target_arch + '/debug/'
-       env.VariantDir(build_dir, dir, duplicate=0)
-
-       env.Replace(BUILD_DIR = build_dir)
-       env.Replace(SRC_DIR = dir)
-
-def __src_to_obj(env, src, home = ''):
-       obj = env.get('BUILD_DIR') + src.replace(home, '')
-       if env.get('OBJSUFFIX'):
-               obj += env.get('OBJSUFFIX')
-       return env.Object(obj, src)
-
-def __install(ienv, targets, name):
-       i_n = ienv.Install(env.get('BUILD_DIR'), targets)
-       Alias(name, i_n)
-       env.AppendUnique(TS = [name])
-
-def __append_target(ienv, target):
-       env.AppendUnique(TS = [target])
-
-def __installlib(ienv, targets, name):
-       user_prefix = env.get('PREFIX')
-       if user_prefix:
-               i_n = ienv.Install(user_prefix + '/lib', targets)
-               ienv.Alias("install", i_n)
-
-def __installbin(ienv, targets, name):
-       user_prefix = env.get('PREFIX')
-       if user_prefix:
-               i_n = ienv.Install(user_prefix + '/bin', targets)
-               ienv.Alias("install", i_n)
-
-def __print_targets(env):
-       Help('''
-===============================================================================
-Targets:\n    ''')
-       for t in env.get('TS'):
-               Help(t + ' ')
-       Help('''
-\nDefault all targets will be built. You can specify the target to build:
-
-    $ scons [options] [target]
-===============================================================================
-''')
-
-env.AddMethod(__set_dir, 'SetDir')
-env.AddMethod(__print_targets, 'PrintTargets')
-env.AddMethod(__src_to_obj, 'SrcToObj')
-env.AddMethod(__append_target, 'AppendTarget')
-env.AddMethod(__install, 'InstallTarget')
-env.AddMethod(__installlib, 'UserInstallTargetLib')
-env.AddMethod(__installbin, 'UserInstallTargetBin')
-env.SetDir(env.GetLaunchDir())
-env['ROOT_DIR']=env.GetLaunchDir()
-
-Export('env')
-
-######################################################################
-# Link scons to Yocto cross-toolchain ONLY when target_os is yocto
-######################################################################
-if target_os == "yocto":
-    '''
-    This code injects Yocto cross-compilation tools+flags into scons'
-    build environment in order to invoke the relevant tools while
-    performing a build.
-    '''
-    import os.path
-    try:
-        CC = os.environ['CC']
-        target_prefix = CC.split()[0]
-        target_prefix = target_prefix[:len(target_prefix)-3]
-        tools = {"CC" : target_prefix+"gcc",
-                "CXX" : target_prefix+"g++",
-                "AS" : target_prefix+"as",
-                "LD" : target_prefix+"ld",
-                "GDB" : target_prefix+"gdb",
-                "STRIP" : target_prefix+"strip",
-                "RANLIB" : target_prefix+"ranlib",
-                "OBJCOPY" : target_prefix+"objcopy",
-                "OBJDUMP" : target_prefix+"objdump",
-                "AR" : target_prefix+"ar",
-                "NM" : target_prefix+"nm",
-                "M4" : "m4",
-                "STRINGS": target_prefix+"strings"}
-        PATH = os.environ['PATH'].split(os.pathsep)
-        for tool in tools:
-            if tool in os.environ:
-                for path in PATH:
-                    if os.path.isfile(os.path.join(path, tools[tool])):
-                        env[tool] = os.path.join(path, os.environ[tool])
-                        break
-    except:
-        print "ERROR in Yocto cross-toolchain environment"
-        Exit(1)
-    '''
-    Now reset TARGET_OS to linux so that all linux specific build configurations
-    hereupon apply for the entirety of the build process.
-    '''
-    env['TARGET_OS'] = 'linux'
-    '''
-    We want to preserve debug symbols to allow BitBake to generate both DEBUG and
-    RELEASE packages for OIC.
-    '''
-    env['CCFLAGS'].append('-g')
-    Export('env')
-else:
-    '''
-    If target_os is not Yocto, continue with the regular build process
-    '''
-    # Load config of target os
-    env.SConscript(target_os + '/SConscript')
-
-# Delete the temp files of configuration
-if env.GetOption('clean'):
-       dir = env.get('SRC_DIR')
-
-       if os.path.exists(dir + '/config.log'):
-               Execute(Delete(dir + '/config.log'))
-               Execute(Delete(dir + '/.sconsign.dblite'))
-               Execute(Delete(dir + '/.sconf_temp'))
-
-Return('env')
-
diff --git a/resource/csdk/connectivity/samples/tizen/SConstruct b/resource/csdk/connectivity/samples/tizen/SConstruct
deleted file mode 100644 (file)
index bc860fb..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-##
-# The main build script
-#
-##
-
-# Load common build config
-# Load common build config
-SConscript('SConscript')
-
-Import('env')
-
-target_os = env.get('TARGET_OS')
-transport = env.get('TARGET_TRANSPORT')
-
-print "Given Transport is %s" % transport
-print "Given OS is %s" % target_os
-print "Secured %s" % env.get('SECURED')
-
-if target_os == 'tizen':
-        SConscript('scons/SConscript')
-else:
-       print "Given platform is not supported"
-
diff --git a/resource/csdk/connectivity/samples/tizen/casample.c b/resource/csdk/connectivity/samples/tizen/casample.c
deleted file mode 100644 (file)
index 2d2a594..0000000
+++ /dev/null
@@ -1,1455 +0,0 @@
-/******************************************************************
- *
- * Copyright 2014 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 <glib.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <pthread.h>
-#include "cacommon.h"
-#include "cainterface.h"
-
-/**
- * @def MAX_BUF_LEN
- * @brief maximum buffer length
- */
-#define MAX_BUF_LEN 1024
-
-/**
- * @def MAX_OPT_LEN
- * @brief maximum option length
- */
-#define MAX_OPT_LEN 16
-
-/**
- * @def PORT_LENGTH
- * @brief maximum port length
- */
-#define PORT_LENGTH 5
-
-/**
- * @def SECURE_DEFAULT_PORT
- * @brief default secured port
- */
-#define SECURE_DEFAULT_PORT 5684
-
-#define RESOURCE_URI_LENGTH 14
-
-#define COAP_PREFIX          "coap://"
-#define COAP_PREFIX_LEN      7
-#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");
-
-// PSK between this device and peer device.
-const unsigned char RS_CLIENT_PSK[] = ("AAAAAAAAAAAAAAAA");
-
-/**
- * Max size for big payload.
- */
-#define BIG_PAYLOAD_SIZE 15000
-
-static GMainLoop *g_mainloop = NULL;
-pthread_t thread;
-
-int g_received;
-uint16_t g_local_secure_port = SECURE_DEFAULT_PORT;
-CATransportAdapter_t g_selected_nw_type = CA_ADAPTER_IP;
-const char *MESSAGE_TYPE[] = {"CON", "NON", "ACK", "RESET"};
-
-typedef struct
-{
-    char ipAddress[CA_IPADDR_SIZE];
-    uint16_t port;
-} addressSet_t;
-
-char get_menu();
-void process();
-CAResult_t get_network_type();
-CAResult_t get_input_data(char *buf, int32_t length);
-
-bool select_payload();
-void populate_binary_payload(uint8_t *bigBuffer, size_t bigBufferLen);
-
-void start_listening_server();
-void start_discovery_server();
-void send_request();
-void send_request_all();
-void send_notification();
-void select_network();
-void unselect_network();
-void handle_request_response();
-void get_network_info();
-void send_secure_request();
-
-void request_handler(const CAEndpoint_t *object, const CARequestInfo_t *requestInfo);
-void response_handler(const CAEndpoint_t *object, const CAResponseInfo_t *responseInfo);
-void error_handler(const CAEndpoint_t *object, const CAErrorInfo_t* errorInfo);
-void send_response(const CAEndpoint_t *endpoint, const CAInfo_t *info);
-void get_resource_uri(char *URI, char *resourceURI, int length);
-int get_secure_information(CAPayload_t payLoad);
-int get_address_set(const char *uri, addressSet_t* outAddress);
-void parse_coap_uri(const char* uri, addressSet_t* address, CATransportFlags_t *flags);
-
-static CAToken_t g_last_request_token = NULL;
-static const char SECURE_COAPS_PREFIX[] = "coaps://";
-static const char SECURE_INFO_DATA[] =
-    "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
-    "\"if\":[\"oic.if.baseline\"],\"obs\":1,\"sec\":1,\"port\":%d}}]}";
-static const char NORMAL_INFO_DATA[] =
-    "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
-    "\"if\":[\"oic.if.baseline\"],\"obs\":1}}]}";
-
-#ifdef __WITH_DTLS__
-// Internal API. Invoked by CA stack to retrieve credentials from this module.
-int32_t CAGetDtlsPskCredentials( CADtlsPskCredType_t type,
-              const unsigned char *desc, size_t desc_len,
-              unsigned char *result, size_t result_length)
-{
-    printf("CAGetDtlsPskCredentials IN\n");
-
-    int32_t ret = -1;
-
-    if (NULL == result)
-    {
-        return ret;
-    }
-
-    switch (type)
-    {
-        case CA_DTLS_PSK_HINT:
-        case CA_DTLS_PSK_IDENTITY:
-
-            if (result_length < sizeof(IDENTITY))
-            {
-                printf("ERROR : Wrong value for result for storing IDENTITY");
-                return ret;
-            }
-
-            memcpy(result, IDENTITY, sizeof(IDENTITY));
-            ret = sizeof(IDENTITY);
-            break;
-
-        case CA_DTLS_PSK_KEY:
-
-            if ((desc_len == sizeof(IDENTITY)) &&
-                memcmp(desc, IDENTITY, sizeof(IDENTITY)) == 0)
-            {
-                if (result_length < sizeof(RS_CLIENT_PSK))
-                {
-                    printf("ERROR : Wrong value for result for storing RS_CLIENT_PSK");
-                    return ret;
-                }
-
-                memcpy(result, RS_CLIENT_PSK, sizeof(RS_CLIENT_PSK));
-                ret = sizeof(RS_CLIENT_PSK);
-            }
-            break;
-
-        default:
-
-            printf("Wrong value passed for PSK_CRED_TYPE.");
-            ret = -1;
-    }
-
-    printf("CAGetDtlsPskCredentials OUT\n");
-    return ret;
-}
-#endif
-
-void GMainLoopThread()
-{
-    g_main_loop_run(g_mainloop);
-}
-
-CAResult_t Initialize()
-{
-    g_mainloop = g_main_loop_new(NULL, FALSE);
-    if(!g_mainloop)
-    {
-        printf("g_main_loop_new failed\n");
-        return CA_STATUS_FAILED;
-    }
-
-    int result = pthread_create(&thread, NULL, (void *) &GMainLoopThread, NULL);
-    if (result < 0)
-    {
-        printf("pthread_create failed in initialize\n");
-        return CA_STATUS_FAILED;
-    }
-
-    CAResult_t res = CAInitialize();
-    if (res != CA_STATUS_OK)
-    {
-        printf("CAInitialize fail\n");
-    }
-    return res;
-}
-
-int main()
-{
-    int ret = system("clear");
-    // shell invoke error: 127, others: -1
-    if (127 == ret || -1 == ret)
-    {
-        printf("Terminal Clear Error: %d\n", ret);
-    }
-
-    printf("=============================================\n");
-    printf("\t\tsample main\n");
-    printf("=============================================\n");
-
-    CAResult_t res = Initialize();
-    if (CA_STATUS_OK != res)
-    {
-        printf("Initialization is  failed\n");
-        return -1;
-    }
-
-    // Set the PSK Credentials callback handler.
-#ifdef __WITH_DTLS__
-    res = CARegisterDTLSCredentialsHandler(CAGetDtlsPskCredentials);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Set credential handler fail\n");
-        return -1;
-    }
-#endif
-
-    // set handler.
-    CARegisterHandler(request_handler, response_handler, error_handler);
-
-    process();
-
-    CADestroyToken(g_last_request_token);
-
-    CATerminate();
-    return 0;
-}
-
-void process()
-{
-    while (1)
-    {
-        char menu = get_menu();
-
-        switch (menu)
-        {
-            case 'm': // menu
-            case 'M':
-                break;
-
-            case 'q': // quit
-            case 'Q':
-                printf("quit..!!\n");
-                return;
-
-            case 's': // start server
-            case 'S':
-                start_listening_server();
-                break;
-
-            case 't': // send request
-            case 'T':
-                send_request_all();
-                break;
-
-            case 'c': // start client
-            case 'C':
-                start_discovery_server();
-                break;
-
-            case 'r': // send request
-            case 'R':
-                send_request();
-                break;
-
-            case 'b': // send notification
-            case 'B':
-                send_notification();
-                break;
-
-            case 'n': // select network
-            case 'N':
-                select_network();
-                break;
-
-            case 'x': // unselect network
-            case 'X':
-                unselect_network();
-                break;
-
-            case 'h': // handle request response
-            case 'H':
-                handle_request_response();
-                break;
-
-            case 'w':
-            case 'W':
-                g_received = 0;
-                start_discovery_server();
-                send_secure_request();
-                while (g_received == 0)
-                {
-                    sleep(1);
-                    handle_request_response();
-                }
-                break;
-
-            case 'z':
-            case 'Z':
-                start_listening_server();
-                while (1)
-                {
-                    sleep(1);
-                    handle_request_response();
-                }
-                break;
-
-            case 'g': // get network information
-            case 'G':
-                get_network_info();
-                break;
-
-            default:
-                printf("Not supported menu!!\n");
-                break;
-        }
-    }
-
-}
-
-void start_listening_server()
-{
-    printf("Start listening server!!\n");
-
-    CAResult_t res = CAStartListeningServer();
-    if (CA_STATUS_OK != res)
-    {
-        printf("Start listening server fail, error code : %d\n", res);
-    }
-    else
-    {
-        printf("Start listening server success\n");
-    }
-}
-
-void start_discovery_server()
-{
-    printf("Start discovery client!!\n");
-
-    CAResult_t res = CAStartDiscoveryServer();
-    if (CA_STATUS_OK != res)
-    {
-        printf("Start discovery client fail, error code : %d\n", res);
-    }
-    else
-    {
-        printf("Start discovery client success\n");
-    }
-}
-
-bool select_payload()
-{
-    char buf[MAX_BUF_LEN]={0};
-    printf("\n=============================================\n");
-    printf("0:Normal Payload\n1:Big Payload(~15KB)\n");
-    printf("select Payload type : ");
-
-    CAResult_t res = get_input_data(buf, sizeof(buf));
-    if (CA_STATUS_OK != res)
-    {
-        printf("Payload type selection error\n");
-        printf("Default: Using normal Payload\n");
-        return false;
-    }
-
-    return (buf[0] == '1') ? true : false;
-}
-
-void populate_binary_payload(uint8_t *bigBuffer, size_t bigBufferLen)
-{
-/**
- * bigBuffer to be filled with binary data. For our sample application to verify, we may fill with
- * any arbitrary value. Hence filling with '1' here.
- */
-    memset(bigBuffer, '1', bigBufferLen-1);
-    //Last byte making NULL
-    bigBuffer[bigBufferLen-1] = '\0';
-}
-
-void send_request()
-{
-    CAResult_t res = get_network_type();
-    if (CA_STATUS_OK != res)
-    {
-        return;
-    }
-
-    printf("Do you want to send secure request ?.... enter (0/1): ");
-
-    char secureRequest[MAX_BUF_LEN] = {0};
-    if (CA_STATUS_OK != get_input_data(secureRequest, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    if (strcmp(secureRequest, "1") == 0)
-    {
-        printf("Enter the URI like below....\n");
-        printf("coaps://10.11.12.13:4545/resource_uri ( for IP secure)\n");
-    }
-    else if (strcmp(secureRequest, "0") == 0)
-    {
-        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("Input data is wrong value\n");
-        return;
-    }
-
-    char uri[MAX_BUF_LEN] = {'\0'};
-    if (CA_STATUS_OK != get_input_data(uri, MAX_BUF_LEN))
-    {
-        return;
-    }
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    CATransportFlags_t flags;
-
-    printf("URI : %s\n", uri);
-    addressSet_t address = {};
-    parse_coap_uri(uri, &address, &flags);
-
-    res = CACreateEndpoint(flags, g_selected_nw_type,
-                           (const char*)address.ipAddress, address.port, &endpoint);
-    if (CA_STATUS_OK != res || !endpoint)
-    {
-        printf("Failed to create remote endpoint, error code : %d\n", res);
-        return;
-    }
-
-    printf("\n=============================================\n");
-    printf("0:CON, 1:NON\n");
-    printf("select message type : ");
-
-    char buf[MAX_BUF_LEN] = { 0 };
-    if (CA_STATUS_OK != get_input_data(buf, MAX_BUF_LEN))
-    {
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    CAMessageType_t msgType = (buf[0] == '1') ? 1 : 0;
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if ((CA_STATUS_OK != res) || (!token))
-    {
-        printf("Token generate error, error code : %d\n", res);
-        CADestroyEndpoint(endpoint);
-        return;
-    }
-
-    printf("Generated token %s\n", token);
-
-    // extract relative resourceuri from give uri
-    char resourceURI[RESOURCE_URI_LENGTH + 1] = {0};
-    get_resource_uri(uri, resourceURI, RESOURCE_URI_LENGTH);
-    printf("resourceURI : %s\n", resourceURI);
-
-    // create request data
-    CAInfo_t requestData = { 0 };
-    requestData.token = token;
-    requestData.tokenLength = tokenLength;
-    requestData.resourceUri = (CAURI_t)resourceURI;
-
-    if (strcmp(secureRequest, "1") == 0)
-    {
-        size_t length = sizeof(SECURE_INFO_DATA) + strlen(resourceURI);
-        requestData.payload = (CAPayload_t) calloc(length,  sizeof(char));
-        if (NULL == requestData.payload)
-        {
-            printf("Memory allocation fail\n");
-            CADestroyEndpoint(endpoint);
-            CADestroyToken(token);
-            return;
-        }
-        snprintf((char *) requestData.payload, length, SECURE_INFO_DATA,
-                 (const char *) resourceURI, g_local_secure_port);
-    }
-    else
-    {
-        bool useBigPayload = select_payload();
-        if (useBigPayload)
-        {
-            requestData.payload = (CAPayload_t) calloc(BIG_PAYLOAD_SIZE, sizeof(char));
-            if (NULL == requestData.payload)
-            {
-                printf("Memory allocation fail\n");
-                CADestroyEndpoint(endpoint);
-                CADestroyToken(token);
-                return;
-            }
-            populate_binary_payload(requestData.payload, BIG_PAYLOAD_SIZE);
-        }
-        else
-        {
-            size_t length = sizeof(NORMAL_INFO_DATA) + strlen(resourceURI);
-            requestData.payload = (CAPayload_t) calloc(length, sizeof(char));
-            if (NULL == requestData.payload)
-            {
-                printf("Memory allocation fail\n");
-                CADestroyEndpoint(endpoint);
-                CADestroyToken(token);
-                return;
-            }
-            snprintf((char *) requestData.payload, length, NORMAL_INFO_DATA,
-                     (const char *) resourceURI);
-        }
-    }
-    requestData.payloadSize = strlen((char *)requestData.payload)+1;
-    requestData.type = msgType;
-
-    CARequestInfo_t requestInfo = { 0 };
-    requestInfo.method = CA_GET;
-    requestInfo.info = requestData;
-    requestInfo.isMulticast = false;
-
-    // send request
-    res = CASendRequest(endpoint, &requestInfo);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Could not send request : %d\n", res);
-    }
-
-    //destroy token
-    CADestroyToken(token);
-    // destroy remote endpoint
-    CADestroyEndpoint(endpoint);
-    free(requestData.payload);
-
-
-    printf("=============================================\n");
-}
-
-void send_secure_request()
-{
-    char ipv4addr[CA_IPADDR_SIZE];
-
-    printf("\n=============================================\n");
-    printf("Enter IPv4 address of the source hosting secure resource (Ex: 11.12.13.14)\n");
-
-    if (CA_STATUS_OK != get_input_data(ipv4addr, CA_IPADDR_SIZE))
-    {
-        return;
-    }
-    printf("%s%s:5684/a/light", SECURE_COAPS_PREFIX, ipv4addr);
-
-    // create remote endpoint
-    CAEndpoint_t *endpoint = NULL;
-    CAResult_t res = CACreateEndpoint(0, CA_ADAPTER_IP, ipv4addr, SECURE_DEFAULT_PORT, &endpoint);
-    if (CA_STATUS_OK != res)
-    {
-        printf("Failed to create remote endpoint, error code: %d\n", res);
-        goto exit;
-    }
-
-    // create token
-    CAToken_t token = NULL;
-    uint8_t tokenLength = CA_MAX_TOKEN_LEN;
-
-    res = CAGenerateToken(&token, tokenLength);
-    if ((CA_STATUS_OK != res) || (!token))
-    {
-        printf("Token generate error, error code : %d\n", res);
-        goto exit;
-    }
-
-    printf("Generated token&nb