diff --git a/android/src/main/java/com/dj/printer/dj_printer/Blutooth.java b/android/src/main/java/com/dj/printer/dj_printer/Blutooth.java index 0eadfe7..dae059a 100644 --- a/android/src/main/java/com/dj/printer/dj_printer/Blutooth.java +++ b/android/src/main/java/com/dj/printer/dj_printer/Blutooth.java @@ -42,7 +42,7 @@ public class Blutooth { bluetoothSetup(); searchflags = false; disconnectflags = false; - System.out.println("初始化完成"); + System.out.println("打印机蓝牙初始化完成"); } //初始化连接监听 diff --git a/android/src/main/java/com/dj/printer/dj_printer/DjPrinterPlugin.java b/android/src/main/java/com/dj/printer/dj_printer/DjPrinterPlugin.java index c3f7edf..d7807a4 100644 --- a/android/src/main/java/com/dj/printer/dj_printer/DjPrinterPlugin.java +++ b/android/src/main/java/com/dj/printer/dj_printer/DjPrinterPlugin.java @@ -77,6 +77,7 @@ public class DjPrinterPlugin implements FlutterPlugin, MethodCallHandler { e.printStackTrace(); } } else if (call.method.equals("init")) { + System.out.println("打印机初始化"); blutooth.init(); asPrint = new AsPrint(); diff --git a/lib/dj_printer.dart b/lib/dj_printer.dart index 8ae9ffd..1e4e752 100644 --- a/lib/dj_printer.dart +++ b/lib/dj_printer.dart @@ -69,6 +69,10 @@ class DjPrinter { final res = _channel.invokeMethod('startSearch'); } + bool _hasInit = false; + + bool get hasInit => _hasInit; + Future connect(String address) async { final res = await _channel.invokeMethod('connect', {'address': address}); return res; @@ -86,6 +90,7 @@ class DjPrinter { Future init() async { final res = await _channel.invokeMethod('init'); + _hasInit = true; return res; }