| | |
| | | |
| | | public BleManager(Context context) { |
| | | this.mContext = context; |
| | | |
| | | if (isSupportBle()) { |
| | | if (bleBluetooth == null) { |
| | | bleBluetooth = new BleBluetooth(context); |
| | |
| | | } |
| | | |
| | | bleExceptionHandler = new DefaultBleExceptionHandler(); |
| | | } |
| | | |
| | | public void setMtu(int mtu) { |
| | | bleBluetooth.setMtu(mtu); |
| | | } |
| | | |
| | | /** |
| | |
| | | * cancel scan |
| | | */ |
| | | public void cancelScan() { |
| | | if(bleBluetooth!=null) |
| | | bleBluetooth.cancelScan(); |
| | | if (bleBluetooth != null) |
| | | bleBluetooth.cancelScan(); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | public boolean isInScanning() { |
| | | return bleBluetooth != null &&bleBluetooth.isInScanning(); |
| | | return bleBluetooth != null && bleBluetooth.isInScanning(); |
| | | } |
| | | |
| | | public boolean isConnectingOrConnected() { |
| | | return bleBluetooth != null &&bleBluetooth.isConnectingOrConnected(); |
| | | return bleBluetooth != null && bleBluetooth.isConnectingOrConnected(); |
| | | } |
| | | |
| | | public boolean isConnected() { |
| | | return bleBluetooth != null &&bleBluetooth.isConnected(); |
| | | return bleBluetooth != null && bleBluetooth.isConnected(); |
| | | } |
| | | |
| | | public boolean isServiceDiscovered() { |
| | | return bleBluetooth != null &&bleBluetooth.isServiceDiscovered(); |
| | | return bleBluetooth != null && bleBluetooth.isServiceDiscovered(); |
| | | } |
| | | |
| | | /** |