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