Add APIs of cloud provisioning for Android and JNI layer
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / android / jni / JniRemoteEnrollee.h
1 /******************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 /** @file   JniRemoteEnrollee.h
22  *
23  *   @brief  This file contains the JniRemoteEnrollee class
24  *               & declaration of RemoteEnrollee APIs for JNI implementation
25  */
26
27 #ifndef __JNI_ES_REMOTEENROLLEE_H
28 #define __JNI_ES_REMOTEENROLLEE_H
29
30 #include "RemoteEnrollee.h"
31 #include "ESRichCommon.h"
32 #include "ESException.h"
33
34 #include "JniJvm.h"
35 #include "JniEsUtils.h"
36 #include "JniProvisioningStatusListener.h"
37 #include "JniCloudProvisioningStatusListener.h"
38 #include "JniEsListenerManager.h"
39
40 using namespace OIC::Service;
41
42 /**
43  * @class   JniRemoteEnrollee
44  * @brief   This class contains all the APIs for RemoteEnrollee
45  *
46  * NOTE: JNI APIs internally call the APIs of this class.
47  */
48 class JniRemoteEnrollee
49 {
50     public:
51
52         /**
53         *@brief constructor
54         */
55         JniRemoteEnrollee(std::shared_ptr< RemoteEnrollee> remoteEnrollee);
56
57         /**
58          *@brief destructor
59         */
60         ~JniRemoteEnrollee();
61
62         // ***** JNI APIs internally call the APIs of this class ***** //
63
64         void setCloudProvInfo(JNIEnv *env, jstring authCode, jstring authProvider, jstring ciServer);
65
66         void startCloudProvisioning(JNIEnv *env, jobject jListener);
67
68         static JniRemoteEnrollee *getJniRemoteEnrollee(JNIEnv *env, jobject thiz);
69
70         JniCloudProvisioningStatusListener *addCloudProvisioningStatusListener(JNIEnv *env, jobject jListener);
71         void removeCloudProvisioningStatusListener(JNIEnv *env, jobject jListener);
72
73     private:
74         void registerCloudProvisioningHandler(JNIEnv *env, jobject jListener);
75         JniEsListenerManager<JniCloudProvisioningStatusListener> m_cloudProvisioningStatus;
76         std::shared_ptr<RemoteEnrollee> m_sharedResource;
77
78 };
79
80
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84
85 /**
86  * API for setting cloud provisioning information.
87  */
88 JNIEXPORT void JNICALL
89 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeSetCloudProvInfo
90 (JNIEnv *env, jobject jClass, jstring jauthCode, jstring jauthProvider, jstring jciServer);
91
92 /**
93  * API for starting the cloud provisioning process.
94  */
95 JNIEXPORT void JNICALL
96 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeStartCloudProvisioning
97 (JNIEnv *env, jobject jClass, jobject jListener);
98
99 /**
100  * API for starting the provisioning process.
101  */
102 //JNIEXPORT void JNICALL
103 //Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeStartProvision
104 //(JNIEnv *env, jobject jClass);
105
106 /**
107  * API for stopping the provisioning process.
108  */
109 //JNIEXPORT void JNICALL
110 //Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeStopProvision
111 //(JNIEnv *env, jobject jClass);
112
113 /**
114  * API for setting the lisener for recieiving provisioning status.
115  *
116  * @param provisiongListener - Provisioning listener [callback from native layer will be passing to this listener]
117  */
118 //JNIEXPORT void JNICALL
119 //Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeRegisterProvisioningHandler
120 //(JNIEnv *env, jobject jClass, jobject provisiongListener);
121
122 #ifdef __cplusplus
123 }
124 #endif
125 #endif // __JNI_ES_REMOTEENROLLEE_H