Home | History | Annotate | Download | only in jni
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include "OverrideLog.h"
     18 #include "NfcJniUtil.h"
     19 #include "JavaClassConstants.h"
     20 
     21 #include <cutils/log.h>
     22 #include <JNIHelp.h>
     23 
     24 namespace android
     25 {
     26 
     27 
     28 static jboolean nativeP2pDeviceDoConnect (JNIEnv*, jobject)
     29 {
     30     ALOGD ("%s", __FUNCTION__);
     31     return JNI_TRUE;
     32 }
     33 
     34 
     35 static jboolean nativeP2pDeviceDoDisconnect (JNIEnv*, jobject)
     36 {
     37     ALOGD ("%s", __FUNCTION__);
     38     return JNI_TRUE;
     39 }
     40 
     41 
     42 static jbyteArray nativeP2pDeviceDoTransceive (JNIEnv*, jobject, jbyteArray)
     43 {
     44     ALOGD ("%s", __FUNCTION__);
     45     return NULL;
     46 }
     47 
     48 
     49 static jbyteArray nativeP2pDeviceDoReceive (JNIEnv*, jobject)
     50 {
     51     ALOGD ("%s", __FUNCTION__);
     52     return NULL;
     53 }
     54 
     55 
     56 static jboolean nativeP2pDeviceDoSend (JNIEnv*, jobject, jbyteArray)
     57 {
     58     ALOGD ("%s", __FUNCTION__);
     59     return JNI_TRUE;
     60 }
     61 
     62 
     63 /*****************************************************************************
     64 **
     65 ** Description:     JNI functions
     66 **
     67 *****************************************************************************/
     68 static JNINativeMethod gMethods[] =
     69 {
     70     {"doConnect", "()Z", (void *) nativeP2pDeviceDoConnect},
     71     {"doDisconnect", "()Z", (void *) nativeP2pDeviceDoDisconnect},
     72     {"doTransceive", "([B)[B", (void *) nativeP2pDeviceDoTransceive},
     73     {"doReceive", "()[B", (void *) nativeP2pDeviceDoReceive},
     74     {"doSend", "([B)Z", (void *) nativeP2pDeviceDoSend},
     75 };
     76 
     77 
     78 /*******************************************************************************
     79 **
     80 ** Function:        register_com_android_nfc_NativeP2pDevice
     81 **
     82 ** Description:     Regisgter JNI functions with Java Virtual Machine.
     83 **                  e: Environment of JVM.
     84 **
     85 ** Returns:         Status of registration.
     86 **
     87 *******************************************************************************/
     88 int register_com_android_nfc_NativeP2pDevice (JNIEnv* e)
     89 {
     90     return jniRegisterNativeMethods (e, gNativeP2pDeviceClassName,
     91             gMethods, NELEM(gMethods));
     92 }
     93 
     94 
     95 } // namepspace android
     96