2 * //******************************************************************
4 * // Copyright 2015 Samsung Electronics All Rights Reserved.
6 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
12 * // http://www.apache.org/licenses/LICENSE-2.0
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.
20 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 #include "JniOcStack.h"
24 #include "JniProvisionResultListner.h"
25 #include "OCProvisioningManager.hpp"
28 #ifndef _Included_org_iotivity_base_OcSecureResource
29 #define _Included_org_iotivity_base_OcSecureResource
33 class JniOcSecureResource
36 JniOcSecureResource(std::shared_ptr<OCSecureResource> secureresource);
37 ~JniOcSecureResource();
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();
46 JniProvisionResultListner* AddProvisionResultListener(JNIEnv* env, jobject jListener);
47 void RemoveProvisionResultListener(JNIEnv* env, jobject jListener);
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,
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);
64 std::map<jobject, std::pair<JniProvisionResultListner*, int>> resultMap;
65 std::mutex resultMapLock;
66 std::shared_ptr<OCSecureResource> m_sharedSecureResource;
69 /* DO NOT EDIT THIS FILE BEYOND THIS LINE - it is machine generated */
75 * Class: org_iotivity_base_OcSecureResource
76 * Method: doOwnershipTransfer
77 * Signature: (Lorg/iotivity/base/OcSecureResource/DoOwnershipTransferListener;)V
79 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_doOwnershipTransfer
80 (JNIEnv *, jobject, jobject);
83 * Class: org_iotivity_base_OcSecureResource
84 * Method: removeDevice
85 * Signature: (ILorg/iotivity/base/OcSecureResource/RemoveDeviceListener;)V
87 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_removeDevice
88 (JNIEnv *, jobject, jint, jobject);
91 * Class: org_iotivity_base_OcSecureResource
92 * Method: unlinkDevices
93 * Signature: (Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/UnlinkDevicesListener;)V
95 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_unlinkDevices
96 (JNIEnv *, jobject, jobject, jobject);
99 * Class: org_iotivity_base_OcSecureResource
100 * Method: provisionCredentials1
101 * Signature: (IILjava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionCredentialsListener;)V
103 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionCredentials1
104 (JNIEnv *, jobject, jint, jint, jobject, jobject);
107 * Class: org_iotivity_base_OcSecureResource
108 * Method: provisionTrustCertChain1
109 * Signature: (Lorg/iotivity/base/OcSecureResource/ProvisionTrustCertChainListener;)V
111 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionTrustCertChain1
112 (JNIEnv *, jobject, jint, jint, jobject);
115 * Class: org_iotivity_base_OcSecureResource
116 * Method: provisionACL
117 * Signature: (Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionAclListener;)V
119 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionACL
120 (JNIEnv *, jobject, jobject, jobject);
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
127 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionPairwiseDevices1
128 (JNIEnv *, jobject, jint, jint, jobject, jobject, jobject, jobject);
131 * Class: org_iotivity_base_OcSecureResource
132 * Method: provisionDirectPairing
133 * Signature: (Ljava/lang/Object;Lorg/iotivity/base/OcSecureResource/ProvisionDirectPairingListener;)V
135 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_provisionDirectPairing
136 (JNIEnv *, jobject, jstring, jobjectArray, jintArray, jint, jobject);
139 * Class: org_iotivity_base_OcSecureResource
140 * Method: getLinkedDevices
141 * Signature: ()Ljava/util/List;
143 JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcSecureResource_getLinkedDevices
147 * Class: org_iotivity_base_OcSecureResource
149 * Signature: ()Ljava/lang/String;
151 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcSecureResource_getIpAddr
155 * Class: org_iotivity_base_OcSecureResource
156 * Method: getDeviceID
157 * Signature: ()Ljava/lang/String;
159 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcSecureResource_getDeviceID
163 * Class: org_iotivity_base_OcSecureResource
164 * Method: deviceStatus
167 JNIEXPORT jint JNICALL Java_org_iotivity_base_OcSecureResource_deviceStatus
171 * Class: org_iotivity_base_OcSecureResource
172 * Method: ownedStatus
175 JNIEXPORT jint JNICALL Java_org_iotivity_base_OcSecureResource_ownedStatus
179 * Class: org_iotivity_base_OcSecureResource
183 JNIEXPORT void JNICALL Java_org_iotivity_base_OcSecureResource_dispose