Add APIs of cloud provisioning for Android and JNI layer
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / android / EasySetupCore / src / main / java / org / iotivity / service / easysetup / mediator / RemoteEnrollee.java
1 /**
2  * ***************************************************************
3  *
4  * Copyright 2016 Samsung Electronics All Rights Reserved.
5  *
6  *
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * ****************************************************************
21  */
22
23
24 package org.iotivity.service.easysetup.mediator;
25
26 import android.util.Log;
27
28 public class RemoteEnrollee{
29
30     public static final String TAG = RemoteEnrollee.class.getName();
31     private long m_nativeHandle;
32
33     private native void nativeSetCloudProvInfo(String authCode, String autoProvider, String ciServer);
34     private native void nativeStartCloudProvisioning(CloudProvisioningCallback callback);
35
36     /* constructor will be invoked from the native layer */
37     private RemoteEnrollee(long nativeHandle){
38         this.m_nativeHandle = nativeHandle;
39     }
40
41         /* native setCloudProvInfo */
42     public void setCloudProvInfo(CloudProvInfo cloudInfo) throws ESException{
43         nativeSetCloudProvInfo(cloudInfo.getAuthCode(), cloudInfo.getAuthProvider(), cloudInfo.getCiServer());
44         }
45
46     /* native startCloudProvisioning */
47     public void startCloudProvisioning(CloudProvisioningCallback callback) throws ESException{
48         if(callback != null)
49         {
50             nativeStartCloudProvisioning(callback);
51             return;
52         }
53         Log.d(TAG, "CloudProvisioningCallback is null ");
54     }
55 }