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 * LlcpClientSocket represents a LLCP Connection-Oriented client to be used in a 21 * connection-oriented communication 22 */ 23 public class NativeLlcpSocket { 24 25 private int mHandle; 26 27 private int mSap; 28 29 private int mLocalMiu; 30 31 private int mLocalRw; 32 33 public NativeLlcpSocket(){ 34 35 } 36 37 public NativeLlcpSocket(int sap, int miu, int rw){ 38 mSap = sap; 39 mLocalMiu = miu; 40 mLocalRw = rw; 41 } 42 43 public native boolean doConnect(int nSap); 44 45 public native boolean doConnectBy(String sn); 46 47 public native boolean doClose(); 48 49 public native boolean doSend(byte[] data); 50 51 public native int doReceive(byte[] recvBuff); 52 53 public native int doGetRemoteSocketMiu(); 54 55 public native int doGetRemoteSocketRw(); 56 57 public int getSap(){ 58 return mSap; 59 } 60 61 public int getMiu(){ 62 return mLocalMiu; 63 } 64 65 public int getRw(){ 66 return mLocalRw; 67 } 68 69 public int getHandle(){ 70 return mHandle; 71 } 72 73 } 74