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