Imported Upstream version 1.1.0
[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 "JniEsListenerManager.h"
38
39 using namespace OIC::Service;
40
41 /**
42  * @class   JniRemoteEnrollee
43  * @brief   This class contains all the APIs for RemoteEnrollee
44  *
45  * NOTE: JNI APIs internally call the APIs of this class.
46  */
47 class JniRemoteEnrollee
48 {
49     public:
50
51         /**
52         *@brief constructor
53         */
54         JniRemoteEnrollee(std::shared_ptr< RemoteEnrollee> remoteEnrollee);
55
56         /**
57          *@brief destructor
58         */
59         ~JniRemoteEnrollee();
60
61         // ***** JNI APIs internally call the APIs of this class ***** //
62
63         void startProvisioning(JNIEnv *env);
64         void stopProvisioning(JNIEnv *env);
65         void registerProvisioningHandler(JNIEnv *env, jobject jListener);
66
67         JniProvisioningStatusListener *addProvisioningStatusListener(JNIEnv *env, jobject jListener);
68         void removeProvisioningStatusListener(JNIEnv *env, jobject jListener);
69
70         static JniRemoteEnrollee *getJniRemoteEnrollee(JNIEnv *env, jobject thiz);
71
72     private:
73         JniEsListenerManager<JniProvisioningStatusListener> m_provisioingStatus;
74         std::shared_ptr<RemoteEnrollee> m_sharedResource;
75
76 };
77
78
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82
83 /**
84  * API for starting the provisioning process.
85  */
86 JNIEXPORT void JNICALL
87 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeStartProvision
88 (JNIEnv *env, jobject jClass);
89
90 /**
91  * API for stopping the provisioning process.
92  */
93 JNIEXPORT void JNICALL
94 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeStopProvision
95 (JNIEnv *env, jobject jClass);
96
97 /**
98  * API for setting the lisener for recieiving provisioning status.
99  *
100  * @param provisiongListener - Provisioning listener [callback from native layer will be passing to this listener]
101  */
102 JNIEXPORT void JNICALL
103 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeRegisterProvisioningHandler
104 (JNIEnv *env, jobject jClass, jobject provisiongListener);
105
106 #ifdef __cplusplus
107 }
108 #endif
109 #endif // __JNI_ES_REMOTEENROLLEE_H