2 * //******************************************************************
4 * // Copyright 2015 Intel Corporation.
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 "OCResource.h"
25 #include "JniListenerManager.h"
26 #include "JniOnGetListener.h"
27 #include "JniOnPutListener.h"
28 #include "JniOnPostListener.h"
29 #include "JniOnDeleteListener.h"
30 #include "JniOnObserveListener.h"
31 #include "JniOcResourceIdentifier.h"
33 #ifndef _Included_org_iotivity_base_OcResource
34 #define _Included_org_iotivity_base_OcResource
41 JniOcResource(std::shared_ptr<OCResource> resource);
44 OCStackResult get(JNIEnv* env, const QueryParamsMap &queryParametersMap, jobject jListener);
45 OCStackResult get(JNIEnv* env, const QueryParamsMap &queryParametersMap, jobject jListener,
46 QualityOfService QoS);
47 OCStackResult get(JNIEnv* env, const std::string &resourceType, const std::string &resourceInterface,
48 const QueryParamsMap &queryParametersMap, jobject jListener);
49 OCStackResult get(JNIEnv* env, const std::string &resourceType, const std::string &resourceInterface,
50 const QueryParamsMap &queryParametersMap, jobject jListener, QualityOfService QoS);
52 OCStackResult put(JNIEnv* env, const OCRepresentation &representation, const QueryParamsMap &queryParametersMap,
54 OCStackResult put(JNIEnv* env, const OCRepresentation &representation, const QueryParamsMap &queryParametersMap,
55 jobject jListener, QualityOfService QoS);
56 OCStackResult put(JNIEnv* env, const std::string &resourceType, const std::string &resourceInterface,
57 const OCRepresentation &representation, const QueryParamsMap &queryParametersMap, jobject jListener);
58 OCStackResult put(JNIEnv* env, const std::string &resourceType, const std::string &resourceInterface,
59 const OCRepresentation &representation, const QueryParamsMap &queryParametersMap, jobject jListener, QualityOfService QoS);
61 OCStackResult post(JNIEnv* env, const OCRepresentation &representation, const QueryParamsMap &queryParametersMap,
63 OCStackResult post(JNIEnv* env, const OCRepresentation &representation, const QueryParamsMap &queryParametersMap,
64 jobject jListener, QualityOfService QoS);
65 OCStackResult post(JNIEnv* env, const std::string &resourceType, const std::string &resourceInterface,
66 const OCRepresentation &representation, const QueryParamsMap &queryParametersMap, jobject jListener);
67 OCStackResult post(JNIEnv* env, const std::string &resourceType, const std::string &resourceInterface,
68 const OCRepresentation &representation, const QueryParamsMap &queryParametersMap, jobject jListener, QualityOfService QoS);
70 OCStackResult deleteResource(JNIEnv* env, jobject jListener);
71 OCStackResult deleteResource(JNIEnv* env, jobject jListener, QualityOfService QoS);
73 OCStackResult observe(JNIEnv* env, ObserveType observeType, const QueryParamsMap &queryParametersMap,
75 OCStackResult observe(JNIEnv* env, ObserveType observeType, const QueryParamsMap &queryParametersMap,
76 jobject jListener, QualityOfService qos);
78 OCStackResult cancelObserve(JNIEnv* env);
79 OCStackResult cancelObserve(JNIEnv* env, QualityOfService qos);
81 void setHeaderOptions(const HeaderOptions &headerOptions);
82 void unsetHeaderOptions();
85 OCConnectivityType connectivityType() const;
87 std::vector< std::string > getResourceTypes() const;
88 std::vector< std::string > getResourceInterfaces(void) const;
89 OCResourceIdentifier uniqueIdentifier() const;
90 std::string sid() const;
92 JniOnGetListener* addOnGetListener(JNIEnv* env, jobject jListener);
93 JniOnPutListener* addOnPutListener(JNIEnv* env, jobject jListener);
94 JniOnPostListener* addOnPostListener(JNIEnv* env, jobject jListener);
95 JniOnDeleteListener* addOnDeleteListener(JNIEnv* env, jobject jListener);
96 JniOnObserveListener* addOnObserveListener(JNIEnv* env, jobject jListener);
98 void removeOnGetListener(JNIEnv* env, jobject jListener);
99 void removeOnPutListener(JNIEnv* env, jobject jListener);
100 void removeOnPostListener(JNIEnv* env, jobject jListener);
101 void removeOnDeleteListener(JNIEnv* env, jobject jListener);
102 void removeOnObserveListener(JNIEnv* env, jobject jListener);
104 std::shared_ptr<OCResource> getOCResource();
106 static JniOcResource* getJniOcResourcePtr(JNIEnv *env, jobject thiz);
109 JniListenerManager<JniOnGetListener> m_onGetManager;
110 JniListenerManager<JniOnPutListener> m_onPutManager;
111 JniListenerManager<JniOnPostListener> m_onPostManager;
112 JniListenerManager<JniOnDeleteListener> m_onDeleteManager;
113 JniListenerManager<JniOnObserveListener> m_onObserveManager;
115 std::shared_ptr<OCResource> m_sharedResource;
118 /* DO NOT EDIT THIS FILE BEYOND THIS LINE - it is machine generated */
125 * Class: org_iotivity_base_OcResource
127 * Signature: (Ljava/util/Map;Lorg/iotivity/base/OcResource/OnGetListener;)V
129 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_get
130 (JNIEnv *, jobject, jobject, jobject);
133 * Class: org_iotivity_base_OcResource
135 * Signature: (Ljava/util/Map;Lorg/iotivity/base/OcResource/OnGetListener;I)V
137 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_get1
138 (JNIEnv *, jobject, jobject, jobject, jint);
141 * Class: org_iotivity_base_OcResource
143 * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnGetListener;)V
145 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_get2
146 (JNIEnv *, jobject, jstring, jstring, jobject, jobject);
149 * Class: org_iotivity_base_OcResource
151 * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnGetListener;I)V
153 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_get3
154 (JNIEnv *, jobject, jstring, jstring, jobject, jobject, jint);
157 * Class: org_iotivity_base_OcResource
159 * Signature: (Lorg/iotivity/base/OcRepresentation;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnPutListener;)V
161 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_put
162 (JNIEnv *, jobject, jobject, jobject, jobject);
165 * Class: org_iotivity_base_OcResource
167 * Signature: (Lorg/iotivity/base/OcRepresentation;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnPutListener;I)V
169 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_put1
170 (JNIEnv *, jobject, jobject, jobject, jobject, jint);
173 * Class: org_iotivity_base_OcResource
175 * Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnPutListener;)V
177 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_put2
178 (JNIEnv *, jobject, jstring, jstring, jobject, jobject, jobject);
181 * Class: org_iotivity_base_OcResource
183 * Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnPutListener;I)V
185 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_put3
186 (JNIEnv *, jobject, jstring, jstring, jobject, jobject, jobject, jint);
189 * Class: org_iotivity_base_OcResource
191 * Signature: (Lorg/iotivity/base/OcRepresentation;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnPostListener;)V
193 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_post
194 (JNIEnv *, jobject, jobject, jobject, jobject);
197 * Class: org_iotivity_base_OcResource
199 * Signature: (Lorg/iotivity/base/OcRepresentation;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnPostListener;I)V
201 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_post1
202 (JNIEnv *, jobject, jobject, jobject, jobject, jint);
205 * Class: org_iotivity_base_OcResource
207 * Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnPostListener;)V
209 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_post2
210 (JNIEnv *, jobject, jstring, jstring, jobject, jobject, jobject);
213 * Class: org_iotivity_base_OcResource
215 * Signature: (Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcRepresentation;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnPostListener;I)V
217 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_post3
218 (JNIEnv *, jobject, jstring, jstring, jobject, jobject, jobject, jint);
221 * Class: org_iotivity_base_OcResource
222 * Method: deleteResource
223 * Signature: (Lorg/iotivity/base/OcResource/OnDeleteListener;)V
225 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_deleteResource
226 (JNIEnv *, jobject, jobject);
229 * Class: org_iotivity_base_OcResource
230 * Method: deleteResource1
231 * Signature: (Lorg/iotivity/base/OcResource/OnDeleteListener;I)V
233 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_deleteResource1
234 (JNIEnv *, jobject, jobject, jint);
237 * Class: org_iotivity_base_OcResource
239 * Signature: (Lorg/iotivity/base/ObserveType;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnObserveListener;)V
241 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_observe
242 (JNIEnv *, jobject, jint, jobject, jobject);
245 * Class: org_iotivity_base_OcResource
247 * Signature: (Lorg/iotivity/base/ObserveType;Ljava/util/Map;Lorg/iotivity/base/OcResource/OnObserveListener;I)V
249 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_observe1
250 (JNIEnv *, jobject, jint, jobject, jobject, jint);
253 * Class: org_iotivity_base_OcResource
254 * Method: cancelObserve1
257 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_cancelObserve1
258 (JNIEnv *, jobject, jint);
261 * Class: org_iotivity_base_OcResource
262 * Method: setHeaderOptions
263 * Signature: ([Lorg/iotivity/OcHeaderOption;)V
265 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_setHeaderOptions
266 (JNIEnv *, jobject, jobjectArray);
269 * Class: org_iotivity_base_OcResource
270 * Method: unsetHeaderOptions
273 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_unsetHeaderOptions
277 * Class: org_iotivity_base_OcResource
279 * Signature: ()Ljava/lang/String;
281 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcResource_getHost
285 * Class: org_iotivity_base_OcResource
287 * Signature: ()Ljava/lang/String;
289 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcResource_getUri
293 * Class: org_iotivity_base_OcResource
294 * Method: getConnectivityTypeN
297 JNIEXPORT jint JNICALL Java_org_iotivity_base_OcResource_getConnectivityTypeN
301 * Class: org_iotivity_base_OcResource
302 * Method: isObservable
305 JNIEXPORT jboolean JNICALL Java_org_iotivity_base_OcResource_isObservable
309 * Class: org_iotivity_base_OcResource
310 * Method: getResourceTypes
311 * Signature: ()Ljava/util/List;
313 JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcResource_getResourceTypes
317 * Class: org_iotivity_base_OcResource
318 * Method: getResourceInterfaces
319 * Signature: ()Ljava/util/List;
321 JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcResource_getResourceInterfaces
325 * Class: org_iotivity_base_OcResource
326 * Method: getUniqueIdentifier
327 * Signature: ()Lorg/iotivity/base/OcResourceIdentifier;
329 JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcResource_getUniqueIdentifier
333 * Class: org_iotivity_base_OcResource
334 * Method: getServerId
335 * Signature: ()Ljava/lang/String;
337 JNIEXPORT jstring JNICALL Java_org_iotivity_base_OcResource_getServerId
341 * Class: org_iotivity_base_OcResource
345 JNIEXPORT void JNICALL Java_org_iotivity_base_OcResource_dispose