--- /dev/null
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "20.0.0"
+
+ defaultConfig {
+ applicationId "org.iotivity.base.examples.cloudprovisioningclient"
+ minSdkVersion 21
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+ lintOptions {
+ abortOnError false
+ }
+}
+repositories {
+ flatDir {
+ dirs "../../android_api/base/build/outputs/aar/"
+ }
+}
+
+try {
+ dependencies {
+ compile ":iotivity-base-${TARGET_ARCH}-${RELEASE}@aar"
+ }
+} catch (all) {
+ print "${ERROR_MSG}"
+ assert all
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.id=":cloudprovisioningclient" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="examples" 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=":cloudprovisioningclient" />
+ </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="COMPILE_JAVA_TEST_TASK_NAME" value="compileDebugAndroidTestSources" />
+ <afterSyncTasks>
+ <task>generateDebugAndroidTestSources</task>
+ <task>generateDebugSources</task>
+ </afterSyncTasks>
+ <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" LANGUAGE_LEVEL="JDK_1_7" 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/resValues/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/resValues/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/reports" />
+ <excludeFolder url="file://$MODULE_DIR$/build/test-results" />
+ <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="iotivity-base-armeabi-release-" level="project" />
+ <orderEntry type="library" exported="" name="android-android-21" level="project" />
+ </component>
+</module>
--- /dev/null
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/sandeep/iot/android-sdk/android-sdk-linux/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.iotivity.base.examples.cloudprovisioningclient" >
+
+ <application
+ android:allowBackup="true"
+ android:icon="@mipmap/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/AppTheme" >
+ <activity
+ android:name="org.iotivity.base.examples.cloudprovisioningclient.CloudProvisioningClient"
+ android:label="@string/app_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name="org.iotivity.base.examples.cloudprovisioningclient.LoginActivity" />
+ </application>
+
+</manifest>
--- /dev/null
+{\r
+ "acl": {\r
+ "aclist": {\r
+ "aces": [\r
+ {\r
+ "subjectuuid": "*",\r
+ "resources": [\r
+ {\r
+ "href": "/oic/res",\r
+ "rel": "",\r
+ "rt": ["oic.wk.res"],\r
+ "if": ["oic.if.ll"]\r
+ },\r
+ {\r
+ "href": "/oic/d",\r
+ "rel": "",\r
+ "rt": ["oic.wk.d"],\r
+ "if": ["oic.if.baseline", "oic.if.r"]\r
+ },\r
+ {\r
+ "href": "/oic/p",\r
+ "rel": "",\r
+ "rt": ["oic.wk.p"],\r
+ "if": ["oic.if.baseline", "oic.if.r"]\r
+ },\r
+ {\r
+ "href": "/oic/ad",\r
+ "rel": "",\r
+ "rt": ["oic.wk.ad"],\r
+ "if": ["oic.if.baseline"]\r
+ },\r
+ {\r
+ "href": "/oic/sec/amacl",\r
+ "rel": "",\r
+ "rt": ["oic.r.amacl"],\r
+ "if": ["oic.if.baseline"]\r
+ }\r
+ ],\r
+ "permission": 2\r
+ },\r
+ {\r
+ "subjectuuid": "*",\r
+ "resources": [\r
+ {\r
+ "href": "/oic/sec/doxm",\r
+ "rel": "",\r
+ "rt": ["oic.r.doxm"],\r
+ "if": ["oic.if.baseline"]\r
+ },\r
+ {\r
+ "href": "/oic/sec/pstat",\r
+ "rel": "",\r
+ "rt": ["oic.r.pstat"],\r
+ "if": ["oic.if.baseline"]\r
+ }\r
+ ],\r
+ "permission": 2\r
+ }\r
+ ]\r
+ },\r
+ "rowneruuid" : "61646D69-6E44-6576-6963-655575696430"\r
+ },\r
+ "pstat": {\r
+ "isop": true,\r
+ "cm": 2,\r
+ "tm": 0,\r
+ "om": 3,\r
+ "sm": 3,\r
+ "deviceuuid": "61646D69-6E44-6576-6963-655575696430",\r
+ "rowneruuid": "61646D69-6E44-6576-6963-655575696430"\r
+ },\r
+ "doxm": {\r
+ "oxms": [0],\r
+ "oxmsel": 0,\r
+ "sct": 1,\r
+ "owned": true,\r
+ "deviceuuid": "61646D69-6E44-6576-6963-655575696430",\r
+ "x.org.iotivity.dpc": false,\r
+ "devowneruuid": "61646D69-6E44-6576-6963-655575696430",\r
+ "rowneruuid": "61646D69-6E44-6576-6963-655575696430"\r
+ }\r
+}\r
--- /dev/null
+/*
+ * ******************************************************************
+ *
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
+ *
+ * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ */
+package org.iotivity.base.examples.cloudprovisioningclient;
+
+import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.os.Message;
+import android.preference.PreferenceManager;
+import android.util.Log;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import org.iotivity.base.ErrorCode;
+import org.iotivity.base.ModeType;
+import org.iotivity.base.OcAccountManager;
+import org.iotivity.base.OcCloudProvisioning;
+import org.iotivity.base.OcConnectivityType;
+import org.iotivity.base.OcException;
+import org.iotivity.base.OcHeaderOption;
+import org.iotivity.base.OcPlatform;
+import org.iotivity.base.OcProvisioning;
+import org.iotivity.base.OcRepresentation;
+import org.iotivity.base.PlatformConfig;
+import org.iotivity.base.QualityOfService;
+import org.iotivity.base.ServiceType;
+import org.iotivity.base.examples.cloudprovisioningclient.R;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
+public class CloudProvisioningClient extends Activity implements OcAccountManager.OnPostListener {
+
+ private static final String TAG = "Cloud Provisioning Client: ";
+ OcAccountManager.OnPostListener onSignUp = new OcAccountManager.OnPostListener() {
+ @Override
+ public synchronized void onPostCompleted(List<OcHeaderOption> list,
+ OcRepresentation ocRepresentation) {
+ logMessage("signUp was successful");
+ try {
+ String mUserUuid = ocRepresentation.getValue("uid");
+ String mAccesstoken = ocRepresentation.getValue("accesstoken");
+
+ String mRefreshtoken = ocRepresentation.getValue("refreshtoken");
+ String tokenType = ocRepresentation.getValue("tokentype");
+
+ SharedPreferences.Editor editor = settingPreference.edit();
+ editor.putString("useruuid", mUserUuid);
+ editor.putString("accesstoken", mAccesstoken);
+ editor.commit();
+
+ logMessage("\tuserID: " + mUserUuid);
+ logMessage("\taccessToken: " + mAccesstoken);
+ logMessage("\trefreshToken: " + mRefreshtoken);
+ logMessage("\ttokenType: " + tokenType);
+
+ if (ocRepresentation.hasAttribute("expiresin")) {
+ int expiresIn = ocRepresentation.getValue("expiresin");
+ logMessage("\texpiresIn: " + expiresIn);
+ }
+
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ signupLyt.setVisibility(View.GONE);
+ signinLyt.setVisibility(View.VISIBLE);
+ }
+ });
+
+
+ } catch (OcException e) {
+ Log.e(TAG, e.toString());
+ }
+ }
+
+
+ @Override
+ public synchronized void onPostFailed(Throwable throwable) {
+ logMessage("Failed to signUp");
+ if (throwable instanceof OcException) {
+ OcException ocEx = (OcException) throwable;
+ Log.e(TAG, ocEx.toString());
+ ErrorCode errCode = ocEx.getErrorCode();
+ logMessage("Error code: " + errCode);
+ }
+ }
+ };
+ OcAccountManager.OnPostListener onSignIn = new OcAccountManager.OnPostListener() {
+ @Override
+ public synchronized void onPostCompleted(List<OcHeaderOption> list,
+ OcRepresentation ocRepresentation) {
+ logMessage("signIn was successful");
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ signinLyt.setVisibility(View.GONE);
+ userid.setText(settingPreference.getString("useruuid", ""));
+ lyt1.setVisibility(View.VISIBLE);
+ lyt2.setVisibility(View.VISIBLE);
+ }
+ });
+
+
+ }
+
+ @Override
+ public synchronized void onPostFailed(Throwable throwable) {
+ logMessage("Failed to signIn");
+ if (throwable instanceof OcException) {
+ OcException ocEx = (OcException) throwable;
+ Log.e(TAG, ocEx.toString());
+ ErrorCode errCode = ocEx.getErrorCode();
+ logMessage("Error code: " + errCode);
+ }
+ }
+ };
+ OcCloudProvisioning.GetIndividualAclInfoListener getIndividualAclInfoListener =
+ new OcCloudProvisioning.GetIndividualAclInfoListener() {
+ @Override
+ public void getIndividualAclInfoListener(boolean result) {
+ Log.d(TAG, "Inside getIndividualAclInfoListener ");
+ if (!result) {
+ logMessage("Individual ACL Info Successfull !!");
+ } else {
+ logMessage("Error: Individual ACL Info failed !!");
+ }
+ }
+ };
+ OcCloudProvisioning.RequestCertificateListener requestCertificateListener =
+ new OcCloudProvisioning.RequestCertificateListener() {
+ @Override
+ public void requestCertificateListener(boolean result) {
+ Log.d(TAG, "Inside requestCertificateListener ");
+ if (!result) {
+ logMessage("Request certificate Successfull !!");
+ } else {
+ logMessage("Error: Request certificate failed !!");
+ }
+ }
+ };
+ OcCloudProvisioning.GetCRLListener getCRLListener =
+ new OcCloudProvisioning.GetCRLListener() {
+ @Override
+ public void getCRLListener(boolean result) {
+ Log.d(TAG, "Inside getCRLListener ");
+ if (!result) {
+ logMessage("Get CRL Successfull !!");
+ } else {
+ logMessage("Error: Get CRL failed !!");
+ }
+ }
+ };
+ OcCloudProvisioning.PostCRLListener postCRLListener =
+ new OcCloudProvisioning.PostCRLListener() {
+ @Override
+ public void postCRLListener(boolean result) {
+ Log.d(TAG, "Inside postCRLListener ");
+ if (!result) {
+ logMessage("Post CRL Successfull !!");
+ } else {
+ logMessage("Error: Post CRL failed !!");
+ }
+ }
+ };
+ private static final int BUFFER_SIZE = 1024;
+ private final int REQUEST_LOGIN = 1;
+ Button signUp, signIn, signOut, getAclId, getAclInfo, requestCert, postCrl, getCrl;
+ TextView userid;
+ LinearLayout lyt1, lyt2, signupLyt, signinLyt;
+ // private TextView eventView;
+ SharedPreferences settingPreference;
+ OcCloudProvisioning ocCloudProvisioning;
+ String acl_Id;
+ OcCloudProvisioning.GetAclIdByDeviceListener getAclIdByDeviceListener =
+ new OcCloudProvisioning.GetAclIdByDeviceListener() {
+ @Override
+ public void getAclIdByDeviceListener(boolean result, String aclId) {
+ Log.d(TAG, "Inside getAclIdByDeviceListener ");
+ if (!result) {
+ acl_Id = aclId;
+ logMessage("Acl Id by device !!" + acl_Id);
+ } else {
+ logMessage("Error: Acl Id by device failed !!");
+ }
+ }
+ };
+ private OcAccountManager mAccountManager;
+ private String filePath = "";
+ private TextView mEventsTextView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main_activity);
+
+ signUp = (Button) findViewById(R.id.signup);
+ signIn = (Button) findViewById(R.id.signin);
+ signOut = (Button) findViewById(R.id.signout);
+ getAclId = (Button) findViewById(R.id.getAclId);
+ getAclInfo = (Button) findViewById(R.id.getAclInfo);
+ requestCert = (Button) findViewById(R.id.request);
+ postCrl = (Button) findViewById(R.id.postCRL);
+ getCrl = (Button) findViewById(R.id.getCRL);
+
+ lyt1 = (LinearLayout) findViewById(R.id.lyt1);
+ lyt2 = (LinearLayout) findViewById(R.id.lyt2);
+ signupLyt = (LinearLayout) findViewById(R.id.signupLyt);
+ signinLyt = (LinearLayout) findViewById(R.id.signinLyt);
+
+
+ userid = (TextView) findViewById(R.id.userid);
+
+ mEventsTextView = (TextView) findViewById(R.id.eventView);
+
+ filePath = getFilesDir().getPath() + "/"; // data/data/<package>/files/
+ //copy CBOR file when application runs first time
+ settingPreference = PreferenceManager.getDefaultSharedPreferences(this);
+ boolean isFirstRun = settingPreference.getBoolean("FIRSTRUN", true);
+ if (isFirstRun) {
+ copyCborFromAsset();
+ SharedPreferences.Editor editor = settingPreference.edit();
+ editor.putBoolean("FIRSTRUN", false);
+ editor.putString("IP", StringConstants.DEFAULT_COAP_DERVER_IP);
+ editor.putString("PORT", StringConstants.DEFAULT_COAP_DERVER_PORT);
+ editor.putString("DEVICEID", StringConstants.DEFAULT_DEVICE_ID);
+ editor.commit();
+ }
+ if (settingPreference.getString("useruuid", "").equals("")) {
+
+ lyt1.setVisibility(View.GONE);
+ lyt2.setVisibility(View.GONE);
+ signupLyt.setVisibility(View.VISIBLE);
+ signinLyt.setVisibility(View.GONE);
+
+
+ } else {
+ userid.setText(settingPreference.getString("useruuid", ""));
+ lyt1.setVisibility(View.VISIBLE);
+ lyt2.setVisibility(View.VISIBLE);
+ signupLyt.setVisibility(View.GONE);
+ signinLyt.setVisibility(View.VISIBLE);
+ }
+
+ initOICStack();
+ ocCloudProvisioning = new OcCloudProvisioning(settingPreference.getString("IP", ""),
+ Integer.valueOf(settingPreference.getString("PORT", "")));
+
+ signUp.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ signUp();
+ }
+ });
+ signIn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ signIn();
+ }
+ });
+ signOut.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ signOut();
+ }
+ });
+ getAclId.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getAclId();
+ }
+ });
+ getAclInfo.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getAclInfo();
+ }
+ });
+ requestCert.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ requestCert();
+ }
+ });
+ postCrl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ postCrl();
+ }
+ });
+ getCrl.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getCrl();
+ }
+ });
+ }
+
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_cloud_provision, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case R.id.action_settings:
+ setDefualtSettings();
+ return (true);
+
+
+ }
+ return (super.onOptionsItemSelected(item));
+ }
+
+ private void signIn() {
+ try {
+ logMessage("signIn");
+ if(mAccountManager==null)
+ {
+ mAccountManager = OcPlatform.constructAccountManagerObject(
+ StringConstants.COAP_TCP + settingPreference.getString("IP",
+ StringConstants.DEFAULT_COAP_DERVER_IP) + ":" +
+ settingPreference.getString("PORT", StringConstants.DEFAULT_COAP_DERVER_PORT),
+ EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));
+ }
+
+ mAccountManager.signIn(settingPreference.getString("useruuid", ""),
+ settingPreference.getString("accesstoken", ""), onSignIn);
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void signOut() {
+ try {
+ logMessage("signOut");
+ if(mAccountManager==null)
+ {
+ mAccountManager = OcPlatform.constructAccountManagerObject(
+ StringConstants.COAP_TCP + settingPreference.getString("IP",
+ StringConstants.DEFAULT_COAP_DERVER_IP) + ":" +
+ settingPreference.getString("PORT", StringConstants.DEFAULT_COAP_DERVER_PORT),
+ EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));
+ }
+
+ mAccountManager.signOut(CloudProvisioningClient.this);
+ lyt1.setVisibility(View.GONE);
+ lyt2.setVisibility(View.GONE);
+ signinLyt.setVisibility(View.VISIBLE);
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ private void getAclId() {
+ try {
+ logMessage("getAclId");
+ logMessage("\tdeviceId= " + settingPreference.getString("DEVICEID", ""));
+ ocCloudProvisioning.getAclIdByDevice(settingPreference.getString("DEVICEID", ""), getAclIdByDeviceListener);
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void getAclInfo() {
+ try {
+ logMessage("getAclInfo");
+ logMessage("\taclid="+acl_Id);
+ ocCloudProvisioning.getIndividualAclInfo(acl_Id, getIndividualAclInfoListener);
+
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void requestCert() {
+ try {
+ logMessage("requestCert");
+ ocCloudProvisioning = new OcCloudProvisioning(settingPreference.getString("IP", ""),
+ Integer.valueOf(settingPreference.getString("PORT", "")));
+ ocCloudProvisioning.requestCertificate(requestCertificateListener);
+
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void postCrl() {
+ try {
+ logMessage("postCrl");
+ ArrayList<String> arrayList = new ArrayList<>();
+ arrayList.add("1234");
+
+ ocCloudProvisioning.postCRL("20160727000000", "20161027000000", null, arrayList, postCRLListener);
+
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void getCrl() {
+ try {
+ logMessage("getCrl");
+ ocCloudProvisioning.getCRL(getCRLListener);
+
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void signUp() {
+ try {
+ mAccountManager = OcPlatform.constructAccountManagerObject(
+ StringConstants.COAP_TCP + settingPreference.getString("IP",
+ StringConstants.DEFAULT_COAP_DERVER_IP) + settingPreference.getString("PORT",
+ StringConstants.DEFAULT_COAP_DERVER_PORT),
+ EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));
+ logMessage(StringConstants.COAP_TCP + settingPreference.getString("IP",
+ StringConstants.DEFAULT_COAP_DERVER_IP) + settingPreference.getString("PORT",
+ StringConstants.DEFAULT_COAP_DERVER_PORT));
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+
+ Intent intentLogin = new Intent(this, LoginActivity.class);
+ startActivityForResult(intentLogin, REQUEST_LOGIN);
+ }
+
+
+ /**
+ * configure OIC platform and call findResource
+ */
+ private void initOICStack() {
+ //create platform config
+ PlatformConfig cfg = new PlatformConfig(
+ this,
+ ServiceType.IN_PROC,
+ ModeType.CLIENT_SERVER,
+ "0.0.0.0", // bind to all available interfaces
+ 0,
+ QualityOfService.LOW, filePath + StringConstants.OIC_CLIENT_CBOR_DB_FILE);
+ OcPlatform.Configure(cfg);
+ try {
+ /*
+ * Initialize DataBase
+ */
+ String sqlDbPath = getFilesDir().getAbsolutePath().replace("files", "databases") +
+ File.separator;
+ File file = new File(sqlDbPath);
+ //check files directory exists
+ if (!(file.isDirectory())) {
+ file.mkdirs();
+ Log.d(TAG, "Sql db directory created at " + sqlDbPath);
+ }
+ Log.d(TAG, "Sql db directory exists at " + sqlDbPath);
+ OcProvisioning.provisionInit(sqlDbPath + StringConstants.OIC_SQL_DB_FILE);
+ } catch (OcException e) {
+ logMessage(TAG + "provisionInit error: " + e.getMessage());
+ Log.e(TAG, e.getMessage());
+ }
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_LOGIN) {
+ String mAuthCode = data.getStringExtra("authCode");
+
+
+ logMessage("\tauthCode: " + mAuthCode);
+
+ try {
+ logMessage("Sign Up");
+ mAccountManager = OcPlatform.constructAccountManagerObject(
+ StringConstants.COAP_TCP + settingPreference.getString("IP",
+ StringConstants.DEFAULT_COAP_DERVER_IP) + ":" +
+ settingPreference.getString("PORT", StringConstants.DEFAULT_COAP_DERVER_PORT),
+ EnumSet.of(OcConnectivityType.CT_ADAPTER_TCP));
+
+ mAccountManager.signUp("github", mAuthCode, onSignUp);
+ } catch (OcException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+
+ /**
+ * Copy svr db CBOR dat file from assets folder to app data files dir
+ */
+ private void copyCborFromAsset() {
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ int length;
+ byte[] buffer = new byte[BUFFER_SIZE];
+ try {
+ inputStream = getAssets().open(StringConstants.OIC_CLIENT_CBOR_DB_FILE);
+ File file = new File(filePath);
+ //check files directory exists
+ if (!(file.exists() && file.isDirectory())) {
+ file.mkdirs();
+ }
+ outputStream = new FileOutputStream(filePath + StringConstants.OIC_CLIENT_CBOR_DB_FILE);
+ while ((length = inputStream.read(buffer)) != -1) {
+ outputStream.write(buffer, 0, length);
+ }
+ } catch (NullPointerException e) {
+ logMessage(TAG + "Null pointer exception " + e.getMessage());
+ Log.e(TAG, e.getMessage());
+ } catch (FileNotFoundException e) {
+ logMessage(TAG + "CBOR svr db file not found " + e.getMessage());
+ Log.e(TAG, e.getMessage());
+ } catch (IOException e) {
+ logMessage(TAG + StringConstants.OIC_CLIENT_CBOR_DB_FILE + " file copy failed");
+ Log.e(TAG, e.getMessage());
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ if (outputStream != null) {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ Log.e(TAG, e.getMessage());
+ }
+ }
+ }
+ }
+
+ public void logMessage(String text) {
+ logMsg(text);
+ }
+
+ public void logMsg(final String text) {
+ runOnUiThread(new Runnable() {
+ public void run() {
+ Message msg = new Message();
+ msg.obj = text;
+ mEventsTextView.append(text);
+ mEventsTextView.append("\n");
+ }
+ });
+ Log.i(TAG, text);
+ Intent intent = new Intent(getPackageName());
+ intent.putExtra(StringConstants.MESSAGE, text);
+ sendBroadcast(intent);
+ }
+
+
+ private void setDefualtSettings() {
+ View setingLayout = getLayoutInflater().inflate(R.layout.setting_layout, null);
+
+ final EditText ip = (EditText) setingLayout.findViewById(R.id.ip);
+ final EditText port = (EditText) setingLayout.findViewById(R.id.port);
+ final EditText deviceId = (EditText) setingLayout.findViewById(R.id.deviceId);
+
+ ip.setText(settingPreference.getString("IP", ""));
+ port.setText(settingPreference.getString("PORT", ""));
+ deviceId.setText(settingPreference.getString("DEVICEID", ""));
+
+
+ final AlertDialog.Builder builder = new AlertDialog.Builder(CloudProvisioningClient.this);
+ builder.setView(setingLayout);
+ builder.setPositiveButton("Submit", null).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {
+ Log.d(TAG, "AlertDialog onClick");
+
+ }
+ });
+ final AlertDialog alertDialog = builder.create();
+ alertDialog.setMessage("Settings");
+ alertDialog.show();
+ alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ String ip_address = ip.getText().toString();
+ String port_num = port.getText().toString();
+ String deviceId_val = deviceId.getText().toString();
+
+ SharedPreferences.Editor editor = settingPreference.edit();
+
+ editor.putString("IP", ip_address);
+ editor.putString("PORT", port_num);
+ editor.putString("DEVICEID", deviceId_val);
+ editor.commit();
+
+ alertDialog.cancel();
+ }
+ });
+ alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ alertDialog.cancel();
+ }
+ });
+
+ }
+
+ @Override
+ public void onPostCompleted(List<OcHeaderOption> ocHeaderOptions, OcRepresentation ocRepresentation) {
+
+ }
+
+ @Override
+ public void onPostFailed(Throwable throwable) {
+
+ }
+
+
+ /**
+ * to display on Server Message on Client screen
+ */
+ public class MessageReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final String message = intent.getStringExtra(StringConstants.MESSAGE);
+ logMessage(message);
+ }
+ }
+}
--- /dev/null
+/*
+ * ******************************************************************
+ *
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
+ *
+ * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ */
+
+package org.iotivity.base.examples.cloudprovisioningclient;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.UrlQuerySanitizer;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import org.iotivity.base.examples.cloudprovisioningclient.R;
+
+/**
+ * This class is for login to the provider.
+ * Can be get auth code via web page.
+ */
+public class LoginActivity extends Activity {
+ private static final String TAG = "OIC_SIMPLE_LOGIN";
+
+ private WebView mWebView = null;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_login);
+
+ mWebView = (WebView) findViewById(R.id.webView);
+ mWebView.setInitialScale(200);
+ mWebView.getSettings().setJavaScriptEnabled(true);
+ mWebView.getSettings().setBuiltInZoomControls(true);
+ mWebView.setWebViewClient(new WebViewClientClass());
+
+ mWebView.loadUrl("https://github.com/login?return_to=%2Flogin%2Foauth" +
+ "%2Fauthorize%3Fclient_id%3Dea9c18f540323b0213d0%26redirect_uri" +
+ "%3Dhttp%253A%252F%252Fwww.example.com%252Foauth_callback%252F");
+ }
+
+ private class WebViewClientClass extends WebViewClient {
+
+ @Override
+ public void onPageFinished(WebView view, String url) {
+ Log.i(TAG, "called url=" + url);
+
+ if (url.contains("http://www.example.com/oauth_callback")) {
+
+ mWebView.setVisibility(View.INVISIBLE);
+
+ // parsing url
+ UrlQuerySanitizer sanitizer = new UrlQuerySanitizer();
+ sanitizer.setAllowUnregisteredParamaters(true);
+ sanitizer.parseUrl(url);
+
+ String mAuthCode = sanitizer.getValue("code");
+
+ Intent intent = getIntent();
+ intent.putExtra("authCode", mAuthCode);
+ setResult(RESULT_OK, intent);
+
+ finish();
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * ******************************************************************
+ *
+ * Copyright 2016 Samsung Electronics All Rights Reserved.
+ *
+ * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+ */
+package org.iotivity.base.examples.cloudprovisioningclient;
+
+public interface StringConstants {
+
+ public static final String DEFAULT_DEVICE_ID = "9cfbeb8e-5a1e-4d1c-9d01-2ae6fdb";
+ public static final String COAP_TCP = "coap+tcp://";
+ public static final String DEFAULT_COAP_DERVER_IP = "107.109.229.111";
+ public static final String DEFAULT_COAP_DERVER_PORT = "5684";
+
+ public static final String OIC_CLIENT_CBOR_DB_FILE = "oic_svr_db_client.dat";
+ public static final String MESSAGE = "message";
+ public static final String OIC_SQL_DB_FILE = "Pdm.db";
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">\r
+ <item>\r
+ <shape>\r
+ <stroke\r
+ android:width="1dp"\r
+ android:color="#ffbde0fb" />\r
+\r
+ <!--<stroke\r
+ android:width="1dp"\r
+ android:color="#E4E4E4" />-->\r
+\r
+ <padding\r
+ android:left="1dp"\r
+ android:right="1dp"\r
+ android:top="1dp"\r
+ android:bottom="1dp"\r
+ />\r
+ </shape>\r
+\r
+\r
+ </item>\r
+\r
+ <item>\r
+ <shape android:shape="rectangle">\r
+ <solid android:color="#fff5f9fe" />\r
+ </shape>\r
+ </item>\r
+\r
+</layer-list>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle"
+ android:padding="3dp" >
+ <solid android:color="#00a0ce" />
+
+ <corners android:radius="8dp" />
+</shape>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/loginLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ tools:context=".LoginActivity">
+
+ <WebView
+ android:id="@+id/webView"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="visible" />
+
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:id="@+id/signeninLyt"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:paddingTop="10dp">
+
+ <LinearLayout
+ android:id="@+id/lyt1"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right"
+ android:gravity="right">
+
+
+ <TextView
+ android:id="@+id/userid"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="4545-4554-4545-2121"
+ android:textColor="#ffffa469"
+
+ />
+
+ <Button
+ android:id="@+id/signout"
+ android:layout_width="wrap_content"
+ android:textColor="#ffe7fff6"
+ android:layout_height="30dp"
+ android:background="@drawable/round_button"
+ android:text="Sign Out" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/lyt2"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="30dp">
+
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:weightSum="1">
+
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.33"
+ android:gravity="center_horizontal">
+
+ <Button
+ android:id="@+id/getAclId"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Get AclId" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.33"
+ android:gravity="center_horizontal">
+
+ <Button
+ android:id="@+id/getAclInfo"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Get AclInfo" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="40dp" />
+
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1">
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.33"
+ android:gravity="center_horizontal">
+
+
+ <Button
+ android:id="@+id/request"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Request Cert" />
+
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.33"
+ android:gravity="center_horizontal">
+
+ <Button
+ android:id="@+id/postCRL"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Post CRL" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.33"
+ android:gravity="center_horizontal">
+
+ <Button
+ android:id="@+id/getCRL"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="Get CRL" />
+ </LinearLayout>
+
+
+ </LinearLayout>
+
+
+ </LinearLayout>
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/signupLyt"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal">
+
+ <Button
+ android:id="@+id/signup"
+ android:layout_width="wrap_content"
+ android:textColor="#ffe7fff6"
+ android:layout_height="30dp"
+ android:background="@drawable/round_button"
+ android:text="Sign Up" />
+ </LinearLayout>
+
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="10dp" />
+
+ <LinearLayout
+ android:id="@+id/signinLyt"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal">
+
+ <Button
+ android:id="@+id/signin"
+ android:layout_width="wrap_content"
+ android:textColor="#ffe7fff6"
+ android:layout_height="30dp"
+ android:background="@drawable/round_button"
+ android:text="Sign In" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/linearLayout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="10dip"
+ android:background="@drawable/dash_nil_border"
+ android:orientation="vertical">
+
+ <ScrollView
+ android:id="@+id/scrollView"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:fillViewport="true"
+ android:scrollbars="vertical">
+
+ <TextView
+ android:id="@+id/eventView"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_weight="1.0"
+ android:padding="5dip"
+ android:text="Cloud"
+ android:textColor="#8e8e8e"
+ android:textIsSelectable="true"
+ android:textSize="12dip" />
+
+ </ScrollView>
+
+ </LinearLayout>
+
+
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/loginLayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:weightSum="1">
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.3"
+ android:gravity="right"
+ android:text="IP :" />
+
+ <EditText
+ android:id="@+id/ip"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.7" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:weightSum="1"
+ >
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.3"
+ android:gravity="right"
+ android:text="PORT :" />
+
+ <EditText
+ android:id="@+id/port"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.7" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:weightSum="1"
+ >
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.3"
+ android:gravity="right"
+ android:text="DEVICE ID :" />
+
+ <EditText
+ android:id="@+id/deviceId"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="0.7" />
+
+ </LinearLayout>
+
+</LinearLayout>
\ No newline at end of file
--- /dev/null
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ >
+ <item
+ android:id="@+id/action_settings"
+ android:orderInCategory="100"
+ android:title="@string/action_settings" />
+</menu>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <style name="AppTheme" parent="android:Theme.Material.Light">
+ </style>
+</resources>
--- /dev/null
+<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>
--- /dev/null
+<resources>
+ <!-- Default screen margins, per the Android Design guidelines. -->
+ <dimen name="activity_horizontal_margin">16dp</dimen>
+ <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
--- /dev/null
+<resources>
+ <string name="app_name">Cloud Provisioning Client</string>
+
+ <string name="hello_world">Hello world!</string>
+ <string name="action_settings">Settings</string>
+</resources>
--- /dev/null
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
+ <!-- Customize your theme here. -->
+ </style>
+
+</resources>
if(SECURED== "1"){
include ':provisioningclient', ':DirectPairing'
}
-
+if(SECURED== "1" && WITH_TCP== "1" && WITH_CLOUD== "1"){
+ include ':cloudprovisioningclient'
+}
if(System.getProperty('WITH_TRANSPORT_EDR') == "1" && System.getProperty('WITH_TRANSPORT_BLE') == "1" && System.getProperty('WITH_TRANSPORT_NFC') == "1"){
println 'transport is all..simplebase will be added in sample list'
include ':simplebase'
}
+