diff --git a/CHANGELOG.md b/CHANGELOG.md index 81a014cd..1aed5742 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 3.1.1 * Bump `bluez` to `^0.9.0`. * Bump the `pigeon` dev dependency to `^29.0.0`. +* Regenerate the Pigeon bindings with Pigeon 29. The async platform channels now use `@asyncCallback`, so the existing callback-based native implementations (Swift completion handlers, Kotlin callbacks) are kept as-is rather than migrated to native `async`/`suspend`. No public API change. ## 3.1.0 * `BleDevice.services` is now normalised to full 128-bit lower-case UUIDs on every platform, matching the keys of `BleDevice.serviceData`. Apple was the outlier: it reported 16-bit advertised service UUIDs in their short form (`180D`), so the same field had a different shape per platform and stored keys or comparisons did not transfer between them. Compare against, or store, the 128-bit form; short (`180D`) and `0x`-prefixed forms are still accepted as *input*. Entries that are not valid UUIDs are kept verbatim rather than dropped. diff --git a/android/src/main/kotlin/com/navideck/universal_ble/UniversalBle.g.kt b/android/src/main/kotlin/com/navideck/universal_ble/UniversalBle.g.kt index 0a412e37..6db224cf 100644 --- a/android/src/main/kotlin/com/navideck/universal_ble/UniversalBle.g.kt +++ b/android/src/main/kotlin/com/navideck/universal_ble/UniversalBle.g.kt @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v26.3.4), do not edit directly. +// Autogenerated from Pigeon (v29.0.10), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") @@ -548,6 +548,9 @@ data class UniversalBleScanResult ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.connectable) return result } + override fun toString(): String { + return "UniversalBleScanResult(deviceId=$deviceId, name=$name, isPaired=$isPaired, rssi=$rssi, manufacturerDataList=$manufacturerDataList, serviceData=$serviceData, services=$services, timestamp=$timestamp, timestampMicroseconds=$timestampMicroseconds, connectable=$connectable)" + } } /** @@ -592,6 +595,9 @@ data class UniversalDevicePickerResult ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.name) return result } + override fun toString(): String { + return "UniversalDevicePickerResult(deviceId=$deviceId, name=$name)" + } } /** @@ -634,6 +640,9 @@ data class UniversalBleService ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.characteristics) return result } + override fun toString(): String { + return "UniversalBleService(uuid=$uuid, characteristics=$characteristics)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -676,6 +685,9 @@ data class UniversalBleCharacteristic ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.descriptors) return result } + override fun toString(): String { + return "UniversalBleCharacteristic(uuid=$uuid, properties=$properties, descriptors=$descriptors)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -710,6 +722,9 @@ data class UniversalBleDescriptor ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.uuid) return result } + override fun toString(): String { + return "UniversalBleDescriptor(uuid=$uuid)" + } } /** @@ -767,6 +782,9 @@ data class BleConnectionParametersChange ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.status) return result } + override fun toString(): String { + return "BleConnectionParametersChange(deviceId=$deviceId, interval=$interval, latency=$latency, supervisionTimeout=$supervisionTimeout, status=$status)" + } } /** @@ -855,6 +873,9 @@ data class AndroidOptions ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.legacy) return result } + override fun toString(): String { + return "AndroidOptions(requestLocationPermission=$requestLocationPermission, scanMode=$scanMode, reportDelayMillis=$reportDelayMillis, callbackType=$callbackType, matchMode=$matchMode, numOfMatches=$numOfMatches, legacy=$legacy)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -899,6 +920,9 @@ data class UniversalScanConfig ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.skipDuplicates) return result } + override fun toString(): String { + return "UniversalScanConfig(android=$android, skipDuplicates=$skipDuplicates)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -950,6 +974,9 @@ data class UniversalScanFilter ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.withServiceData) return result } + override fun toString(): String { + return "UniversalScanFilter(withServices=$withServices, withNamePrefix=$withNamePrefix, withManufacturerData=$withManufacturerData, withServiceData=$withServiceData)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -999,6 +1026,9 @@ data class ManufacturerDataFilter ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.payloadMask) return result } + override fun toString(): String { + return "ManufacturerDataFilter(companyIdentifier=$companyIdentifier, payloadPrefix=${payloadPrefix?.contentToString()}, payloadMask=${payloadMask?.contentToString()})" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1037,6 +1067,9 @@ data class UniversalManufacturerData ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.data) return result } + override fun toString(): String { + return "UniversalManufacturerData(companyIdentifier=$companyIdentifier, data=${data.contentToString()})" + } } /** @@ -1107,6 +1140,9 @@ data class AppleConnectionOptions ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.notifyOnNotification) return result } + override fun toString(): String { + return "AppleConnectionOptions(notifyOnConnection=$notifyOnConnection, notifyOnDisconnection=$notifyOnDisconnection, notifyOnNotification=$notifyOnNotification)" + } } /** @@ -1172,6 +1208,9 @@ data class AppleAccessoryPickerItem ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.supportsBluetoothPairing) return result } + override fun toString(): String { + return "AppleAccessoryPickerItem(displayName=$displayName, imageAsset=$imageAsset, serviceUuid=$serviceUuid, nameSubstring=$nameSubstring, requiresImmediateRange=$requiresImmediateRange, supportsBluetoothPairing=$supportsBluetoothPairing)" + } } /** @@ -1212,6 +1251,9 @@ data class AppleAccessorySetupOptions ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.items) return result } + override fun toString(): String { + return "AppleAccessorySetupOptions(items=$items)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1255,6 +1297,9 @@ data class AndroidConnectionOptions ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.closeGattOnDetach) return result } + override fun toString(): String { + return "AndroidConnectionOptions(closeGattOnDetach=$closeGattOnDetach)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1293,6 +1338,9 @@ data class ConnectionPlatformConfig ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.android) return result } + override fun toString(): String { + return "ConnectionPlatformConfig(apple=$apple, android=$android)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1335,6 +1383,9 @@ data class AndroidDiscoverServicesOptions ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.clearGattCache) return result } + override fun toString(): String { + return "AndroidDiscoverServicesOptions(clearGattCache=$clearGattCache)" + } } /** @@ -1374,6 +1425,9 @@ data class DiscoverServicesPlatformConfig ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.android) return result } + override fun toString(): String { + return "DiscoverServicesPlatformConfig(android=$android)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1420,6 +1474,9 @@ data class PeripheralAndroidOptions ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.addServicesInScanResponse) return result } + override fun toString(): String { + return "PeripheralAndroidOptions(addManufacturerDataInScanResponse=$addManufacturerDataInScanResponse, addServicesInScanResponse=$addServicesInScanResponse)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1454,6 +1511,9 @@ data class PeripheralPlatformConfig ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.android) return result } + override fun toString(): String { + return "PeripheralPlatformConfig(android=$android)" + } } /** @@ -1500,6 +1560,9 @@ data class PeripheralService ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.characteristics) return result } + override fun toString(): String { + return "PeripheralService(uuid=$uuid, primary=$primary, characteristics=$characteristics)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1550,6 +1613,9 @@ data class PeripheralCharacteristic ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.value) return result } + override fun toString(): String { + return "PeripheralCharacteristic(uuid=$uuid, properties=$properties, permissions=$permissions, descriptors=$descriptors, value=${value?.contentToString()})" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1592,6 +1658,9 @@ data class PeripheralDescriptor ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.permissions) return result } + override fun toString(): String { + return "PeripheralDescriptor(uuid=$uuid, value=${value?.contentToString()}, permissions=$permissions)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1634,6 +1703,9 @@ data class PeripheralReadRequestResult ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.status) return result } + override fun toString(): String { + return "PeripheralReadRequestResult(value=${value.contentToString()}, offset=$offset, status=$status)" + } } /** Generated class from Pigeon that represents data sent in messages. */ @@ -1676,6 +1748,9 @@ data class PeripheralWriteRequestResult ( result = 31 * result + UniversalBlePigeonUtils.deepHash(this.status) return result } + override fun toString(): String { + return "PeripheralWriteRequestResult(value=${value?.contentToString()}, offset=$offset, status=$status)" + } } private open class UniversalBlePigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { @@ -2054,6 +2129,11 @@ private open class UniversalBlePigeonCodec : StandardMessageCodec() { /** * APIs (Flutter -> Native / Native -> Flutter) * ------------------------------------------------------------ + * + * Async methods use [asyncCallback] instead of the Pigeon >= 28 default + * (`async` / `suspend`): the native implementations are callback-based + * (Swift completion handlers, Kotlin callbacks), and [asyncCallback] keeps + * those signatures rather than forcing a rewrite to native async/await. * Flutter -> Native (central) * * Generated interface from Pigeon that represents a handler of messages from Flutter. diff --git a/darwin/universal_ble/Sources/universal_ble/UniversalBle.g.swift b/darwin/universal_ble/Sources/universal_ble/UniversalBle.g.swift index 6d38a796..1d2ec110 100644 --- a/darwin/universal_ble/Sources/universal_ble/UniversalBle.g.swift +++ b/darwin/universal_ble/Sources/universal_ble/UniversalBle.g.swift @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v26.3.4), do not edit directly. +// Autogenerated from Pigeon (v29.0.10), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -25,7 +25,7 @@ final class PigeonError: Error { var localizedDescription: String { return - "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? "")" + "PigeonError(code: \(code), message: \(message ?? ""), details: \(details ?? ""))" } } @@ -59,126 +59,136 @@ private func createConnectionError(withChannelName channelName: String) -> Pigeo return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } -private func isNullish(_ value: Any?) -> Bool { - return value is NSNull || value == nil -} +enum UniversalBlePigeonInternal { + static func isNullish(_ value: Any?) -> Bool { + guard let innerValue = value else { + return true + } -private func nilOrValue(_ value: Any?) -> T? { - if value is NSNull { return nil } - return value as! T? -} + if case Optional.some(Optional.none) = value { + return true + } -private func doubleEqualsUniversalBle(_ lhs: Double, _ rhs: Double) -> Bool { - return (lhs.isNaN && rhs.isNaN) || lhs == rhs -} + return innerValue is NSNull + } + static func doubleEquals(_ lhs: Double, _ rhs: Double) -> Bool { + return (lhs.isNaN && rhs.isNaN) || lhs == rhs + } -private func doubleHashUniversalBle(_ value: Double, _ hasher: inout Hasher) { - if value.isNaN { - hasher.combine(0x7FF8000000000000) - } else { - // Normalize -0.0 to 0.0 - hasher.combine(value == 0 ? 0 : value) + static func doubleHash(_ value: Double, _ hasher: inout Hasher) { + if value.isNaN { + hasher.combine(0x7FF8000000000000) + } else { + // Normalize -0.0 to 0.0 + hasher.combine(value == 0 ? 0 : value) + } } -} -func deepEqualsUniversalBle(_ lhs: Any?, _ rhs: Any?) -> Bool { - let cleanLhs = nilOrValue(lhs) as Any? - let cleanRhs = nilOrValue(rhs) as Any? - switch (cleanLhs, cleanRhs) { - case (nil, nil): - return true + static func deepEquals(_ lhs: Any?, _ rhs: Any?) -> Bool { + let cleanLhs = nilOrValue(lhs) as Any? + let cleanRhs = nilOrValue(rhs) as Any? + switch (cleanLhs, cleanRhs) { + case (nil, nil): + return true - case (nil, _), (_, nil): - return false + case (nil, _), (_, nil): + return false - case (let lhs as AnyObject, let rhs as AnyObject) where lhs === rhs: - return true + case (let lhs as AnyObject, let rhs as AnyObject) where lhs === rhs: + return true - case is (Void, Void): - return true + case is (Void, Void): + return true - case (let lhsArray, let rhsArray) as ([Any?], [Any?]): - guard lhsArray.count == rhsArray.count else { return false } - for (index, element) in lhsArray.enumerated() { - if !deepEqualsUniversalBle(element, rhsArray[index]) { - return false + case (let lhsArray, let rhsArray) as ([Double], [Double]): + guard lhsArray.count == rhsArray.count else { return false } + for (index, element) in lhsArray.enumerated() { + if !doubleEquals(element, rhsArray[index]) { + return false + } } - } - return true + return true - case (let lhsArray, let rhsArray) as ([Double], [Double]): - guard lhsArray.count == rhsArray.count else { return false } - for (index, element) in lhsArray.enumerated() { - if !doubleEqualsUniversalBle(element, rhsArray[index]) { - return false + case (let lhsArray, let rhsArray) as ([Any?], [Any?]): + guard lhsArray.count == rhsArray.count else { return false } + for (index, element) in lhsArray.enumerated() { + if !deepEquals(element, rhsArray[index]) { + return false + } } - } - return true - - case (let lhsDictionary, let rhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): - guard lhsDictionary.count == rhsDictionary.count else { return false } - for (lhsKey, lhsValue) in lhsDictionary { - var found = false - for (rhsKey, rhsValue) in rhsDictionary { - if deepEqualsUniversalBle(lhsKey, rhsKey) { - if deepEqualsUniversalBle(lhsValue, rhsValue) { - found = true - break - } else { - return false + return true + + case (let lhsDictionary, let rhsDictionary) as ([AnyHashable: Any?], [AnyHashable: Any?]): + guard lhsDictionary.count == rhsDictionary.count else { return false } + for (lhsKey, lhsValue) in lhsDictionary { + var found = false + for (rhsKey, rhsValue) in rhsDictionary { + if deepEquals(lhsKey, rhsKey) { + if deepEquals(lhsValue, rhsValue) { + found = true + break + } else { + return false + } } } + if !found { return false } } - if !found { return false } - } - return true + return true - case (let lhs as Double, let rhs as Double): - return doubleEqualsUniversalBle(lhs, rhs) + case (let lhs as Double, let rhs as Double): + return doubleEquals(lhs, rhs) - case (let lhsHashable, let rhsHashable) as (AnyHashable, AnyHashable): - return lhsHashable == rhsHashable + case (let lhsHashable, let rhsHashable) as (AnyHashable, AnyHashable): + return lhsHashable == rhsHashable - default: - return false + default: + return false + } } -} -func deepHashUniversalBle(value: Any?, hasher: inout Hasher) { - let cleanValue = nilOrValue(value) as Any? - if let cleanValue = cleanValue { - if let doubleValue = cleanValue as? Double { - doubleHashUniversalBle(doubleValue, &hasher) - } else if let valueList = cleanValue as? [Any?] { - for item in valueList { - deepHashUniversalBle(value: item, hasher: &hasher) - } - } else if let valueList = cleanValue as? [Double] { - for item in valueList { - doubleHashUniversalBle(item, &hasher) - } - } else if let valueDict = cleanValue as? [AnyHashable: Any?] { - var result = 0 - for (key, value) in valueDict { - var entryKeyHasher = Hasher() - deepHashUniversalBle(value: key, hasher: &entryKeyHasher) - var entryValueHasher = Hasher() - deepHashUniversalBle(value: value, hasher: &entryValueHasher) - result = result &+ ((entryKeyHasher.finalize() &* 31) ^ entryValueHasher.finalize()) - } - hasher.combine(result) - } else if let hashableValue = cleanValue as? AnyHashable { - hasher.combine(hashableValue) + static func deepHash(value: Any?, hasher: inout Hasher) { + let cleanValue = nilOrValue(value) as Any? + if let cleanValue = cleanValue { + if let doubleValue = cleanValue as? Double { + doubleHash(doubleValue, &hasher) + } else if let valueList = cleanValue as? [Any?] { + for item in valueList { + deepHash(value: item, hasher: &hasher) + } + } else if let valueList = cleanValue as? [Double] { + for item in valueList { + doubleHash(item, &hasher) + } + } else if let valueDict = cleanValue as? [AnyHashable: Any?] { + var result = 0 + for (key, value) in valueDict { + var entryKeyHasher = Hasher() + deepHash(value: key, hasher: &entryKeyHasher) + var entryValueHasher = Hasher() + deepHash(value: value, hasher: &entryValueHasher) + result = result &+ ((entryKeyHasher.finalize() &* 31) ^ entryValueHasher.finalize()) + } + hasher.combine(result) + } else if let hashableValue = cleanValue as? AnyHashable { + hasher.combine(hashableValue) + } else { + hasher.combine(String(describing: cleanValue)) + } } else { - hasher.combine(String(describing: cleanValue)) + hasher.combine(0) } - } else { - hasher.combine(0) } + +} + +private func nilOrValue(_ value: Any?) -> T? { + if value is NSNull { return nil } + return value as! T? } -enum BleLogLevel: Int { +enum BleLogLevel: Int, CaseIterable { case none = 0 case error = 1 case warning = 2 @@ -187,7 +197,7 @@ enum BleLogLevel: Int { case verbose = 5 } -enum AvailabilityState: Int { +enum AvailabilityState: Int, CaseIterable { case unknown = 0 case resetting = 1 case unsupported = 2 @@ -196,20 +206,20 @@ enum AvailabilityState: Int { case poweredOn = 5 } -enum BleConnectionState: Int { +enum BleConnectionState: Int, CaseIterable { case connected = 0 case disconnected = 1 case connecting = 2 case disconnecting = 3 } -enum BleInputProperty: Int { +enum BleInputProperty: Int, CaseIterable { case disabled = 0 case notification = 1 case indication = 2 } -enum BleOutputProperty: Int { +enum BleOutputProperty: Int, CaseIterable { case withResponse = 0 case withoutResponse = 1 } @@ -217,7 +227,7 @@ enum BleOutputProperty: Int { /// Connection priority hint passed to [requestConnectionPriority]. /// /// Maps to Android `BluetoothGatt.CONNECTION_PRIORITY_*` constants. -enum BleConnectionPriority: Int { +enum BleConnectionPriority: Int, CaseIterable { /// Default OS-managed interval (~30-50 ms). Android constant: 0. case balanced = 0 /// Low-latency interval (~7.5-15 ms), higher power draw. Android constant: 1. @@ -226,7 +236,7 @@ enum BleConnectionPriority: Int { case lowPower = 2 } -enum AndroidScanMode: Int { +enum AndroidScanMode: Int, CaseIterable { case balanced = 0 case lowLatency = 1 case lowPower = 2 @@ -245,7 +255,7 @@ enum AndroidScanMode: Int { /// older devices. /// /// See https://developer.android.com/reference/android/bluetooth/le/ScanSettings -enum AndroidScanCallbackType: Int { +enum AndroidScanCallbackType: Int, CaseIterable { case allMatches = 0 case firstMatch = 1 case matchLost = 2 @@ -253,19 +263,19 @@ enum AndroidScanCallbackType: Int { } /// Mirrors `android.bluetooth.le.ScanSettings#setMatchMode`. -enum AndroidScanMatchMode: Int { +enum AndroidScanMatchMode: Int, CaseIterable { case aggressive = 0 case sticky = 1 } /// Mirrors `android.bluetooth.le.ScanSettings#setNumOfMatches`. -enum AndroidScanNumOfMatches: Int { +enum AndroidScanNumOfMatches: Int, CaseIterable { case one = 0 case few = 1 case max = 2 } -enum CharacteristicProperty: Int { +enum CharacteristicProperty: Int, CaseIterable { case broadcast = 0 case read = 1 case writeWithoutResponse = 2 @@ -276,7 +286,7 @@ enum CharacteristicProperty: Int { case extendedProperties = 7 } -enum PeripheralReadinessState: Int { +enum PeripheralReadinessState: Int, CaseIterable { case unknown = 0 case ready = 1 case bluetoothOff = 2 @@ -284,14 +294,14 @@ enum PeripheralReadinessState: Int { case unsupported = 4 } -enum PeripheralAttributePermission: Int { +enum PeripheralAttributePermission: Int, CaseIterable { case readable = 0 case writeable = 1 case readEncryptionRequired = 2 case writeEncryptionRequired = 3 } -enum PeripheralAdvertisingState: Int { +enum PeripheralAdvertisingState: Int, CaseIterable { case idle = 0 case starting = 1 case advertising = 2 @@ -300,7 +310,7 @@ enum PeripheralAdvertisingState: Int { } /// Unified error codes for all platforms -enum UniversalBleErrorCode: Int { +enum UniversalBleErrorCode: Int, CaseIterable { case unknownError = 0 case failed = 1 case notSupported = 2 @@ -368,7 +378,7 @@ enum UniversalBleErrorCode: Int { /// ------------------------------------------------------------ /// /// Generated class from Pigeon that represents data sent in messages. -struct UniversalBleScanResult: Hashable { +struct UniversalBleScanResult: Hashable, CustomStringConvertible { var deviceId: String var name: String? = nil var isPaired: Bool? = nil @@ -425,28 +435,32 @@ struct UniversalBleScanResult: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.deviceId, rhs.deviceId) && deepEqualsUniversalBle(lhs.name, rhs.name) && deepEqualsUniversalBle(lhs.isPaired, rhs.isPaired) && deepEqualsUniversalBle(lhs.rssi, rhs.rssi) && deepEqualsUniversalBle(lhs.manufacturerDataList, rhs.manufacturerDataList) && deepEqualsUniversalBle(lhs.serviceData, rhs.serviceData) && deepEqualsUniversalBle(lhs.services, rhs.services) && deepEqualsUniversalBle(lhs.timestamp, rhs.timestamp) && deepEqualsUniversalBle(lhs.timestampMicroseconds, rhs.timestampMicroseconds) && deepEqualsUniversalBle(lhs.connectable, rhs.connectable) + return UniversalBlePigeonInternal.deepEquals(lhs.deviceId, rhs.deviceId) && UniversalBlePigeonInternal.deepEquals(lhs.name, rhs.name) && UniversalBlePigeonInternal.deepEquals(lhs.isPaired, rhs.isPaired) && UniversalBlePigeonInternal.deepEquals(lhs.rssi, rhs.rssi) && UniversalBlePigeonInternal.deepEquals(lhs.manufacturerDataList, rhs.manufacturerDataList) && UniversalBlePigeonInternal.deepEquals(lhs.serviceData, rhs.serviceData) && UniversalBlePigeonInternal.deepEquals(lhs.services, rhs.services) && UniversalBlePigeonInternal.deepEquals(lhs.timestamp, rhs.timestamp) && UniversalBlePigeonInternal.deepEquals(lhs.timestampMicroseconds, rhs.timestampMicroseconds) && UniversalBlePigeonInternal.deepEquals(lhs.connectable, rhs.connectable) } func hash(into hasher: inout Hasher) { hasher.combine("UniversalBleScanResult") - deepHashUniversalBle(value: deviceId, hasher: &hasher) - deepHashUniversalBle(value: name, hasher: &hasher) - deepHashUniversalBle(value: isPaired, hasher: &hasher) - deepHashUniversalBle(value: rssi, hasher: &hasher) - deepHashUniversalBle(value: manufacturerDataList, hasher: &hasher) - deepHashUniversalBle(value: serviceData, hasher: &hasher) - deepHashUniversalBle(value: services, hasher: &hasher) - deepHashUniversalBle(value: timestamp, hasher: &hasher) - deepHashUniversalBle(value: timestampMicroseconds, hasher: &hasher) - deepHashUniversalBle(value: connectable, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: deviceId, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: name, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: isPaired, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: rssi, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: manufacturerDataList, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: serviceData, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: services, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: timestamp, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: timestampMicroseconds, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: connectable, hasher: &hasher) + } + + public var description: String { + return "UniversalBleScanResult(deviceId: \(String(describing: deviceId)), name: \(String(describing: name)), isPaired: \(String(describing: isPaired)), rssi: \(String(describing: rssi)), manufacturerDataList: \(String(describing: manufacturerDataList)), serviceData: \(String(describing: serviceData)), services: \(String(describing: services)), timestamp: \(String(describing: timestamp)), timestampMicroseconds: \(String(describing: timestampMicroseconds)), connectable: \(String(describing: connectable)))" } } /// The device a platform's native picker returned. /// /// Generated class from Pigeon that represents data sent in messages. -struct UniversalDevicePickerResult: Hashable { +struct UniversalDevicePickerResult: Hashable, CustomStringConvertible { /// Identifier to pass to `connect`. var deviceId: String /// Name the platform reported for the selected device, if any. @@ -473,20 +487,24 @@ struct UniversalDevicePickerResult: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.deviceId, rhs.deviceId) && deepEqualsUniversalBle(lhs.name, rhs.name) + return UniversalBlePigeonInternal.deepEquals(lhs.deviceId, rhs.deviceId) && UniversalBlePigeonInternal.deepEquals(lhs.name, rhs.name) } func hash(into hasher: inout Hasher) { hasher.combine("UniversalDevicePickerResult") - deepHashUniversalBle(value: deviceId, hasher: &hasher) - deepHashUniversalBle(value: name, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: deviceId, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: name, hasher: &hasher) + } + + public var description: String { + return "UniversalDevicePickerResult(deviceId: \(String(describing: deviceId)), name: \(String(describing: name)))" } } /// Central/GATT models /// /// Generated class from Pigeon that represents data sent in messages. -struct UniversalBleService: Hashable { +struct UniversalBleService: Hashable, CustomStringConvertible { var uuid: String var characteristics: [UniversalBleCharacteristic]? = nil @@ -511,18 +529,22 @@ struct UniversalBleService: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.uuid, rhs.uuid) && deepEqualsUniversalBle(lhs.characteristics, rhs.characteristics) + return UniversalBlePigeonInternal.deepEquals(lhs.uuid, rhs.uuid) && UniversalBlePigeonInternal.deepEquals(lhs.characteristics, rhs.characteristics) } func hash(into hasher: inout Hasher) { hasher.combine("UniversalBleService") - deepHashUniversalBle(value: uuid, hasher: &hasher) - deepHashUniversalBle(value: characteristics, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: uuid, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: characteristics, hasher: &hasher) + } + + public var description: String { + return "UniversalBleService(uuid: \(String(describing: uuid)), characteristics: \(String(describing: characteristics)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct UniversalBleCharacteristic: Hashable { +struct UniversalBleCharacteristic: Hashable, CustomStringConvertible { var uuid: String var properties: [CharacteristicProperty] var descriptors: [UniversalBleDescriptor] @@ -551,19 +573,23 @@ struct UniversalBleCharacteristic: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.uuid, rhs.uuid) && deepEqualsUniversalBle(lhs.properties, rhs.properties) && deepEqualsUniversalBle(lhs.descriptors, rhs.descriptors) + return UniversalBlePigeonInternal.deepEquals(lhs.uuid, rhs.uuid) && UniversalBlePigeonInternal.deepEquals(lhs.properties, rhs.properties) && UniversalBlePigeonInternal.deepEquals(lhs.descriptors, rhs.descriptors) } func hash(into hasher: inout Hasher) { hasher.combine("UniversalBleCharacteristic") - deepHashUniversalBle(value: uuid, hasher: &hasher) - deepHashUniversalBle(value: properties, hasher: &hasher) - deepHashUniversalBle(value: descriptors, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: uuid, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: properties, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: descriptors, hasher: &hasher) + } + + public var description: String { + return "UniversalBleCharacteristic(uuid: \(String(describing: uuid)), properties: \(String(describing: properties)), descriptors: \(String(describing: descriptors)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct UniversalBleDescriptor: Hashable { +struct UniversalBleDescriptor: Hashable, CustomStringConvertible { var uuid: String @@ -584,12 +610,16 @@ struct UniversalBleDescriptor: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.uuid, rhs.uuid) + return UniversalBlePigeonInternal.deepEquals(lhs.uuid, rhs.uuid) } func hash(into hasher: inout Hasher) { hasher.combine("UniversalBleDescriptor") - deepHashUniversalBle(value: uuid, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: uuid, hasher: &hasher) + } + + public var description: String { + return "UniversalBleDescriptor(uuid: \(String(describing: uuid)))" } } @@ -599,7 +629,7 @@ struct UniversalBleDescriptor: Hashable { /// (multiply interval by 1.25 for ms; supervisionTimeout by 10 for ms). /// /// Generated class from Pigeon that represents data sent in messages. -struct BleConnectionParametersChange: Hashable { +struct BleConnectionParametersChange: Hashable, CustomStringConvertible { var deviceId: String var interval: Int64 var latency: Int64 @@ -636,16 +666,20 @@ struct BleConnectionParametersChange: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.deviceId, rhs.deviceId) && deepEqualsUniversalBle(lhs.interval, rhs.interval) && deepEqualsUniversalBle(lhs.latency, rhs.latency) && deepEqualsUniversalBle(lhs.supervisionTimeout, rhs.supervisionTimeout) && deepEqualsUniversalBle(lhs.status, rhs.status) + return UniversalBlePigeonInternal.deepEquals(lhs.deviceId, rhs.deviceId) && UniversalBlePigeonInternal.deepEquals(lhs.interval, rhs.interval) && UniversalBlePigeonInternal.deepEquals(lhs.latency, rhs.latency) && UniversalBlePigeonInternal.deepEquals(lhs.supervisionTimeout, rhs.supervisionTimeout) && UniversalBlePigeonInternal.deepEquals(lhs.status, rhs.status) } func hash(into hasher: inout Hasher) { hasher.combine("BleConnectionParametersChange") - deepHashUniversalBle(value: deviceId, hasher: &hasher) - deepHashUniversalBle(value: interval, hasher: &hasher) - deepHashUniversalBle(value: latency, hasher: &hasher) - deepHashUniversalBle(value: supervisionTimeout, hasher: &hasher) - deepHashUniversalBle(value: status, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: deviceId, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: interval, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: latency, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: supervisionTimeout, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: status, hasher: &hasher) + } + + public var description: String { + return "BleConnectionParametersChange(deviceId: \(String(describing: deviceId)), interval: \(String(describing: interval)), latency: \(String(describing: latency)), supervisionTimeout: \(String(describing: supervisionTimeout)), status: \(String(describing: status)))" } } @@ -678,7 +712,7 @@ struct BleConnectionParametersChange: Hashable { /// See https://developer.android.com/reference/android/bluetooth/le/ScanSettings /// /// Generated class from Pigeon that represents data sent in messages. -struct AndroidOptions: Hashable { +struct AndroidOptions: Hashable, CustomStringConvertible { var requestLocationPermission: Bool? = nil var scanMode: AndroidScanMode? = nil var reportDelayMillis: Int64? = nil @@ -723,23 +757,27 @@ struct AndroidOptions: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.requestLocationPermission, rhs.requestLocationPermission) && deepEqualsUniversalBle(lhs.scanMode, rhs.scanMode) && deepEqualsUniversalBle(lhs.reportDelayMillis, rhs.reportDelayMillis) && deepEqualsUniversalBle(lhs.callbackType, rhs.callbackType) && deepEqualsUniversalBle(lhs.matchMode, rhs.matchMode) && deepEqualsUniversalBle(lhs.numOfMatches, rhs.numOfMatches) && deepEqualsUniversalBle(lhs.legacy, rhs.legacy) + return UniversalBlePigeonInternal.deepEquals(lhs.requestLocationPermission, rhs.requestLocationPermission) && UniversalBlePigeonInternal.deepEquals(lhs.scanMode, rhs.scanMode) && UniversalBlePigeonInternal.deepEquals(lhs.reportDelayMillis, rhs.reportDelayMillis) && UniversalBlePigeonInternal.deepEquals(lhs.callbackType, rhs.callbackType) && UniversalBlePigeonInternal.deepEquals(lhs.matchMode, rhs.matchMode) && UniversalBlePigeonInternal.deepEquals(lhs.numOfMatches, rhs.numOfMatches) && UniversalBlePigeonInternal.deepEquals(lhs.legacy, rhs.legacy) } func hash(into hasher: inout Hasher) { hasher.combine("AndroidOptions") - deepHashUniversalBle(value: requestLocationPermission, hasher: &hasher) - deepHashUniversalBle(value: scanMode, hasher: &hasher) - deepHashUniversalBle(value: reportDelayMillis, hasher: &hasher) - deepHashUniversalBle(value: callbackType, hasher: &hasher) - deepHashUniversalBle(value: matchMode, hasher: &hasher) - deepHashUniversalBle(value: numOfMatches, hasher: &hasher) - deepHashUniversalBle(value: legacy, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: requestLocationPermission, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: scanMode, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: reportDelayMillis, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: callbackType, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: matchMode, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: numOfMatches, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: legacy, hasher: &hasher) + } + + public var description: String { + return "AndroidOptions(requestLocationPermission: \(String(describing: requestLocationPermission)), scanMode: \(String(describing: scanMode)), reportDelayMillis: \(String(describing: reportDelayMillis)), callbackType: \(String(describing: callbackType)), matchMode: \(String(describing: matchMode)), numOfMatches: \(String(describing: numOfMatches)), legacy: \(String(describing: legacy)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct UniversalScanConfig: Hashable { +struct UniversalScanConfig: Hashable, CustomStringConvertible { var android: AndroidOptions? = nil /// When `true`, each device is reported only once per scan session: repeated /// scan results for a device are suppressed. Platforms with a native lever @@ -768,18 +806,22 @@ struct UniversalScanConfig: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.android, rhs.android) && deepEqualsUniversalBle(lhs.skipDuplicates, rhs.skipDuplicates) + return UniversalBlePigeonInternal.deepEquals(lhs.android, rhs.android) && UniversalBlePigeonInternal.deepEquals(lhs.skipDuplicates, rhs.skipDuplicates) } func hash(into hasher: inout Hasher) { hasher.combine("UniversalScanConfig") - deepHashUniversalBle(value: android, hasher: &hasher) - deepHashUniversalBle(value: skipDuplicates, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: android, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: skipDuplicates, hasher: &hasher) + } + + public var description: String { + return "UniversalScanConfig(android: \(String(describing: android)), skipDuplicates: \(String(describing: skipDuplicates)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct UniversalScanFilter: Hashable { +struct UniversalScanFilter: Hashable, CustomStringConvertible { var withServices: [String] var withNamePrefix: [String] var withManufacturerData: [ManufacturerDataFilter] @@ -815,20 +857,24 @@ struct UniversalScanFilter: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.withServices, rhs.withServices) && deepEqualsUniversalBle(lhs.withNamePrefix, rhs.withNamePrefix) && deepEqualsUniversalBle(lhs.withManufacturerData, rhs.withManufacturerData) && deepEqualsUniversalBle(lhs.withServiceData, rhs.withServiceData) + return UniversalBlePigeonInternal.deepEquals(lhs.withServices, rhs.withServices) && UniversalBlePigeonInternal.deepEquals(lhs.withNamePrefix, rhs.withNamePrefix) && UniversalBlePigeonInternal.deepEquals(lhs.withManufacturerData, rhs.withManufacturerData) && UniversalBlePigeonInternal.deepEquals(lhs.withServiceData, rhs.withServiceData) } func hash(into hasher: inout Hasher) { hasher.combine("UniversalScanFilter") - deepHashUniversalBle(value: withServices, hasher: &hasher) - deepHashUniversalBle(value: withNamePrefix, hasher: &hasher) - deepHashUniversalBle(value: withManufacturerData, hasher: &hasher) - deepHashUniversalBle(value: withServiceData, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: withServices, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: withNamePrefix, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: withManufacturerData, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: withServiceData, hasher: &hasher) + } + + public var description: String { + return "UniversalScanFilter(withServices: \(String(describing: withServices)), withNamePrefix: \(String(describing: withNamePrefix)), withManufacturerData: \(String(describing: withManufacturerData)), withServiceData: \(String(describing: withServiceData)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct ManufacturerDataFilter: Hashable { +struct ManufacturerDataFilter: Hashable, CustomStringConvertible { /// Must be of integer type, in hex or decimal form (e.g. 0x004c or 76). var companyIdentifier: Int64 /// Matches as prefix the device's advertised data. @@ -862,19 +908,23 @@ struct ManufacturerDataFilter: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.companyIdentifier, rhs.companyIdentifier) && deepEqualsUniversalBle(lhs.payloadPrefix, rhs.payloadPrefix) && deepEqualsUniversalBle(lhs.payloadMask, rhs.payloadMask) + return UniversalBlePigeonInternal.deepEquals(lhs.companyIdentifier, rhs.companyIdentifier) && UniversalBlePigeonInternal.deepEquals(lhs.payloadPrefix, rhs.payloadPrefix) && UniversalBlePigeonInternal.deepEquals(lhs.payloadMask, rhs.payloadMask) } func hash(into hasher: inout Hasher) { hasher.combine("ManufacturerDataFilter") - deepHashUniversalBle(value: companyIdentifier, hasher: &hasher) - deepHashUniversalBle(value: payloadPrefix, hasher: &hasher) - deepHashUniversalBle(value: payloadMask, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: companyIdentifier, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: payloadPrefix, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: payloadMask, hasher: &hasher) + } + + public var description: String { + return "ManufacturerDataFilter(companyIdentifier: \(String(describing: companyIdentifier)), payloadPrefix: \(String(describing: payloadPrefix)), payloadMask: \(String(describing: payloadMask)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct UniversalManufacturerData: Hashable { +struct UniversalManufacturerData: Hashable, CustomStringConvertible { var companyIdentifier: Int64 var data: FlutterStandardTypedData @@ -899,13 +949,17 @@ struct UniversalManufacturerData: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.companyIdentifier, rhs.companyIdentifier) && deepEqualsUniversalBle(lhs.data, rhs.data) + return UniversalBlePigeonInternal.deepEquals(lhs.companyIdentifier, rhs.companyIdentifier) && UniversalBlePigeonInternal.deepEquals(lhs.data, rhs.data) } func hash(into hasher: inout Hasher) { hasher.combine("UniversalManufacturerData") - deepHashUniversalBle(value: companyIdentifier, hasher: &hasher) - deepHashUniversalBle(value: data, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: companyIdentifier, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: data, hasher: &hasher) + } + + public var description: String { + return "UniversalManufacturerData(companyIdentifier: \(String(describing: companyIdentifier)), data: \(String(describing: data)))" } } @@ -923,7 +977,7 @@ struct UniversalManufacturerData: Hashable { /// delivered while suspended). /// /// Generated class from Pigeon that represents data sent in messages. -struct AppleConnectionOptions: Hashable { +struct AppleConnectionOptions: Hashable, CustomStringConvertible { /// `CBConnectPeripheralOptionNotifyOnConnectionKey`: /// notify when a connection to the device succeeds while the app is suspended. var notifyOnConnection: Bool? = nil @@ -959,14 +1013,18 @@ struct AppleConnectionOptions: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.notifyOnConnection, rhs.notifyOnConnection) && deepEqualsUniversalBle(lhs.notifyOnDisconnection, rhs.notifyOnDisconnection) && deepEqualsUniversalBle(lhs.notifyOnNotification, rhs.notifyOnNotification) + return UniversalBlePigeonInternal.deepEquals(lhs.notifyOnConnection, rhs.notifyOnConnection) && UniversalBlePigeonInternal.deepEquals(lhs.notifyOnDisconnection, rhs.notifyOnDisconnection) && UniversalBlePigeonInternal.deepEquals(lhs.notifyOnNotification, rhs.notifyOnNotification) } func hash(into hasher: inout Hasher) { hasher.combine("AppleConnectionOptions") - deepHashUniversalBle(value: notifyOnConnection, hasher: &hasher) - deepHashUniversalBle(value: notifyOnDisconnection, hasher: &hasher) - deepHashUniversalBle(value: notifyOnNotification, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: notifyOnConnection, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: notifyOnDisconnection, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: notifyOnNotification, hasher: &hasher) + } + + public var description: String { + return "AppleConnectionOptions(notifyOnConnection: \(String(describing: notifyOnConnection)), notifyOnDisconnection: \(String(describing: notifyOnDisconnection)), notifyOnNotification: \(String(describing: notifyOnNotification)))" } } @@ -974,7 +1032,7 @@ struct AppleConnectionOptions: Hashable { /// a separate entry in the system picker. /// /// Generated class from Pigeon that represents data sent in messages. -struct AppleAccessoryPickerItem: Hashable { +struct AppleAccessoryPickerItem: Hashable, CustomStringConvertible { /// Name shown in the system accessory picker. var displayName: String /// Name of the product image in the iOS app's asset catalog. @@ -1021,17 +1079,21 @@ struct AppleAccessoryPickerItem: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.displayName, rhs.displayName) && deepEqualsUniversalBle(lhs.imageAsset, rhs.imageAsset) && deepEqualsUniversalBle(lhs.serviceUuid, rhs.serviceUuid) && deepEqualsUniversalBle(lhs.nameSubstring, rhs.nameSubstring) && deepEqualsUniversalBle(lhs.requiresImmediateRange, rhs.requiresImmediateRange) && deepEqualsUniversalBle(lhs.supportsBluetoothPairing, rhs.supportsBluetoothPairing) + return UniversalBlePigeonInternal.deepEquals(lhs.displayName, rhs.displayName) && UniversalBlePigeonInternal.deepEquals(lhs.imageAsset, rhs.imageAsset) && UniversalBlePigeonInternal.deepEquals(lhs.serviceUuid, rhs.serviceUuid) && UniversalBlePigeonInternal.deepEquals(lhs.nameSubstring, rhs.nameSubstring) && UniversalBlePigeonInternal.deepEquals(lhs.requiresImmediateRange, rhs.requiresImmediateRange) && UniversalBlePigeonInternal.deepEquals(lhs.supportsBluetoothPairing, rhs.supportsBluetoothPairing) } func hash(into hasher: inout Hasher) { hasher.combine("AppleAccessoryPickerItem") - deepHashUniversalBle(value: displayName, hasher: &hasher) - deepHashUniversalBle(value: imageAsset, hasher: &hasher) - deepHashUniversalBle(value: serviceUuid, hasher: &hasher) - deepHashUniversalBle(value: nameSubstring, hasher: &hasher) - deepHashUniversalBle(value: requiresImmediateRange, hasher: &hasher) - deepHashUniversalBle(value: supportsBluetoothPairing, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: displayName, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: imageAsset, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: serviceUuid, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: nameSubstring, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: requiresImmediateRange, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: supportsBluetoothPairing, hasher: &hasher) + } + + public var description: String { + return "AppleAccessoryPickerItem(displayName: \(String(describing: displayName)), imageAsset: \(String(describing: imageAsset)), serviceUuid: \(String(describing: serviceUuid)), nameSubstring: \(String(describing: nameSubstring)), requiresImmediateRange: \(String(describing: requiresImmediateRange)), supportsBluetoothPairing: \(String(describing: supportsBluetoothPairing)))" } } @@ -1039,7 +1101,7 @@ struct AppleAccessoryPickerItem: Hashable { /// AccessorySetupKit before connecting to them. /// /// Generated class from Pigeon that represents data sent in messages. -struct AppleAccessorySetupOptions: Hashable { +struct AppleAccessorySetupOptions: Hashable, CustomStringConvertible { /// Accessories the picker offers. At least one item is required. var items: [AppleAccessoryPickerItem] @@ -1061,17 +1123,21 @@ struct AppleAccessorySetupOptions: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.items, rhs.items) + return UniversalBlePigeonInternal.deepEquals(lhs.items, rhs.items) } func hash(into hasher: inout Hasher) { hasher.combine("AppleAccessorySetupOptions") - deepHashUniversalBle(value: items, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: items, hasher: &hasher) + } + + public var description: String { + return "AppleAccessorySetupOptions(items: \(String(describing: items)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct AndroidConnectionOptions: Hashable { +struct AndroidConnectionOptions: Hashable, CustomStringConvertible { /// Close the GATT client when the FlutterEngine is detached (for /// example, when the app is "killed"). The plugin otherwise leaves the /// GATT open, keeping the peripheral occupied until its supervision @@ -1099,17 +1165,21 @@ struct AndroidConnectionOptions: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.closeGattOnDetach, rhs.closeGattOnDetach) + return UniversalBlePigeonInternal.deepEquals(lhs.closeGattOnDetach, rhs.closeGattOnDetach) } func hash(into hasher: inout Hasher) { hasher.combine("AndroidConnectionOptions") - deepHashUniversalBle(value: closeGattOnDetach, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: closeGattOnDetach, hasher: &hasher) + } + + public var description: String { + return "AndroidConnectionOptions(closeGattOnDetach: \(String(describing: closeGattOnDetach)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct ConnectionPlatformConfig: Hashable { +struct ConnectionPlatformConfig: Hashable, CustomStringConvertible { var apple: AppleConnectionOptions? = nil var android: AndroidConnectionOptions? = nil @@ -1134,18 +1204,22 @@ struct ConnectionPlatformConfig: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.apple, rhs.apple) && deepEqualsUniversalBle(lhs.android, rhs.android) + return UniversalBlePigeonInternal.deepEquals(lhs.apple, rhs.apple) && UniversalBlePigeonInternal.deepEquals(lhs.android, rhs.android) } func hash(into hasher: inout Hasher) { hasher.combine("ConnectionPlatformConfig") - deepHashUniversalBle(value: apple, hasher: &hasher) - deepHashUniversalBle(value: android, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: apple, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: android, hasher: &hasher) + } + + public var description: String { + return "ConnectionPlatformConfig(apple: \(String(describing: apple)), android: \(String(describing: android)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct AndroidDiscoverServicesOptions: Hashable { +struct AndroidDiscoverServicesOptions: Hashable, CustomStringConvertible { /// Clear the OS-level GATT cache of the connection (`BluetoothGatt.refresh()`) /// before discovering, so a peripheral whose GATT layout changed while it /// was disconnected is read again instead of served from the cache. @@ -1172,12 +1246,16 @@ struct AndroidDiscoverServicesOptions: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.clearGattCache, rhs.clearGattCache) + return UniversalBlePigeonInternal.deepEquals(lhs.clearGattCache, rhs.clearGattCache) } func hash(into hasher: inout Hasher) { hasher.combine("AndroidDiscoverServicesOptions") - deepHashUniversalBle(value: clearGattCache, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: clearGattCache, hasher: &hasher) + } + + public var description: String { + return "AndroidDiscoverServicesOptions(clearGattCache: \(String(describing: clearGattCache)))" } } @@ -1185,7 +1263,7 @@ struct AndroidDiscoverServicesOptions: Hashable { /// that have no equivalent. /// /// Generated class from Pigeon that represents data sent in messages. -struct DiscoverServicesPlatformConfig: Hashable { +struct DiscoverServicesPlatformConfig: Hashable, CustomStringConvertible { var android: AndroidDiscoverServicesOptions? = nil @@ -1206,17 +1284,21 @@ struct DiscoverServicesPlatformConfig: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.android, rhs.android) + return UniversalBlePigeonInternal.deepEquals(lhs.android, rhs.android) } func hash(into hasher: inout Hasher) { hasher.combine("DiscoverServicesPlatformConfig") - deepHashUniversalBle(value: android, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: android, hasher: &hasher) + } + + public var description: String { + return "DiscoverServicesPlatformConfig(android: \(String(describing: android)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct PeripheralAndroidOptions: Hashable { +struct PeripheralAndroidOptions: Hashable, CustomStringConvertible { var addManufacturerDataInScanResponse: Bool? = nil /// Put advertised service UUIDs in the scan response instead of the primary /// advertisement. The Android primary advertisement and scan response are @@ -1247,18 +1329,22 @@ struct PeripheralAndroidOptions: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.addManufacturerDataInScanResponse, rhs.addManufacturerDataInScanResponse) && deepEqualsUniversalBle(lhs.addServicesInScanResponse, rhs.addServicesInScanResponse) + return UniversalBlePigeonInternal.deepEquals(lhs.addManufacturerDataInScanResponse, rhs.addManufacturerDataInScanResponse) && UniversalBlePigeonInternal.deepEquals(lhs.addServicesInScanResponse, rhs.addServicesInScanResponse) } func hash(into hasher: inout Hasher) { hasher.combine("PeripheralAndroidOptions") - deepHashUniversalBle(value: addManufacturerDataInScanResponse, hasher: &hasher) - deepHashUniversalBle(value: addServicesInScanResponse, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: addManufacturerDataInScanResponse, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: addServicesInScanResponse, hasher: &hasher) + } + + public var description: String { + return "PeripheralAndroidOptions(addManufacturerDataInScanResponse: \(String(describing: addManufacturerDataInScanResponse)), addServicesInScanResponse: \(String(describing: addServicesInScanResponse)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct PeripheralPlatformConfig: Hashable { +struct PeripheralPlatformConfig: Hashable, CustomStringConvertible { var android: PeripheralAndroidOptions? = nil @@ -1279,19 +1365,23 @@ struct PeripheralPlatformConfig: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.android, rhs.android) + return UniversalBlePigeonInternal.deepEquals(lhs.android, rhs.android) } func hash(into hasher: inout Hasher) { hasher.combine("PeripheralPlatformConfig") - deepHashUniversalBle(value: android, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: android, hasher: &hasher) + } + + public var description: String { + return "PeripheralPlatformConfig(android: \(String(describing: android)))" } } /// Peripheral/GATT server models /// /// Generated class from Pigeon that represents data sent in messages. -struct PeripheralService: Hashable { +struct PeripheralService: Hashable, CustomStringConvertible { var uuid: String var primary: Bool var characteristics: [PeripheralCharacteristic] @@ -1320,19 +1410,23 @@ struct PeripheralService: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.uuid, rhs.uuid) && deepEqualsUniversalBle(lhs.primary, rhs.primary) && deepEqualsUniversalBle(lhs.characteristics, rhs.characteristics) + return UniversalBlePigeonInternal.deepEquals(lhs.uuid, rhs.uuid) && UniversalBlePigeonInternal.deepEquals(lhs.primary, rhs.primary) && UniversalBlePigeonInternal.deepEquals(lhs.characteristics, rhs.characteristics) } func hash(into hasher: inout Hasher) { hasher.combine("PeripheralService") - deepHashUniversalBle(value: uuid, hasher: &hasher) - deepHashUniversalBle(value: primary, hasher: &hasher) - deepHashUniversalBle(value: characteristics, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: uuid, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: primary, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: characteristics, hasher: &hasher) + } + + public var description: String { + return "PeripheralService(uuid: \(String(describing: uuid)), primary: \(String(describing: primary)), characteristics: \(String(describing: characteristics)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct PeripheralCharacteristic: Hashable { +struct PeripheralCharacteristic: Hashable, CustomStringConvertible { var uuid: String var properties: [CharacteristicProperty] var permissions: [PeripheralAttributePermission] @@ -1369,21 +1463,25 @@ struct PeripheralCharacteristic: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.uuid, rhs.uuid) && deepEqualsUniversalBle(lhs.properties, rhs.properties) && deepEqualsUniversalBle(lhs.permissions, rhs.permissions) && deepEqualsUniversalBle(lhs.descriptors, rhs.descriptors) && deepEqualsUniversalBle(lhs.value, rhs.value) + return UniversalBlePigeonInternal.deepEquals(lhs.uuid, rhs.uuid) && UniversalBlePigeonInternal.deepEquals(lhs.properties, rhs.properties) && UniversalBlePigeonInternal.deepEquals(lhs.permissions, rhs.permissions) && UniversalBlePigeonInternal.deepEquals(lhs.descriptors, rhs.descriptors) && UniversalBlePigeonInternal.deepEquals(lhs.value, rhs.value) } func hash(into hasher: inout Hasher) { hasher.combine("PeripheralCharacteristic") - deepHashUniversalBle(value: uuid, hasher: &hasher) - deepHashUniversalBle(value: properties, hasher: &hasher) - deepHashUniversalBle(value: permissions, hasher: &hasher) - deepHashUniversalBle(value: descriptors, hasher: &hasher) - deepHashUniversalBle(value: value, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: uuid, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: properties, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: permissions, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: descriptors, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: value, hasher: &hasher) + } + + public var description: String { + return "PeripheralCharacteristic(uuid: \(String(describing: uuid)), properties: \(String(describing: properties)), permissions: \(String(describing: permissions)), descriptors: \(String(describing: descriptors)), value: \(String(describing: value)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct PeripheralDescriptor: Hashable { +struct PeripheralDescriptor: Hashable, CustomStringConvertible { var uuid: String var value: FlutterStandardTypedData? = nil var permissions: [PeripheralAttributePermission]? = nil @@ -1412,19 +1510,23 @@ struct PeripheralDescriptor: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.uuid, rhs.uuid) && deepEqualsUniversalBle(lhs.value, rhs.value) && deepEqualsUniversalBle(lhs.permissions, rhs.permissions) + return UniversalBlePigeonInternal.deepEquals(lhs.uuid, rhs.uuid) && UniversalBlePigeonInternal.deepEquals(lhs.value, rhs.value) && UniversalBlePigeonInternal.deepEquals(lhs.permissions, rhs.permissions) } func hash(into hasher: inout Hasher) { hasher.combine("PeripheralDescriptor") - deepHashUniversalBle(value: uuid, hasher: &hasher) - deepHashUniversalBle(value: value, hasher: &hasher) - deepHashUniversalBle(value: permissions, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: uuid, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: value, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: permissions, hasher: &hasher) + } + + public var description: String { + return "PeripheralDescriptor(uuid: \(String(describing: uuid)), value: \(String(describing: value)), permissions: \(String(describing: permissions)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct PeripheralReadRequestResult: Hashable { +struct PeripheralReadRequestResult: Hashable, CustomStringConvertible { var value: FlutterStandardTypedData var offset: Int64? = nil var status: Int64? = nil @@ -1453,19 +1555,23 @@ struct PeripheralReadRequestResult: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.value, rhs.value) && deepEqualsUniversalBle(lhs.offset, rhs.offset) && deepEqualsUniversalBle(lhs.status, rhs.status) + return UniversalBlePigeonInternal.deepEquals(lhs.value, rhs.value) && UniversalBlePigeonInternal.deepEquals(lhs.offset, rhs.offset) && UniversalBlePigeonInternal.deepEquals(lhs.status, rhs.status) } func hash(into hasher: inout Hasher) { hasher.combine("PeripheralReadRequestResult") - deepHashUniversalBle(value: value, hasher: &hasher) - deepHashUniversalBle(value: offset, hasher: &hasher) - deepHashUniversalBle(value: status, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: value, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: offset, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: status, hasher: &hasher) + } + + public var description: String { + return "PeripheralReadRequestResult(value: \(String(describing: value)), offset: \(String(describing: offset)), status: \(String(describing: status)))" } } /// Generated class from Pigeon that represents data sent in messages. -struct PeripheralWriteRequestResult: Hashable { +struct PeripheralWriteRequestResult: Hashable, CustomStringConvertible { var value: FlutterStandardTypedData? = nil var offset: Int64? = nil var status: Int64? = nil @@ -1494,14 +1600,18 @@ struct PeripheralWriteRequestResult: Hashable { if Swift.type(of: lhs) != Swift.type(of: rhs) { return false } - return deepEqualsUniversalBle(lhs.value, rhs.value) && deepEqualsUniversalBle(lhs.offset, rhs.offset) && deepEqualsUniversalBle(lhs.status, rhs.status) + return UniversalBlePigeonInternal.deepEquals(lhs.value, rhs.value) && UniversalBlePigeonInternal.deepEquals(lhs.offset, rhs.offset) && UniversalBlePigeonInternal.deepEquals(lhs.status, rhs.status) } func hash(into hasher: inout Hasher) { hasher.combine("PeripheralWriteRequestResult") - deepHashUniversalBle(value: value, hasher: &hasher) - deepHashUniversalBle(value: offset, hasher: &hasher) - deepHashUniversalBle(value: status, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: value, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: offset, hasher: &hasher) + UniversalBlePigeonInternal.deepHash(value: status, hasher: &hasher) + } + + public var description: String { + return "PeripheralWriteRequestResult(value: \(String(describing: value)), offset: \(String(describing: offset)), status: \(String(describing: status)))" } } @@ -1799,6 +1909,11 @@ class UniversalBlePigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable /// APIs (Flutter -> Native / Native -> Flutter) /// ------------------------------------------------------------ +/// +/// Async methods use [asyncCallback] instead of the Pigeon >= 28 default +/// (`async` / `suspend`): the native implementations are callback-based +/// (Swift completion handlers, Kotlin callbacks), and [asyncCallback] keeps +/// those signatures rather than forcing a rewrite to native async/await. /// Flutter -> Native (central) /// /// Generated protocol from Pigeon that represents a handler of messages from Flutter. @@ -2282,6 +2397,7 @@ class UniversalBlePlatformChannelSetup { } } } + /// Native -> Flutter (central) /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. @@ -2664,6 +2780,7 @@ class UniversalBleAndroidChannelSetup { } } } + /// Native -> Flutter (peripheral) /// /// Generated protocol from Pigeon that represents Flutter messages that can be called from Swift. diff --git a/lib/src/universal_ble.g.dart b/lib/src/universal_ble.g.dart index 7c20d1aa..885131c0 100644 --- a/lib/src/universal_ble.g.dart +++ b/lib/src/universal_ble.g.dart @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v26.3.4), do not edit directly. +// Autogenerated from Pigeon (v29.0.10), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: unused_import, unused_shown_name // ignore_for_file: type=lint @@ -113,7 +113,7 @@ enum BleLogLevel { warning, info, debug, - verbose, + verbose; } enum AvailabilityState { @@ -122,25 +122,25 @@ enum AvailabilityState { unsupported, unauthorized, poweredOff, - poweredOn, + poweredOn; } enum BleConnectionState { connected, disconnected, connecting, - disconnecting, + disconnecting; } enum BleInputProperty { disabled, notification, - indication, + indication; } enum BleOutputProperty { withResponse, - withoutResponse, + withoutResponse; } /// Connection priority hint passed to [requestConnectionPriority]. @@ -154,14 +154,14 @@ enum BleConnectionPriority { highPerformance, /// Power-optimized interval (~100-125 ms). Android constant: 2. - lowPower, + lowPower; } enum AndroidScanMode { balanced, lowLatency, lowPower, - opportunistic, + opportunistic; } /// Mirrors `android.bluetooth.le.ScanSettings#setCallbackType`. Pass any @@ -180,20 +180,20 @@ enum AndroidScanCallbackType { allMatches, firstMatch, matchLost, - allMatchesAutoBatch, + allMatchesAutoBatch; } /// Mirrors `android.bluetooth.le.ScanSettings#setMatchMode`. enum AndroidScanMatchMode { aggressive, - sticky, + sticky; } /// Mirrors `android.bluetooth.le.ScanSettings#setNumOfMatches`. enum AndroidScanNumOfMatches { one, few, - max, + max; } enum CharacteristicProperty { @@ -204,7 +204,7 @@ enum CharacteristicProperty { notify, indicate, authenticatedSignedWrites, - extendedProperties, + extendedProperties; } enum PeripheralReadinessState { @@ -212,14 +212,14 @@ enum PeripheralReadinessState { ready, bluetoothOff, unauthorized, - unsupported, + unsupported; } enum PeripheralAttributePermission { readable, writeable, readEncryptionRequired, - writeEncryptionRequired, + writeEncryptionRequired; } enum PeripheralAdvertisingState { @@ -227,7 +227,7 @@ enum PeripheralAdvertisingState { starting, advertising, stopping, - error, + error; } /// Unified error codes for all platforms @@ -292,7 +292,7 @@ enum UniversalBleErrorCode { alreadyUnpaired, scanFailed, stoppingScanInProgress, - webBluetoothGloballyDisabled, + webBluetoothGloballyDisabled; } /// Shared models & enums @@ -392,6 +392,11 @@ class UniversalBleScanResult { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UniversalBleScanResult(deviceId: $deviceId, name: $name, isPaired: $isPaired, rssi: $rssi, manufacturerDataList: $manufacturerDataList, serviceData: $serviceData, services: $services, timestamp: $timestamp, timestampMicroseconds: $timestampMicroseconds, connectable: $connectable)'; + } } /// The device a platform's native picker returned. @@ -443,6 +448,11 @@ class UniversalDevicePickerResult { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UniversalDevicePickerResult(deviceId: $deviceId, name: $name)'; + } } /// Central/GATT models @@ -492,6 +502,11 @@ class UniversalBleService { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UniversalBleService(uuid: $uuid, characteristics: $characteristics)'; + } } class UniversalBleCharacteristic { @@ -546,6 +561,11 @@ class UniversalBleCharacteristic { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UniversalBleCharacteristic(uuid: $uuid, properties: $properties, descriptors: $descriptors)'; + } } class UniversalBleDescriptor { @@ -587,6 +607,11 @@ class UniversalBleDescriptor { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UniversalBleDescriptor(uuid: $uuid)'; + } } /// Link-layer connection parameters reported by Android [onConnectionUpdated]. @@ -657,6 +682,11 @@ class BleConnectionParametersChange { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'BleConnectionParametersChange(deviceId: $deviceId, interval: $interval, latency: $latency, supervisionTimeout: $supervisionTimeout, status: $status)'; + } } /// Scan models @@ -763,6 +793,11 @@ class AndroidOptions { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'AndroidOptions(requestLocationPermission: $requestLocationPermission, scanMode: $scanMode, reportDelayMillis: $reportDelayMillis, callbackType: $callbackType, matchMode: $matchMode, numOfMatches: $numOfMatches, legacy: $legacy)'; + } } class UniversalScanConfig { @@ -814,6 +849,11 @@ class UniversalScanConfig { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UniversalScanConfig(android: $android, skipDuplicates: $skipDuplicates)'; + } } class UniversalScanFilter { @@ -877,6 +917,11 @@ class UniversalScanFilter { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UniversalScanFilter(withServices: $withServices, withNamePrefix: $withNamePrefix, withManufacturerData: $withManufacturerData, withServiceData: $withServiceData)'; + } } class ManufacturerDataFilter { @@ -935,6 +980,11 @@ class ManufacturerDataFilter { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'ManufacturerDataFilter(companyIdentifier: $companyIdentifier, payloadPrefix: $payloadPrefix, payloadMask: $payloadMask)'; + } } class UniversalManufacturerData { @@ -983,6 +1033,11 @@ class UniversalManufacturerData { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'UniversalManufacturerData(companyIdentifier: $companyIdentifier, data: $data)'; + } } /// Apple options for `connect`. @@ -1055,6 +1110,11 @@ class AppleConnectionOptions { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'AppleConnectionOptions(notifyOnConnection: $notifyOnConnection, notifyOnDisconnection: $notifyOnDisconnection, notifyOnNotification: $notifyOnNotification)'; + } } /// One accessory the AccessorySetupKit picker can offer. Each item is shown as @@ -1135,6 +1195,11 @@ class AppleAccessoryPickerItem { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'AppleAccessoryPickerItem(displayName: $displayName, imageAsset: $imageAsset, serviceUuid: $serviceUuid, nameSubstring: $nameSubstring, requiresImmediateRange: $requiresImmediateRange, supportsBluetoothPairing: $supportsBluetoothPairing)'; + } } /// iOS 18+ options for discovering and authorizing Bluetooth accessories with @@ -1180,6 +1245,11 @@ class AppleAccessorySetupOptions { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'AppleAccessorySetupOptions(items: $items)'; + } } class AndroidConnectionOptions { @@ -1229,6 +1299,11 @@ class AndroidConnectionOptions { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'AndroidConnectionOptions(closeGattOnDetach: $closeGattOnDetach)'; + } } class ConnectionPlatformConfig { @@ -1277,6 +1352,11 @@ class ConnectionPlatformConfig { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'ConnectionPlatformConfig(apple: $apple, android: $android)'; + } } class AndroidDiscoverServicesOptions { @@ -1325,6 +1405,11 @@ class AndroidDiscoverServicesOptions { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'AndroidDiscoverServicesOptions(clearGattCache: $clearGattCache)'; + } } /// Platform-specific options for `discoverServices`. Ignored on platforms @@ -1369,6 +1454,11 @@ class DiscoverServicesPlatformConfig { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'DiscoverServicesPlatformConfig(android: $android)'; + } } class PeripheralAndroidOptions { @@ -1424,6 +1514,11 @@ class PeripheralAndroidOptions { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'PeripheralAndroidOptions(addManufacturerDataInScanResponse: $addManufacturerDataInScanResponse, addServicesInScanResponse: $addServicesInScanResponse)'; + } } class PeripheralPlatformConfig { @@ -1466,6 +1561,11 @@ class PeripheralPlatformConfig { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'PeripheralPlatformConfig(android: $android)'; + } } /// Peripheral/GATT server models @@ -1521,6 +1621,11 @@ class PeripheralService { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'PeripheralService(uuid: $uuid, primary: $primary, characteristics: $characteristics)'; + } } class PeripheralCharacteristic { @@ -1588,6 +1693,11 @@ class PeripheralCharacteristic { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'PeripheralCharacteristic(uuid: $uuid, properties: $properties, permissions: $permissions, descriptors: $descriptors, value: $value)'; + } } class PeripheralDescriptor { @@ -1642,6 +1752,11 @@ class PeripheralDescriptor { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'PeripheralDescriptor(uuid: $uuid, value: $value, permissions: $permissions)'; + } } class PeripheralReadRequestResult { @@ -1696,6 +1811,11 @@ class PeripheralReadRequestResult { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'PeripheralReadRequestResult(value: $value, offset: $offset, status: $status)'; + } } class PeripheralWriteRequestResult { @@ -1750,6 +1870,11 @@ class PeripheralWriteRequestResult { @override // ignore: avoid_equals_and_hash_code_on_mutable_classes int get hashCode => _deepHash([runtimeType, ..._toList()]); + + @override + String toString() { + return 'PeripheralWriteRequestResult(value: $value, offset: $offset, status: $status)'; + } } class _PigeonCodec extends StandardMessageCodec { @@ -1992,18 +2117,24 @@ class _PigeonCodec extends StandardMessageCodec { /// APIs (Flutter -> Native / Native -> Flutter) /// ------------------------------------------------------------ +/// +/// Async methods use [asyncCallback] instead of the Pigeon >= 28 default +/// (`async` / `suspend`): the native implementations are callback-based +/// (Swift completion handlers, Kotlin callbacks), and [asyncCallback] keeps +/// those signatures rather than forcing a rewrite to native async/await. /// Flutter -> Native (central) class UniversalBlePlatformChannel { - /// Constructor for [UniversalBlePlatformChannel]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default + /// 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, + UniversalBlePlatformChannel({ + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) : pigeonVar_binaryMessenger = binaryMessenger, pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; @@ -2540,27 +2671,29 @@ class UniversalBlePlatformChannel { abstract class UniversalBleCallbackChannel { static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - void onAvailabilityChanged(AvailabilityState state); + Future onAvailabilityChanged(AvailabilityState state); /// [isFailure] marks a failed bond attempt — an event rather than a steady /// pairing state — so the Dart side can bypass its state de-duplication /// instead of swallowing every failure after the first (#325). - void onPairStateChange(String deviceId, bool isPaired, bool isFailure); + Future onPairStateChange( + String deviceId, bool isPaired, bool isFailure); - void onScanResult(UniversalBleScanResult result); + Future onScanResult(UniversalBleScanResult result); - void onValueChanged(String deviceId, String characteristicId, Uint8List value, - int? timestamp); + Future onValueChanged(String deviceId, String characteristicId, + Uint8List value, int? timestamp); /// [errorCode] classifies a failed connection or an unexpected disconnect /// (`deviceDisconnected`, `connectionTimeout`, `connectionFailed`, ...), /// mapped on the native side from `CBError.Code` (Apple) or the GATT /// `status` (Android). [nativeErrorCode] is that raw platform value. /// Both are `null` when there is no error or the platform has no code. - void onConnectionChanged(String deviceId, bool connected, String? error, - UniversalBleErrorCode? errorCode, int? nativeErrorCode); + Future onConnectionChanged(String deviceId, bool connected, + String? error, UniversalBleErrorCode? errorCode, int? nativeErrorCode); - void onConnectionParametersUpdated(BleConnectionParametersChange update); + Future onConnectionParametersUpdated( + BleConnectionParametersChange update); static void setUp( UniversalBleCallbackChannel? api, { @@ -2581,7 +2714,7 @@ abstract class UniversalBleCallbackChannel { final List args = message! as List; final AvailabilityState arg_state = args[0]! as AvailabilityState; try { - api.onAvailabilityChanged(arg_state); + await api.onAvailabilityChanged(arg_state); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -2606,7 +2739,8 @@ abstract class UniversalBleCallbackChannel { final bool arg_isPaired = args[1]! as bool; final bool arg_isFailure = args[2]! as bool; try { - api.onPairStateChange(arg_deviceId, arg_isPaired, arg_isFailure); + await api.onPairStateChange( + arg_deviceId, arg_isPaired, arg_isFailure); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -2630,7 +2764,7 @@ abstract class UniversalBleCallbackChannel { final UniversalBleScanResult arg_result = args[0]! as UniversalBleScanResult; try { - api.onScanResult(arg_result); + await api.onScanResult(arg_result); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -2656,7 +2790,7 @@ abstract class UniversalBleCallbackChannel { final Uint8List arg_value = args[2]! as Uint8List; final int? arg_timestamp = args[3] as int?; try { - api.onValueChanged( + await api.onValueChanged( arg_deviceId, arg_characteristicId, arg_value, arg_timestamp); return wrapResponse(empty: true); } on PlatformException catch (e) { @@ -2685,8 +2819,8 @@ abstract class UniversalBleCallbackChannel { args[3] as UniversalBleErrorCode?; final int? arg_nativeErrorCode = args[4] as int?; try { - api.onConnectionChanged(arg_deviceId, arg_connected, arg_error, - arg_errorCode, arg_nativeErrorCode); + await api.onConnectionChanged(arg_deviceId, arg_connected, + arg_error, arg_errorCode, arg_nativeErrorCode); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -2710,7 +2844,7 @@ abstract class UniversalBleCallbackChannel { final BleConnectionParametersChange arg_update = args[0]! as BleConnectionParametersChange; try { - api.onConnectionParametersUpdated(arg_update); + await api.onConnectionParametersUpdated(arg_update); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -2726,16 +2860,17 @@ abstract class UniversalBleCallbackChannel { /// Flutter -> Native (peripheral) class UniversalBlePeripheralChannel { - /// Constructor for [UniversalBlePeripheralChannel]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default + /// Constructor for [UniversalBlePeripheralChannel]. 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. - UniversalBlePeripheralChannel( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, + UniversalBlePeripheralChannel({ + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) : pigeonVar_binaryMessenger = binaryMessenger, pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; @@ -2967,16 +3102,17 @@ class UniversalBlePeripheralChannel { /// Flutter -> Native (Android only) class UniversalBleAndroidChannel { - /// Constructor for [UniversalBleAndroidChannel]. The [binaryMessenger] named argument is - /// available for dependency injection. If it is left null, the default + /// Constructor for [UniversalBleAndroidChannel]. 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. - UniversalBleAndroidChannel( - {BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''}) - : pigeonVar_binaryMessenger = binaryMessenger, + UniversalBleAndroidChannel({ + BinaryMessenger? binaryMessenger, + String messageChannelSuffix = '', + }) : pigeonVar_binaryMessenger = binaryMessenger, pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : ''; - final BinaryMessenger? pigeonVar_binaryMessenger; + final BinaryMessenger? pigeonVar_binaryMessenger; static const MessageCodec pigeonChannelCodec = _PigeonCodec(); final String pigeonVar_messageChannelSuffix; @@ -3024,37 +3160,37 @@ class UniversalBleAndroidChannel { abstract class UniversalBlePeripheralCallback { static const MessageCodec pigeonChannelCodec = _PigeonCodec(); - PeripheralReadRequestResult? onReadRequest( + Future onReadRequest( String deviceId, String characteristicId, int offset, Uint8List? value); - PeripheralWriteRequestResult? onWriteRequest( + Future onWriteRequest( String deviceId, String characteristicId, int offset, Uint8List? value); - PeripheralReadRequestResult? onDescriptorReadRequest( + Future onDescriptorReadRequest( String deviceId, String characteristicId, String descriptorId, int offset, Uint8List? value); - PeripheralWriteRequestResult? onDescriptorWriteRequest( + Future onDescriptorWriteRequest( String deviceId, String characteristicId, String descriptorId, int offset, Uint8List? value); - void onCharacteristicSubscriptionChange(String deviceId, + Future onCharacteristicSubscriptionChange(String deviceId, String characteristicId, bool isSubscribed, String? name); - void onAdvertisingStateChange( + Future onAdvertisingStateChange( PeripheralAdvertisingState state, String? error); - void onServiceAdded(String serviceId, String? error); + Future onServiceAdded(String serviceId, String? error); - void onMtuChange(String deviceId, int mtu); + Future onMtuChange(String deviceId, int mtu); - void onConnectionStateChange(String deviceId, bool connected); + Future onConnectionStateChange(String deviceId, bool connected); static void setUp( UniversalBlePeripheralCallback? api, { @@ -3078,7 +3214,7 @@ abstract class UniversalBlePeripheralCallback { final int arg_offset = args[2]! as int; final Uint8List? arg_value = args[3] as Uint8List?; try { - final PeripheralReadRequestResult? output = api.onReadRequest( + final PeripheralReadRequestResult? output = await api.onReadRequest( arg_deviceId, arg_characteristicId, arg_offset, arg_value); return wrapResponse(result: output); } on PlatformException catch (e) { @@ -3105,8 +3241,9 @@ abstract class UniversalBlePeripheralCallback { final int arg_offset = args[2]! as int; final Uint8List? arg_value = args[3] as Uint8List?; try { - final PeripheralWriteRequestResult? output = api.onWriteRequest( - arg_deviceId, arg_characteristicId, arg_offset, arg_value); + final PeripheralWriteRequestResult? output = + await api.onWriteRequest( + arg_deviceId, arg_characteristicId, arg_offset, arg_value); return wrapResponse(result: output); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3134,8 +3271,12 @@ abstract class UniversalBlePeripheralCallback { final Uint8List? arg_value = args[4] as Uint8List?; try { final PeripheralReadRequestResult? output = - api.onDescriptorReadRequest(arg_deviceId, arg_characteristicId, - arg_descriptorId, arg_offset, arg_value); + await api.onDescriptorReadRequest( + arg_deviceId, + arg_characteristicId, + arg_descriptorId, + arg_offset, + arg_value); return wrapResponse(result: output); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3163,8 +3304,12 @@ abstract class UniversalBlePeripheralCallback { final Uint8List? arg_value = args[4] as Uint8List?; try { final PeripheralWriteRequestResult? output = - api.onDescriptorWriteRequest(arg_deviceId, arg_characteristicId, - arg_descriptorId, arg_offset, arg_value); + await api.onDescriptorWriteRequest( + arg_deviceId, + arg_characteristicId, + arg_descriptorId, + arg_offset, + arg_value); return wrapResponse(result: output); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3190,7 +3335,7 @@ abstract class UniversalBlePeripheralCallback { final bool arg_isSubscribed = args[2]! as bool; final String? arg_name = args[3] as String?; try { - api.onCharacteristicSubscriptionChange( + await api.onCharacteristicSubscriptionChange( arg_deviceId, arg_characteristicId, arg_isSubscribed, arg_name); return wrapResponse(empty: true); } on PlatformException catch (e) { @@ -3216,7 +3361,7 @@ abstract class UniversalBlePeripheralCallback { args[0]! as PeripheralAdvertisingState; final String? arg_error = args[1] as String?; try { - api.onAdvertisingStateChange(arg_state, arg_error); + await api.onAdvertisingStateChange(arg_state, arg_error); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3240,7 +3385,7 @@ abstract class UniversalBlePeripheralCallback { final String arg_serviceId = args[0]! as String; final String? arg_error = args[1] as String?; try { - api.onServiceAdded(arg_serviceId, arg_error); + await api.onServiceAdded(arg_serviceId, arg_error); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3264,7 +3409,7 @@ abstract class UniversalBlePeripheralCallback { final String arg_deviceId = args[0]! as String; final int arg_mtu = args[1]! as int; try { - api.onMtuChange(arg_deviceId, arg_mtu); + await api.onMtuChange(arg_deviceId, arg_mtu); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -3288,7 +3433,7 @@ abstract class UniversalBlePeripheralCallback { final String arg_deviceId = args[0]! as String; final bool arg_connected = args[1]! as bool; try { - api.onConnectionStateChange(arg_deviceId, arg_connected); + await api.onConnectionStateChange(arg_deviceId, arg_connected); return wrapResponse(empty: true); } on PlatformException catch (e) { return wrapResponse(error: e); diff --git a/lib/src/universal_ble_pigeon/universal_ble_peripheral_pigeon.dart b/lib/src/universal_ble_pigeon/universal_ble_peripheral_pigeon.dart index 83f0cabc..bdea07b6 100644 --- a/lib/src/universal_ble_pigeon/universal_ble_peripheral_pigeon.dart +++ b/lib/src/universal_ble_pigeon/universal_ble_peripheral_pigeon.dart @@ -168,20 +168,20 @@ class UniversalBlePeripheralPigeon extends UniversalBlePeripheralPlatform _descriptorWriteRequestHandler = handler; @override - void onAdvertisingStateChange( + Future onAdvertisingStateChange( PeripheralAdvertisingState state, String? error, - ) { + ) async { updateAdvertisingState(BlePeripheralAdvertisingStateChanged(state, error)); } @override - void onCharacteristicSubscriptionChange( + Future onCharacteristicSubscriptionChange( String deviceId, String characteristicId, bool isSubscribed, String? name, - ) { + ) async { updateCharacteristicSubscription( BlePeripheralCharacteristicSubscriptionChanged( deviceId: deviceId, @@ -193,24 +193,24 @@ class UniversalBlePeripheralPigeon extends UniversalBlePeripheralPlatform } @override - void onConnectionStateChange(String deviceId, bool connected) { + Future onConnectionStateChange(String deviceId, bool connected) async { updateConnectionState( BlePeripheralConnectionStateChanged(deviceId, connected), ); } @override - void onMtuChange(String deviceId, int mtu) { + Future onMtuChange(String deviceId, int mtu) async { updateMtu(BlePeripheralMtuChanged(deviceId, mtu)); } @override - PeripheralReadRequestResult? onReadRequest( + Future onReadRequest( String deviceId, String characteristicId, int offset, Uint8List? value, - ) { + ) async { final result = _readRequestHandler?.call( deviceId.toDeviceId(isAddress: hasAddressDeviceIds).canonical, BleUuidParser.string(characteristicId), @@ -226,19 +226,19 @@ class UniversalBlePeripheralPigeon extends UniversalBlePeripheralPlatform } @override - void onServiceAdded(String serviceId, String? error) { + Future onServiceAdded(String serviceId, String? error) async { updateServiceAdded( BlePeripheralServiceAdded(BleUuidParser.string(serviceId), error), ); } @override - PeripheralWriteRequestResult? onWriteRequest( + Future onWriteRequest( String deviceId, String characteristicId, int offset, Uint8List? value, - ) { + ) async { final result = _writeRequestHandler?.call( deviceId.toDeviceId(isAddress: hasAddressDeviceIds).canonical, BleUuidParser.string(characteristicId), @@ -254,13 +254,13 @@ class UniversalBlePeripheralPigeon extends UniversalBlePeripheralPlatform } @override - PeripheralReadRequestResult? onDescriptorReadRequest( + Future onDescriptorReadRequest( String deviceId, String characteristicId, String descriptorId, int offset, Uint8List? value, - ) { + ) async { final result = _descriptorReadRequestHandler?.call( deviceId.toDeviceId(isAddress: hasAddressDeviceIds).canonical, BleUuidParser.string(characteristicId), @@ -277,13 +277,13 @@ class UniversalBlePeripheralPigeon extends UniversalBlePeripheralPlatform } @override - PeripheralWriteRequestResult? onDescriptorWriteRequest( + Future onDescriptorWriteRequest( String deviceId, String characteristicId, String descriptorId, int offset, Uint8List? value, - ) { + ) async { final result = _descriptorWriteRequestHandler?.call( deviceId.toDeviceId(isAddress: hasAddressDeviceIds).canonical, BleUuidParser.string(characteristicId), diff --git a/lib/src/universal_ble_pigeon/universal_ble_pigeon_channel.dart b/lib/src/universal_ble_pigeon/universal_ble_pigeon_channel.dart index 7ce9e626..b4237a9c 100644 --- a/lib/src/universal_ble_pigeon/universal_ble_pigeon_channel.dart +++ b/lib/src/universal_ble_pigeon/universal_ble_pigeon_channel.dart @@ -306,21 +306,21 @@ class UniversalBlePigeonChannel extends UniversalBlePlatform } @override - void onAvailabilityChanged(AvailabilityState state) => + Future onAvailabilityChanged(AvailabilityState state) async => updateAvailability(state); @override - void onConnectionChanged( + Future onConnectionChanged( String deviceId, bool connected, String? error, UniversalBleErrorCode? errorCode, int? nativeErrorCode, - ) => + ) async => updateConnection(deviceId, connected, error, errorCode, nativeErrorCode); @override - void onScanResult(UniversalBleScanResult result) { + Future onScanResult(UniversalBleScanResult result) async { // Exclusion filter and connectableOnly are handled on Dart side; // other scan filters (services, manufacturerData, namePrefix) // are handled natively by the platform. @@ -331,16 +331,20 @@ class UniversalBlePigeonChannel extends UniversalBlePlatform } @override - void onValueChanged( + Future onValueChanged( String deviceId, String characteristicId, Uint8List value, int? timestamp, - ) => + ) async => updateCharacteristicValue(deviceId, characteristicId, value, timestamp); @override - void onPairStateChange(String deviceId, bool isPaired, bool isFailure) { + Future onPairStateChange( + String deviceId, + bool isPaired, + bool isFailure, + ) async { // A failed bond is an event, not a state: route it around the pairing-state dedup (#325). if (isFailure) { updatePairingFailure(deviceId); @@ -350,7 +354,9 @@ class UniversalBlePigeonChannel extends UniversalBlePlatform } @override - void onConnectionParametersUpdated(BleConnectionParametersChange update) => + Future onConnectionParametersUpdated( + BleConnectionParametersChange update, + ) async => updateConnectionParameters(update); } diff --git a/pigeon/universal_ble.dart b/pigeon/universal_ble.dart index 551fd082..ec49fc7d 100644 --- a/pigeon/universal_ble.dart +++ b/pigeon/universal_ble.dart @@ -467,22 +467,27 @@ class PeripheralWriteRequestResult { /// APIs (Flutter -> Native / Native -> Flutter) /// ------------------------------------------------------------ +/// +/// Async methods use [asyncCallback] instead of the Pigeon >= 28 default +/// (`async` / `suspend`): the native implementations are callback-based +/// (Swift completion handlers, Kotlin callbacks), and [asyncCallback] keeps +/// those signatures rather than forcing a rewrite to native async/await. /// Flutter -> Native (central) @HostApi() abstract class UniversalBlePlatformChannel { - @async + @asyncCallback AvailabilityState getBluetoothAvailabilityState(); bool hasPermissions(bool withAndroidFineLocation); - @async + @asyncCallback void requestPermissions(bool withAndroidFineLocation); - @async + @asyncCallback bool enableBluetooth(); - @async + @asyncCallback bool disableBluetooth(); void startScan(UniversalScanFilter? filter, UniversalScanConfig? config); @@ -493,7 +498,7 @@ abstract class UniversalBlePlatformChannel { /// Shows the platform's native device picker (iOS 18+ AccessorySetupKit) and /// returns the selected device. - @async + @asyncCallback UniversalDevicePickerResult requestDevice(AppleAccessorySetupOptions options); void connect( @@ -504,7 +509,7 @@ abstract class UniversalBlePlatformChannel { void disconnect(String deviceId); - @async + @asyncCallback void setNotifiable( String deviceId, String service, @@ -512,17 +517,17 @@ abstract class UniversalBlePlatformChannel { BleInputProperty bleInputProperty, ); - @async + @asyncCallback List discoverServices( String deviceId, bool withDescriptors, DiscoverServicesPlatformConfig? platformConfig, ); - @async + @asyncCallback Uint8List readValue(String deviceId, String service, String characteristic); - @async + @asyncCallback Uint8List readDescriptorValue( String deviceId, String service, @@ -530,10 +535,10 @@ abstract class UniversalBlePlatformChannel { String descriptor, ); - @async + @asyncCallback int requestMtu(String deviceId, int expectedMtu); - @async + @asyncCallback void writeValue( String deviceId, String service, @@ -542,7 +547,7 @@ abstract class UniversalBlePlatformChannel { BleOutputProperty bleOutputProperty, ); - @async + @asyncCallback void writeDescriptorValue( String deviceId, String service, @@ -551,24 +556,24 @@ abstract class UniversalBlePlatformChannel { Uint8List value, ); - @async + @asyncCallback bool isPaired(String deviceId); - @async + @asyncCallback bool pair(String deviceId); - @async + @asyncCallback void unPair(String deviceId); - @async + @asyncCallback List getSystemDevices(List withServices); BleConnectionState getConnectionState(String deviceId); - @async + @asyncCallback int readRssi(String deviceId); - @async + @asyncCallback void requestConnectionPriority( String deviceId, BleConnectionPriority priority, @@ -580,15 +585,19 @@ abstract class UniversalBlePlatformChannel { /// Native -> Flutter (central) @FlutterApi() abstract class UniversalBleCallbackChannel { + @asyncCallback void onAvailabilityChanged(AvailabilityState state); /// [isFailure] marks a failed bond attempt — an event rather than a steady /// pairing state — so the Dart side can bypass its state de-duplication /// instead of swallowing every failure after the first (#325). + @asyncCallback void onPairStateChange(String deviceId, bool isPaired, bool isFailure); + @asyncCallback void onScanResult(UniversalBleScanResult result); + @asyncCallback void onValueChanged( String deviceId, String characteristicId, @@ -601,6 +610,7 @@ abstract class UniversalBleCallbackChannel { /// mapped on the native side from `CBError.Code` (Apple) or the GATT /// `status` (Android). [nativeErrorCode] is that raw platform value. /// Both are `null` when there is no error or the platform has no code. + @asyncCallback void onConnectionChanged( String deviceId, bool connected, @@ -609,6 +619,7 @@ abstract class UniversalBleCallbackChannel { int? nativeErrorCode, ); + @asyncCallback void onConnectionParametersUpdated(BleConnectionParametersChange update); } @@ -656,13 +667,14 @@ abstract class UniversalBlePeripheralChannel { abstract class UniversalBleAndroidChannel { bool hasBluetoothAdvertisePermission(); - @async + @asyncCallback bool requestBluetoothAdvertisePermission(); } /// Native -> Flutter (peripheral) @FlutterApi() abstract class UniversalBlePeripheralCallback { + @asyncCallback PeripheralReadRequestResult? onReadRequest( String deviceId, String characteristicId, @@ -670,6 +682,7 @@ abstract class UniversalBlePeripheralCallback { Uint8List? value, ); + @asyncCallback PeripheralWriteRequestResult? onWriteRequest( String deviceId, String characteristicId, @@ -677,6 +690,7 @@ abstract class UniversalBlePeripheralCallback { Uint8List? value, ); + @asyncCallback PeripheralReadRequestResult? onDescriptorReadRequest( String deviceId, String characteristicId, @@ -685,6 +699,7 @@ abstract class UniversalBlePeripheralCallback { Uint8List? value, ); + @asyncCallback PeripheralWriteRequestResult? onDescriptorWriteRequest( String deviceId, String characteristicId, @@ -693,6 +708,7 @@ abstract class UniversalBlePeripheralCallback { Uint8List? value, ); + @asyncCallback void onCharacteristicSubscriptionChange( String deviceId, String characteristicId, @@ -700,15 +716,19 @@ abstract class UniversalBlePeripheralCallback { String? name, ); + @asyncCallback void onAdvertisingStateChange( PeripheralAdvertisingState state, String? error, ); + @asyncCallback void onServiceAdded(String serviceId, String? error); + @asyncCallback void onMtuChange(String deviceId, int mtu); + @asyncCallback void onConnectionStateChange(String deviceId, bool connected); } diff --git a/windows/src/generated/universal_ble.g.cpp b/windows/src/generated/universal_ble.g.cpp index 3cbcc1cc..ead7272f 100644 --- a/windows/src/generated/universal_ble.g.cpp +++ b/windows/src/generated/universal_ble.g.cpp @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v26.3.4), do not edit directly. +// Autogenerated from Pigeon (v29.0.10), do not edit directly. // See also: https://pub.dev/packages/pigeon #undef _HAS_EXCEPTIONS @@ -14,6 +14,7 @@ #include #include #include +#include #include namespace universal_ble { @@ -224,6 +225,99 @@ size_t PigeonInternalDeepHash(const ::flutter::EncodableValue& v) { return result; } +template +std::string PigeonInternalToString(const T& v); + +std::string PigeonInternalToString(const bool& v); + +template +std::string PigeonInternalToString(const std::vector& v); + +template +std::string PigeonInternalToString(const std::map& v); + +template +std::string PigeonInternalToString(const std::optional& v); + +template +std::string PigeonInternalToString(const std::unique_ptr& v); + +std::string PigeonInternalToString(const ::flutter::EncodableValue& v); + +template +std::string PigeonInternalToString(const T& v) { + std::stringstream ss; + if constexpr (std::is_enum_v) { + ss << static_cast(v); + } else { + ss << v; + } + return ss.str(); +} + +std::string PigeonInternalToString(const bool& v) { + return v ? "true" : "false"; +} + +template +std::string PigeonInternalToString(const std::vector& v) { + std::stringstream ss; + ss << "["; + for (size_t i = 0; i < v.size(); ++i) { + if (i > 0) { + ss << ", "; + } + ss << PigeonInternalToString(v[i]); + } + ss << "]"; + return ss.str(); +} + +template +std::string PigeonInternalToString(const std::map& v) { + std::stringstream ss; + ss << "{"; + bool first = true; + for (const auto& kv : v) { + if (!first) { + ss << ", "; + } + first = false; + ss << PigeonInternalToString(kv.first) << ": " << PigeonInternalToString(kv.second); + } + ss << "}"; + return ss.str(); +} + +template +std::string PigeonInternalToString(const std::optional& v) { + return v ? PigeonInternalToString(*v) : "null"; +} + +template +std::string PigeonInternalToString(const std::unique_ptr& v) { + return v ? PigeonInternalToString(*v) : "null"; +} + +std::string PigeonInternalToString(const ::flutter::EncodableValue& v) { + return std::visit( + [](const auto& val) { + using T = std::decay_t; + if constexpr (std::is_same_v) { + return std::string("null"); + } else if constexpr (std::is_same_v) { + return val ? std::string("true") : std::string("false"); + } else if constexpr (std::is_same_v) { + return "\"" + val + "\""; + } else if constexpr (std::is_same_v) { + return std::string("[custom]"); + } else { + return PigeonInternalToString(val); + } + }, + v); +} + } // namespace // UniversalBleScanResult @@ -459,6 +553,79 @@ size_t UniversalBleScanResult::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const UniversalBleScanResult& obj) { + os << "UniversalBleScanResult("; + os << "device_id: "; + os << PigeonInternalToString(obj.device_id_); + os << ", name: "; + if (obj.name_) { + os << PigeonInternalToString(*obj.name_); + } + else { + os << "null"; + } + os << ", is_paired: "; + if (obj.is_paired_) { + os << PigeonInternalToString(*obj.is_paired_); + } + else { + os << "null"; + } + os << ", rssi: "; + if (obj.rssi_) { + os << PigeonInternalToString(*obj.rssi_); + } + else { + os << "null"; + } + os << ", manufacturer_data_list: "; + if (obj.manufacturer_data_list_) { + os << PigeonInternalToString(*obj.manufacturer_data_list_); + } + else { + os << "null"; + } + os << ", service_data: "; + if (obj.service_data_) { + os << PigeonInternalToString(*obj.service_data_); + } + else { + os << "null"; + } + os << ", services: "; + if (obj.services_) { + os << PigeonInternalToString(*obj.services_); + } + else { + os << "null"; + } + os << ", timestamp: "; + if (obj.timestamp_) { + os << PigeonInternalToString(*obj.timestamp_); + } + else { + os << "null"; + } + os << ", timestamp_microseconds: "; + if (obj.timestamp_microseconds_) { + os << PigeonInternalToString(*obj.timestamp_microseconds_); + } + else { + os << "null"; + } + os << ", connectable: "; + if (obj.connectable_) { + os << PigeonInternalToString(*obj.connectable_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const UniversalBleScanResult& v) { return v.Hash(); } @@ -529,6 +696,23 @@ size_t UniversalDevicePickerResult::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const UniversalDevicePickerResult& obj) { + os << "UniversalDevicePickerResult("; + os << "device_id: "; + os << PigeonInternalToString(obj.device_id_); + os << ", name: "; + if (obj.name_) { + os << PigeonInternalToString(*obj.name_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const UniversalDevicePickerResult& v) { return v.Hash(); } @@ -599,6 +783,23 @@ size_t UniversalBleService::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const UniversalBleService& obj) { + os << "UniversalBleService("; + os << "uuid: "; + os << PigeonInternalToString(obj.uuid_); + os << ", characteristics: "; + if (obj.characteristics_) { + os << PigeonInternalToString(*obj.characteristics_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const UniversalBleService& v) { return v.Hash(); } @@ -673,6 +874,20 @@ size_t UniversalBleCharacteristic::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const UniversalBleCharacteristic& obj) { + os << "UniversalBleCharacteristic("; + os << "uuid: "; + os << PigeonInternalToString(obj.uuid_); + os << ", properties: "; + os << PigeonInternalToString(obj.properties_); + os << ", descriptors: "; + os << PigeonInternalToString(obj.descriptors_); + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const UniversalBleCharacteristic& v) { return v.Hash(); } @@ -718,6 +933,16 @@ size_t UniversalBleDescriptor::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const UniversalBleDescriptor& obj) { + os << "UniversalBleDescriptor("; + os << "uuid: "; + os << PigeonInternalToString(obj.uuid_); + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const UniversalBleDescriptor& v) { return v.Hash(); } @@ -820,6 +1045,24 @@ size_t BleConnectionParametersChange::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const BleConnectionParametersChange& obj) { + os << "BleConnectionParametersChange("; + os << "device_id: "; + os << PigeonInternalToString(obj.device_id_); + os << ", interval: "; + os << PigeonInternalToString(obj.interval_); + os << ", latency: "; + os << PigeonInternalToString(obj.latency_); + os << ", supervision_timeout: "; + os << PigeonInternalToString(obj.supervision_timeout_); + os << ", status: "; + os << PigeonInternalToString(obj.status_); + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const BleConnectionParametersChange& v) { return v.Hash(); } @@ -1001,6 +1244,63 @@ size_t AndroidOptions::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const AndroidOptions& obj) { + os << "AndroidOptions("; + os << "request_location_permission: "; + if (obj.request_location_permission_) { + os << PigeonInternalToString(*obj.request_location_permission_); + } + else { + os << "null"; + } + os << ", scan_mode: "; + if (obj.scan_mode_) { + os << PigeonInternalToString(*obj.scan_mode_); + } + else { + os << "null"; + } + os << ", report_delay_millis: "; + if (obj.report_delay_millis_) { + os << PigeonInternalToString(*obj.report_delay_millis_); + } + else { + os << "null"; + } + os << ", callback_type: "; + if (obj.callback_type_) { + os << PigeonInternalToString(*obj.callback_type_); + } + else { + os << "null"; + } + os << ", match_mode: "; + if (obj.match_mode_) { + os << PigeonInternalToString(*obj.match_mode_); + } + else { + os << "null"; + } + os << ", num_of_matches: "; + if (obj.num_of_matches_) { + os << PigeonInternalToString(*obj.num_of_matches_); + } + else { + os << "null"; + } + os << ", legacy: "; + if (obj.legacy_) { + os << PigeonInternalToString(*obj.legacy_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const AndroidOptions& v) { return v.Hash(); } @@ -1087,6 +1387,28 @@ size_t UniversalScanConfig::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const UniversalScanConfig& obj) { + os << "UniversalScanConfig("; + os << "android: "; + if (obj.android_) { + os << *obj.android_; + } + else { + os << "null"; + } + os << ", skip_duplicates: "; + if (obj.skip_duplicates_) { + os << PigeonInternalToString(*obj.skip_duplicates_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const UniversalScanConfig& v) { return v.Hash(); } @@ -1175,6 +1497,22 @@ size_t UniversalScanFilter::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const UniversalScanFilter& obj) { + os << "UniversalScanFilter("; + os << "with_services: "; + os << PigeonInternalToString(obj.with_services_); + os << ", with_name_prefix: "; + os << PigeonInternalToString(obj.with_name_prefix_); + os << ", with_manufacturer_data: "; + os << PigeonInternalToString(obj.with_manufacturer_data_); + os << ", with_service_data: "; + os << PigeonInternalToString(obj.with_service_data_); + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const UniversalScanFilter& v) { return v.Hash(); } @@ -1266,6 +1604,30 @@ size_t ManufacturerDataFilter::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const ManufacturerDataFilter& obj) { + os << "ManufacturerDataFilter("; + os << "company_identifier: "; + os << PigeonInternalToString(obj.company_identifier_); + os << ", payload_prefix: "; + if (obj.payload_prefix_) { + os << PigeonInternalToString(*obj.payload_prefix_); + } + else { + os << "null"; + } + os << ", payload_mask: "; + if (obj.payload_mask_) { + os << PigeonInternalToString(*obj.payload_mask_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const ManufacturerDataFilter& v) { return v.Hash(); } @@ -1326,6 +1688,18 @@ size_t UniversalManufacturerData::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const UniversalManufacturerData& obj) { + os << "UniversalManufacturerData("; + os << "company_identifier: "; + os << PigeonInternalToString(obj.company_identifier_); + os << ", data: "; + os << PigeonInternalToString(obj.data_); + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const UniversalManufacturerData& v) { return v.Hash(); } @@ -1423,6 +1797,35 @@ size_t AppleConnectionOptions::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const AppleConnectionOptions& obj) { + os << "AppleConnectionOptions("; + os << "notify_on_connection: "; + if (obj.notify_on_connection_) { + os << PigeonInternalToString(*obj.notify_on_connection_); + } + else { + os << "null"; + } + os << ", notify_on_disconnection: "; + if (obj.notify_on_disconnection_) { + os << PigeonInternalToString(*obj.notify_on_disconnection_); + } + else { + os << "null"; + } + os << ", notify_on_notification: "; + if (obj.notify_on_notification_) { + os << PigeonInternalToString(*obj.notify_on_notification_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const AppleConnectionOptions& v) { return v.Hash(); } @@ -1568,6 +1971,41 @@ size_t AppleAccessoryPickerItem::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const AppleAccessoryPickerItem& obj) { + os << "AppleAccessoryPickerItem("; + os << "display_name: "; + os << PigeonInternalToString(obj.display_name_); + os << ", image_asset: "; + os << PigeonInternalToString(obj.image_asset_); + os << ", service_uuid: "; + os << PigeonInternalToString(obj.service_uuid_); + os << ", name_substring: "; + if (obj.name_substring_) { + os << PigeonInternalToString(*obj.name_substring_); + } + else { + os << "null"; + } + os << ", requires_immediate_range: "; + if (obj.requires_immediate_range_) { + os << PigeonInternalToString(*obj.requires_immediate_range_); + } + else { + os << "null"; + } + os << ", supports_bluetooth_pairing: "; + if (obj.supports_bluetooth_pairing_) { + os << PigeonInternalToString(*obj.supports_bluetooth_pairing_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const AppleAccessoryPickerItem& v) { return v.Hash(); } @@ -1613,6 +2051,16 @@ size_t AppleAccessorySetupOptions::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const AppleAccessorySetupOptions& obj) { + os << "AppleAccessorySetupOptions("; + os << "items: "; + os << PigeonInternalToString(obj.items_); + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const AppleAccessorySetupOptions& v) { return v.Hash(); } @@ -1667,6 +2115,21 @@ size_t AndroidConnectionOptions::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const AndroidConnectionOptions& obj) { + os << "AndroidConnectionOptions("; + os << "close_gatt_on_detach: "; + if (obj.close_gatt_on_detach_) { + os << PigeonInternalToString(*obj.close_gatt_on_detach_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const AndroidConnectionOptions& v) { return v.Hash(); } @@ -1753,6 +2216,28 @@ size_t ConnectionPlatformConfig::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const ConnectionPlatformConfig& obj) { + os << "ConnectionPlatformConfig("; + os << "apple: "; + if (obj.apple_) { + os << *obj.apple_; + } + else { + os << "null"; + } + os << ", android: "; + if (obj.android_) { + os << *obj.android_; + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const ConnectionPlatformConfig& v) { return v.Hash(); } @@ -1807,6 +2292,21 @@ size_t AndroidDiscoverServicesOptions::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const AndroidDiscoverServicesOptions& obj) { + os << "AndroidDiscoverServicesOptions("; + os << "clear_gatt_cache: "; + if (obj.clear_gatt_cache_) { + os << PigeonInternalToString(*obj.clear_gatt_cache_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const AndroidDiscoverServicesOptions& v) { return v.Hash(); } @@ -1869,6 +2369,21 @@ size_t DiscoverServicesPlatformConfig::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const DiscoverServicesPlatformConfig& obj) { + os << "DiscoverServicesPlatformConfig("; + os << "android: "; + if (obj.android_) { + os << *obj.android_; + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const DiscoverServicesPlatformConfig& v) { return v.Hash(); } @@ -1945,6 +2460,28 @@ size_t PeripheralAndroidOptions::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const PeripheralAndroidOptions& obj) { + os << "PeripheralAndroidOptions("; + os << "add_manufacturer_data_in_scan_response: "; + if (obj.add_manufacturer_data_in_scan_response_) { + os << PigeonInternalToString(*obj.add_manufacturer_data_in_scan_response_); + } + else { + os << "null"; + } + os << ", add_services_in_scan_response: "; + if (obj.add_services_in_scan_response_) { + os << PigeonInternalToString(*obj.add_services_in_scan_response_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const PeripheralAndroidOptions& v) { return v.Hash(); } @@ -2007,6 +2544,21 @@ size_t PeripheralPlatformConfig::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const PeripheralPlatformConfig& obj) { + os << "PeripheralPlatformConfig("; + os << "android: "; + if (obj.android_) { + os << *obj.android_; + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const PeripheralPlatformConfig& v) { return v.Hash(); } @@ -2081,6 +2633,20 @@ size_t PeripheralService::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const PeripheralService& obj) { + os << "PeripheralService("; + os << "uuid: "; + os << PigeonInternalToString(obj.uuid_); + os << ", primary: "; + os << PigeonInternalToString(obj.primary_); + os << ", characteristics: "; + os << PigeonInternalToString(obj.characteristics_); + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const PeripheralService& v) { return v.Hash(); } @@ -2205,6 +2771,34 @@ size_t PeripheralCharacteristic::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const PeripheralCharacteristic& obj) { + os << "PeripheralCharacteristic("; + os << "uuid: "; + os << PigeonInternalToString(obj.uuid_); + os << ", properties: "; + os << PigeonInternalToString(obj.properties_); + os << ", permissions: "; + os << PigeonInternalToString(obj.permissions_); + os << ", descriptors: "; + if (obj.descriptors_) { + os << PigeonInternalToString(*obj.descriptors_); + } + else { + os << "null"; + } + os << ", value: "; + if (obj.value_) { + os << PigeonInternalToString(*obj.value_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const PeripheralCharacteristic& v) { return v.Hash(); } @@ -2296,6 +2890,30 @@ size_t PeripheralDescriptor::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const PeripheralDescriptor& obj) { + os << "PeripheralDescriptor("; + os << "uuid: "; + os << PigeonInternalToString(obj.uuid_); + os << ", value: "; + if (obj.value_) { + os << PigeonInternalToString(*obj.value_); + } + else { + os << "null"; + } + os << ", permissions: "; + if (obj.permissions_) { + os << PigeonInternalToString(*obj.permissions_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const PeripheralDescriptor& v) { return v.Hash(); } @@ -2387,6 +3005,30 @@ size_t PeripheralReadRequestResult::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const PeripheralReadRequestResult& obj) { + os << "PeripheralReadRequestResult("; + os << "value: "; + os << PigeonInternalToString(obj.value_); + os << ", offset: "; + if (obj.offset_) { + os << PigeonInternalToString(*obj.offset_); + } + else { + os << "null"; + } + os << ", status: "; + if (obj.status_) { + os << PigeonInternalToString(*obj.status_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const PeripheralReadRequestResult& v) { return v.Hash(); } @@ -2484,6 +3126,35 @@ size_t PeripheralWriteRequestResult::Hash() const { return result; } +std::ostream& operator<<( + std::ostream& os, + const PeripheralWriteRequestResult& obj) { + os << "PeripheralWriteRequestResult("; + os << "value: "; + if (obj.value_) { + os << PigeonInternalToString(*obj.value_); + } + else { + os << "null"; + } + os << ", offset: "; + if (obj.offset_) { + os << PigeonInternalToString(*obj.offset_); + } + else { + os << "null"; + } + os << ", status: "; + if (obj.status_) { + os << PigeonInternalToString(*obj.status_); + } + else { + os << "null"; + } + os << ")"; + return os; +} + size_t PigeonInternalDeepHash(const PeripheralWriteRequestResult& v) { return v.Hash(); } diff --git a/windows/src/generated/universal_ble.g.h b/windows/src/generated/universal_ble.g.h index 71980405..350268f4 100644 --- a/windows/src/generated/universal_ble.g.h +++ b/windows/src/generated/universal_ble.g.h @@ -1,4 +1,4 @@ -// Autogenerated from Pigeon (v26.3.4), do not edit directly. +// Autogenerated from Pigeon (v29.0.10), do not edit directly. // See also: https://pub.dev/packages/pigeon #ifndef PIGEON_UNIVERSAL_BLE_G_H_ @@ -10,6 +10,7 @@ #include #include +#include #include namespace universal_ble { @@ -312,6 +313,8 @@ class UniversalBleScanResult { bool operator!=(const UniversalBleScanResult& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const UniversalBleScanResult& obj); private: static UniversalBleScanResult FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -360,6 +363,8 @@ class UniversalDevicePickerResult { bool operator!=(const UniversalDevicePickerResult& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const UniversalDevicePickerResult& obj); private: static UniversalDevicePickerResult FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -398,6 +403,8 @@ class UniversalBleService { bool operator!=(const UniversalBleService& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const UniversalBleService& obj); private: static UniversalBleService FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -434,6 +441,8 @@ class UniversalBleCharacteristic { bool operator!=(const UniversalBleCharacteristic& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const UniversalBleCharacteristic& obj); private: static UniversalBleCharacteristic FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -462,6 +471,8 @@ class UniversalBleDescriptor { bool operator!=(const UniversalBleDescriptor& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const UniversalBleDescriptor& obj); private: static UniversalBleDescriptor FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -510,6 +521,8 @@ class BleConnectionParametersChange { bool operator!=(const BleConnectionParametersChange& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const BleConnectionParametersChange& obj); private: static BleConnectionParametersChange FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -603,6 +616,8 @@ class AndroidOptions { bool operator!=(const AndroidOptions& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const AndroidOptions& obj); private: static AndroidOptions FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -655,6 +670,8 @@ class UniversalScanConfig { bool operator!=(const UniversalScanConfig& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const UniversalScanConfig& obj); private: static UniversalScanConfig FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -698,6 +715,8 @@ class UniversalScanFilter { bool operator!=(const UniversalScanFilter& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const UniversalScanFilter& obj); private: static UniversalScanFilter FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -746,6 +765,8 @@ class ManufacturerDataFilter { bool operator!=(const ManufacturerDataFilter& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const ManufacturerDataFilter& obj); private: static ManufacturerDataFilter FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -779,6 +800,8 @@ class UniversalManufacturerData { bool operator!=(const UniversalManufacturerData& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const UniversalManufacturerData& obj); private: static UniversalManufacturerData FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -841,6 +864,8 @@ class AppleConnectionOptions { bool operator!=(const AppleConnectionOptions& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const AppleConnectionOptions& obj); private: static AppleConnectionOptions FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -909,6 +934,8 @@ class AppleAccessoryPickerItem { bool operator!=(const AppleAccessoryPickerItem& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const AppleAccessoryPickerItem& obj); private: static AppleAccessoryPickerItem FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -944,6 +971,8 @@ class AppleAccessorySetupOptions { bool operator!=(const AppleAccessorySetupOptions& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const AppleAccessorySetupOptions& obj); private: static AppleAccessorySetupOptions FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -981,6 +1010,8 @@ class AndroidConnectionOptions { bool operator!=(const AndroidConnectionOptions& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const AndroidConnectionOptions& obj); private: static AndroidConnectionOptions FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1023,6 +1054,8 @@ class ConnectionPlatformConfig { bool operator!=(const ConnectionPlatformConfig& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const ConnectionPlatformConfig& obj); private: static ConnectionPlatformConfig FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1060,6 +1093,8 @@ class AndroidDiscoverServicesOptions { bool operator!=(const AndroidDiscoverServicesOptions& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const AndroidDiscoverServicesOptions& obj); private: static AndroidDiscoverServicesOptions FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1099,6 +1134,8 @@ class DiscoverServicesPlatformConfig { bool operator!=(const DiscoverServicesPlatformConfig& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const DiscoverServicesPlatformConfig& obj); private: static DiscoverServicesPlatformConfig FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1141,6 +1178,8 @@ class PeripheralAndroidOptions { bool operator!=(const PeripheralAndroidOptions& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const PeripheralAndroidOptions& obj); private: static PeripheralAndroidOptions FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1178,6 +1217,8 @@ class PeripheralPlatformConfig { bool operator!=(const PeripheralPlatformConfig& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const PeripheralPlatformConfig& obj); private: static PeripheralPlatformConfig FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1215,6 +1256,8 @@ class PeripheralService { bool operator!=(const PeripheralService& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const PeripheralService& obj); private: static PeripheralService FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1268,6 +1311,8 @@ class PeripheralCharacteristic { bool operator!=(const PeripheralCharacteristic& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const PeripheralCharacteristic& obj); private: static PeripheralCharacteristic FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1312,6 +1357,8 @@ class PeripheralDescriptor { bool operator!=(const PeripheralDescriptor& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const PeripheralDescriptor& obj); private: static PeripheralDescriptor FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1354,6 +1401,8 @@ class PeripheralReadRequestResult { bool operator!=(const PeripheralReadRequestResult& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const PeripheralReadRequestResult& obj); private: static PeripheralReadRequestResult FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1397,6 +1446,8 @@ class PeripheralWriteRequestResult { bool operator!=(const PeripheralWriteRequestResult& other) const; /// Returns a hash code value for the object. This method is supported for the benefit of hash tables. size_t Hash() const; + /// Stream output operator for formatted string representation. + friend std::ostream& operator<<(std::ostream& os, const PeripheralWriteRequestResult& obj); private: static PeripheralWriteRequestResult FromEncodableList(const ::flutter::EncodableList& list); ::flutter::EncodableList ToEncodableList() const; @@ -1431,6 +1482,11 @@ class PigeonInternalCodecSerializer : public ::flutter::StandardCodecSerializer // APIs (Flutter -> Native / Native -> Flutter) // ------------------------------------------------------------ +// +// Async methods use [asyncCallback] instead of the Pigeon >= 28 default +// (`async` / `suspend`): the native implementations are callback-based +// (Swift completion handlers, Kotlin callbacks), and [asyncCallback] keeps +// those signatures rather than forcing a rewrite to native async/await. // Flutter -> Native (central) // // Generated interface from Pigeon that represents a handler of messages from Flutter.