|
|
@@ -22,6 +22,7 @@ import id.kalanusa.flutter_zsdk.bluetoothconnectionhandler.BluetoothConnectionHa
|
|
22
|
22
|
import id.kalanusa.flutter_zsdk.bluetoothconnectionhandler.BluetoothConnectionHolder;
|
|
23
|
23
|
import id.kalanusa.flutter_zsdk.bluetoothdiscoveryhandler.BluetoothDiscoveryHandler;
|
|
24
|
24
|
import id.kalanusa.flutter_zsdk.bluetoothdiscoveryhandler.BluetoothPrinter;
|
|
|
25
|
+import id.kalanusa.flutter_zsdk.zplprinthandler.ZplPrintHandler;
|
|
25
|
26
|
import io.flutter.Log;
|
|
26
|
27
|
import io.flutter.embedding.engine.dart.DartExecutor;
|
|
27
|
28
|
import io.flutter.embedding.engine.plugins.FlutterPlugin;
|
|
|
@@ -54,6 +55,7 @@ public class FlutterZsdkPlugin implements FlutterPlugin, MethodCallHandler, Acti
|
|
54
|
55
|
public BluetoothConnectionHolder bluetoothConnectionHolder;
|
|
55
|
56
|
|
|
56
|
57
|
public BluetoothConnectionHandler bluetoothConnectionHandler;
|
|
|
58
|
+ public ZplPrintHandler zplPrintHandler;
|
|
57
|
59
|
|
|
58
|
60
|
|
|
59
|
61
|
@Override
|
|
|
@@ -64,6 +66,8 @@ public class FlutterZsdkPlugin implements FlutterPlugin, MethodCallHandler, Acti
|
|
64
|
66
|
dartExecutor = Objects.requireNonNull(flutterPluginBinding.getFlutterEngine()).getDartExecutor();
|
|
65
|
67
|
binaryMessenger = dartExecutor.getBinaryMessenger();
|
|
66
|
68
|
|
|
|
69
|
+
|
|
|
70
|
+ bluetoothConnectionHolder = new BluetoothConnectionHolder(null);
|
|
67
|
71
|
}
|
|
68
|
72
|
|
|
69
|
73
|
@Override
|
|
|
@@ -90,19 +94,26 @@ public class FlutterZsdkPlugin implements FlutterPlugin, MethodCallHandler, Acti
|
|
90
|
94
|
|
|
91
|
95
|
@Override
|
|
92
|
96
|
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
|
|
93
|
|
- Log.w("From Native (Android)", "ini di FLutterZsdkPlugin");
|
|
|
97
|
+ Log.w("From Native (Android)", "ini di FlutterZsdkPlugin");
|
|
94
|
98
|
|
|
95
|
99
|
switch(call.method) {
|
|
96
|
100
|
case "bluetoothOpenConnection":
|
|
97
|
101
|
case "isConnected":
|
|
98
|
102
|
case "bluetoothCloseConnection":
|
|
99
|
103
|
if (bluetoothConnectionHandler == null) {
|
|
100
|
|
- bluetoothConnectionHandler = new BluetoothConnectionHandler(bluetoothConnectionHolder);
|
|
|
104
|
+ bluetoothConnectionHandler = new BluetoothConnectionHandler();
|
|
101
|
105
|
}
|
|
102
|
106
|
|
|
103
|
107
|
bluetoothConnectionHandler.handle(call, result);
|
|
104
|
108
|
break;
|
|
105
|
109
|
|
|
|
110
|
+ case "printZplOverBluetooth":
|
|
|
111
|
+ if (zplPrintHandler == null) {
|
|
|
112
|
+ zplPrintHandler = new ZplPrintHandler();
|
|
|
113
|
+ }
|
|
|
114
|
+
|
|
|
115
|
+ zplPrintHandler.handle(call, result);
|
|
|
116
|
+ break;
|
|
106
|
117
|
}
|
|
107
|
118
|
}
|
|
108
|
119
|
|