replace : iotivity -> iotivity-sec
[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.hpp"
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 provisionTrustCertChain(JNIEnv* env, jint type, jint credId,
57                 jobject jListener);
58         OCStackResult unlinkDevices(JNIEnv* env, jobject device2, jobject jListener);
59         OCStackResult removeDevice(JNIEnv* env, jint timeout, jobject jListener);
60         OCStackResult provisionDirectPairing(JNIEnv* env, jobjectArray jpdacls,jobject jListener,
61                 std::string pin, std::vector<int> prms, int edp);
62     private:
63
64         std::map<jobject, std::pair<JniProvisionResultListner*, int>> resultMap;
65         std::mutex resultMapLock;
66         std::shared_ptr<OCSecureResource> m_sharedSecureResource;
67 };
68
69 /* DO NOT EDIT THIS FILE BEYOND THIS LINE - it is machine generated */
70
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74 /*
75  * Class:     org_iotivity_base_OcSecureResource
76  * Method:    doOwnershipTransfer
77  * Signature: (Lorg/iotivity/base/OcSecureResource/DoOwnershipTransferListener;)V
78  */
79 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_doOwnershipTransfer
80   (JNIEnv *, jobject, jobject);
81
82 /*
83  * Class:     org_iotivity_base_OcSecureResource
84  * Method:    removeDevice
85  * Signature: (ILorg/iotivity/base/OcSecureResource/RemoveDeviceListener;)V
86  */
87 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_removeDevice
88   (JNIEnv *, jobject, jint, jobject);
89
90 /*
91  * Class:     org_iotivity_base_OcSecureResource
92  * Method:    unlinkDevices
93  * Signature: (Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/UnlinkDevicesListener;)V
94  */
95 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_unlinkDevices
96   (JNIEnv *, jobject, jobject, jobject);
97
98 /*
99  * Class:     org_iotivity_base_OcSecureResource
100  * Method:    provisionCredentials1
101  * Signature: (IILjava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionCredentialsListener;)V
102  */
103 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionCredentials1
104     (JNIEnv *, jobject, jint, jint, jobject, jobject);
105
106 /*
107  * Class:     org_iotivity_base_OcSecureResource
108  * Method:    provisionTrustCertChain1
109  * Signature: (Lorg/iotivity/base/OcSecureResource/ProvisionTrustCertChainListener;)V
110  */
111 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionTrustCertChain1
112     (JNIEnv *, jobject, jint, jint, jobject);
113
114 /*
115  * Class:     org_iotivity_base_OcSecureResource
116  * Method:    provisionACL
117  * Signature: (Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionAclListener;)V
118  */
119 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionACL
120     (JNIEnv *, jobject, jobject, jobject);
121
122 /*
123  * Class:     org_iotivity_base_OcSecureResource
124  * Method:    provisionPairwiseDevices1
125  * Signature: (IILjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionPairwiseDevicesListener;)V
126  */
127 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionPairwiseDevices1
128   (JNIEnv *, jobject, jint, jint, jobject, jobject, jobject, jobject);
129
130 /*
131  * Class:     org_iotivity_base_OcSecureResource
132  * Method:    provisionDirectPairing
133  * Signature: (Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionDirectPairingListener;)V
134  */
135 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionDirectPairing
136   (JNIEnv *, jobject, jstring, jobjectArray, jintArray, jint, jobject);
137
138 /*
139  * Class:     org_iotivity_base_OcSecureResource
140  * Method:    getLinkedDevices
141  * Signature: ()Ljava/util/List;
142  */
143 JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcSecureResource_getLinkedDevices
144   (JNIEnv *, jobject);
145
146 /*
147  * Class:     org_iotivity_base_OcSecureResource
148  * Method:    getIpAddr
149  * Signature: ()Ljava/lang/String;
150  */
151 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcSecureResource_getIpAddr
152   (JNIEnv *, jobject);
153
154 /*
155  * Class:     org_iotivity_base_OcSecureResource
156  * Method:    getDeviceID
157  * Signature: ()Ljava/lang/String;
158  */
159 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcSecureResource_getDeviceID
160   (JNIEnv *, jobject);
161
162 /*
163  * Class:     org_iotivity_base_OcSecureResource
164  * Method:    deviceStatus
165  * Signature: ()I
166  */
167 JNIEXPORT jint JNICALL Java_org_iotivity_base_OcSecureResource_deviceStatus
168   (JNIEnv *, jobject);
169
170 /*
171  * Class:     org_iotivity_base_OcSecureResource
172  * Method:    ownedStatus
173  * Signature: ()I
174  */
175 JNIEXPORT jint JNICALL Java_org_iotivity_base_OcSecureResource_ownedStatus
176   (JNIEnv *, jobject);
177
178 /*
179  * Class:     org_iotivity_base_OcSecureResource
180  * Method:    dispose
181  * Signature: ()V
182  */
183 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_dispose
184   (JNIEnv *, jobject);
185
186 #ifdef __cplusplus
187 }
188 #endif
189 #endif
190