Home | History | Annotate | Download | only in dhimpl
      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.dhimpl;
     18 
     19 import com.android.nfc.DeviceHost.NfcDepEndpoint;
     20 
     21 /**
     22  * Native interface to the P2P Initiator functions
     23  */
     24 public class NativeP2pDevice implements NfcDepEndpoint {
     25 
     26     private int mHandle;
     27 
     28     private int mMode;
     29 
     30     private byte[] mGeneralBytes;
     31 
     32     private byte mLlcpVersion;
     33 
     34     private native byte[] doReceive();
     35     @Override
     36     public byte[] receive() {
     37         return doReceive();
     38     }
     39 
     40     private native boolean doSend(byte[] data);
     41     @Override
     42     public boolean send(byte[] data) {
     43         return doSend(data);
     44     }
     45 
     46     private native boolean doConnect();
     47     @Override
     48     public boolean connect() {
     49         return doConnect();
     50     }
     51 
     52     private native boolean doDisconnect();
     53     @Override
     54     public boolean disconnect() {
     55         return doDisconnect();
     56     }
     57 
     58     public native byte[] doTransceive(byte[] data);
     59     @Override
     60     public byte[] transceive(byte[] data) {
     61         return doTransceive(data);
     62     }
     63 
     64     @Override
     65     public int getHandle() {
     66         return mHandle;
     67     }
     68 
     69     @Override
     70     public int getMode() {
     71         return mMode;
     72     }
     73 
     74     @Override
     75     public byte[] getGeneralBytes() {
     76         return mGeneralBytes;
     77     }
     78 
     79     @Override
     80     public byte getLlcpVersion() {
     81         return mLlcpVersion;
     82     }
     83 }
     84