2 * ***************************************************************
\r
4 * Copyright 2015 Samsung Electronics All Rights Reserved.
\r
8 * Licensed under the Apache License, Version 2.0 (the "License");
\r
9 * you may not use this file except in compliance with the License.
\r
10 * You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing, software
\r
15 * distributed under the License is distributed on an "AS IS" BASIS,
\r
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
17 * See the License for the specific language governing permissions and
\r
18 * limitations under the License.
\r
20 * ****************************************************************
\r
22 package org.iotivity.service.easysetup.mediator;
\r
24 import android.content.Context;
\r
26 //import org.iotivity.ca.CaInterface;
\r
28 public class EasySetupManager {
\r
29 private native void InitEasySetup();
\r
31 private native void TerminateEasySetup();
\r
33 // TODO : "OcConnectivityType connectivityType" has to be passed as the
\r
34 // second parameter for PerformEasySetup
\r
35 // instead of integer
\r
36 private native void ProvisionEnrollee(String ipAddress, String netSSID,
\r
37 String netPWD, int connectivityType);
\r
39 private native void StopEnrolleeProvisioning(int connectivityType);
\r
41 public static native void initialize(Context context);
\r
43 private static EasySetupManager easySetupManagerInterfaceObj = null;
\r
44 private Context appContext = null;
\r
47 // Load Easy Setup JNI interface
\r
48 System.loadLibrary("gnustl_shared");
\r
49 System.loadLibrary("octbstack");
\r
50 System.loadLibrary("connectivity_abstraction");
\r
51 System.loadLibrary("easysetup-jni");
\r
54 private EasySetupManager() {
\r
59 * Function for Getting instance of EasySetupManager object.
\r
61 * @return EasySetupManager instance.
\r
64 public static synchronized EasySetupManager getInstance() {
\r
65 if (null == easySetupManagerInterfaceObj) {
\r
66 easySetupManagerInterfaceObj = new EasySetupManager();
\r
68 return easySetupManagerInterfaceObj;
\r
71 public void setApplicationContext(Context context) {
\r
72 appContext = context;
\r
75 public void initEasySetup() {
\r
76 // CaInterface.initialize(appContext);
\r
80 public void terminateEasySetup() {
\r
81 TerminateEasySetup();
\r
84 public void provisionEnrollee(String ipAddress, String netSSID,
\r
85 String netPWD, int connectivityType) {
\r
87 ProvisionEnrollee(ipAddress, netSSID, netPWD, connectivityType);
\r
90 public void stopEnrolleeProvisioning(int connectivityType) {
\r
91 StopEnrolleeProvisioning(connectivityType);
\r