public class BluetoothAPI extends java.lang.Object implements InterfaceAPI
| 限定符和类型 | 字段和说明 |
|---|---|
protected int |
mTimeAfterRead |
static int |
READBYTEMAX |
static int |
READTIMEOUT |
static int |
WRITEBYTEMAX |
| 构造器和说明 |
|---|
BluetoothAPI(android.content.Context context) |
| 限定符和类型 | 方法和说明 |
|---|---|
java.lang.String |
byte2hex(byte[] buffer) |
boolean |
cancelDiscovery() |
int |
checkDevice(java.lang.String macAddress) |
boolean |
closeBluetooth() |
int |
closeDevice() |
void |
finallize() |
java.lang.String |
getAddress() |
java.util.Set<android.bluetooth.BluetoothDevice> |
getBondedDevices() |
java.lang.String |
getName() |
int |
getState() |
boolean |
isBTSupport() |
java.lang.Boolean |
isConnected()
判断是否连接
|
boolean |
isDiscovery() |
boolean |
isEnabledBluetooth() |
java.lang.Boolean |
isOpen() |
boolean |
openBluetooth(int waitTime) |
int |
openDevice() |
int |
readBuffer(byte[] data,
int readSize,
int ReadTimeOut) |
int |
readBuffer(byte[] readBuffer,
int offsetSize,
int readSize,
int ReadTimeOut) |
boolean |
setDiscoverable(int time) |
boolean |
startDiscovery() |
int |
writeBuffer(byte[] writeBuffer,
int offsetSize,
int writeSize,
int waitTime) |
public static final int WRITEBYTEMAX
public static final int READBYTEMAX
public static final int READTIMEOUT
protected int mTimeAfterRead
public boolean isBTSupport()
public java.lang.String getAddress()
public java.lang.String getName()
public int getState()
public java.lang.Boolean isConnected()
public java.lang.Boolean isOpen()
isOpen 在接口中 InterfaceAPIpublic boolean openBluetooth(int waitTime)
waitTime - 使设置可用时的超时的时间public boolean isEnabledBluetooth()
public boolean closeBluetooth()
public boolean setDiscoverable(int time)
public boolean startDiscovery()
public boolean isDiscovery()
public boolean cancelDiscovery()
public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices()
public int checkDevice(java.lang.String macAddress)
public int openDevice()
openDevice 在接口中 InterfaceAPIpublic int closeDevice()
closeDevice 在接口中 InterfaceAPIpublic int writeBuffer(byte[] writeBuffer,
int offsetSize,
int writeSize,
int waitTime)
writeBuffer 在接口中 InterfaceAPIpublic int readBuffer(byte[] readBuffer,
int offsetSize,
int readSize,
int ReadTimeOut)
readBuffer 在接口中 InterfaceAPIpublic int readBuffer(byte[] data,
int readSize,
int ReadTimeOut)
throws java.io.IOException,
java.net.SocketTimeoutException,
java.lang.InterruptedException
java.io.IOExceptionjava.net.SocketTimeoutExceptionjava.lang.InterruptedExceptionpublic java.lang.String byte2hex(byte[] buffer)
public void finallize()