-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/base/BaseManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
15 changes: 15 additions & 0 deletions
15
lmbluetoothsdk/src/main/java/co/lujun/lmbluetoothsdk/base/BluetoothListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |