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 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 #include "JniOcPresenceHandle.h"
23 #include "OCPlatform.h"
25 JniOcPresenceHandle::JniOcPresenceHandle(JniOnPresenceListener* jniListener, OCPresenceHandle presenceHandle)
26 : m_jniListener(jniListener), m_presenceHandle(presenceHandle)
29 JniOcPresenceHandle::~JniOcPresenceHandle()
31 LOGD("~JniOcPresenceHandle()");
33 //delete m_jniListener;
34 m_presenceHandle = nullptr;
37 JniOcPresenceHandle* JniOcPresenceHandle::getJniOcPresenceHandlePtr
38 (JNIEnv *env, jobject thiz)
40 JniOcPresenceHandle *handle = GetHandle<JniOcPresenceHandle>(env, thiz);
41 if (env->ExceptionCheck())
43 LOGE("Failed to get native handle from OcPresenceHandle");
47 ThrowOcException(JNI_NO_NATIVE_POINTER, "");
52 OCPresenceHandle JniOcPresenceHandle::getOCPresenceHandle()
54 return this->m_presenceHandle;
57 JniOnPresenceListener* JniOcPresenceHandle::getJniOnPresenceListener()
59 return this->m_jniListener;
63 * Class: org_iotivity_base_OcPresenceHandle
67 JNIEXPORT void JNICALL Java_org_iotivity_base_OcPresenceHandle_dispose
68 (JNIEnv *env, jobject thiz)
70 LOGD("OcPresenceHandle_dispose");
71 JniOcPresenceHandle *presenceHandle = JniOcPresenceHandle::getJniOcPresenceHandlePtr(env, thiz);
72 delete presenceHandle;