1/*
2 * Copyright (C) 2014 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 android.bluetooth.client.pbap;
18
19import android.bluetooth.BluetoothSocket;
20
21import java.io.DataInputStream;
22import java.io.DataOutputStream;
23import java.io.IOException;
24import java.io.InputStream;
25import java.io.OutputStream;
26
27import javax.obex.ObexTransport;
28
29class BluetoothPbapObexTransport implements ObexTransport {
30
31    private BluetoothSocket mSocket = null;
32
33    public BluetoothPbapObexTransport(BluetoothSocket rfs) {
34        super();
35        mSocket = rfs;
36    }
37
38    @Override
39    public void close() throws IOException {
40        mSocket.close();
41    }
42
43    @Override
44    public DataInputStream openDataInputStream() throws IOException {
45        return new DataInputStream(openInputStream());
46    }
47
48    @Override
49    public DataOutputStream openDataOutputStream() throws IOException {
50        return new DataOutputStream(openOutputStream());
51    }
52
53    @Override
54    public InputStream openInputStream() throws IOException {
55        return mSocket.getInputStream();
56    }
57
58    @Override
59    public OutputStream openOutputStream() throws IOException {
60        return mSocket.getOutputStream();
61    }
62
63    @Override
64    public void connect() throws IOException {
65    }
66
67    @Override
68    public void create() throws IOException {
69    }
70
71    @Override
72    public void disconnect() throws IOException {
73    }
74
75    @Override
76    public void listen() throws IOException {
77    }
78
79    public boolean isConnected() throws IOException {
80        // return true;
81        return mSocket.isConnected();
82    }
83}
84