-/*
-* //******************************************************************
-* //
-* // Copyright 2015 Intel Corporation.
-* //
-* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-* //
-* // Licensed under the Apache License, Version 2.0 (the "License");
-* // you may not use this file except in compliance with the License.
-* // You may obtain a copy of the License at
-* //
-* // http://www.apache.org/licenses/LICENSE-2.0
-* //
-* // Unless required by applicable law or agreed to in writing, software
-* // distributed under the License is distributed on an "AS IS" BASIS,
-* // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* // See the License for the specific language governing permissions and
-* // limitations under the License.
-* //
-* //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-*/
+//******************************************************************
+//
+// Copyright 2015 Intel Corporation.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
#include "JniOcPlatform.h"
#include "OCPlatform.h"
#include "JniOcResource.h"
resourceFoundMapLock.lock();
- for (auto it = onResourceFoundListenerMap.begin(); it != onResourceFoundListenerMap.end(); ++it)
+ for (auto it = onResourceFoundListenerMap.begin();
+ it != onResourceFoundListenerMap.end();
+ ++it)
{
if (env->IsSameObject(jListener, it->first))
{
if (!onResourceFoundListener)
{
- onResourceFoundListener = new JniOnResourceFoundListener(env, jListener, RemoveOnResourceFoundListener);
+ onResourceFoundListener =
+ new JniOnResourceFoundListener(env, jListener, RemoveOnResourceFoundListener);
jobject jgListener = env->NewGlobalRef(jListener);
- onResourceFoundListenerMap.insert(std::pair < jobject, std::pair < JniOnResourceFoundListener*,
- int >> (jgListener, std::pair<JniOnResourceFoundListener*, int>(onResourceFoundListener, 1)));
+ onResourceFoundListenerMap.insert(
+ std::pair<jobject,
+ std::pair<JniOnResourceFoundListener*, int >>(
+ jgListener,
+ std::pair<JniOnResourceFoundListener*, int>(onResourceFoundListener,
+ 1)));
LOGD("OnResourceFoundListener: new listener");
}
resourceFoundMapLock.unlock();
{
resourceFoundMapLock.lock();
- for (auto it = onResourceFoundListenerMap.begin(); it != onResourceFoundListenerMap.end(); ++it)
+ for (auto it = onResourceFoundListenerMap.begin();
+ it != onResourceFoundListenerMap.end();
+ ++it)
{
if (env->IsSameObject(jListener, it->first))
{
if (!onDeviceInfoListener)
{
- onDeviceInfoListener = new JniOnDeviceInfoListener(env, jListener, RemoveOnDeviceInfoListener);
+ onDeviceInfoListener =
+ new JniOnDeviceInfoListener(env, jListener, RemoveOnDeviceInfoListener);
jobject jgListener = env->NewGlobalRef(jListener);
- onDeviceInfoListenerMap.insert(std::pair < jobject, std::pair < JniOnDeviceInfoListener*,
- int >> (jgListener, std::pair<JniOnDeviceInfoListener*, int>(onDeviceInfoListener, 1)));
+ onDeviceInfoListenerMap.insert(
+ std::pair<jobject,
+ std::pair<JniOnDeviceInfoListener*, int>>(
+ jgListener,
+ std::pair<JniOnDeviceInfoListener*, int>(onDeviceInfoListener, 1)));
LOGI("OnDeviceInfoListener: new listener");
}
if (!onPlatformInfoListener)
{
- onPlatformInfoListener = new JniOnPlatformInfoListener(env, jListener, RemoveOnPlatformInfoListener);
+ onPlatformInfoListener =
+ new JniOnPlatformInfoListener(env, jListener, RemoveOnPlatformInfoListener);
jobject jgListener = env->NewGlobalRef(jListener);
- onPlatformInfoListenerMap.insert(std::pair < jobject, std::pair < JniOnPlatformInfoListener*,
- int >> (jgListener, std::pair<JniOnPlatformInfoListener*, int>(onPlatformInfoListener, 1)));
+ onPlatformInfoListenerMap.insert(
+ std::pair<jobject, std::pair<JniOnPlatformInfoListener*, int>>(
+ jgListener,
+ std::pair<JniOnPlatformInfoListener*, int>(onPlatformInfoListener, 1)));
LOGI("OnPlatformInfoListener: new listener");
}
{
onPresenceListener = new JniOnPresenceListener(env, jListener, RemoveOnPresenceListener);
jobject jgListener = env->NewGlobalRef(jListener);
- onPresenceListenerMap.insert(std::pair < jobject, std::pair < JniOnPresenceListener*,
- int >> (jgListener, std::pair<JniOnPresenceListener*, int>(onPresenceListener, 1)));
+ onPresenceListenerMap.insert(
+ std::pair<jobject, std::pair<JniOnPresenceListener*, int>>(
+ jgListener,
+ std::pair<JniOnPresenceListener*, int>(onPresenceListener, 1)));
LOGI("OnPresenceListener: new listener");
}
presenceMapLock.unlock();
try
{
- OCStackResult result = OCPlatform::notifyAllObservers(jniOcResourceHandle->getOCResourceHandle());
+ OCStackResult result =
+ OCPlatform::notifyAllObservers(jniOcResourceHandle->getOCResourceHandle());
if (OC_STACK_OK != result)
{
return;
}
- JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ JniOcResourceHandle* jniOcResourceHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
try{
OCStackResult result = OCPlatform::notifyAllObservers(
* Method: notifyListOfObservers2
* Signature: (Lorg/iotivity/base/OcResourceHandle;[Ljava/lang/Byte;Lorg/iotivity/base/OcResourceResponse;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers2
-(JNIEnv *env, jclass clazz, jobject jResourceHandle, jbyteArray jObservationIdArr, jobject jResourceResponse)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers2(
+ JNIEnv *env,
+ jclass clazz,
+ jobject jResourceHandle,
+ jbyteArray jObservationIdArr,
+ jobject jResourceResponse)
{
LOGD("OcPlatform_notifyListOfObservers2");
if (!jResourceHandle)
return;
}
- JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ JniOcResourceHandle* jniOcResourceHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
- JniOcResourceResponse* jniOcResourceResponse = JniOcResourceResponse::getJniOcResourceResponsePtr(
- env, jResourceResponse);
- if (!jniOcResourceResponse) return;
+ JniOcResourceResponse* jniOcResourceResponse =
+ JniOcResourceResponse::getJniOcResourceResponsePtr(env, jResourceResponse);
+ if (!jniOcResourceResponse)
+ {
+ return;
+ }
int len = env->GetArrayLength(jObservationIdArr);
uint8_t* bArr = (uint8_t*)env->GetByteArrayElements(jObservationIdArr, 0);
env->ReleaseByteArrayElements(jObservationIdArr, (jbyte*)bArr, 0);
- try{
+ try
+ {
OCStackResult result = OCPlatform::notifyListOfObservers(
jniOcResourceHandle->getOCResourceHandle(),
observationIds,
* Method: notifyListOfObservers3
* Signature: (Lorg/iotivity/base/OcResourceHandle;[Ljava/lang/Byte;Lorg/iotivity/base/OcResourceResponse;I)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers3
-(JNIEnv *env, jclass clazz, jobject jResourceHandle, jbyteArray jObservationIdArr, jobject jResourceResponse, jint jQoS)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_notifyListOfObservers3(
+ JNIEnv *env,
+ jclass clazz,
+ jobject jResourceHandle,
+ jbyteArray jObservationIdArr,
+ jobject jResourceResponse,
+ jint jQoS)
{
LOGD("OcPlatform_notifyListOfObservers3");
if (!jResourceHandle)
return;
}
- JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ JniOcResourceHandle* jniOcResourceHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
- JniOcResourceResponse* jniOcResourceResponse = JniOcResourceResponse::getJniOcResourceResponsePtr(
- env, jResourceResponse);
- if (!jniOcResourceResponse) return;
+ JniOcResourceResponse* jniOcResourceResponse =
+ JniOcResourceResponse::getJniOcResourceResponsePtr(env, jResourceResponse);
+ if (!jniOcResourceResponse)
+ {
+ return;
+ }
int len = env->GetArrayLength(jObservationIdArr);
uint8_t* bArr = (uint8_t*)env->GetByteArrayElements(jObservationIdArr, 0);
env->ReleaseByteArrayElements(jObservationIdArr, (jbyte*)bArr, 0);
- try{
+ try
+ {
OCStackResult result = OCPlatform::notifyListOfObservers(
jniOcResourceHandle->getOCResourceHandle(),
observationIds,
* Method: findResource0
* Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnResourceFoundListener;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource0
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource0(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jstring jResourceUri,
+ jint jConnectivityType,
+ jobject jListener)
{
LOGD("OcPlatform_findResource");
std::string host;
* Method: findResource1
* Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnResourceFoundListener;I)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource1
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener, jint jQoS)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_findResource1(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jstring jResourceUri,
+ jint jConnectivityType,
+ jobject jListener,
+ jint jQoS)
{
LOGD("OcPlatform_findResource");
std::string host;
* Method: getDeviceInfo0
* Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnDeviceFoundListener;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo0
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo0(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jstring jResourceUri,
+ jint jConnectivityType,
+ jobject jListener)
{
LOGD("OcPlatform_getDeviceInfo0");
std::string host;
}
JniOnDeviceInfoListener *onDeviceInfoListener = AddOnDeviceInfoListener(env, jListener);
- FindDeviceCallback findDeviceCallback = [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
- {
- onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
- };
+ FindDeviceCallback findDeviceCallback =
+ [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
+ {
+ onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
+ };
try
{
* Method: getDeviceInfo1
* Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnDeviceFoundListener;I)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo1
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener, jint jQoS)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getDeviceInfo1(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jstring jResourceUri,
+ jint jConnectivityType,
+ jobject jListener,
+ jint jQoS)
{
LOGD("OcPlatform_getDeviceInfo1");
std::string host;
}
JniOnDeviceInfoListener *onDeviceInfoListener = AddOnDeviceInfoListener(env, jListener);
- FindDeviceCallback findDeviceCallback = [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
- {
- onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
- };
+ FindDeviceCallback findDeviceCallback =
+ [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
+ {
+ onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
+ };
try
{
* Method: getPlatformInfo0
* Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnPlatformFoundListener;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo0
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo0(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jstring jResourceUri,
+ jint jConnectivityType,
+ jobject jListener)
{
LOGD("OcPlatform_getPlatformInfo0");
std::string host;
}
JniOnPlatformInfoListener *onPlatformInfoListener = AddOnPlatformInfoListener(env, jListener);
- FindPlatformCallback findPlatformCallback = [onPlatformInfoListener](const OCRepresentation& ocRepresentation)
- {
- onPlatformInfoListener->foundPlatformCallback(ocRepresentation);
- };
+ FindPlatformCallback findPlatformCallback =
+ [onPlatformInfoListener](const OCRepresentation& ocRepresentation)
+ {
+ onPlatformInfoListener->foundPlatformCallback(ocRepresentation);
+ };
try
{
* Method: getPlatformInfo1
* Signature: (Ljava/lang/String;Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnPlatformFoundListener;I)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo1
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceUri, jint jConnectivityType, jobject jListener, jint jQoS)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_getPlatformInfo1(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jstring jResourceUri,
+ jint jConnectivityType,
+ jobject jListener,
+ jint jQoS)
{
LOGD("OcPlatform_getPlatformInfo1");
std::string host;
}
JniOnDeviceInfoListener *onDeviceInfoListener = AddOnDeviceInfoListener(env, jListener);
- FindDeviceCallback findDeviceCallback = [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
- {
- onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
- };
+ FindDeviceCallback findDeviceCallback =
+ [onDeviceInfoListener](const OCRepresentation& ocRepresentation)
+ {
+ onDeviceInfoListener->foundDeviceCallback(ocRepresentation);
+ };
try
{
* Method: registerResource0
* Signature: (Lorg/iotivity/base/OcResource;)Lorg/iotivity/base/OcResourceHandle;
*/
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource0
-(JNIEnv *env, jclass clazz, jobject jResource)
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource0(
+ JNIEnv *env, jclass clazz, jobject jResource)
{
LOGD("OcPlatform_registerResource");
if (!jResource)
}
JniOcResourceHandle* jniHandle = new JniOcResourceHandle(resourceHandle);
jlong handle = reinterpret_cast<jlong>(jniHandle);
- jobject jResourceHandle = env->NewObject(g_cls_OcResourceHandle, g_mid_OcResourceHandle_N_ctor, handle);
+ jobject jResourceHandle =
+ env->NewObject(g_cls_OcResourceHandle, g_mid_OcResourceHandle_N_ctor, handle);
if (!jResourceHandle)
{
* Method: registerResource1
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lorg/iotivity/base/OcPlatform/EntityHandler;I)Lorg/iotivity/base/OcResourceHandle;
*/
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource1
-(JNIEnv *env, jclass clazz, jstring jResourceUri, jstring jResourceTypeName, jstring jResourceInterface,
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_registerResource1(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jResourceUri,
+ jstring jResourceTypeName,
+ jstring jResourceInterface,
jobject jListener, jint jResourceProperty)
{
LOGI("OcPlatform_registerResource1");
return nullptr;
}
JniEntityHandler* entityHandler = new JniEntityHandler(env, jListener);
- EntityHandler handleEntityCallback = [entityHandler](const std::shared_ptr<OCResourceRequest> request) ->
- OCEntityHandlerResult{
- return entityHandler->handleEntity(request);
- };
+ EntityHandler handleEntityCallback =
+ [entityHandler](const std::shared_ptr<OCResourceRequest> request) -> OCEntityHandlerResult
+ {
+ return entityHandler->handleEntity(request);
+ };
OCResourceHandle resourceHandle;
try
JniOcResourceHandle* jniHandle = new JniOcResourceHandle(resourceHandle);
jlong handle = reinterpret_cast<jlong>(jniHandle);
- jobject jResourceHandle = env->NewObject(g_cls_OcResourceHandle, g_mid_OcResourceHandle_N_ctor, handle);
+ jobject jResourceHandle =
+ env->NewObject(g_cls_OcResourceHandle, g_mid_OcResourceHandle_N_ctor, handle);
if (!jResourceHandle)
{
LOGE("Failed to create OcResourceHandle");
* Method: registerDeviceInfo0
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_registerDeviceInfo0
-(JNIEnv *env,
-jclass clazz,
-jstring jDeviceName)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_registerDeviceInfo0(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jDeviceName)
{
LOGI("OcPlatform_registerDeviceInfo");
* Method: registerPlatformInfo0
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_registerPlatformInfo0
-(JNIEnv *env,
-jclass clazz,
-jstring jPlatformID,
-jstring jManufacturerName,
-jstring jManufacturerUrl,
-jstring jModelNumber,
-jstring jDateOfManufacture,
-jstring jPlatformVersion,
-jstring jOperatingSystemVersion,
-jstring jHardwareVersion,
-jstring jFirmwareVersion,
-jstring jSupportUrl,
-jstring jSystemTime)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_registerPlatformInfo0(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jPlatformID,
+ jstring jManufacturerName,
+ jstring jManufacturerUrl,
+ jstring jModelNumber,
+ jstring jDateOfManufacture,
+ jstring jPlatformVersion,
+ jstring jOperatingSystemVersion,
+ jstring jHardwareVersion,
+ jstring jFirmwareVersion,
+ jstring jSupportUrl,
+ jstring jSystemTime)
{
LOGI("OcPlatform_registerPlatformInfo");
LOGE("Error is due to %s", e.reason().c_str());
ThrowOcException(OC_STACK_ERROR, e.reason().c_str());
}
-
-
-
}
/*
* Method: unregisterResource0
* Signature: (Lorg/iotivity/base/OcResourceHandle;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unregisterResource0
-(JNIEnv *env, jclass clazz, jobject jResourceHandle)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unregisterResource0(
+ JNIEnv *env, jclass clazz, jobject jResourceHandle)
{
LOGI("OcPlatform_unregisterResource");
if (!jResourceHandle)
}
JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
try
{
ThrowOcException(OC_STACK_INVALID_PARAM, "resourceHandle cannot be null");
return;
}
- JniOcResourceHandle* jniOcResourceCollectionHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceCollectionHandle);
+ JniOcResourceHandle* jniOcResourceCollectionHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceCollectionHandle);
if (!jniOcResourceCollectionHandle) return;
JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
try
{
* Method: bindResources0
* Signature: (Lorg/iotivity/base/OcResourceHandle;[Lorg/iotivity/base/OcResourceHandle;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResources0
-(JNIEnv *env, jclass clazz, jobject jResourceCollectionHandle, jobjectArray jResourceHandleArray)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindResources0(
+ JNIEnv *env,
+ jclass clazz,
+ jobject jResourceCollectionHandle,
+ jobjectArray jResourceHandleArray)
{
LOGI("OcPlatform_bindResources");
return;
}
- JniOcResourceHandle* jniOcResourceCollectionHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceCollectionHandle);
- if (!jniOcResourceCollectionHandle) return;
+ JniOcResourceHandle* jniOcResourceCollectionHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceCollectionHandle);
+ if (!jniOcResourceCollectionHandle)
+ {
+ return;
+ }
std::vector<OCResourceHandle> resourceHandleList;
int len = env->GetArrayLength(jResourceHandleArray);
return;
}
- JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ JniOcResourceHandle* jniOcResourceHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
resourceHandleList.push_back(
jniOcResourceHandle->getOCResourceHandle());
* Method: unbindResource0
* Signature: (Lorg/iotivity/base/OcResourceHandle;Lorg/iotivity/base/OcResourceHandle;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResource0
-(JNIEnv *env, jclass clazz, jobject jResourceCollectionHandle, jobject jResourceHandle)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResource0(
+ JNIEnv *env,
+ jclass clazz,
+ jobject jResourceCollectionHandle,
+ jobject jResourceHandle)
{
LOGI("OcPlatform_unbindResource");
if (!jResourceCollectionHandle)
return;
}
- JniOcResourceHandle* jniOcResourceCollectionHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceCollectionHandle);
- if (!jniOcResourceCollectionHandle) return;
+ JniOcResourceHandle* jniOcResourceCollectionHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceCollectionHandle);
+ if (!jniOcResourceCollectionHandle)
+ {
+ return;
+ }
- JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ JniOcResourceHandle* jniOcResourceHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
try
{
OCStackResult result = OCPlatform::unbindResource(
jniOcResourceCollectionHandle->getOCResourceHandle(),
- jniOcResourceHandle->getOCResourceHandle()
- );
+ jniOcResourceHandle->getOCResourceHandle());
if (OC_STACK_OK != result)
{
* Method: unbindResources0
* Signature: (Lorg/iotivity/base/OcResourceHandle;[Lorg/iotivity/base/OcResourceHandle;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResources0
-(JNIEnv *env, jclass clazz, jobject jResourceCollectionHandle, jobjectArray jResourceHandleArray)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unbindResources0(
+ JNIEnv *env,
+ jclass clazz,
+ jobject jResourceCollectionHandle,
+ jobjectArray jResourceHandleArray)
{
LOGI("OcPlatform_unbindResources");
if (!jResourceCollectionHandle)
return;
}
- JniOcResourceHandle* jniOcResourceCollectionHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceCollectionHandle);
- if (!jniOcResourceCollectionHandle) return;
+ JniOcResourceHandle* jniOcResourceCollectionHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceCollectionHandle);
+ if (!jniOcResourceCollectionHandle)
+ {
+ return;
+ }
std::vector<OCResourceHandle> resourceHandleList;
int len = env->GetArrayLength(jResourceHandleArray);
return;
}
- JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ JniOcResourceHandle* jniOcResourceHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
resourceHandleList.push_back(
jniOcResourceHandle->getOCResourceHandle());
* Method: bindTypeToResource0
* Signature: (Lorg/iotivity/base/OcResourceHandle;Ljava/lang/String;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindTypeToResource0
-(JNIEnv *env, jclass clazz, jobject jResourceHandle, jstring jResourceTypeName)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_bindTypeToResource0(
+ JNIEnv *env,
+ jclass clazz,
+ jobject jResourceHandle,
+ jstring jResourceTypeName)
{
LOGI("OcPlatform_bindTypeToResource");
if (!jResourceHandle)
typeName = env->GetStringUTFChars(jResourceTypeName, NULL);
}
- JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceHandle);
+ JniOcResourceHandle* jniOcResourceHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
if (!jniOcResourceHandle) return;
try
interfaceName = env->GetStringUTFChars(jResourceInterfaceName, NULL);
}
- JniOcResourceHandle* jniOcResourceHandle = JniOcResourceHandle::getJniOcResourceHandlePtr(
- env, jResourceHandle);
- if (!jniOcResourceHandle) return;
+ JniOcResourceHandle* jniOcResourceHandle =
+ JniOcResourceHandle::getJniOcResourceHandlePtr(env, jResourceHandle);
+ if (!jniOcResourceHandle)
+ {
+ return;
+ }
try
{
* Method: startPresence0
* Signature: (I)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_startPresence0
-(JNIEnv *env, jclass clazz, jint ttl)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_startPresence0(
+ JNIEnv *env, jclass clazz, jint ttl)
{
LOGI("OcPlatform_startPresence");
* Method: stopPresence0
* Signature: ()V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_stopPresence0
-(JNIEnv *env, jclass clazz)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_stopPresence0(
+ JNIEnv *env, jclass clazz)
{
LOGI("OcPlatform_stopPresence");
* Method: subscribePresence0
* Signature: (Ljava/lang/String;ILorg/iotivity/base/OcPlatform/OnPresenceListener;)Lorg/iotivity/base/OcPresenceHandle;
*/
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence0
-(JNIEnv *env, jclass clazz, jstring jHost, jint jConnectivityType, jobject jListener)
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence0(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jint jConnectivityType,
+ jobject jListener)
{
LOGD("OcPlatform_subscribePresence");
std::string host;
JniOnPresenceListener *onPresenceListener = AddOnPresenceListener(env, jListener);
- SubscribeCallback subscribeCallback = [onPresenceListener](OCStackResult result, const unsigned int nonce,
- const std::string& hostAddress)
- {
- onPresenceListener->onPresenceCallback(result, nonce, hostAddress);
- };
+ SubscribeCallback subscribeCallback =
+ [onPresenceListener](OCStackResult result,
+ const unsigned int nonce,
+ const std::string& hostAddress)
+ {
+ onPresenceListener->onPresenceCallback(result, nonce, hostAddress);
+ };
OCPlatform::OCPresenceHandle presenceHandle;
try
return nullptr;
}
- JniOcPresenceHandle* jniPresenceHandle = new JniOcPresenceHandle(onPresenceListener, presenceHandle);
+ JniOcPresenceHandle* jniPresenceHandle =
+ new JniOcPresenceHandle(onPresenceListener, presenceHandle);
jlong jhandle = reinterpret_cast<jlong>(jniPresenceHandle);
- jobject jPresenceHandle = env->NewObject(g_cls_OcPresenceHandle, g_mid_OcPresenceHandle_N_ctor, jhandle);
+ jobject jPresenceHandle =
+ env->NewObject(g_cls_OcPresenceHandle, g_mid_OcPresenceHandle_N_ctor, jhandle);
if (!jPresenceHandle)
{
LOGE("Failed to create OcPresenceHandle");
* Signature: (Ljava/lang/String;Ljava/lang/String;I
Lorg/iotivity/base/OcPlatform/OnPresenceListener;)Lorg/iotivity/base/OcPresenceHandle;
*/
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence1
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jResourceType, jint jConnectivityType, jobject jListener)
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_subscribePresence1(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jstring jResourceType,
+ jint jConnectivityType,
+ jobject jListener)
{
LOGD("OcPlatform_subscribePresence1");
std::string host;
return nullptr;
}
- JniOcPresenceHandle* jniPresenceHandle = new JniOcPresenceHandle(onPresenceListener, presenceHandle);
+ JniOcPresenceHandle* jniPresenceHandle =
+ new JniOcPresenceHandle(onPresenceListener, presenceHandle);
jlong jhandle = reinterpret_cast<jlong>(jniPresenceHandle);
- jobject jPresenceHandle = env->NewObject(g_cls_OcPresenceHandle, g_mid_OcPresenceHandle_N_ctor, jhandle);
+ jobject jPresenceHandle =
+ env->NewObject(g_cls_OcPresenceHandle, g_mid_OcPresenceHandle_N_ctor, jhandle);
if (!jPresenceHandle)
{
LOGE("Failed to create OcPresenceHandle");
* Method: unsubscribePresence0
* Signature: (Lorg/iotivity/base/OcPresenceHandle;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unsubscribePresence0
-(JNIEnv *env, jclass clazz, jobject jPresenceHandle)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_unsubscribePresence0(
+ JNIEnv *env, jclass clazz, jobject jPresenceHandle)
{
LOGD("OcPlatform_unsubscribePresence");
if (!jPresenceHandle)
ThrowOcException(OC_STACK_INVALID_PARAM, "presenceHandle cannot be null");
return;
}
- JniOcPresenceHandle* jniPresenceHandle = JniOcPresenceHandle::getJniOcPresenceHandlePtr(env, jPresenceHandle);
- if (!jniPresenceHandle) return;
+ JniOcPresenceHandle* jniPresenceHandle =
+ JniOcPresenceHandle::getJniOcPresenceHandlePtr(env, jPresenceHandle);
+ if (!jniPresenceHandle)
+ {
+ return;
+ }
OCPresenceHandle presenceHandle = jniPresenceHandle->getOCPresenceHandle();
ThrowOcException(result, "unsubscribe presence has failed");
return;
}
- jweak jwOnPresenceListener = jniPresenceHandle->getJniOnPresenceListener()->getJWListener();
+ jweak jwOnPresenceListener =
+ jniPresenceHandle->getJniOnPresenceListener()->getJWListener();
if (jwOnPresenceListener)
{
RemoveOnPresenceListener(env, jwOnPresenceListener);
* Signature: (Ljava/lang/String;Ljava/lang/String;IZ[Ljava/lang/String;[Ljava/lang/String;)
Lorg/iotivity/base/OcResource;
*/
-JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_constructResourceObject0
-(JNIEnv *env, jclass clazz, jstring jHost, jstring jUri, jint jConnectivityType,
-jboolean jIsObservable, jobjectArray jResourceTypeArray, jobjectArray jInterfaceArray)
+JNIEXPORT jobject JNICALL Java_org_iotivity_base_OcPlatform_constructResourceObject0(
+ JNIEnv *env,
+ jclass clazz,
+ jstring jHost,
+ jstring jUri,
+ jint jConnectivityType,
+ jboolean jIsObservable,
+ jobjectArray jResourceTypeArray,
+ jobjectArray jInterfaceArray)
{
LOGD("OcPlatform_constructResourceObject");
std::string host;
* Method: sendResponse0
* Signature: (Lorg/iotivity/base/OcResourceResponse;)V
*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_sendResponse0
-(JNIEnv *env, jclass clazz, jobject jResourceResponse)
+JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_sendResponse0(
+ JNIEnv *env, jclass clazz, jobject jResourceResponse)
{
LOGD("OcPlatform_sendResponse");
if (!jResourceResponse)
return;
}
- JniOcResourceResponse *jniResponse = JniOcResourceResponse::getJniOcResourceResponsePtr(
- env, jResourceResponse);
+ JniOcResourceResponse *jniResponse =
+ JniOcResourceResponse::getJniOcResourceResponsePtr(env, jResourceResponse);
if (!jniResponse) return;
try
{
- OCStackResult result = OCPlatform::sendResponse(jniResponse->getOCResourceResponse());
+ OCStackResult result =
+ OCPlatform::sendResponse(jniResponse->getOCResourceResponse());
if (OC_STACK_OK != result)
{