From f0b2982229b23baa44dfc64111b99eed68136ec5 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 30 Mar 2022 17:24:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=8F=90=E7=A4=BA=E6=96=87?= =?UTF-8?q?=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/dj/printer/dj_printer/Blutooth.java | 2 +- .../main/java/com/dj/printer/dj_printer/DjPrinterPlugin.java | 1 + lib/dj_printer.dart | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) 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; }