Home | History | Annotate | Download | only in nfc
      1 /*
      2  * Copyright (C) 2010 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 package com.android.nfc;
     18 
     19 /**
     20  * Native interface to the P2P Initiator functions
     21  */
     22 public class NativeP2pDevice {
     23 
     24     /**
     25     * Peer-to-Peer Target.
     26     */
     27     public static final short MODE_P2P_TARGET          = 0x00;
     28 
     29     /**
     30     * Peer-to-Peer Initiator.
     31     */
     32     public static final short MODE_P2P_INITIATOR       = 0x01;
     33 
     34     /**
     35     * Invalid target type.
     36     */
     37     public static final short MODE_INVALID             = 0xff;
     38 
     39     private int mHandle;
     40 
     41     private int mMode;
     42 
     43     private byte[] mGeneralBytes;
     44 
     45     public native byte[] doReceive();
     46 
     47     public native boolean doSend(byte[] data);
     48 
     49     public native boolean doConnect();
     50 
     51     public native boolean doDisconnect();
     52 
     53     public native byte[] doTransceive(byte[] data);
     54 
     55     public int getHandle() {
     56         return mHandle;
     57     }
     58 
     59     public int getMode() {
     60         return mMode;
     61     }
     62 
     63     public byte[] getGeneralBytes() {
     64         return mGeneralBytes;
     65     }
     66 
     67 }
     68