Skip to content

Commit

Permalink
Add Manger
Browse files Browse the repository at this point in the history
  • Loading branch information
whilu committed Jan 15, 2016
1 parent 3bdf3e0 commit ecaaae5
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package co.lujun.lmbluetoothsdk.base;

import android.bluetooth.BluetoothDevice;

import java.util.List;
import java.util.Set;

/**
* Author: lujun(http://blog.lujun.co)
* Date: 2016-1-15 11:52
*/
public interface BaseManager {

/**
* Is current device's bluetooth avaliable.
* @return
*/
boolean isAvaliable();

/**
* Is current device's bluetooth opened.
* @return
*/
boolean isEnabled();

/**
* Open bluetooth.
*/
void onOpenBluetooth();

/**
* Close bluetooth.
*/
void onCloseBluetooth();

/**
* Set bluetooth discoverable with specified time.
* @param time
* @return
*/
boolean setDiscoverable(int time);

/**
* Get paired devices.
* @return
*/
Set<BluetoothDevice> getBondedDevices();

/**
* Find all bluetooth devices.
* @return
*/
List<BluetoothDevice> findAllDevices();

/**
* Find a bluetooth device by mac address.
* @param mac
* @return
*/
BluetoothDevice findDeviceByMac(String mac);

/**
* Connected a bluetooth device by mac address.
* @param mac
*/
void connect(String mac);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package co.lujun.lmbluetoothsdk.base;

import android.bluetooth.BluetoothDevice;

/**
* Author: lujun(http://blog.lujun.co)
* Date: 2016-1-15 10:53
*/
public interface BluetoothListener {

void onActionStateChanged(int preState, int state);
void onActionDiscoveryStateChanged(String discoveryState);
void onActionFound(BluetoothDevice device);
void onActionScanModeChanged(int preScanMode, int scanMode);
}

0 comments on commit ecaaae5

Please sign in to comment.