2 * //******************************************************************
4 * // Copyright 2016 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 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
22 #include "JniConfirmNumListener.h"
24 JniConfirmNumListener::JniConfirmNumListener(JNIEnv *env, jobject jListener)
26 m_jgListener = env->NewGlobalRef(jListener);
29 JniConfirmNumListener::~JniConfirmNumListener()
31 LOGI("~JniConfirmNumListener()");
35 JNIEnv *env = GetJNIEnv(ret);
36 if (NULL == env) return;
37 env->DeleteGlobalRef(m_jgListener);
38 if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();
42 OCStackResult JniConfirmNumListener::confirmMutualVerifNumCallback()
45 JNIEnv *env = GetJNIEnv(ret);
48 return OC_STACK_ERROR;
51 jclass clsL = env->GetObjectClass(m_jgListener);
55 if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();
56 return OC_STACK_ERROR;
59 jmethodID midL = env->GetMethodID(clsL, "confirmNumListener", "()I");
62 if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();
63 return OC_STACK_ERROR;
66 OCStackResult result = (OCStackResult) env->CallIntMethod(m_jgListener, midL);
68 if (env->ExceptionCheck())
70 LOGE("Java exception is thrown");
71 env->ExceptionClear();
74 if (JNI_EDETACHED == ret) g_jvm->DetachCurrentThread();