Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / android / android_api / base / jni / JniOcSecureResource.h
1 /*
2 * //******************************************************************
3 * //
4 * // Copyright 2015 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 #include "JniOcStack.h"
24 #include "JniProvisionResultListner.h"
25 #include "OCProvisioningManager.h"
26 #include <mutex>
27
28 #ifndef _Included_org_iotivity_base_OcSecureResource
29 #define _Included_org_iotivity_base_OcSecureResource
30
31 using namespace OC;
32
33 class JniOcSecureResource
34 {
35     public:
36         JniOcSecureResource(std::shared_ptr<OCSecureResource> secureresource);
37         ~JniOcSecureResource();
38
39         static JniOcSecureResource* getJniOcSecureResourcePtr(JNIEnv *env, jobject thiz);
40         std::string getDeviceID(void);
41         std::string getIpAddr(void);
42         int getDeviceStatus(void);
43         bool getOwnedStatus(void);
44         OCSecureResource* getDevicePtr();
45
46         JniProvisionResultListner* AddProvisionResultListener(JNIEnv* env, jobject jListener);
47         void  RemoveProvisionResultListener(JNIEnv* env, jobject jListener);
48
49         OCStackResult doOwnershipTransfer(JNIEnv* env, jobject jListener);
50         OCStackResult getLinkedDevices(JNIEnv *env, UuidList_t &uuidList);
51         OCStackResult provisionACL(JNIEnv* env, jobject acl, jobject jListener);
52         OCStackResult provisionPairwiseDevices(JNIEnv* env, jint type, jint keySize,
53                 jobject acl1, jobject device2, jobject acl2, jobject jListener);
54         OCStackResult provisionCredentials(JNIEnv* env, jint type, jint keySize,
55                 jobject device2, jobject jListener);
56         OCStackResult unlinkDevices(JNIEnv* env, jobject device2, jobject jListener);
57         OCStackResult removeDevice(JNIEnv* env, jint timeout, jobject jListener);
58
59     private:
60
61         std::map<jobject, std::pair<JniProvisionResultListner*, int>> resultMap;
62         std::mutex resultMapLock;
63         std::shared_ptr<OCSecureResource> m_sharedSecureResource;
64 };
65
66 /* DO NOT EDIT THIS FILE BEYOND THIS LINE - it is machine generated */
67
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 /*
72  * Class:     org_iotivity_base_OcSecureResource
73  * Method:    doOwnershipTransfer
74  * Signature: (Lorg/iotivity/base/OcSecureResource/DoOwnershipTransferListener;)V
75  */
76 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_doOwnershipTransfer
77   (JNIEnv *, jobject, jobject);
78
79 /*
80  * Class:     org_iotivity_base_OcSecureResource
81  * Method:    removeDevice
82  * Signature: (ILorg/iotivity/base/OcSecureResource/RemoveDeviceListener;)V
83  */
84 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_removeDevice
85   (JNIEnv *, jobject, jint, jobject);
86
87 /*
88  * Class:     org_iotivity_base_OcSecureResource
89  * Method:    unlinkDevices
90  * Signature: (Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/UnlinkDevicesListener;)V
91  */
92 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_unlinkDevices
93   (JNIEnv *, jobject, jobject, jobject);
94
95 /*
96  * Class:     org_iotivity_base_OcSecureResource
97  * Method:    provisionCredentials1
98  * Signature: (IILjava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionCredentialsListener;)V
99  */
100 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionCredentials1
101   (JNIEnv *, jobject, jint, jint, jobject, jobject);
102
103 /*
104  * Class:     org_iotivity_base_OcSecureResource
105  * Method:    provisionACL
106  * Signature: (Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionAclListener;)V
107  */
108 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionACL
109   (JNIEnv *, jobject, jobject, jobject);
110
111 /*
112  * Class:     org_iotivity_base_OcSecureResource
113  * Method:    provisionPairwiseDevices1
114  * Signature: (IILjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionPairwiseDevicesListener;)V
115  */
116 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionPairwiseDevices1
117   (JNIEnv *, jobject, jint, jint, jobject, jobject, jobject, jobject);
118
119 /*
120  * Class:     org_iotivity_base_OcSecureResource
121  * Method:    getLinkedDevices
122  * Signature: ()Ljava/util/List;
123  */
124 JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcSecureResource_getLinkedDevices
125   (JNIEnv *, jobject);
126
127 /*
128  * Class:     org_iotivity_base_OcSecureResource
129  * Method:    getIpAddr
130  * Signature: ()Ljava/lang/String;
131  */
132 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcSecureResource_getIpAddr
133   (JNIEnv *, jobject);
134
135 /*
136  * Class:     org_iotivity_base_OcSecureResource
137  * Method:    getDeviceID
138  * Signature: ()Ljava/lang/String;
139  */
140 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcSecureResource_getDeviceID
141   (JNIEnv *, jobject);
142
143 /*
144  * Class:     org_iotivity_base_OcSecureResource
145  * Method:    deviceStatus
146  * Signature: ()I
147  */
148 JNIEXPORT jint JNICALL Java_org_iotivity_base_OcSecureResource_deviceStatus
149   (JNIEnv *, jobject);
150
151 /*
152  * Class:     org_iotivity_base_OcSecureResource
153  * Method:    ownedStatus
154  * Signature: ()I
155  */
156 JNIEXPORT jint JNICALL Java_org_iotivity_base_OcSecureResource_ownedStatus
157   (JNIEnv *, jobject);
158
159 /*
160  * Class:     org_iotivity_base_OcSecureResource
161  * Method:    dispose
162  * Signature: ()V
163  */
164 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_dispose
165   (JNIEnv *, jobject);
166
167 #ifdef __cplusplus
168 }
169 #endif
170 #endif
171