|
|
|
@ -34,17 +34,16 @@ class DjPrinter {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void cancelDiscovery() {
|
|
|
|
|
if (_discoveryStream != null) {
|
|
|
|
|
_discoveryStream!.cancel();
|
|
|
|
|
_discoveryStream?.cancel();
|
|
|
|
|
_discoveryStream = null;
|
|
|
|
|
}
|
|
|
|
|
print('结束搜索');
|
|
|
|
|
disposeDiscovery();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const EventChannel _connectChannel = EventChannel("com.connect");
|
|
|
|
|
StreamSubscription? _connectStream;
|
|
|
|
|
|
|
|
|
|
StreamSubscription addConnectListen(
|
|
|
|
|
{required void Function() onConnect,
|
|
|
|
|
StreamSubscription addConnectListen({required void Function() onConnect,
|
|
|
|
|
required void Function() onDisconnect}) {
|
|
|
|
|
if (_connectStream == null) {
|
|
|
|
|
return _connectChannel.receiveBroadcastStream().listen((data) {
|
|
|
|
@ -66,9 +65,8 @@ class DjPrinter {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool?> get startSearch async {
|
|
|
|
|
final res = await _channel.invokeMethod('startSearch');
|
|
|
|
|
return res;
|
|
|
|
|
void get startSearch {
|
|
|
|
|
final res = _channel.invokeMethod('startSearch');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool?> connect(String address) async {
|
|
|
|
@ -76,6 +74,16 @@ class DjPrinter {
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void disposeDiscovery() {
|
|
|
|
|
print('disposeDiscovery');
|
|
|
|
|
final res = _channel.invokeMethod('disposeDiscovery');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool?> disposeConnect() async {
|
|
|
|
|
final res = await _channel.invokeMethod('disposeConnect');
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool?> init() async {
|
|
|
|
|
final res = await _channel.invokeMethod('init');
|
|
|
|
|
return res;
|
|
|
|
@ -104,8 +112,7 @@ class DjPrinter {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool?> print(
|
|
|
|
|
{required String code,
|
|
|
|
|
Future<bool?> printAScode({required String code,
|
|
|
|
|
required String channel,
|
|
|
|
|
required String country,
|
|
|
|
|
required String countStr,
|
|
|
|
|