1 /******************************************************************
\r
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
19 ******************************************************************/
\r
20 package org.iotivity.service.easysetup.mediator;
\r
22 import android.content.Context;
\r
24 //import org.iotivity.ca.CaInterface;
\r
26 public class EasySetupManager {
\r
27 private native void InitEasySetup();
\r
29 private native void TerminateEasySetup();
\r
31 // TODO : "OcConnectivityType connectivityType" has to be passed as the
\r
32 // second parameter for PerformEasySetup
\r
33 // instead of integer
\r
34 private native void ProvisionEnrollee(String ipAddress, String netSSID,
\r
35 String netPWD, int connectivityType);
\r
37 private native void StopEnrolleeProvisioning(int connectivityType);
\r
39 public static native void initialize(Context context);
\r
41 private static EasySetupManager easySetupManagerInterfaceObj = null;
\r
42 private Context appContext = null;
\r
45 // Load Easy Setup JNI interface
\r
46 System.loadLibrary("gnustl_shared");
\r
47 System.loadLibrary("octbstack");
\r
48 System.loadLibrary("connectivity_abstraction");
\r
49 System.loadLibrary("easysetup-jni");
\r
52 private EasySetupManager() {
\r
57 * Function for Getting instance of EasySetupManager object.
\r
59 * @return EasySetupManager instance.
\r
62 public static synchronized EasySetupManager getInstance() {
\r
63 if (null == easySetupManagerInterfaceObj) {
\r
64 easySetupManagerInterfaceObj = new EasySetupManager();
\r
66 return easySetupManagerInterfaceObj;
\r
69 public void setApplicationContext(Context context) {
\r
70 appContext = context;
\r
73 public void initEasySetup() {
\r
74 // CaInterface.initialize(appContext);
\r
78 public void terminateEasySetup() {
\r
79 TerminateEasySetup();
\r
82 public void provisionEnrollee(String ipAddress, String netSSID,
\r
83 String netPWD, int connectivityType) {
\r
85 ProvisionEnrollee(ipAddress, netSSID, netPWD, connectivityType);
\r
88 public void stopEnrolleeProvisioning(int connectivityType) {
\r
89 StopEnrolleeProvisioning(connectivityType);
\r