97936046e0
* Implement hasPermissions api * Bump minimum MacOS version to 10.15 * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1310 lines
44 KiB
Dart
1310 lines
44 KiB
Dart
// Autogenerated from Pigeon (v26.1.4), do not edit directly.
|
|
// See also: https://pub.dev/packages/pigeon
|
|
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, omit_obvious_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers
|
|
|
|
import 'dart:async';
|
|
import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List;
|
|
|
|
import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer;
|
|
import 'package:flutter/services.dart';
|
|
|
|
PlatformException _createConnectionError(String channelName) {
|
|
return PlatformException(
|
|
code: 'channel-error',
|
|
message: 'Unable to establish connection on channel: "$channelName".',
|
|
);
|
|
}
|
|
|
|
List<Object?> wrapResponse(
|
|
{Object? result, PlatformException? error, bool empty = false}) {
|
|
if (empty) {
|
|
return <Object?>[];
|
|
}
|
|
if (error == null) {
|
|
return <Object?>[result];
|
|
}
|
|
return <Object?>[error.code, error.message, error.details];
|
|
}
|
|
|
|
bool _deepEquals(Object? a, Object? b) {
|
|
if (a is List && b is List) {
|
|
return a.length == b.length &&
|
|
a.indexed
|
|
.every(((int, dynamic) item) => _deepEquals(item.$2, b[item.$1]));
|
|
}
|
|
if (a is Map && b is Map) {
|
|
return a.length == b.length &&
|
|
a.entries.every((MapEntry<Object?, Object?> entry) =>
|
|
(b as Map<Object?, Object?>).containsKey(entry.key) &&
|
|
_deepEquals(entry.value, b[entry.key]));
|
|
}
|
|
return a == b;
|
|
}
|
|
|
|
enum UniversalBleLogLevel {
|
|
none,
|
|
error,
|
|
warning,
|
|
info,
|
|
debug,
|
|
verbose,
|
|
}
|
|
|
|
/// Unified error codes for all platforms
|
|
enum UniversalBleErrorCode {
|
|
unknownError,
|
|
failed,
|
|
notSupported,
|
|
notImplemented,
|
|
channelError,
|
|
bluetoothNotAvailable,
|
|
bluetoothNotEnabled,
|
|
bluetoothNotAllowed,
|
|
bluetoothUnauthorized,
|
|
deviceDisconnected,
|
|
connectionTimeout,
|
|
connectionFailed,
|
|
connectionRejected,
|
|
connectionLimitExceeded,
|
|
connectionAlreadyExists,
|
|
connectionTerminated,
|
|
connectionInProgress,
|
|
illegalArgument,
|
|
deviceNotFound,
|
|
serviceNotFound,
|
|
characteristicNotFound,
|
|
invalidServiceUuid,
|
|
invalidCharacteristicUuid,
|
|
invalidOffset,
|
|
invalidAttributeLength,
|
|
invalidPdu,
|
|
invalidHandle,
|
|
readFailed,
|
|
readNotPermitted,
|
|
writeFailed,
|
|
writeNotPermitted,
|
|
writeRequestBusy,
|
|
invalidAction,
|
|
operationNotSupported,
|
|
operationTimeout,
|
|
operationCancelled,
|
|
operationInProgress,
|
|
characteristicDoesNotSupportRead,
|
|
characteristicDoesNotSupportWrite,
|
|
characteristicDoesNotSupportWriteWithoutResponse,
|
|
characteristicDoesNotSupportNotify,
|
|
characteristicDoesNotSupportIndicate,
|
|
notPaired,
|
|
notPairable,
|
|
alreadyPaired,
|
|
pairingFailed,
|
|
pairingCancelled,
|
|
pairingTimeout,
|
|
pairingNotAllowed,
|
|
authenticationFailure,
|
|
insufficientAuthentication,
|
|
insufficientAuthorization,
|
|
insufficientEncryption,
|
|
insufficientKeySize,
|
|
protectionLevelNotMet,
|
|
accessDenied,
|
|
unpairingFailed,
|
|
alreadyUnpaired,
|
|
scanFailed,
|
|
stoppingScanInProgress,
|
|
webBluetoothGloballyDisabled,
|
|
}
|
|
|
|
class UniversalBleScanResult {
|
|
UniversalBleScanResult({
|
|
required this.deviceId,
|
|
this.name,
|
|
this.isPaired,
|
|
this.rssi,
|
|
this.manufacturerDataList,
|
|
this.services,
|
|
this.timestamp,
|
|
});
|
|
|
|
String deviceId;
|
|
|
|
String? name;
|
|
|
|
bool? isPaired;
|
|
|
|
int? rssi;
|
|
|
|
List<UniversalManufacturerData>? manufacturerDataList;
|
|
|
|
List<String>? services;
|
|
|
|
int? timestamp;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[
|
|
deviceId,
|
|
name,
|
|
isPaired,
|
|
rssi,
|
|
manufacturerDataList,
|
|
services,
|
|
timestamp,
|
|
];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UniversalBleScanResult decode(Object result) {
|
|
result as List<Object?>;
|
|
return UniversalBleScanResult(
|
|
deviceId: result[0]! as String,
|
|
name: result[1] as String?,
|
|
isPaired: result[2] as bool?,
|
|
rssi: result[3] as int?,
|
|
manufacturerDataList:
|
|
(result[4] as List<Object?>?)?.cast<UniversalManufacturerData>(),
|
|
services: (result[5] as List<Object?>?)?.cast<String>(),
|
|
timestamp: result[6] as int?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UniversalBleScanResult || other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
class UniversalBleService {
|
|
UniversalBleService({
|
|
required this.uuid,
|
|
this.characteristics,
|
|
});
|
|
|
|
String uuid;
|
|
|
|
List<UniversalBleCharacteristic>? characteristics;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[
|
|
uuid,
|
|
characteristics,
|
|
];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UniversalBleService decode(Object result) {
|
|
result as List<Object?>;
|
|
return UniversalBleService(
|
|
uuid: result[0]! as String,
|
|
characteristics:
|
|
(result[1] as List<Object?>?)?.cast<UniversalBleCharacteristic>(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UniversalBleService || other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
class UniversalBleCharacteristic {
|
|
UniversalBleCharacteristic({
|
|
required this.uuid,
|
|
required this.properties,
|
|
required this.descriptors,
|
|
});
|
|
|
|
String uuid;
|
|
|
|
List<int> properties;
|
|
|
|
List<UniversalBleDescriptor> descriptors;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[
|
|
uuid,
|
|
properties,
|
|
descriptors,
|
|
];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UniversalBleCharacteristic decode(Object result) {
|
|
result as List<Object?>;
|
|
return UniversalBleCharacteristic(
|
|
uuid: result[0]! as String,
|
|
properties: (result[1] as List<Object?>?)!.cast<int>(),
|
|
descriptors:
|
|
(result[2] as List<Object?>?)!.cast<UniversalBleDescriptor>(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UniversalBleCharacteristic ||
|
|
other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
class UniversalBleDescriptor {
|
|
UniversalBleDescriptor({
|
|
required this.uuid,
|
|
});
|
|
|
|
String uuid;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[
|
|
uuid,
|
|
];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UniversalBleDescriptor decode(Object result) {
|
|
result as List<Object?>;
|
|
return UniversalBleDescriptor(
|
|
uuid: result[0]! as String,
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UniversalBleDescriptor || other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
/// Scan Filters
|
|
class UniversalScanFilter {
|
|
UniversalScanFilter({
|
|
required this.withServices,
|
|
required this.withNamePrefix,
|
|
required this.withManufacturerData,
|
|
});
|
|
|
|
List<String> withServices;
|
|
|
|
List<String> withNamePrefix;
|
|
|
|
List<UniversalManufacturerDataFilter> withManufacturerData;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[
|
|
withServices,
|
|
withNamePrefix,
|
|
withManufacturerData,
|
|
];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UniversalScanFilter decode(Object result) {
|
|
result as List<Object?>;
|
|
return UniversalScanFilter(
|
|
withServices: (result[0] as List<Object?>?)!.cast<String>(),
|
|
withNamePrefix: (result[1] as List<Object?>?)!.cast<String>(),
|
|
withManufacturerData: (result[2] as List<Object?>?)!
|
|
.cast<UniversalManufacturerDataFilter>(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UniversalScanFilter || other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
class UniversalManufacturerDataFilter {
|
|
UniversalManufacturerDataFilter({
|
|
required this.companyIdentifier,
|
|
this.data,
|
|
this.mask,
|
|
});
|
|
|
|
int companyIdentifier;
|
|
|
|
Uint8List? data;
|
|
|
|
Uint8List? mask;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[
|
|
companyIdentifier,
|
|
data,
|
|
mask,
|
|
];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UniversalManufacturerDataFilter decode(Object result) {
|
|
result as List<Object?>;
|
|
return UniversalManufacturerDataFilter(
|
|
companyIdentifier: result[0]! as int,
|
|
data: result[1] as Uint8List?,
|
|
mask: result[2] as Uint8List?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UniversalManufacturerDataFilter ||
|
|
other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
class UniversalManufacturerData {
|
|
UniversalManufacturerData({
|
|
required this.companyIdentifier,
|
|
required this.data,
|
|
});
|
|
|
|
int companyIdentifier;
|
|
|
|
Uint8List data;
|
|
|
|
List<Object?> _toList() {
|
|
return <Object?>[
|
|
companyIdentifier,
|
|
data,
|
|
];
|
|
}
|
|
|
|
Object encode() {
|
|
return _toList();
|
|
}
|
|
|
|
static UniversalManufacturerData decode(Object result) {
|
|
result as List<Object?>;
|
|
return UniversalManufacturerData(
|
|
companyIdentifier: result[0]! as int,
|
|
data: result[1]! as Uint8List,
|
|
);
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
bool operator ==(Object other) {
|
|
if (other is! UniversalManufacturerData ||
|
|
other.runtimeType != runtimeType) {
|
|
return false;
|
|
}
|
|
if (identical(this, other)) {
|
|
return true;
|
|
}
|
|
return _deepEquals(encode(), other.encode());
|
|
}
|
|
|
|
@override
|
|
// ignore: avoid_equals_and_hash_code_on_mutable_classes
|
|
int get hashCode => Object.hashAll(_toList());
|
|
}
|
|
|
|
class _PigeonCodec extends StandardMessageCodec {
|
|
const _PigeonCodec();
|
|
@override
|
|
void writeValue(WriteBuffer buffer, Object? value) {
|
|
if (value is int) {
|
|
buffer.putUint8(4);
|
|
buffer.putInt64(value);
|
|
} else if (value is UniversalBleLogLevel) {
|
|
buffer.putUint8(129);
|
|
writeValue(buffer, value.index);
|
|
} else if (value is UniversalBleErrorCode) {
|
|
buffer.putUint8(130);
|
|
writeValue(buffer, value.index);
|
|
} else if (value is UniversalBleScanResult) {
|
|
buffer.putUint8(131);
|
|
writeValue(buffer, value.encode());
|
|
} else if (value is UniversalBleService) {
|
|
buffer.putUint8(132);
|
|
writeValue(buffer, value.encode());
|
|
} else if (value is UniversalBleCharacteristic) {
|
|
buffer.putUint8(133);
|
|
writeValue(buffer, value.encode());
|
|
} else if (value is UniversalBleDescriptor) {
|
|
buffer.putUint8(134);
|
|
writeValue(buffer, value.encode());
|
|
} else if (value is UniversalScanFilter) {
|
|
buffer.putUint8(135);
|
|
writeValue(buffer, value.encode());
|
|
} else if (value is UniversalManufacturerDataFilter) {
|
|
buffer.putUint8(136);
|
|
writeValue(buffer, value.encode());
|
|
} else if (value is UniversalManufacturerData) {
|
|
buffer.putUint8(137);
|
|
writeValue(buffer, value.encode());
|
|
} else {
|
|
super.writeValue(buffer, value);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Object? readValueOfType(int type, ReadBuffer buffer) {
|
|
switch (type) {
|
|
case 129:
|
|
final value = readValue(buffer) as int?;
|
|
return value == null ? null : UniversalBleLogLevel.values[value];
|
|
case 130:
|
|
final value = readValue(buffer) as int?;
|
|
return value == null ? null : UniversalBleErrorCode.values[value];
|
|
case 131:
|
|
return UniversalBleScanResult.decode(readValue(buffer)!);
|
|
case 132:
|
|
return UniversalBleService.decode(readValue(buffer)!);
|
|
case 133:
|
|
return UniversalBleCharacteristic.decode(readValue(buffer)!);
|
|
case 134:
|
|
return UniversalBleDescriptor.decode(readValue(buffer)!);
|
|
case 135:
|
|
return UniversalScanFilter.decode(readValue(buffer)!);
|
|
case 136:
|
|
return UniversalManufacturerDataFilter.decode(readValue(buffer)!);
|
|
case 137:
|
|
return UniversalManufacturerData.decode(readValue(buffer)!);
|
|
default:
|
|
return super.readValueOfType(type, buffer);
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Flutter -> Native
|
|
class UniversalBlePlatformChannel {
|
|
/// Constructor for [UniversalBlePlatformChannel]. The [binaryMessenger] named argument is
|
|
/// available for dependency injection. If it is left null, the default
|
|
/// BinaryMessenger will be used which routes to the host platform.
|
|
UniversalBlePlatformChannel(
|
|
{BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
|
|
: pigeonVar_binaryMessenger = binaryMessenger,
|
|
pigeonVar_messageChannelSuffix =
|
|
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
|
|
final BinaryMessenger? pigeonVar_binaryMessenger;
|
|
|
|
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
|
|
|
|
final String pigeonVar_messageChannelSuffix;
|
|
|
|
Future<int> getBluetoothAvailabilityState() async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.getBluetoothAvailabilityState$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as int?)!;
|
|
}
|
|
}
|
|
|
|
Future<bool> hasPermissions(bool withAndroidFineLocation) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.hasPermissions$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[withAndroidFineLocation]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
}
|
|
}
|
|
|
|
Future<void> requestPermissions(bool withAndroidFineLocation) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.requestPermissions$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[withAndroidFineLocation]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<bool> enableBluetooth() async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.enableBluetooth$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
}
|
|
}
|
|
|
|
Future<bool> disableBluetooth() async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.disableBluetooth$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
}
|
|
}
|
|
|
|
Future<void> startScan(UniversalScanFilter? filter) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.startScan$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[filter]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<void> stopScan() async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.stopScan$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<bool> isScanning() async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.isScanning$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
}
|
|
}
|
|
|
|
Future<void> connect(String deviceId) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.connect$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<void> disconnect(String deviceId) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.disconnect$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<void> setNotifiable(String deviceId, String service,
|
|
String characteristic, int bleInputProperty) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.setNotifiable$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel
|
|
.send(<Object?>[deviceId, service, characteristic, bleInputProperty]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<List<UniversalBleService>> discoverServices(
|
|
String deviceId, bool withDescriptors) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.discoverServices$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId, withDescriptors]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as List<Object?>?)!
|
|
.cast<UniversalBleService>();
|
|
}
|
|
}
|
|
|
|
Future<Uint8List> readValue(
|
|
String deviceId, String service, String characteristic) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.readValue$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId, service, characteristic]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as Uint8List?)!;
|
|
}
|
|
}
|
|
|
|
Future<int> requestMtu(String deviceId, int expectedMtu) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.requestMtu$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId, expectedMtu]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as int?)!;
|
|
}
|
|
}
|
|
|
|
Future<void> writeValue(String deviceId, String service,
|
|
String characteristic, Uint8List value, int bleOutputProperty) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.writeValue$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(
|
|
<Object?>[deviceId, service, characteristic, value, bleOutputProperty]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<bool> isPaired(String deviceId) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.isPaired$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
}
|
|
}
|
|
|
|
Future<bool> pair(String deviceId) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.pair$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as bool?)!;
|
|
}
|
|
}
|
|
|
|
Future<void> unPair(String deviceId) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.unPair$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
Future<List<UniversalBleScanResult>> getSystemDevices(
|
|
List<String> withServices) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.getSystemDevices$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[withServices]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as List<Object?>?)!
|
|
.cast<UniversalBleScanResult>();
|
|
}
|
|
}
|
|
|
|
Future<int> getConnectionState(String deviceId) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.getConnectionState$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[deviceId]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else if (pigeonVar_replyList[0] == null) {
|
|
throw PlatformException(
|
|
code: 'null-error',
|
|
message: 'Host platform returned null value for non-null return value.',
|
|
);
|
|
} else {
|
|
return (pigeonVar_replyList[0] as int?)!;
|
|
}
|
|
}
|
|
|
|
Future<void> setLogLevel(UniversalBleLogLevel logLevel) async {
|
|
final pigeonVar_channelName =
|
|
'dev.flutter.pigeon.universal_ble.UniversalBlePlatformChannel.setLogLevel$pigeonVar_messageChannelSuffix';
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
pigeonVar_channelName,
|
|
pigeonChannelCodec,
|
|
binaryMessenger: pigeonVar_binaryMessenger,
|
|
);
|
|
final Future<Object?> pigeonVar_sendFuture =
|
|
pigeonVar_channel.send(<Object?>[logLevel]);
|
|
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
|
|
if (pigeonVar_replyList == null) {
|
|
throw _createConnectionError(pigeonVar_channelName);
|
|
} else if (pigeonVar_replyList.length > 1) {
|
|
throw PlatformException(
|
|
code: pigeonVar_replyList[0]! as String,
|
|
message: pigeonVar_replyList[1] as String?,
|
|
details: pigeonVar_replyList[2],
|
|
);
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Native -> Flutter
|
|
abstract class UniversalBleCallbackChannel {
|
|
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
|
|
|
|
void onAvailabilityChanged(int state);
|
|
|
|
void onPairStateChange(String deviceId, bool isPaired, String? error);
|
|
|
|
void onScanResult(UniversalBleScanResult result);
|
|
|
|
void onValueChanged(String deviceId, String characteristicId, Uint8List value,
|
|
int? timestamp);
|
|
|
|
void onConnectionChanged(String deviceId, bool connected, String? error);
|
|
|
|
static void setUp(
|
|
UniversalBleCallbackChannel? api, {
|
|
BinaryMessenger? binaryMessenger,
|
|
String messageChannelSuffix = '',
|
|
}) {
|
|
messageChannelSuffix =
|
|
messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
|
|
{
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
'dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onAvailabilityChanged$messageChannelSuffix',
|
|
pigeonChannelCodec,
|
|
binaryMessenger: binaryMessenger);
|
|
if (api == null) {
|
|
pigeonVar_channel.setMessageHandler(null);
|
|
} else {
|
|
pigeonVar_channel.setMessageHandler((Object? message) async {
|
|
assert(message != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onAvailabilityChanged was null.');
|
|
final List<Object?> args = (message as List<Object?>?)!;
|
|
final int? arg_state = (args[0] as int?);
|
|
assert(arg_state != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onAvailabilityChanged was null, expected non-null int.');
|
|
try {
|
|
api.onAvailabilityChanged(arg_state!);
|
|
return wrapResponse(empty: true);
|
|
} on PlatformException catch (e) {
|
|
return wrapResponse(error: e);
|
|
} catch (e) {
|
|
return wrapResponse(
|
|
error: PlatformException(code: 'error', message: e.toString()));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
{
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
'dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onPairStateChange$messageChannelSuffix',
|
|
pigeonChannelCodec,
|
|
binaryMessenger: binaryMessenger);
|
|
if (api == null) {
|
|
pigeonVar_channel.setMessageHandler(null);
|
|
} else {
|
|
pigeonVar_channel.setMessageHandler((Object? message) async {
|
|
assert(message != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onPairStateChange was null.');
|
|
final List<Object?> args = (message as List<Object?>?)!;
|
|
final String? arg_deviceId = (args[0] as String?);
|
|
assert(arg_deviceId != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onPairStateChange was null, expected non-null String.');
|
|
final bool? arg_isPaired = (args[1] as bool?);
|
|
assert(arg_isPaired != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onPairStateChange was null, expected non-null bool.');
|
|
final String? arg_error = (args[2] as String?);
|
|
try {
|
|
api.onPairStateChange(arg_deviceId!, arg_isPaired!, arg_error);
|
|
return wrapResponse(empty: true);
|
|
} on PlatformException catch (e) {
|
|
return wrapResponse(error: e);
|
|
} catch (e) {
|
|
return wrapResponse(
|
|
error: PlatformException(code: 'error', message: e.toString()));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
{
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
'dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onScanResult$messageChannelSuffix',
|
|
pigeonChannelCodec,
|
|
binaryMessenger: binaryMessenger);
|
|
if (api == null) {
|
|
pigeonVar_channel.setMessageHandler(null);
|
|
} else {
|
|
pigeonVar_channel.setMessageHandler((Object? message) async {
|
|
assert(message != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onScanResult was null.');
|
|
final List<Object?> args = (message as List<Object?>?)!;
|
|
final UniversalBleScanResult? arg_result =
|
|
(args[0] as UniversalBleScanResult?);
|
|
assert(arg_result != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onScanResult was null, expected non-null UniversalBleScanResult.');
|
|
try {
|
|
api.onScanResult(arg_result!);
|
|
return wrapResponse(empty: true);
|
|
} on PlatformException catch (e) {
|
|
return wrapResponse(error: e);
|
|
} catch (e) {
|
|
return wrapResponse(
|
|
error: PlatformException(code: 'error', message: e.toString()));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
{
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
'dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onValueChanged$messageChannelSuffix',
|
|
pigeonChannelCodec,
|
|
binaryMessenger: binaryMessenger);
|
|
if (api == null) {
|
|
pigeonVar_channel.setMessageHandler(null);
|
|
} else {
|
|
pigeonVar_channel.setMessageHandler((Object? message) async {
|
|
assert(message != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onValueChanged was null.');
|
|
final List<Object?> args = (message as List<Object?>?)!;
|
|
final String? arg_deviceId = (args[0] as String?);
|
|
assert(arg_deviceId != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onValueChanged was null, expected non-null String.');
|
|
final String? arg_characteristicId = (args[1] as String?);
|
|
assert(arg_characteristicId != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onValueChanged was null, expected non-null String.');
|
|
final Uint8List? arg_value = (args[2] as Uint8List?);
|
|
assert(arg_value != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onValueChanged was null, expected non-null Uint8List.');
|
|
final int? arg_timestamp = (args[3] as int?);
|
|
try {
|
|
api.onValueChanged(arg_deviceId!, arg_characteristicId!, arg_value!,
|
|
arg_timestamp);
|
|
return wrapResponse(empty: true);
|
|
} on PlatformException catch (e) {
|
|
return wrapResponse(error: e);
|
|
} catch (e) {
|
|
return wrapResponse(
|
|
error: PlatformException(code: 'error', message: e.toString()));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
{
|
|
final pigeonVar_channel = BasicMessageChannel<Object?>(
|
|
'dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onConnectionChanged$messageChannelSuffix',
|
|
pigeonChannelCodec,
|
|
binaryMessenger: binaryMessenger);
|
|
if (api == null) {
|
|
pigeonVar_channel.setMessageHandler(null);
|
|
} else {
|
|
pigeonVar_channel.setMessageHandler((Object? message) async {
|
|
assert(message != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onConnectionChanged was null.');
|
|
final List<Object?> args = (message as List<Object?>?)!;
|
|
final String? arg_deviceId = (args[0] as String?);
|
|
assert(arg_deviceId != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onConnectionChanged was null, expected non-null String.');
|
|
final bool? arg_connected = (args[1] as bool?);
|
|
assert(arg_connected != null,
|
|
'Argument for dev.flutter.pigeon.universal_ble.UniversalBleCallbackChannel.onConnectionChanged was null, expected non-null bool.');
|
|
final String? arg_error = (args[2] as String?);
|
|
try {
|
|
api.onConnectionChanged(arg_deviceId!, arg_connected!, arg_error);
|
|
return wrapResponse(empty: true);
|
|
} on PlatformException catch (e) {
|
|
return wrapResponse(error: e);
|
|
} catch (e) {
|
|
return wrapResponse(
|
|
error: PlatformException(code: 'error', message: e.toString()));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|