Resolved tizen build issue regarding ip network
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / android / EasySetupCore / src / main / 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 "ESRichCommon.h"
31 #include "ESException.h"
32 #include "RemoteEnrollee.h"
33
34 #include "JniJvm.h"
35 #include "JniEsUtils.h"
36 #include "JniGetEnrolleeStatusListener.h"
37 #include "JniGetConfigurationStatusListener.h"
38 #include "JniSecurityStatusListener.h"
39 #include "JniDevicePropProvisioningStatusListener.h"
40 #include "JniCloudPropProvisioningStatusListener.h"
41 #include "JniEsListenerManager.h"
42
43 using namespace OIC::Service;
44
45 /**
46  * @class   JniRemoteEnrollee
47  * @brief   This class contains all the APIs for RemoteEnrollee
48  *
49  * NOTE: JNI APIs internally call the APIs of this class.
50  */
51 class JniRemoteEnrollee
52 {
53     public:
54
55         /**
56         *@brief constructor
57         */
58         JniRemoteEnrollee(std::shared_ptr< RemoteEnrollee> remoteEnrollee);
59
60         /**
61          *@brief destructor
62         */
63         ~JniRemoteEnrollee();
64
65         // ***** JNI APIs internally call the APIs of this class ***** //
66         void getStatus(JNIEnv *env, jobject jListener);
67         void getConfiguration(JNIEnv *env, jobject jListener);
68         void provisionSecurity(JNIEnv *env, jobject jListener);
69         void provisionDeviceProperties(JNIEnv *env, jobject jRepresentation, jobject jListener);
70         void provisionCloudProperties(JNIEnv *env, jobject jRepresentation, jstring jCloudID, jobject jListener);
71
72         static JniRemoteEnrollee *getJniRemoteEnrollee(JNIEnv *env, jobject thiz);
73
74         template <class T>
75         T *addStatusListener(JNIEnv *env, jobject jListener)
76         {
77             return JniEsListenerManager<T>().addListener(env, jListener, this);
78         };
79
80         template <class T>
81         void removeStatusListener(JNIEnv *env, jobject jListener)
82         {
83             JniEsListenerManager<T>().removeListener(env, jListener);
84         };
85
86     private:
87         std::shared_ptr<RemoteEnrollee> m_sharedResource;
88
89 };
90
91 #ifdef __cplusplus
92 extern "C" {
93 #endif
94
95 /**
96  * API for starting the Request Enrollee status process.
97  */
98 JNIEXPORT void JNICALL
99 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeGetStatus
100 (JNIEnv *env, jobject jClass, jobject jListener);
101
102 /**
103  * API for starting the Request EnrolleeConf process.
104  */
105 JNIEXPORT void JNICALL
106 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeGetConfiguration
107 (JNIEnv *env, jobject jClass, jobject jListener);
108
109 /**
110  * API for starting the Sequrity provisioning process.
111  */
112 JNIEXPORT void JNICALL
113 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionSecurity
114 (JNIEnv *env, jobject jClass, jobject jListener);
115
116 /**
117  * API for starting the Data provisioning process.
118  */
119 JNIEXPORT void JNICALL
120 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionDeviceProperties
121 (JNIEnv *env, jobject jClass, jobject jRepresentation, jobject jListener);
122
123 /**
124  * API for starting the cloud provisioning process.
125  */
126 JNIEXPORT void JNICALL
127 Java_org_iotivity_service_easysetup_mediator_RemoteEnrollee_nativeProvisionCloudProperties
128 (JNIEnv *env, jobject jClass, jobject jRepresentation, jstring jCloudID, jobject jListener);
129
130 #ifdef __cplusplus
131 }
132 #endif
133 #endif // __JNI_ES_REMOTEENROLLEE_H