Imported Upstream version 1.0.1
[platform/upstream/iotivity.git] / android / android_api / base / jni / JniCaInterface.c
1 /*
2 * //******************************************************************
3 * //
4 * // Copyright 2015 Intel Corporation.
5 * //
6 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 * //
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
11 * //
12 * //      http://www.apache.org/licenses/LICENSE-2.0
13 * //
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.
19 * //
20 * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 */
22
23 #include <jni.h>
24 #include <android/log.h>
25 #include <stdio.h>
26 #include "cainterface.h"
27 #include "JniCaInterface.h"
28
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__)
32
33 JNIEXPORT jint JNI_OnLoad(JavaVM *jvm, void *reserved)
34 {
35     LOGI("CaInterface_initialize");
36     CANativeJNISetJavaVM(jvm);
37
38     return JNI_VERSION_1_6;
39 }
40
41 void JNI_OnUnload(JavaVM *jvm, void *reserved)
42 {
43     return;
44 }
45
46 JNIEXPORT void JNICALL
47 Java_org_iotivity_ca_CaInterface_initialize
48 (JNIEnv *env, jclass clazz, jobject context)
49 {
50     LOGI("CaInterface_initialize");
51
52     CANativeJNISetContext(env, context);
53 }