|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.avetana.bluetooth.connection.BTConnection
The top-level connection class.
COPYRIGHT:
(c) Copyright 2004 Avetana GmbH ALL RIGHTS RESERVED.
This file is part of the Avetana bluetooth API for Linux.
The Avetana bluetooth API for Linux is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
The Avetana bluetooth API is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The development of the Avetana bluetooth API is based on the work of
Christian Lorenz (see the Javabluetooth Stack at http://www.javabluetooth.org) for some classes,
on the work of the jbluez team (see http://jbluez.sourceforge.net/) and
on the work of the bluez team (see the BlueZ linux Stack at http://www.bluez.org) for the C code.
Classes, part of classes, C functions or part of C functions programmed by these teams and/or persons
are explicitly mentioned.
Description:
The top-level connection class. Each connection (whatever the protocol) can be described with at least three
variables:
| Field Summary | |
protected boolean |
closed
If true, the connection was closed by the client or the server. |
protected java.util.Vector |
dataBuffer
This is where incoming data is buffered |
protected int |
fid
The connection ID |
protected RemoteDevice |
m_remote
The remote device the local BT device is connected to. |
| Constructor Summary | |
protected |
BTConnection(int a_fid)
Creates a new instance of BTConnection and set the value of the connection ID |
protected |
BTConnection(int fid,
java.lang.String addr)
Creates a new instance of BTConnection. |
| Method Summary | |
protected int |
available()
|
void |
close()
Closes the current connection |
int |
getConnectionID()
Returns the connection ID |
RemoteDevice |
getRemoteDevice()
Returns the remote device |
boolean |
isClosed()
Returns the state of the connection |
void |
newData(byte[] data)
Called from BlueZ when new data has arrived for that connection |
protected byte[] |
read(int len)
Read the most recent packet of data (L2CAP) or all data available < len for RFComm |
void |
setRemoteDevice(RemoteDevice a_device)
Sets the remote device |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected boolean closed
true, the connection was closed by the client or the server. Default value is false
protected int fid
protected RemoteDevice m_remote
protected java.util.Vector dataBuffer
| Constructor Detail |
protected BTConnection(int a_fid)
a_fid - The connection ID
protected BTConnection(int fid,
java.lang.String addr)
fid - The connection IDaddr - The address of the remote device| Method Detail |
public void setRemoteDevice(RemoteDevice a_device)
a_device - The new remote devicepublic RemoteDevice getRemoteDevice()
public boolean isClosed()
true - If the connection is closed.false - Otherwisepublic int getConnectionID()
public void close()
public void newData(byte[] data)
data -
protected byte[] read(int len)
throws java.io.IOException
len - 0 for L2CAP reading of one packet or > 0 for RFComm to specify the maximum number of bytes requested
java.io.IOException - if the connection is closed.
protected int available()
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||