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 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 #include <android/log.h>
26 #include "cainterface.h"
27 #include "JniCaInterface.h"
29 #define LOG_TAG "JNI_CA_INTERFACE"
30 #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
31 #define LOGE(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
33 JNIEXPORT jint JNI_OnLoad(JavaVM *jvm, void *reserved)
35 LOGI("CaInterface_initialize");
36 CANativeJNISetJavaVM(jvm);
38 return JNI_VERSION_1_6;
41 void JNI_OnUnload(JavaVM *jvm, void *reserved)
46 JNIEXPORT void JNICALL
47 Java_org_iotivity_ca_CaInterface_initialize
48 (JNIEnv *env, jclass clazz, jobject context)
50 LOGI("CaInterface_initialize");
52 CANativeJNISetContext(env, context);
54 CAResult_t res = CAInitialize();
56 if (CA_STATUS_OK != res)
58 LOGE("Could not Initialize");