From c777285ea701309a6de56cb66915585b73006724 Mon Sep 17 00:00:00 2001 From: okadan <46291090+okadan@users.noreply.github.com> Date: Sun, 5 Mar 2023 10:50:25 +0900 Subject: [PATCH] Create v4.0.0 release --- .metadata | 14 +- CHANGELOG.md | 4 + LICENSE | 2 +- README.md | 75 - android/build.gradle | 6 +- android/src/main/AndroidManifest.xml | 2 +- .../plugins/nfcmanager/NfcManagerPlugin.kt | 525 +++ .../flutter/plugins/nfcmanager/Pigeon.java | 2959 +++++++++++++++++ .../plugins/nfcmanager/NfcManagerPlugin.kt | 348 -- .../flutter/plugins/nfcmanager/Translator.kt | 150 - example/README.md | 3 - example/android/app/build.gradle | 4 +- .../android/app/src/debug/AndroidManifest.xml | 2 +- .../android/app/src/main/AndroidManifest.xml | 4 +- .../plugins/nfcmanagerexample/MainActivity.kt | 6 + .../plugins/nfcmanagerexample/MainActivity.kt | 21 - .../app/src/profile/AndroidManifest.xml | 2 +- example/android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/ios/Podfile.lock | 2 +- example/ios/Runner.xcodeproj/project.pbxproj | 102 +- .../AppIcon.appiconset/Icon-App-20x20@1x.png | Bin 564 -> 295 bytes .../AppIcon.appiconset/Icon-App-20x20@2x.png | Bin 1283 -> 406 bytes .../AppIcon.appiconset/Icon-App-20x20@3x.png | Bin 1588 -> 450 bytes .../AppIcon.appiconset/Icon-App-29x29@1x.png | Bin 1025 -> 282 bytes .../AppIcon.appiconset/Icon-App-29x29@2x.png | Bin 1716 -> 462 bytes .../AppIcon.appiconset/Icon-App-29x29@3x.png | Bin 1920 -> 704 bytes .../AppIcon.appiconset/Icon-App-40x40@1x.png | Bin 1283 -> 406 bytes .../AppIcon.appiconset/Icon-App-40x40@2x.png | Bin 1895 -> 586 bytes .../AppIcon.appiconset/Icon-App-40x40@3x.png | Bin 2665 -> 862 bytes .../AppIcon.appiconset/Icon-App-60x60@2x.png | Bin 2665 -> 862 bytes .../AppIcon.appiconset/Icon-App-60x60@3x.png | Bin 3831 -> 1674 bytes .../AppIcon.appiconset/Icon-App-76x76@1x.png | Bin 1888 -> 762 bytes .../AppIcon.appiconset/Icon-App-76x76@2x.png | Bin 3294 -> 1226 bytes .../Icon-App-83.5x83.5@2x.png | Bin 3612 -> 1418 bytes example/ios/Runner/Info.plist | 18 +- example/ios/Runner/Runner.entitlements | 10 - example/lib/main.dart | 129 +- example/pubspec.lock | 85 +- example/pubspec.yaml | 2 +- ios/Classes/NfcManagerPlugin.h | 4 - ios/Classes/NfcManagerPlugin.m | 15 - ios/Classes/NfcManagerPlugin.swift | 663 ++++ ios/Classes/Pigeon.swift | 1527 +++++++++ ios/Classes/SwiftNfcManagerPlugin.swift | 767 ----- ios/Classes/Translator.swift | 161 - lib/nfc_manager.dart | 1 - lib/nfc_manager_android.dart | 11 + lib/nfc_manager_ios.dart | 6 + lib/nfc_manager_ndef.dart | 1 + lib/nfc_manager_ndef_record.dart | 1 + lib/platform_tags.dart | 12 - lib/src/channel.dart | 3 - lib/src/nfc_manager/nfc_manager.dart | 206 +- lib/src/nfc_manager/nfc_manager_platform.dart | 11 + lib/src/nfc_manager/nfc_ndef.dart | 297 -- lib/src/nfc_manager_android/nfc_manager.dart | 99 + .../nfc_manager_platform.dart | 35 + lib/src/nfc_manager_android/pigeon.dart | 60 + lib/src/nfc_manager_android/pigeon.g.dart | 1886 +++++++++++ lib/src/nfc_manager_android/tags/iso_dep.dart | 49 + .../tags/mifare_classic.dart | 103 + .../tags/mifare_ultralight.dart | 60 + lib/src/nfc_manager_android/tags/ndef.dart | 75 + .../tags/ndef_formatable.dart | 40 + lib/src/nfc_manager_android/tags/nfc_a.dart | 45 + lib/src/nfc_manager_android/tags/nfc_b.dart | 37 + .../nfc_manager_android/tags/nfc_barcode.dart | 29 + lib/src/nfc_manager_android/tags/nfc_f.dart | 45 + lib/src/nfc_manager_android/tags/nfc_v.dart | 37 + lib/src/nfc_manager_ios/nfc_manager.dart | 79 + .../nfc_manager_ios/nfc_manager_platform.dart | 32 + lib/src/nfc_manager_ios/pigeon.dart | 87 + lib/src/nfc_manager_ios/pigeon.g.dart | 1828 ++++++++++ lib/src/nfc_manager_ios/tags/felica.dart | 210 ++ lib/src/nfc_manager_ios/tags/iso15693.dart | 175 + lib/src/nfc_manager_ios/tags/iso7816.dart | 84 + lib/src/nfc_manager_ios/tags/mifare.dart | 79 + lib/src/nfc_manager_ios/tags/ndef.dart | 91 + lib/src/nfc_manager_ndef/ndef.dart | 34 + lib/src/nfc_manager_ndef/ndef_platform.dart | 29 + .../ndef_platform_android.dart | 42 + .../nfc_manager_ndef/ndef_platform_ios.dart | 42 + .../nfc_manager_ndef_record/ndef_record.dart | 264 ++ lib/src/platform_tags/felica.dart | 282 -- lib/src/platform_tags/iso15693.dart | 371 --- lib/src/platform_tags/iso7816.dart | 97 - lib/src/platform_tags/iso_dep.dart | 62 - lib/src/platform_tags/mifare.dart | 97 - lib/src/platform_tags/mifare_classic.dart | 173 - lib/src/platform_tags/mifare_ultralight.dart | 81 - lib/src/platform_tags/ndef_formatable.dart | 51 - lib/src/platform_tags/nfc_a.dart | 58 - lib/src/platform_tags/nfc_b.dart | 54 - lib/src/platform_tags/nfc_f.dart | 58 - lib/src/platform_tags/nfc_v.dart | 54 - lib/src/translator.dart | 337 -- pigeon/pigeon_android.dart | 177 + pigeon/pigeon_ios.dart | 217 ++ pubspec.yaml | 11 +- 100 files changed, 11964 insertions(+), 4059 deletions(-) delete mode 100644 README.md create mode 100644 android/src/main/kotlin/dev/flutter/plugins/nfcmanager/NfcManagerPlugin.kt create mode 100644 android/src/main/kotlin/dev/flutter/plugins/nfcmanager/Pigeon.java delete mode 100644 android/src/main/kotlin/io/flutter/plugins/nfcmanager/NfcManagerPlugin.kt delete mode 100644 android/src/main/kotlin/io/flutter/plugins/nfcmanager/Translator.kt delete mode 100644 example/README.md create mode 100644 example/android/app/src/main/kotlin/dev/flutter/plugins/nfcmanagerexample/MainActivity.kt delete mode 100644 example/android/app/src/main/kotlin/io/flutter/plugins/nfcmanagerexample/MainActivity.kt delete mode 100644 example/ios/Runner/Runner.entitlements delete mode 100644 ios/Classes/NfcManagerPlugin.h delete mode 100644 ios/Classes/NfcManagerPlugin.m create mode 100644 ios/Classes/NfcManagerPlugin.swift create mode 100644 ios/Classes/Pigeon.swift delete mode 100644 ios/Classes/SwiftNfcManagerPlugin.swift delete mode 100644 ios/Classes/Translator.swift create mode 100644 lib/nfc_manager_android.dart create mode 100644 lib/nfc_manager_ios.dart create mode 100644 lib/nfc_manager_ndef.dart create mode 100644 lib/nfc_manager_ndef_record.dart delete mode 100644 lib/platform_tags.dart delete mode 100644 lib/src/channel.dart create mode 100644 lib/src/nfc_manager/nfc_manager_platform.dart delete mode 100644 lib/src/nfc_manager/nfc_ndef.dart create mode 100644 lib/src/nfc_manager_android/nfc_manager.dart create mode 100644 lib/src/nfc_manager_android/nfc_manager_platform.dart create mode 100644 lib/src/nfc_manager_android/pigeon.dart create mode 100644 lib/src/nfc_manager_android/pigeon.g.dart create mode 100644 lib/src/nfc_manager_android/tags/iso_dep.dart create mode 100644 lib/src/nfc_manager_android/tags/mifare_classic.dart create mode 100644 lib/src/nfc_manager_android/tags/mifare_ultralight.dart create mode 100644 lib/src/nfc_manager_android/tags/ndef.dart create mode 100644 lib/src/nfc_manager_android/tags/ndef_formatable.dart create mode 100644 lib/src/nfc_manager_android/tags/nfc_a.dart create mode 100644 lib/src/nfc_manager_android/tags/nfc_b.dart create mode 100644 lib/src/nfc_manager_android/tags/nfc_barcode.dart create mode 100644 lib/src/nfc_manager_android/tags/nfc_f.dart create mode 100644 lib/src/nfc_manager_android/tags/nfc_v.dart create mode 100644 lib/src/nfc_manager_ios/nfc_manager.dart create mode 100644 lib/src/nfc_manager_ios/nfc_manager_platform.dart create mode 100644 lib/src/nfc_manager_ios/pigeon.dart create mode 100644 lib/src/nfc_manager_ios/pigeon.g.dart create mode 100644 lib/src/nfc_manager_ios/tags/felica.dart create mode 100644 lib/src/nfc_manager_ios/tags/iso15693.dart create mode 100644 lib/src/nfc_manager_ios/tags/iso7816.dart create mode 100644 lib/src/nfc_manager_ios/tags/mifare.dart create mode 100644 lib/src/nfc_manager_ios/tags/ndef.dart create mode 100644 lib/src/nfc_manager_ndef/ndef.dart create mode 100644 lib/src/nfc_manager_ndef/ndef_platform.dart create mode 100644 lib/src/nfc_manager_ndef/ndef_platform_android.dart create mode 100644 lib/src/nfc_manager_ndef/ndef_platform_ios.dart create mode 100644 lib/src/nfc_manager_ndef_record/ndef_record.dart delete mode 100644 lib/src/platform_tags/felica.dart delete mode 100644 lib/src/platform_tags/iso15693.dart delete mode 100644 lib/src/platform_tags/iso7816.dart delete mode 100644 lib/src/platform_tags/iso_dep.dart delete mode 100644 lib/src/platform_tags/mifare.dart delete mode 100644 lib/src/platform_tags/mifare_classic.dart delete mode 100644 lib/src/platform_tags/mifare_ultralight.dart delete mode 100644 lib/src/platform_tags/ndef_formatable.dart delete mode 100644 lib/src/platform_tags/nfc_a.dart delete mode 100644 lib/src/platform_tags/nfc_b.dart delete mode 100644 lib/src/platform_tags/nfc_f.dart delete mode 100644 lib/src/platform_tags/nfc_v.dart delete mode 100644 lib/src/translator.dart create mode 100644 pigeon/pigeon_android.dart create mode 100644 pigeon/pigeon_ios.dart diff --git a/.metadata b/.metadata index 044504e..c93e545 100644 --- a/.metadata +++ b/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled. version: - revision: e3c29ec00c9c825c891d75054c63fcc46454dca1 + revision: 7048ed95a5ad3e43d697e0c397464193991fc230 channel: stable project_type: plugin @@ -13,14 +13,14 @@ project_type: plugin migration: platforms: - platform: root - create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1 - base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1 + create_revision: 7048ed95a5ad3e43d697e0c397464193991fc230 + base_revision: 7048ed95a5ad3e43d697e0c397464193991fc230 - platform: android - create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1 - base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1 + create_revision: 7048ed95a5ad3e43d697e0c397464193991fc230 + base_revision: 7048ed95a5ad3e43d697e0c397464193991fc230 - platform: ios - create_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1 - base_revision: e3c29ec00c9c825c891d75054c63fcc46454dca1 + create_revision: 7048ed95a5ad3e43d697e0c397464193991fc230 + base_revision: 7048ed95a5ad3e43d697e0c397464193991fc230 # User provided section diff --git a/CHANGELOG.md b/CHANGELOG.md index b58d6d2..047c194 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 4.0.0-dev + +**Has many breaking changes.** + # 3.2.0 * Fix build issues diff --git a/LICENSE b/LICENSE index 52f7a60..2b420f8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Naoki Okada +Copyright (c) 2019 okadan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md deleted file mode 100644 index e967bae..0000000 --- a/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# nfc_manager - -Flutter plugin for accessing the NFC features on Android and iOS. - -Note: This plugin depends on `NFCTagReaderSession` (requires iOS 13.0 or later) and `NfcAdapter#enableReaderMode` (requires Android API level 19 or later). - -## Setup - -**Android Setup** - -* Add [android.permission.NFC](https://developer.android.com/reference/android/Manifest.permission.html#NFC) to your `AndroidManifest.xml`. - -**iOS Setup** - -* Add [Near Field Communication Tag Reader Session Formats Entitlements](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_nfc_readersession_formats) to your entitlements. - -* Add [NFCReaderUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nfcreaderusagedescription) to your `Info.plist`. - -* Add [com.apple.developer.nfc.readersession.felica.systemcodes](https://developer.apple.com/documentation/bundleresources/information_property_list/systemcodes) and [com.apple.developer.nfc.readersession.iso7816.select-identifiers](https://developer.apple.com/documentation/bundleresources/information_property_list/select-identifiers) to your `Info.plist` as needed. - -## Usage - -**Handling Session** - -```dart -// Check availability -bool isAvailable = await NfcManager.instance.isAvailable(); - -// Start Session -NfcManager.instance.startSession( - onDiscovered: (NfcTag tag) async { - // Do something with an NfcTag instance. - }, -); - -// Stop Session -NfcManager.instance.stopSession(); -``` - -**Handling Platform Tag** - -The following platform-tag-classes are available: - -* Ndef -* FeliCa (iOS only) -* Iso7816 (iOS only) -* Iso15693 (iOS only) -* MiFare (iOS only) -* NfcA (Android only) -* NfcB (Android only) -* NfcF (Android only) -* NfcV (Android only) -* IsoDep (Android only) -* MifareClassic (Android only) -* MifareUtralight (Android only) -* NdefFormatable (Android only) - -Obtain an instance by calling the factory constructor `from` on the class. For example: - -```dart -Ndef? ndef = Ndef.from(tag); - -if (ndef == null) { - print('Tag is not compatible with NDEF'); - return; -} - -// Do something with an Ndef instance -``` - -Please see the [API Doc](https://pub.dev/documentation/nfc_manager/latest/) for more details. - -## Real-World-App - -See [this repo](https://github.com/okadan/flutter-nfc-manager-app) which is a Real-World-App demonstrates how to use this plugin. diff --git a/android/build.gradle b/android/build.gradle index dff31fd..e27151d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,15 +1,15 @@ -group 'io.flutter.plugins.nfc_manager' +group 'dev.flutter.plugins.nfcmanager' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.7.10' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' + classpath 'com.android.tools.build:gradle:7.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index a33fc2e..4728e2e 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,3 +1,3 @@ + package="dev.flutter.plugins.nfcmanager"> diff --git a/android/src/main/kotlin/dev/flutter/plugins/nfcmanager/NfcManagerPlugin.kt b/android/src/main/kotlin/dev/flutter/plugins/nfcmanager/NfcManagerPlugin.kt new file mode 100644 index 0000000..f40916c --- /dev/null +++ b/android/src/main/kotlin/dev/flutter/plugins/nfcmanager/NfcManagerPlugin.kt @@ -0,0 +1,525 @@ +package dev.flutter.plugins.nfcmanager + +import android.app.Activity +import android.app.PendingIntent +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.nfc.NdefMessage +import android.nfc.NdefRecord +import android.nfc.NfcAdapter +import android.nfc.Tag +import android.nfc.tech.* +import android.os.Build +import androidx.annotation.RequiresApi +import io.flutter.embedding.engine.plugins.FlutterPlugin +import io.flutter.embedding.engine.plugins.activity.ActivityAware +import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding +import java.io.IOException +import java.util.* + +class NfcManagerPlugin: FlutterPlugin, ActivityAware, Pigeon.PigeonHostApi, BroadcastReceiver() { + private lateinit var flutterApi: Pigeon.PigeonFlutterApi + private lateinit var activity: Activity + private var adapter: NfcAdapter? = null + private var cachedTags: MutableMap = mutableMapOf() + private var connectedTech: TagTechnology? = null + + override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { + Pigeon.PigeonHostApi.setup(flutterPluginBinding.binaryMessenger, this) + flutterApi = Pigeon.PigeonFlutterApi(flutterPluginBinding.binaryMessenger) + adapter = NfcAdapter.getDefaultAdapter(flutterPluginBinding.applicationContext) + } + + override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { + Pigeon.PigeonHostApi.setup(binding.binaryMessenger, null) + } + + override fun onAttachedToActivity(binding: ActivityPluginBinding) { + activity = binding.activity + activity.applicationContext.registerReceiver(this, null) + } + + override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { + activity = binding.activity + } + + override fun onDetachedFromActivityForConfigChanges() { + // no op + } + + override fun onDetachedFromActivity() { + // no op + } + + override fun onReceive(context: Context?, intent: Intent?) { + intent ?: run { return } + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { return } + if (intent.action != NfcAdapter.ACTION_ADAPTER_STATE_CHANGED) { return } + val state = intent.getIntExtra(NfcAdapter.EXTRA_ADAPTER_STATE, NfcAdapter.STATE_OFF) + flutterApi.onAdapterStateChanged(state.toLong()) { /* no op */ } + } + + override fun adapterIsEnabled(): Boolean { + val adapter = adapter ?: run { throw Exception("TODO") } + return adapter.isEnabled + } + + override fun adapterIsSecureNfcEnabled(): Boolean { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { throw Exception("TODO") } + val adapter = adapter ?: run { throw Exception("TODO") } + return adapter.isSecureNfcEnabled + } + + override fun adapterIsSecureNfcSupported(): Boolean { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { throw Exception("TODO") } + val adapter = adapter ?: run { throw Exception("TODO") } + return adapter.isSecureNfcSupported + } + + override fun adapterEnableReaderMode(flags: List) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { throw Exception("TODO") } + val adapter = adapter ?: run { throw Exception("TODO") } + adapter.enableReaderMode(activity, { onTagDiscovered(it) }, toInt(flags), null) + } + + override fun adapterDisableReaderMode() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { throw Exception("TODO") } + val adapter = adapter ?: run { throw Exception("TODO") } + adapter.disableReaderMode(activity) + } + + override fun adapterEnableForegroundDispatch() { + val adapter = adapter ?: run { throw Exception("TODO") } + val intent = Intent(activity.applicationContext, javaClass).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) + val pendingIntent = PendingIntent.getActivity(activity.applicationContext, 0, intent, 0) + adapter.enableForegroundDispatch(activity, pendingIntent, null, null) + } + + override fun adapterDisableForegroundDispatch() { + val adapter = adapter ?: run { throw Exception("TODO") } + adapter.disableForegroundDispatch(activity) + } + + override fun ndefGetNdefMessage(handle: String): Pigeon.PigeonNdefMessage? { + val tech = forceConnect(handle) { Ndef.get(it) } + val message = tech.ndefMessage + return if (message != null) toPigeonNdefMessage(message) else null + } + + override fun ndefWriteNdefMessage(handle: String, message: Pigeon.PigeonNdefMessage) { + val tech = forceConnect(handle) { Ndef.get(it) } + tech.writeNdefMessage(toNdefMessage(message)) + } + + override fun ndefMakeReadOnly(handle: String): Boolean { + val tech = forceConnect(handle) { Ndef.get(it) } + return tech.makeReadOnly() + } + + override fun nfcAGetMaxTransceiveLength(handle: String): Long { + val tech = forceConnect(handle) { NfcA.get(it) } + return tech.maxTransceiveLength.toLong() + } + + override fun nfcAGetTimeout(handle: String): Long { + val tech = forceConnect(handle) { NfcA.get(it) } + return tech.timeout.toLong() + } + + override fun nfcASetTimeout(handle: String, timeout: Long) { + val tech = forceConnect(handle) { NfcA.get(it) } + tech.timeout = timeout.toInt() + } + + override fun nfcATransceive(handle: String, data: ByteArray): ByteArray { + val tech = forceConnect(handle) { NfcA.get(it) } + return tech.transceive(data) + } + + override fun nfcBGetMaxTransceiveLength(handle: String): Long { + val tech = forceConnect(handle) { NfcB.get(it) } + return tech.maxTransceiveLength.toLong() + } + + override fun nfcBTransceive(handle: String, data: ByteArray): ByteArray { + val tech = forceConnect(handle) { NfcB.get(it) } + return tech.transceive(data) + } + + override fun nfcFGetMaxTransceiveLength(handle: String): Long { + val tech = forceConnect(handle) { NfcF.get(it) } + return tech.maxTransceiveLength.toLong() + } + + override fun nfcFGetTimeout(handle: String): Long { + val tech = forceConnect(handle) { NfcF.get(it) } + return tech.timeout.toLong() + } + + override fun nfcFSetTimeout(handle: String, timeout: Long) { + val tech = forceConnect(handle) { NfcF.get(it) } + tech.timeout = timeout.toInt() + } + + override fun nfcFTransceive(handle: String, data: ByteArray): ByteArray { + val tech = forceConnect(handle) { NfcF.get(it) } + return tech.transceive(data) + } + + override fun nfcVGetMaxTransceiveLength(handle: String): Long { + val tech = forceConnect(handle) { NfcV.get(it) } + return tech.maxTransceiveLength.toLong() + } + + override fun nfcVTransceive(handle: String, data: ByteArray): ByteArray { + val tech = forceConnect(handle) { NfcV.get(it) } + return tech.transceive(data) + } + + override fun isoDepGetMaxTransceiveLength(handle: String): Long { + val tech = forceConnect(handle) { IsoDep.get(it) } + return tech.maxTransceiveLength.toLong() + } + + override fun isoDepGetTimeout(handle: String): Long { + val tech = forceConnect(handle) { IsoDep.get(it) } + return tech.timeout.toLong() + } + + override fun isoDepSetTimeout(handle: String, timeout: Long) { + val tech = forceConnect(handle) { IsoDep.get(it) } + tech.timeout = timeout.toInt() + } + + override fun isoDepTransceive(handle: String, data: ByteArray): ByteArray { + val tech = forceConnect(handle) { IsoDep.get(it) } + return tech.transceive(data) + } + + override fun mifareClassicGetMaxTransceiveLength(handle: String): Long { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.maxTransceiveLength.toLong() + } + + override fun mifareClassicGetTimeout(handle: String): Long { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.timeout.toLong() + } + + override fun mifareClassicSetTimeout(handle: String, timeout: Long) { + val tech = forceConnect(handle) { MifareClassic.get(it) } + tech.timeout = timeout.toInt() + } + + override fun mifareClassicAuthenticateSectorWithKeyA(handle: String, sectorIndex: Long, key: ByteArray): Boolean { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.authenticateSectorWithKeyA(sectorIndex.toInt(), key) + } + + override fun mifareClassicAuthenticateSectorWithKeyB(handle: String, sectorIndex: Long, key: ByteArray): Boolean { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.authenticateSectorWithKeyB(sectorIndex.toInt(), key) + } + + override fun mifareClassicGetBlockCountInSector(handle: String, sectorIndex: Long): Long { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.getBlockCountInSector(sectorIndex.toInt()).toLong() + } + + override fun mifareClassicBlockToSector(handle: String, blockIndex: Long): Long { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.blockToSector(blockIndex.toInt()).toLong() + } + + override fun mifareClassicSectorToBlock(handle: String, sectorIndex: Long): Long { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.sectorToBlock(sectorIndex.toInt()).toLong() + } + + override fun mifareClassicIncrement(handle: String, blockIndex: Long, value: Long) { + val tech = forceConnect(handle) { MifareClassic.get(it) } + tech.increment(blockIndex.toInt(), value.toInt()) + } + + override fun mifareClassicDecrement(handle: String, blockIndex: Long, value: Long) { + val tech = forceConnect(handle) { MifareClassic.get(it) } + tech.decrement(blockIndex.toInt(), value.toInt()) + } + + override fun mifareClassicRestore(handle: String, blockIndex: Long) { + val tech = forceConnect(handle) { MifareClassic.get(it) } + tech.restore(blockIndex.toInt()) + } + + override fun mifareClassicTransfer(handle: String, blockIndex: Long) { + val tech = forceConnect(handle) { MifareClassic.get(it) } + tech.transfer(blockIndex.toInt()) + } + + override fun mifareClassicReadBlock(handle: String, blockIndex: Long): ByteArray { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.readBlock(blockIndex.toInt()) + } + + override fun mifareClassicWriteBlock(handle: String, blockIndex: Long, data: ByteArray) { + val tech = forceConnect(handle) { MifareClassic.get(it) } + tech.writeBlock(blockIndex.toInt(), data) + } + + override fun mifareClassicTransceive(handle: String, data: ByteArray): ByteArray { + val tech = forceConnect(handle) { MifareClassic.get(it) } + return tech.transceive(data) + } + + override fun mifareUltralightGetMaxTransceiveLength(handle: String): Long { + val tech = forceConnect(handle) { MifareUltralight.get(it) } + return tech.maxTransceiveLength.toLong() + } + + override fun mifareUltralightGetTimeout(handle: String): Long { + val tech = forceConnect(handle) { MifareUltralight.get(it) } + return tech.timeout.toLong() + } + + override fun mifareUltralightSetTimeout(handle: String, timeout: Long) { + val tech = forceConnect(handle) { MifareUltralight.get(it) } + tech.timeout = timeout.toInt() + } + + override fun mifareUltralightReadPages(handle: String, pageOffset: Long): ByteArray { + val tech = forceConnect(handle) { MifareUltralight.get(it) } + return tech.readPages(pageOffset.toInt()) + } + + override fun mifareUltralightWritePage(handle: String, pageOffset: Long, data: ByteArray) { + val tech = forceConnect(handle) { MifareUltralight.get(it) } + tech.writePage(pageOffset.toInt(), data) + } + + override fun mifareUltralightTransceive(handle: String, data: ByteArray): ByteArray { + val tech = forceConnect(handle) { MifareUltralight.get(it) } + return tech.transceive(data) + } + + override fun ndefFormatableFormat(handle: String, firstMessage: Pigeon.PigeonNdefMessage) { + val tech = forceConnect(handle) { NdefFormatable.get(it) } + tech.format(toNdefMessage(firstMessage)) + } + + override fun ndefFormatableFormatReadOnly(handle: String, firstMessage: Pigeon.PigeonNdefMessage) { + val tech = forceConnect(handle) { NdefFormatable.get(it) } + tech.formatReadOnly(toNdefMessage(firstMessage)) + } + + override fun disposeTag(handle: String) { + val tag = cachedTags.remove(handle) ?: run { return } + val tech = connectedTech ?: run { return } + connectedTech = null + if (tech.tag != tag || !tech.isConnected) return + try { tech.close() } catch (e: IOException) { /* no op */ } + } + + private fun onTagDiscovered(tag: Tag) { + val handle = UUID.randomUUID().toString() + val pigeonTag = toPigeonTag(tag).apply { this.handle = handle } + cachedTags[handle] = tag + activity.runOnUiThread { flutterApi.onTagDiscovered(pigeonTag) { /* no op */ } } + } + + private fun forceConnect(handle: String, getMethod: (Tag) -> T?): T { + val tag = cachedTags[handle] ?: run { throw Exception("TODO") } + val tech = getMethod(tag) ?: run { throw Exception("TODO") } + val connectedTech = connectedTech ?: run { + tech.connect() + connectedTech = tech + return tech + } + if (connectedTech.tag != tech.tag || connectedTech::class.java.name != tech::class.java.name) { + try { connectedTech.close() } catch (e: IOException) { /* no op */ } + tech.connect() + this.connectedTech = tech + return tech + } + return tech + } +} + +@RequiresApi(Build.VERSION_CODES.KITKAT) +private fun toInt(value: List): Int { + return value.fold(0) { p, e -> p or toInt(e)} +} + +@RequiresApi(Build.VERSION_CODES.KITKAT) +private fun toInt(value: Pigeon.PigeonReaderFlag): Int { + return when (value) { + Pigeon.PigeonReaderFlag.NFC_A -> NfcAdapter.FLAG_READER_NFC_A + Pigeon.PigeonReaderFlag.NFC_B -> NfcAdapter.FLAG_READER_NFC_B + Pigeon.PigeonReaderFlag.NFC_BARCODE -> NfcAdapter.FLAG_READER_NFC_BARCODE + Pigeon.PigeonReaderFlag.NFC_F -> NfcAdapter.FLAG_READER_NFC_F + Pigeon.PigeonReaderFlag.NFC_V -> NfcAdapter.FLAG_READER_NFC_V + Pigeon.PigeonReaderFlag.NO_PLATFORM_SOUNDS -> NfcAdapter.FLAG_READER_NO_PLATFORM_SOUNDS + Pigeon.PigeonReaderFlag.SKIP_NDEF_CHECK -> NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK + } +} + +private fun toNdefMessage(value: Pigeon.PigeonNdefMessage): NdefMessage { + return NdefMessage( + value.records!!.map { toNdefRecord(it) }.toTypedArray(), + ) +} + +private fun toPigeonNdefMessage(value: NdefMessage): Pigeon.PigeonNdefMessage { + return Pigeon.PigeonNdefMessage().apply { + records = value.records.map { toPigeonNdefRecord(it) } + } +} + +private fun toNdefRecord(value: Pigeon.PigeonNdefRecord): NdefRecord { + return NdefRecord( + toShort(value.tnf!!), + value.type!!, + value.id!!, + value.payload!!, + ) +} + +private fun toPigeonNdefRecord(value: NdefRecord): Pigeon.PigeonNdefRecord { + return Pigeon.PigeonNdefRecord().apply { + tnf = toPigeonTypeNameFormat(value.tnf) + type = value.type + id = value.id + payload = value.payload + } +} + +private fun toPigeonTag(value: Tag): Pigeon.PigeonTag { + return Pigeon.PigeonTag().apply { + id = value.id + techList = value.techList.toMutableList() + Ndef.get(value).also { ndef = toPigeonNdef(it) } + NfcA.get(value).also { nfcA = toPigeonNfcA(it) } + NfcB.get(value).also { nfcB = toPigeonNfcB(it) } + NfcF.get(value).also { nfcF = toPigeonNfcF(it) } + NfcV.get(value).also { nfcV = toPigeonNfcV(it) } + IsoDep.get(value).also { isoDep = toPigeonIsoDep(it) } + MifareClassic.get(value).also { mifareClassic = toPigeonMifareClassic(it) } + MifareUltralight.get(value).also { mifareUltralight = toPigeonMifareUltralight(it) } + NdefFormatable.get(value).also { ndefFormatable = "" } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) + NfcBarcode.get(value).also { nfcBarcode = toPigeonNfcBarcode(it) } + } +} + +private fun toPigeonNdef(value: Ndef): Pigeon.PigeonNdef { + return Pigeon.PigeonNdef().apply { + type = value.type + isWritable = value.isWritable + maxSize = value.maxSize.toLong() + canMakeReadOnly = value.canMakeReadOnly() + value.cachedNdefMessage?.let { cachedNdefMessage = toPigeonNdefMessage(it) } + } +} + +private fun toPigeonNfcA(value: NfcA): Pigeon.PigeonNfcA { + return Pigeon.PigeonNfcA().apply { + atqa = value.atqa + sak = value.sak.toLong() + } +} + +private fun toPigeonNfcB(value: NfcB): Pigeon.PigeonNfcB { + return Pigeon.PigeonNfcB().apply { + applicationData = value.applicationData + protocolInfo = value.protocolInfo + } +} + +private fun toPigeonNfcF(value: NfcF): Pigeon.PigeonNfcF { + return Pigeon.PigeonNfcF().apply { + manufacturer = value.manufacturer + systemCode = value.systemCode + } +} + +private fun toPigeonNfcV(value: NfcV): Pigeon.PigeonNfcV { + return Pigeon.PigeonNfcV().apply { + dsfId = value.dsfId.toLong() + responseFlags = value.responseFlags.toLong() + } +} + +private fun toPigeonIsoDep(value: IsoDep): Pigeon.PigeonIsoDep { + return Pigeon.PigeonIsoDep().apply { + hiLayerResponse = value.hiLayerResponse + historicalBytes = value.historicalBytes + isExtendedLengthApduSupported = value.isExtendedLengthApduSupported + } +} + +private fun toPigeonMifareClassic(value: MifareClassic): Pigeon.PigeonMifareClassic { + return Pigeon.PigeonMifareClassic().apply { + type = toPigeonMifareClassicType(value.type) + blockCount = value.blockCount.toLong() + sectorCount = value.sectorCount.toLong() + size = value.size.toLong() + } +} + +private fun toPigeonMifareUltralight(value: MifareUltralight): Pigeon.PigeonMifareUltralight { + return Pigeon.PigeonMifareUltralight().apply { + type = toPigeonMifareUltralightType(value.type) + } +} + +@RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1) +private fun toPigeonNfcBarcode(value: NfcBarcode): Pigeon.PigeonNfcBarcode { + return Pigeon.PigeonNfcBarcode().apply { + type = value.type.toLong() + barcode = value.barcode + } +} + +private fun toShort(value: Pigeon.PigeonTypeNameFormat): Short { + return when (value) { + Pigeon.PigeonTypeNameFormat.EMPTY -> NdefRecord.TNF_EMPTY + Pigeon.PigeonTypeNameFormat.WELL_KNOWN -> NdefRecord.TNF_WELL_KNOWN + Pigeon.PigeonTypeNameFormat.MIME_MEDIA -> NdefRecord.TNF_MIME_MEDIA + Pigeon.PigeonTypeNameFormat.ABSOLUTE_URI -> NdefRecord.TNF_ABSOLUTE_URI + Pigeon.PigeonTypeNameFormat.EXTERNAL_TYPE -> NdefRecord.TNF_EXTERNAL_TYPE + Pigeon.PigeonTypeNameFormat.UNKNOWN -> NdefRecord.TNF_UNKNOWN + Pigeon.PigeonTypeNameFormat.UNCHANGED -> NdefRecord.TNF_UNCHANGED + } +} + +private fun toPigeonTypeNameFormat(value: Short): Pigeon.PigeonTypeNameFormat { + return when (value) { + NdefRecord.TNF_EMPTY -> Pigeon.PigeonTypeNameFormat.EMPTY + NdefRecord.TNF_WELL_KNOWN -> Pigeon.PigeonTypeNameFormat.WELL_KNOWN + NdefRecord.TNF_MIME_MEDIA -> Pigeon.PigeonTypeNameFormat.MIME_MEDIA + NdefRecord.TNF_ABSOLUTE_URI -> Pigeon.PigeonTypeNameFormat.ABSOLUTE_URI + NdefRecord.TNF_EXTERNAL_TYPE -> Pigeon.PigeonTypeNameFormat.EXTERNAL_TYPE + NdefRecord.TNF_UNKNOWN -> Pigeon.PigeonTypeNameFormat.UNKNOWN + NdefRecord.TNF_UNCHANGED -> Pigeon.PigeonTypeNameFormat.UNCHANGED + else -> error("TODO:") + } +} + +private fun toPigeonMifareClassicType(value: Int): Pigeon.PigeonMifareClassicType { + return when (value) { + MifareClassic.TYPE_CLASSIC -> Pigeon.PigeonMifareClassicType.CLASSIC + MifareClassic.TYPE_PLUS -> Pigeon.PigeonMifareClassicType.PLUS + MifareClassic.TYPE_PRO -> Pigeon.PigeonMifareClassicType.PRO + MifareClassic.TYPE_UNKNOWN -> Pigeon.PigeonMifareClassicType.UNKNOWN + else -> error("TODO:") + } +} + +private fun toPigeonMifareUltralightType(value: Int): Pigeon.PigeonMifareUltralightType { + return when (value) { + MifareUltralight.TYPE_ULTRALIGHT -> Pigeon.PigeonMifareUltralightType.ULTRALIGHT + MifareUltralight.TYPE_ULTRALIGHT_C -> Pigeon.PigeonMifareUltralightType.ULTRALIGHT_C + MifareUltralight.TYPE_UNKNOWN -> Pigeon.PigeonMifareUltralightType.UNKNOWN + else -> error("TODO:") + } +} diff --git a/android/src/main/kotlin/dev/flutter/plugins/nfcmanager/Pigeon.java b/android/src/main/kotlin/dev/flutter/plugins/nfcmanager/Pigeon.java new file mode 100644 index 0000000..8223232 --- /dev/null +++ b/android/src/main/kotlin/dev/flutter/plugins/nfcmanager/Pigeon.java @@ -0,0 +1,2959 @@ +// Autogenerated from Pigeon (v7.2.1), do not edit directly. +// See also: https://pub.dev/packages/pigeon + +package dev.flutter.plugins.nfcmanager; + +import android.util.Log; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import io.flutter.plugin.common.BasicMessageChannel; +import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugin.common.MessageCodec; +import io.flutter.plugin.common.StandardMessageCodec; +import java.io.ByteArrayOutputStream; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** Generated class from Pigeon. */ +@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"}) +public class Pigeon { + @NonNull + private static ArrayList wrapError(@NonNull Throwable exception) { + ArrayList errorList = new ArrayList(3); + errorList.add(exception.toString()); + errorList.add(exception.getClass().getSimpleName()); + errorList.add( + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + return errorList; + } + + public enum PigeonReaderFlag { + NFC_A(0), + NFC_B(1), + NFC_BARCODE(2), + NFC_F(3), + NFC_V(4), + NO_PLATFORM_SOUNDS(5), + SKIP_NDEF_CHECK(6); + + private final int index; + + private PigeonReaderFlag(final int index) { + this.index = index; + } + } + + public enum PigeonTypeNameFormat { + EMPTY(0), + WELL_KNOWN(1), + MIME_MEDIA(2), + ABSOLUTE_URI(3), + EXTERNAL_TYPE(4), + UNKNOWN(5), + UNCHANGED(6); + + private final int index; + + private PigeonTypeNameFormat(final int index) { + this.index = index; + } + } + + public enum PigeonMifareClassicType { + CLASSIC(0), + PLUS(1), + PRO(2), + UNKNOWN(3); + + private final int index; + + private PigeonMifareClassicType(final int index) { + this.index = index; + } + } + + public enum PigeonMifareUltralightType { + ULTRALIGHT(0), + ULTRALIGHT_C(1), + UNKNOWN(2); + + private final int index; + + private PigeonMifareUltralightType(final int index) { + this.index = index; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonTag { + private @Nullable String handle; + + public @Nullable String getHandle() { + return handle; + } + + public void setHandle(@Nullable String setterArg) { + this.handle = setterArg; + } + + private @Nullable byte[] id; + + public @Nullable byte[] getId() { + return id; + } + + public void setId(@Nullable byte[] setterArg) { + this.id = setterArg; + } + + private @Nullable List techList; + + public @Nullable List getTechList() { + return techList; + } + + public void setTechList(@Nullable List setterArg) { + this.techList = setterArg; + } + + private @Nullable PigeonNdef ndef; + + public @Nullable PigeonNdef getNdef() { + return ndef; + } + + public void setNdef(@Nullable PigeonNdef setterArg) { + this.ndef = setterArg; + } + + private @Nullable PigeonNfcA nfcA; + + public @Nullable PigeonNfcA getNfcA() { + return nfcA; + } + + public void setNfcA(@Nullable PigeonNfcA setterArg) { + this.nfcA = setterArg; + } + + private @Nullable PigeonNfcB nfcB; + + public @Nullable PigeonNfcB getNfcB() { + return nfcB; + } + + public void setNfcB(@Nullable PigeonNfcB setterArg) { + this.nfcB = setterArg; + } + + private @Nullable PigeonNfcF nfcF; + + public @Nullable PigeonNfcF getNfcF() { + return nfcF; + } + + public void setNfcF(@Nullable PigeonNfcF setterArg) { + this.nfcF = setterArg; + } + + private @Nullable PigeonNfcV nfcV; + + public @Nullable PigeonNfcV getNfcV() { + return nfcV; + } + + public void setNfcV(@Nullable PigeonNfcV setterArg) { + this.nfcV = setterArg; + } + + private @Nullable PigeonIsoDep isoDep; + + public @Nullable PigeonIsoDep getIsoDep() { + return isoDep; + } + + public void setIsoDep(@Nullable PigeonIsoDep setterArg) { + this.isoDep = setterArg; + } + + private @Nullable PigeonMifareClassic mifareClassic; + + public @Nullable PigeonMifareClassic getMifareClassic() { + return mifareClassic; + } + + public void setMifareClassic(@Nullable PigeonMifareClassic setterArg) { + this.mifareClassic = setterArg; + } + + private @Nullable PigeonMifareUltralight mifareUltralight; + + public @Nullable PigeonMifareUltralight getMifareUltralight() { + return mifareUltralight; + } + + public void setMifareUltralight(@Nullable PigeonMifareUltralight setterArg) { + this.mifareUltralight = setterArg; + } + + private @Nullable String ndefFormatable; + + public @Nullable String getNdefFormatable() { + return ndefFormatable; + } + + public void setNdefFormatable(@Nullable String setterArg) { + this.ndefFormatable = setterArg; + } + + private @Nullable PigeonNfcBarcode nfcBarcode; + + public @Nullable PigeonNfcBarcode getNfcBarcode() { + return nfcBarcode; + } + + public void setNfcBarcode(@Nullable PigeonNfcBarcode setterArg) { + this.nfcBarcode = setterArg; + } + + public static final class Builder { + + private @Nullable String handle; + + public @NonNull Builder setHandle(@Nullable String setterArg) { + this.handle = setterArg; + return this; + } + + private @Nullable byte[] id; + + public @NonNull Builder setId(@Nullable byte[] setterArg) { + this.id = setterArg; + return this; + } + + private @Nullable List techList; + + public @NonNull Builder setTechList(@Nullable List setterArg) { + this.techList = setterArg; + return this; + } + + private @Nullable PigeonNdef ndef; + + public @NonNull Builder setNdef(@Nullable PigeonNdef setterArg) { + this.ndef = setterArg; + return this; + } + + private @Nullable PigeonNfcA nfcA; + + public @NonNull Builder setNfcA(@Nullable PigeonNfcA setterArg) { + this.nfcA = setterArg; + return this; + } + + private @Nullable PigeonNfcB nfcB; + + public @NonNull Builder setNfcB(@Nullable PigeonNfcB setterArg) { + this.nfcB = setterArg; + return this; + } + + private @Nullable PigeonNfcF nfcF; + + public @NonNull Builder setNfcF(@Nullable PigeonNfcF setterArg) { + this.nfcF = setterArg; + return this; + } + + private @Nullable PigeonNfcV nfcV; + + public @NonNull Builder setNfcV(@Nullable PigeonNfcV setterArg) { + this.nfcV = setterArg; + return this; + } + + private @Nullable PigeonIsoDep isoDep; + + public @NonNull Builder setIsoDep(@Nullable PigeonIsoDep setterArg) { + this.isoDep = setterArg; + return this; + } + + private @Nullable PigeonMifareClassic mifareClassic; + + public @NonNull Builder setMifareClassic(@Nullable PigeonMifareClassic setterArg) { + this.mifareClassic = setterArg; + return this; + } + + private @Nullable PigeonMifareUltralight mifareUltralight; + + public @NonNull Builder setMifareUltralight(@Nullable PigeonMifareUltralight setterArg) { + this.mifareUltralight = setterArg; + return this; + } + + private @Nullable String ndefFormatable; + + public @NonNull Builder setNdefFormatable(@Nullable String setterArg) { + this.ndefFormatable = setterArg; + return this; + } + + private @Nullable PigeonNfcBarcode nfcBarcode; + + public @NonNull Builder setNfcBarcode(@Nullable PigeonNfcBarcode setterArg) { + this.nfcBarcode = setterArg; + return this; + } + + public @NonNull PigeonTag build() { + PigeonTag pigeonReturn = new PigeonTag(); + pigeonReturn.setHandle(handle); + pigeonReturn.setId(id); + pigeonReturn.setTechList(techList); + pigeonReturn.setNdef(ndef); + pigeonReturn.setNfcA(nfcA); + pigeonReturn.setNfcB(nfcB); + pigeonReturn.setNfcF(nfcF); + pigeonReturn.setNfcV(nfcV); + pigeonReturn.setIsoDep(isoDep); + pigeonReturn.setMifareClassic(mifareClassic); + pigeonReturn.setMifareUltralight(mifareUltralight); + pigeonReturn.setNdefFormatable(ndefFormatable); + pigeonReturn.setNfcBarcode(nfcBarcode); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(13); + toListResult.add(handle); + toListResult.add(id); + toListResult.add(techList); + toListResult.add((ndef == null) ? null : ndef.toList()); + toListResult.add((nfcA == null) ? null : nfcA.toList()); + toListResult.add((nfcB == null) ? null : nfcB.toList()); + toListResult.add((nfcF == null) ? null : nfcF.toList()); + toListResult.add((nfcV == null) ? null : nfcV.toList()); + toListResult.add((isoDep == null) ? null : isoDep.toList()); + toListResult.add((mifareClassic == null) ? null : mifareClassic.toList()); + toListResult.add((mifareUltralight == null) ? null : mifareUltralight.toList()); + toListResult.add(ndefFormatable); + toListResult.add((nfcBarcode == null) ? null : nfcBarcode.toList()); + return toListResult; + } + + static @NonNull PigeonTag fromList(@NonNull ArrayList list) { + PigeonTag pigeonResult = new PigeonTag(); + Object handle = list.get(0); + pigeonResult.setHandle((String) handle); + Object id = list.get(1); + pigeonResult.setId((byte[]) id); + Object techList = list.get(2); + pigeonResult.setTechList((List) techList); + Object ndef = list.get(3); + pigeonResult.setNdef((ndef == null) ? null : PigeonNdef.fromList((ArrayList) ndef)); + Object nfcA = list.get(4); + pigeonResult.setNfcA((nfcA == null) ? null : PigeonNfcA.fromList((ArrayList) nfcA)); + Object nfcB = list.get(5); + pigeonResult.setNfcB((nfcB == null) ? null : PigeonNfcB.fromList((ArrayList) nfcB)); + Object nfcF = list.get(6); + pigeonResult.setNfcF((nfcF == null) ? null : PigeonNfcF.fromList((ArrayList) nfcF)); + Object nfcV = list.get(7); + pigeonResult.setNfcV((nfcV == null) ? null : PigeonNfcV.fromList((ArrayList) nfcV)); + Object isoDep = list.get(8); + pigeonResult.setIsoDep((isoDep == null) ? null : PigeonIsoDep.fromList((ArrayList) isoDep)); + Object mifareClassic = list.get(9); + pigeonResult.setMifareClassic((mifareClassic == null) ? null : PigeonMifareClassic.fromList((ArrayList) mifareClassic)); + Object mifareUltralight = list.get(10); + pigeonResult.setMifareUltralight((mifareUltralight == null) ? null : PigeonMifareUltralight.fromList((ArrayList) mifareUltralight)); + Object ndefFormatable = list.get(11); + pigeonResult.setNdefFormatable((String) ndefFormatable); + Object nfcBarcode = list.get(12); + pigeonResult.setNfcBarcode((nfcBarcode == null) ? null : PigeonNfcBarcode.fromList((ArrayList) nfcBarcode)); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonNdef { + private @Nullable String type; + + public @Nullable String getType() { + return type; + } + + public void setType(@Nullable String setterArg) { + this.type = setterArg; + } + + private @Nullable Boolean canMakeReadOnly; + + public @Nullable Boolean getCanMakeReadOnly() { + return canMakeReadOnly; + } + + public void setCanMakeReadOnly(@Nullable Boolean setterArg) { + this.canMakeReadOnly = setterArg; + } + + private @Nullable Boolean isWritable; + + public @Nullable Boolean getIsWritable() { + return isWritable; + } + + public void setIsWritable(@Nullable Boolean setterArg) { + this.isWritable = setterArg; + } + + private @Nullable Long maxSize; + + public @Nullable Long getMaxSize() { + return maxSize; + } + + public void setMaxSize(@Nullable Long setterArg) { + this.maxSize = setterArg; + } + + private @Nullable PigeonNdefMessage cachedNdefMessage; + + public @Nullable PigeonNdefMessage getCachedNdefMessage() { + return cachedNdefMessage; + } + + public void setCachedNdefMessage(@Nullable PigeonNdefMessage setterArg) { + this.cachedNdefMessage = setterArg; + } + + public static final class Builder { + + private @Nullable String type; + + public @NonNull Builder setType(@Nullable String setterArg) { + this.type = setterArg; + return this; + } + + private @Nullable Boolean canMakeReadOnly; + + public @NonNull Builder setCanMakeReadOnly(@Nullable Boolean setterArg) { + this.canMakeReadOnly = setterArg; + return this; + } + + private @Nullable Boolean isWritable; + + public @NonNull Builder setIsWritable(@Nullable Boolean setterArg) { + this.isWritable = setterArg; + return this; + } + + private @Nullable Long maxSize; + + public @NonNull Builder setMaxSize(@Nullable Long setterArg) { + this.maxSize = setterArg; + return this; + } + + private @Nullable PigeonNdefMessage cachedNdefMessage; + + public @NonNull Builder setCachedNdefMessage(@Nullable PigeonNdefMessage setterArg) { + this.cachedNdefMessage = setterArg; + return this; + } + + public @NonNull PigeonNdef build() { + PigeonNdef pigeonReturn = new PigeonNdef(); + pigeonReturn.setType(type); + pigeonReturn.setCanMakeReadOnly(canMakeReadOnly); + pigeonReturn.setIsWritable(isWritable); + pigeonReturn.setMaxSize(maxSize); + pigeonReturn.setCachedNdefMessage(cachedNdefMessage); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(5); + toListResult.add(type); + toListResult.add(canMakeReadOnly); + toListResult.add(isWritable); + toListResult.add(maxSize); + toListResult.add((cachedNdefMessage == null) ? null : cachedNdefMessage.toList()); + return toListResult; + } + + static @NonNull PigeonNdef fromList(@NonNull ArrayList list) { + PigeonNdef pigeonResult = new PigeonNdef(); + Object type = list.get(0); + pigeonResult.setType((String) type); + Object canMakeReadOnly = list.get(1); + pigeonResult.setCanMakeReadOnly((Boolean) canMakeReadOnly); + Object isWritable = list.get(2); + pigeonResult.setIsWritable((Boolean) isWritable); + Object maxSize = list.get(3); + pigeonResult.setMaxSize((maxSize == null) ? null : ((maxSize instanceof Integer) ? (Integer) maxSize : (Long) maxSize)); + Object cachedNdefMessage = list.get(4); + pigeonResult.setCachedNdefMessage((cachedNdefMessage == null) ? null : PigeonNdefMessage.fromList((ArrayList) cachedNdefMessage)); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonNfcA { + private @Nullable byte[] atqa; + + public @Nullable byte[] getAtqa() { + return atqa; + } + + public void setAtqa(@Nullable byte[] setterArg) { + this.atqa = setterArg; + } + + private @Nullable Long sak; + + public @Nullable Long getSak() { + return sak; + } + + public void setSak(@Nullable Long setterArg) { + this.sak = setterArg; + } + + public static final class Builder { + + private @Nullable byte[] atqa; + + public @NonNull Builder setAtqa(@Nullable byte[] setterArg) { + this.atqa = setterArg; + return this; + } + + private @Nullable Long sak; + + public @NonNull Builder setSak(@Nullable Long setterArg) { + this.sak = setterArg; + return this; + } + + public @NonNull PigeonNfcA build() { + PigeonNfcA pigeonReturn = new PigeonNfcA(); + pigeonReturn.setAtqa(atqa); + pigeonReturn.setSak(sak); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(2); + toListResult.add(atqa); + toListResult.add(sak); + return toListResult; + } + + static @NonNull PigeonNfcA fromList(@NonNull ArrayList list) { + PigeonNfcA pigeonResult = new PigeonNfcA(); + Object atqa = list.get(0); + pigeonResult.setAtqa((byte[]) atqa); + Object sak = list.get(1); + pigeonResult.setSak((sak == null) ? null : ((sak instanceof Integer) ? (Integer) sak : (Long) sak)); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonNfcB { + private @Nullable byte[] applicationData; + + public @Nullable byte[] getApplicationData() { + return applicationData; + } + + public void setApplicationData(@Nullable byte[] setterArg) { + this.applicationData = setterArg; + } + + private @Nullable byte[] protocolInfo; + + public @Nullable byte[] getProtocolInfo() { + return protocolInfo; + } + + public void setProtocolInfo(@Nullable byte[] setterArg) { + this.protocolInfo = setterArg; + } + + public static final class Builder { + + private @Nullable byte[] applicationData; + + public @NonNull Builder setApplicationData(@Nullable byte[] setterArg) { + this.applicationData = setterArg; + return this; + } + + private @Nullable byte[] protocolInfo; + + public @NonNull Builder setProtocolInfo(@Nullable byte[] setterArg) { + this.protocolInfo = setterArg; + return this; + } + + public @NonNull PigeonNfcB build() { + PigeonNfcB pigeonReturn = new PigeonNfcB(); + pigeonReturn.setApplicationData(applicationData); + pigeonReturn.setProtocolInfo(protocolInfo); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(2); + toListResult.add(applicationData); + toListResult.add(protocolInfo); + return toListResult; + } + + static @NonNull PigeonNfcB fromList(@NonNull ArrayList list) { + PigeonNfcB pigeonResult = new PigeonNfcB(); + Object applicationData = list.get(0); + pigeonResult.setApplicationData((byte[]) applicationData); + Object protocolInfo = list.get(1); + pigeonResult.setProtocolInfo((byte[]) protocolInfo); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonNfcF { + private @Nullable byte[] manufacturer; + + public @Nullable byte[] getManufacturer() { + return manufacturer; + } + + public void setManufacturer(@Nullable byte[] setterArg) { + this.manufacturer = setterArg; + } + + private @Nullable byte[] systemCode; + + public @Nullable byte[] getSystemCode() { + return systemCode; + } + + public void setSystemCode(@Nullable byte[] setterArg) { + this.systemCode = setterArg; + } + + public static final class Builder { + + private @Nullable byte[] manufacturer; + + public @NonNull Builder setManufacturer(@Nullable byte[] setterArg) { + this.manufacturer = setterArg; + return this; + } + + private @Nullable byte[] systemCode; + + public @NonNull Builder setSystemCode(@Nullable byte[] setterArg) { + this.systemCode = setterArg; + return this; + } + + public @NonNull PigeonNfcF build() { + PigeonNfcF pigeonReturn = new PigeonNfcF(); + pigeonReturn.setManufacturer(manufacturer); + pigeonReturn.setSystemCode(systemCode); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(2); + toListResult.add(manufacturer); + toListResult.add(systemCode); + return toListResult; + } + + static @NonNull PigeonNfcF fromList(@NonNull ArrayList list) { + PigeonNfcF pigeonResult = new PigeonNfcF(); + Object manufacturer = list.get(0); + pigeonResult.setManufacturer((byte[]) manufacturer); + Object systemCode = list.get(1); + pigeonResult.setSystemCode((byte[]) systemCode); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonNfcV { + private @Nullable Long dsfId; + + public @Nullable Long getDsfId() { + return dsfId; + } + + public void setDsfId(@Nullable Long setterArg) { + this.dsfId = setterArg; + } + + private @Nullable Long responseFlags; + + public @Nullable Long getResponseFlags() { + return responseFlags; + } + + public void setResponseFlags(@Nullable Long setterArg) { + this.responseFlags = setterArg; + } + + public static final class Builder { + + private @Nullable Long dsfId; + + public @NonNull Builder setDsfId(@Nullable Long setterArg) { + this.dsfId = setterArg; + return this; + } + + private @Nullable Long responseFlags; + + public @NonNull Builder setResponseFlags(@Nullable Long setterArg) { + this.responseFlags = setterArg; + return this; + } + + public @NonNull PigeonNfcV build() { + PigeonNfcV pigeonReturn = new PigeonNfcV(); + pigeonReturn.setDsfId(dsfId); + pigeonReturn.setResponseFlags(responseFlags); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(2); + toListResult.add(dsfId); + toListResult.add(responseFlags); + return toListResult; + } + + static @NonNull PigeonNfcV fromList(@NonNull ArrayList list) { + PigeonNfcV pigeonResult = new PigeonNfcV(); + Object dsfId = list.get(0); + pigeonResult.setDsfId((dsfId == null) ? null : ((dsfId instanceof Integer) ? (Integer) dsfId : (Long) dsfId)); + Object responseFlags = list.get(1); + pigeonResult.setResponseFlags((responseFlags == null) ? null : ((responseFlags instanceof Integer) ? (Integer) responseFlags : (Long) responseFlags)); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonIsoDep { + private @Nullable byte[] hiLayerResponse; + + public @Nullable byte[] getHiLayerResponse() { + return hiLayerResponse; + } + + public void setHiLayerResponse(@Nullable byte[] setterArg) { + this.hiLayerResponse = setterArg; + } + + private @Nullable byte[] historicalBytes; + + public @Nullable byte[] getHistoricalBytes() { + return historicalBytes; + } + + public void setHistoricalBytes(@Nullable byte[] setterArg) { + this.historicalBytes = setterArg; + } + + private @Nullable Boolean isExtendedLengthApduSupported; + + public @Nullable Boolean getIsExtendedLengthApduSupported() { + return isExtendedLengthApduSupported; + } + + public void setIsExtendedLengthApduSupported(@Nullable Boolean setterArg) { + this.isExtendedLengthApduSupported = setterArg; + } + + public static final class Builder { + + private @Nullable byte[] hiLayerResponse; + + public @NonNull Builder setHiLayerResponse(@Nullable byte[] setterArg) { + this.hiLayerResponse = setterArg; + return this; + } + + private @Nullable byte[] historicalBytes; + + public @NonNull Builder setHistoricalBytes(@Nullable byte[] setterArg) { + this.historicalBytes = setterArg; + return this; + } + + private @Nullable Boolean isExtendedLengthApduSupported; + + public @NonNull Builder setIsExtendedLengthApduSupported(@Nullable Boolean setterArg) { + this.isExtendedLengthApduSupported = setterArg; + return this; + } + + public @NonNull PigeonIsoDep build() { + PigeonIsoDep pigeonReturn = new PigeonIsoDep(); + pigeonReturn.setHiLayerResponse(hiLayerResponse); + pigeonReturn.setHistoricalBytes(historicalBytes); + pigeonReturn.setIsExtendedLengthApduSupported(isExtendedLengthApduSupported); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(3); + toListResult.add(hiLayerResponse); + toListResult.add(historicalBytes); + toListResult.add(isExtendedLengthApduSupported); + return toListResult; + } + + static @NonNull PigeonIsoDep fromList(@NonNull ArrayList list) { + PigeonIsoDep pigeonResult = new PigeonIsoDep(); + Object hiLayerResponse = list.get(0); + pigeonResult.setHiLayerResponse((byte[]) hiLayerResponse); + Object historicalBytes = list.get(1); + pigeonResult.setHistoricalBytes((byte[]) historicalBytes); + Object isExtendedLengthApduSupported = list.get(2); + pigeonResult.setIsExtendedLengthApduSupported((Boolean) isExtendedLengthApduSupported); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonMifareClassic { + private @Nullable PigeonMifareClassicType type; + + public @Nullable PigeonMifareClassicType getType() { + return type; + } + + public void setType(@Nullable PigeonMifareClassicType setterArg) { + this.type = setterArg; + } + + private @Nullable Long blockCount; + + public @Nullable Long getBlockCount() { + return blockCount; + } + + public void setBlockCount(@Nullable Long setterArg) { + this.blockCount = setterArg; + } + + private @Nullable Long sectorCount; + + public @Nullable Long getSectorCount() { + return sectorCount; + } + + public void setSectorCount(@Nullable Long setterArg) { + this.sectorCount = setterArg; + } + + private @Nullable Long size; + + public @Nullable Long getSize() { + return size; + } + + public void setSize(@Nullable Long setterArg) { + this.size = setterArg; + } + + public static final class Builder { + + private @Nullable PigeonMifareClassicType type; + + public @NonNull Builder setType(@Nullable PigeonMifareClassicType setterArg) { + this.type = setterArg; + return this; + } + + private @Nullable Long blockCount; + + public @NonNull Builder setBlockCount(@Nullable Long setterArg) { + this.blockCount = setterArg; + return this; + } + + private @Nullable Long sectorCount; + + public @NonNull Builder setSectorCount(@Nullable Long setterArg) { + this.sectorCount = setterArg; + return this; + } + + private @Nullable Long size; + + public @NonNull Builder setSize(@Nullable Long setterArg) { + this.size = setterArg; + return this; + } + + public @NonNull PigeonMifareClassic build() { + PigeonMifareClassic pigeonReturn = new PigeonMifareClassic(); + pigeonReturn.setType(type); + pigeonReturn.setBlockCount(blockCount); + pigeonReturn.setSectorCount(sectorCount); + pigeonReturn.setSize(size); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(4); + toListResult.add(type == null ? null : type.index); + toListResult.add(blockCount); + toListResult.add(sectorCount); + toListResult.add(size); + return toListResult; + } + + static @NonNull PigeonMifareClassic fromList(@NonNull ArrayList list) { + PigeonMifareClassic pigeonResult = new PigeonMifareClassic(); + Object type = list.get(0); + pigeonResult.setType(type == null ? null : PigeonMifareClassicType.values()[(int) type]); + Object blockCount = list.get(1); + pigeonResult.setBlockCount((blockCount == null) ? null : ((blockCount instanceof Integer) ? (Integer) blockCount : (Long) blockCount)); + Object sectorCount = list.get(2); + pigeonResult.setSectorCount((sectorCount == null) ? null : ((sectorCount instanceof Integer) ? (Integer) sectorCount : (Long) sectorCount)); + Object size = list.get(3); + pigeonResult.setSize((size == null) ? null : ((size instanceof Integer) ? (Integer) size : (Long) size)); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonMifareUltralight { + private @Nullable PigeonMifareUltralightType type; + + public @Nullable PigeonMifareUltralightType getType() { + return type; + } + + public void setType(@Nullable PigeonMifareUltralightType setterArg) { + this.type = setterArg; + } + + public static final class Builder { + + private @Nullable PigeonMifareUltralightType type; + + public @NonNull Builder setType(@Nullable PigeonMifareUltralightType setterArg) { + this.type = setterArg; + return this; + } + + public @NonNull PigeonMifareUltralight build() { + PigeonMifareUltralight pigeonReturn = new PigeonMifareUltralight(); + pigeonReturn.setType(type); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(1); + toListResult.add(type == null ? null : type.index); + return toListResult; + } + + static @NonNull PigeonMifareUltralight fromList(@NonNull ArrayList list) { + PigeonMifareUltralight pigeonResult = new PigeonMifareUltralight(); + Object type = list.get(0); + pigeonResult.setType(type == null ? null : PigeonMifareUltralightType.values()[(int) type]); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonNfcBarcode { + private @Nullable Long type; + + public @Nullable Long getType() { + return type; + } + + public void setType(@Nullable Long setterArg) { + this.type = setterArg; + } + + private @Nullable byte[] barcode; + + public @Nullable byte[] getBarcode() { + return barcode; + } + + public void setBarcode(@Nullable byte[] setterArg) { + this.barcode = setterArg; + } + + public static final class Builder { + + private @Nullable Long type; + + public @NonNull Builder setType(@Nullable Long setterArg) { + this.type = setterArg; + return this; + } + + private @Nullable byte[] barcode; + + public @NonNull Builder setBarcode(@Nullable byte[] setterArg) { + this.barcode = setterArg; + return this; + } + + public @NonNull PigeonNfcBarcode build() { + PigeonNfcBarcode pigeonReturn = new PigeonNfcBarcode(); + pigeonReturn.setType(type); + pigeonReturn.setBarcode(barcode); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(2); + toListResult.add(type); + toListResult.add(barcode); + return toListResult; + } + + static @NonNull PigeonNfcBarcode fromList(@NonNull ArrayList list) { + PigeonNfcBarcode pigeonResult = new PigeonNfcBarcode(); + Object type = list.get(0); + pigeonResult.setType((type == null) ? null : ((type instanceof Integer) ? (Integer) type : (Long) type)); + Object barcode = list.get(1); + pigeonResult.setBarcode((byte[]) barcode); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonNdefMessage { + private @Nullable List records; + + public @Nullable List getRecords() { + return records; + } + + public void setRecords(@Nullable List setterArg) { + this.records = setterArg; + } + + public static final class Builder { + + private @Nullable List records; + + public @NonNull Builder setRecords(@Nullable List setterArg) { + this.records = setterArg; + return this; + } + + public @NonNull PigeonNdefMessage build() { + PigeonNdefMessage pigeonReturn = new PigeonNdefMessage(); + pigeonReturn.setRecords(records); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(1); + toListResult.add(records); + return toListResult; + } + + static @NonNull PigeonNdefMessage fromList(@NonNull ArrayList list) { + PigeonNdefMessage pigeonResult = new PigeonNdefMessage(); + Object records = list.get(0); + pigeonResult.setRecords((List) records); + return pigeonResult; + } + } + + /** Generated class from Pigeon that represents data sent in messages. */ + public static final class PigeonNdefRecord { + private @Nullable PigeonTypeNameFormat tnf; + + public @Nullable PigeonTypeNameFormat getTnf() { + return tnf; + } + + public void setTnf(@Nullable PigeonTypeNameFormat setterArg) { + this.tnf = setterArg; + } + + private @Nullable byte[] type; + + public @Nullable byte[] getType() { + return type; + } + + public void setType(@Nullable byte[] setterArg) { + this.type = setterArg; + } + + private @Nullable byte[] id; + + public @Nullable byte[] getId() { + return id; + } + + public void setId(@Nullable byte[] setterArg) { + this.id = setterArg; + } + + private @Nullable byte[] payload; + + public @Nullable byte[] getPayload() { + return payload; + } + + public void setPayload(@Nullable byte[] setterArg) { + this.payload = setterArg; + } + + public static final class Builder { + + private @Nullable PigeonTypeNameFormat tnf; + + public @NonNull Builder setTnf(@Nullable PigeonTypeNameFormat setterArg) { + this.tnf = setterArg; + return this; + } + + private @Nullable byte[] type; + + public @NonNull Builder setType(@Nullable byte[] setterArg) { + this.type = setterArg; + return this; + } + + private @Nullable byte[] id; + + public @NonNull Builder setId(@Nullable byte[] setterArg) { + this.id = setterArg; + return this; + } + + private @Nullable byte[] payload; + + public @NonNull Builder setPayload(@Nullable byte[] setterArg) { + this.payload = setterArg; + return this; + } + + public @NonNull PigeonNdefRecord build() { + PigeonNdefRecord pigeonReturn = new PigeonNdefRecord(); + pigeonReturn.setTnf(tnf); + pigeonReturn.setType(type); + pigeonReturn.setId(id); + pigeonReturn.setPayload(payload); + return pigeonReturn; + } + } + + @NonNull + ArrayList toList() { + ArrayList toListResult = new ArrayList(4); + toListResult.add(tnf == null ? null : tnf.index); + toListResult.add(type); + toListResult.add(id); + toListResult.add(payload); + return toListResult; + } + + static @NonNull PigeonNdefRecord fromList(@NonNull ArrayList list) { + PigeonNdefRecord pigeonResult = new PigeonNdefRecord(); + Object tnf = list.get(0); + pigeonResult.setTnf(tnf == null ? null : PigeonTypeNameFormat.values()[(int) tnf]); + Object type = list.get(1); + pigeonResult.setType((byte[]) type); + Object id = list.get(2); + pigeonResult.setId((byte[]) id); + Object payload = list.get(3); + pigeonResult.setPayload((byte[]) payload); + return pigeonResult; + } + } + + private static class PigeonFlutterApiCodec extends StandardMessageCodec { + public static final PigeonFlutterApiCodec INSTANCE = new PigeonFlutterApiCodec(); + + private PigeonFlutterApiCodec() {} + + @Override + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { + switch (type) { + case (byte) 128: + return PigeonIsoDep.fromList((ArrayList) readValue(buffer)); + case (byte) 129: + return PigeonMifareClassic.fromList((ArrayList) readValue(buffer)); + case (byte) 130: + return PigeonMifareUltralight.fromList((ArrayList) readValue(buffer)); + case (byte) 131: + return PigeonNdef.fromList((ArrayList) readValue(buffer)); + case (byte) 132: + return PigeonNdefMessage.fromList((ArrayList) readValue(buffer)); + case (byte) 133: + return PigeonNdefRecord.fromList((ArrayList) readValue(buffer)); + case (byte) 134: + return PigeonNfcA.fromList((ArrayList) readValue(buffer)); + case (byte) 135: + return PigeonNfcB.fromList((ArrayList) readValue(buffer)); + case (byte) 136: + return PigeonNfcBarcode.fromList((ArrayList) readValue(buffer)); + case (byte) 137: + return PigeonNfcF.fromList((ArrayList) readValue(buffer)); + case (byte) 138: + return PigeonNfcV.fromList((ArrayList) readValue(buffer)); + case (byte) 139: + return PigeonTag.fromList((ArrayList) readValue(buffer)); + default: + return super.readValueOfType(type, buffer); + } + } + + @Override + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + if (value instanceof PigeonIsoDep) { + stream.write(128); + writeValue(stream, ((PigeonIsoDep) value).toList()); + } else if (value instanceof PigeonMifareClassic) { + stream.write(129); + writeValue(stream, ((PigeonMifareClassic) value).toList()); + } else if (value instanceof PigeonMifareUltralight) { + stream.write(130); + writeValue(stream, ((PigeonMifareUltralight) value).toList()); + } else if (value instanceof PigeonNdef) { + stream.write(131); + writeValue(stream, ((PigeonNdef) value).toList()); + } else if (value instanceof PigeonNdefMessage) { + stream.write(132); + writeValue(stream, ((PigeonNdefMessage) value).toList()); + } else if (value instanceof PigeonNdefRecord) { + stream.write(133); + writeValue(stream, ((PigeonNdefRecord) value).toList()); + } else if (value instanceof PigeonNfcA) { + stream.write(134); + writeValue(stream, ((PigeonNfcA) value).toList()); + } else if (value instanceof PigeonNfcB) { + stream.write(135); + writeValue(stream, ((PigeonNfcB) value).toList()); + } else if (value instanceof PigeonNfcBarcode) { + stream.write(136); + writeValue(stream, ((PigeonNfcBarcode) value).toList()); + } else if (value instanceof PigeonNfcF) { + stream.write(137); + writeValue(stream, ((PigeonNfcF) value).toList()); + } else if (value instanceof PigeonNfcV) { + stream.write(138); + writeValue(stream, ((PigeonNfcV) value).toList()); + } else if (value instanceof PigeonTag) { + stream.write(139); + writeValue(stream, ((PigeonTag) value).toList()); + } else { + super.writeValue(stream, value); + } + } + } + + /** Generated class from Pigeon that represents Flutter messages that can be called from Java. */ + public static final class PigeonFlutterApi { + private final BinaryMessenger binaryMessenger; + + public PigeonFlutterApi(BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ public interface Reply { + void reply(T reply); + } + /** The codec used by PigeonFlutterApi. */ + static MessageCodec getCodec() { + return PigeonFlutterApiCodec.INSTANCE; + } + public void onTagDiscovered(@NonNull PigeonTag tagArg, Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonFlutterApi.onTagDiscovered", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(tagArg)), + channelReply -> callback.reply(null)); + } + public void onAdapterStateChanged(@NonNull Long stateArg, Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonFlutterApi.onAdapterStateChanged", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(stateArg)), + channelReply -> callback.reply(null)); + } + } + + private static class PigeonHostApiCodec extends StandardMessageCodec { + public static final PigeonHostApiCodec INSTANCE = new PigeonHostApiCodec(); + + private PigeonHostApiCodec() {} + + @Override + protected Object readValueOfType(byte type, @NonNull ByteBuffer buffer) { + switch (type) { + case (byte) 128: + return PigeonNdefMessage.fromList((ArrayList) readValue(buffer)); + case (byte) 129: + return PigeonNdefMessage.fromList((ArrayList) readValue(buffer)); + case (byte) 130: + return PigeonNdefRecord.fromList((ArrayList) readValue(buffer)); + default: + return super.readValueOfType(type, buffer); + } + } + + @Override + protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { + if (value instanceof PigeonNdefMessage) { + stream.write(128); + writeValue(stream, ((PigeonNdefMessage) value).toList()); + } else if (value instanceof PigeonNdefMessage) { + stream.write(129); + writeValue(stream, ((PigeonNdefMessage) value).toList()); + } else if (value instanceof PigeonNdefRecord) { + stream.write(130); + writeValue(stream, ((PigeonNdefRecord) value).toList()); + } else { + super.writeValue(stream, value); + } + } + } + + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ + public interface PigeonHostApi { + + @NonNull + Boolean adapterIsEnabled(); + + @NonNull + Boolean adapterIsSecureNfcEnabled(); + + @NonNull + Boolean adapterIsSecureNfcSupported(); + + void adapterEnableReaderMode(@NonNull List flags); + + void adapterDisableReaderMode(); + + void adapterEnableForegroundDispatch(); + + void adapterDisableForegroundDispatch(); + + @Nullable + PigeonNdefMessage ndefGetNdefMessage(@NonNull String handle); + + void ndefWriteNdefMessage(@NonNull String handle, @NonNull PigeonNdefMessage message); + + @NonNull + Boolean ndefMakeReadOnly(@NonNull String handle); + + @NonNull + Long nfcAGetMaxTransceiveLength(@NonNull String handle); + + @NonNull + Long nfcAGetTimeout(@NonNull String handle); + + void nfcASetTimeout(@NonNull String handle, @NonNull Long timeout); + + @NonNull + byte[] nfcATransceive(@NonNull String handle, @NonNull byte[] data); + + @NonNull + Long nfcBGetMaxTransceiveLength(@NonNull String handle); + + @NonNull + byte[] nfcBTransceive(@NonNull String handle, @NonNull byte[] data); + + @NonNull + Long nfcFGetMaxTransceiveLength(@NonNull String handle); + + @NonNull + Long nfcFGetTimeout(@NonNull String handle); + + void nfcFSetTimeout(@NonNull String handle, @NonNull Long timeout); + + @NonNull + byte[] nfcFTransceive(@NonNull String handle, @NonNull byte[] data); + + @NonNull + Long nfcVGetMaxTransceiveLength(@NonNull String handle); + + @NonNull + byte[] nfcVTransceive(@NonNull String handle, @NonNull byte[] data); + + @NonNull + Long isoDepGetMaxTransceiveLength(@NonNull String handle); + + @NonNull + Long isoDepGetTimeout(@NonNull String handle); + + void isoDepSetTimeout(@NonNull String handle, @NonNull Long timeout); + + @NonNull + byte[] isoDepTransceive(@NonNull String handle, @NonNull byte[] data); + + @NonNull + Long mifareClassicGetMaxTransceiveLength(@NonNull String handle); + + @NonNull + Long mifareClassicGetTimeout(@NonNull String handle); + + void mifareClassicSetTimeout(@NonNull String handle, @NonNull Long timeout); + + @NonNull + Long mifareClassicBlockToSector(@NonNull String handle, @NonNull Long blockIndex); + + @NonNull + Long mifareClassicGetBlockCountInSector(@NonNull String handle, @NonNull Long sectorIndex); + + @NonNull + Long mifareClassicSectorToBlock(@NonNull String handle, @NonNull Long sectorIndex); + + @NonNull + Boolean mifareClassicAuthenticateSectorWithKeyA(@NonNull String handle, @NonNull Long sectorIndex, @NonNull byte[] key); + + @NonNull + Boolean mifareClassicAuthenticateSectorWithKeyB(@NonNull String handle, @NonNull Long sectorIndex, @NonNull byte[] key); + + void mifareClassicIncrement(@NonNull String handle, @NonNull Long blockIndex, @NonNull Long value); + + void mifareClassicDecrement(@NonNull String handle, @NonNull Long blockIndex, @NonNull Long value); + + @NonNull + byte[] mifareClassicReadBlock(@NonNull String handle, @NonNull Long blockIndex); + + void mifareClassicWriteBlock(@NonNull String handle, @NonNull Long blockIndex, @NonNull byte[] data); + + void mifareClassicRestore(@NonNull String handle, @NonNull Long blockIndex); + + void mifareClassicTransfer(@NonNull String handle, @NonNull Long blockIndex); + + @NonNull + byte[] mifareClassicTransceive(@NonNull String handle, @NonNull byte[] data); + + @NonNull + Long mifareUltralightGetMaxTransceiveLength(@NonNull String handle); + + @NonNull + Long mifareUltralightGetTimeout(@NonNull String handle); + + void mifareUltralightSetTimeout(@NonNull String handle, @NonNull Long timeout); + + @NonNull + byte[] mifareUltralightReadPages(@NonNull String handle, @NonNull Long pageOffset); + + void mifareUltralightWritePage(@NonNull String handle, @NonNull Long pageOffset, @NonNull byte[] data); + + @NonNull + byte[] mifareUltralightTransceive(@NonNull String handle, @NonNull byte[] data); + + void ndefFormatableFormat(@NonNull String handle, @NonNull PigeonNdefMessage firstMessage); + + void ndefFormatableFormatReadOnly(@NonNull String handle, @NonNull PigeonNdefMessage firstMessage); + + void disposeTag(@NonNull String handle); + + /** The codec used by PigeonHostApi. */ + static MessageCodec getCodec() { + return PigeonHostApiCodec.INSTANCE; + } + /**Sets up an instance of `PigeonHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(BinaryMessenger binaryMessenger, PigeonHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.adapterIsEnabled", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + Boolean output = api.adapterIsEnabled(); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.adapterIsSecureNfcEnabled", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + Boolean output = api.adapterIsSecureNfcEnabled(); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.adapterIsSecureNfcSupported", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + Boolean output = api.adapterIsSecureNfcSupported(); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.adapterEnableReaderMode", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + List flagsArg = (List) args.get(0); + if (flagsArg == null) { + throw new NullPointerException("flagsArg unexpectedly null."); + } + api.adapterEnableReaderMode(flagsArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.adapterDisableReaderMode", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.adapterDisableReaderMode(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.adapterEnableForegroundDispatch", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.adapterEnableForegroundDispatch(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.adapterDisableForegroundDispatch", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + api.adapterDisableForegroundDispatch(); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.ndefGetNdefMessage", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + PigeonNdefMessage output = api.ndefGetNdefMessage(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.ndefWriteNdefMessage", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + PigeonNdefMessage messageArg = (PigeonNdefMessage) args.get(1); + if (messageArg == null) { + throw new NullPointerException("messageArg unexpectedly null."); + } + api.ndefWriteNdefMessage(handleArg, messageArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.ndefMakeReadOnly", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Boolean output = api.ndefMakeReadOnly(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcAGetMaxTransceiveLength", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.nfcAGetMaxTransceiveLength(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcAGetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.nfcAGetTimeout(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcASetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number timeoutArg = (Number) args.get(1); + if (timeoutArg == null) { + throw new NullPointerException("timeoutArg unexpectedly null."); + } + api.nfcASetTimeout(handleArg, (timeoutArg == null) ? null : timeoutArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcATransceive", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + byte[] output = api.nfcATransceive(handleArg, dataArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcBGetMaxTransceiveLength", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.nfcBGetMaxTransceiveLength(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcBTransceive", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + byte[] output = api.nfcBTransceive(handleArg, dataArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcFGetMaxTransceiveLength", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.nfcFGetMaxTransceiveLength(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcFGetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.nfcFGetTimeout(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcFSetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number timeoutArg = (Number) args.get(1); + if (timeoutArg == null) { + throw new NullPointerException("timeoutArg unexpectedly null."); + } + api.nfcFSetTimeout(handleArg, (timeoutArg == null) ? null : timeoutArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcFTransceive", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + byte[] output = api.nfcFTransceive(handleArg, dataArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcVGetMaxTransceiveLength", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.nfcVGetMaxTransceiveLength(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.nfcVTransceive", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + byte[] output = api.nfcVTransceive(handleArg, dataArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.isoDepGetMaxTransceiveLength", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.isoDepGetMaxTransceiveLength(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.isoDepGetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.isoDepGetTimeout(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.isoDepSetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number timeoutArg = (Number) args.get(1); + if (timeoutArg == null) { + throw new NullPointerException("timeoutArg unexpectedly null."); + } + api.isoDepSetTimeout(handleArg, (timeoutArg == null) ? null : timeoutArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.isoDepTransceive", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + byte[] output = api.isoDepTransceive(handleArg, dataArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicGetMaxTransceiveLength", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.mifareClassicGetMaxTransceiveLength(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicGetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.mifareClassicGetTimeout(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicSetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number timeoutArg = (Number) args.get(1); + if (timeoutArg == null) { + throw new NullPointerException("timeoutArg unexpectedly null."); + } + api.mifareClassicSetTimeout(handleArg, (timeoutArg == null) ? null : timeoutArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicBlockToSector", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number blockIndexArg = (Number) args.get(1); + if (blockIndexArg == null) { + throw new NullPointerException("blockIndexArg unexpectedly null."); + } + Long output = api.mifareClassicBlockToSector(handleArg, (blockIndexArg == null) ? null : blockIndexArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicGetBlockCountInSector", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number sectorIndexArg = (Number) args.get(1); + if (sectorIndexArg == null) { + throw new NullPointerException("sectorIndexArg unexpectedly null."); + } + Long output = api.mifareClassicGetBlockCountInSector(handleArg, (sectorIndexArg == null) ? null : sectorIndexArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicSectorToBlock", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number sectorIndexArg = (Number) args.get(1); + if (sectorIndexArg == null) { + throw new NullPointerException("sectorIndexArg unexpectedly null."); + } + Long output = api.mifareClassicSectorToBlock(handleArg, (sectorIndexArg == null) ? null : sectorIndexArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicAuthenticateSectorWithKeyA", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number sectorIndexArg = (Number) args.get(1); + if (sectorIndexArg == null) { + throw new NullPointerException("sectorIndexArg unexpectedly null."); + } + byte[] keyArg = (byte[]) args.get(2); + if (keyArg == null) { + throw new NullPointerException("keyArg unexpectedly null."); + } + Boolean output = api.mifareClassicAuthenticateSectorWithKeyA(handleArg, (sectorIndexArg == null) ? null : sectorIndexArg.longValue(), keyArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicAuthenticateSectorWithKeyB", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number sectorIndexArg = (Number) args.get(1); + if (sectorIndexArg == null) { + throw new NullPointerException("sectorIndexArg unexpectedly null."); + } + byte[] keyArg = (byte[]) args.get(2); + if (keyArg == null) { + throw new NullPointerException("keyArg unexpectedly null."); + } + Boolean output = api.mifareClassicAuthenticateSectorWithKeyB(handleArg, (sectorIndexArg == null) ? null : sectorIndexArg.longValue(), keyArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicIncrement", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number blockIndexArg = (Number) args.get(1); + if (blockIndexArg == null) { + throw new NullPointerException("blockIndexArg unexpectedly null."); + } + Number valueArg = (Number) args.get(2); + if (valueArg == null) { + throw new NullPointerException("valueArg unexpectedly null."); + } + api.mifareClassicIncrement(handleArg, (blockIndexArg == null) ? null : blockIndexArg.longValue(), (valueArg == null) ? null : valueArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicDecrement", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number blockIndexArg = (Number) args.get(1); + if (blockIndexArg == null) { + throw new NullPointerException("blockIndexArg unexpectedly null."); + } + Number valueArg = (Number) args.get(2); + if (valueArg == null) { + throw new NullPointerException("valueArg unexpectedly null."); + } + api.mifareClassicDecrement(handleArg, (blockIndexArg == null) ? null : blockIndexArg.longValue(), (valueArg == null) ? null : valueArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicReadBlock", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number blockIndexArg = (Number) args.get(1); + if (blockIndexArg == null) { + throw new NullPointerException("blockIndexArg unexpectedly null."); + } + byte[] output = api.mifareClassicReadBlock(handleArg, (blockIndexArg == null) ? null : blockIndexArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicWriteBlock", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number blockIndexArg = (Number) args.get(1); + if (blockIndexArg == null) { + throw new NullPointerException("blockIndexArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(2); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + api.mifareClassicWriteBlock(handleArg, (blockIndexArg == null) ? null : blockIndexArg.longValue(), dataArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicRestore", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number blockIndexArg = (Number) args.get(1); + if (blockIndexArg == null) { + throw new NullPointerException("blockIndexArg unexpectedly null."); + } + api.mifareClassicRestore(handleArg, (blockIndexArg == null) ? null : blockIndexArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicTransfer", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number blockIndexArg = (Number) args.get(1); + if (blockIndexArg == null) { + throw new NullPointerException("blockIndexArg unexpectedly null."); + } + api.mifareClassicTransfer(handleArg, (blockIndexArg == null) ? null : blockIndexArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareClassicTransceive", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + byte[] output = api.mifareClassicTransceive(handleArg, dataArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareUltralightGetMaxTransceiveLength", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.mifareUltralightGetMaxTransceiveLength(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareUltralightGetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Long output = api.mifareUltralightGetTimeout(handleArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareUltralightSetTimeout", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number timeoutArg = (Number) args.get(1); + if (timeoutArg == null) { + throw new NullPointerException("timeoutArg unexpectedly null."); + } + api.mifareUltralightSetTimeout(handleArg, (timeoutArg == null) ? null : timeoutArg.longValue()); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareUltralightReadPages", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number pageOffsetArg = (Number) args.get(1); + if (pageOffsetArg == null) { + throw new NullPointerException("pageOffsetArg unexpectedly null."); + } + byte[] output = api.mifareUltralightReadPages(handleArg, (pageOffsetArg == null) ? null : pageOffsetArg.longValue()); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareUltralightWritePage", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + Number pageOffsetArg = (Number) args.get(1); + if (pageOffsetArg == null) { + throw new NullPointerException("pageOffsetArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(2); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + api.mifareUltralightWritePage(handleArg, (pageOffsetArg == null) ? null : pageOffsetArg.longValue(), dataArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.mifareUltralightTransceive", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + byte[] dataArg = (byte[]) args.get(1); + if (dataArg == null) { + throw new NullPointerException("dataArg unexpectedly null."); + } + byte[] output = api.mifareUltralightTransceive(handleArg, dataArg); + wrapped.add(0, output); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.ndefFormatableFormat", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + PigeonNdefMessage firstMessageArg = (PigeonNdefMessage) args.get(1); + if (firstMessageArg == null) { + throw new NullPointerException("firstMessageArg unexpectedly null."); + } + api.ndefFormatableFormat(handleArg, firstMessageArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.ndefFormatableFormatReadOnly", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + PigeonNdefMessage firstMessageArg = (PigeonNdefMessage) args.get(1); + if (firstMessageArg == null) { + throw new NullPointerException("firstMessageArg unexpectedly null."); + } + api.ndefFormatableFormatReadOnly(handleArg, firstMessageArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.PigeonHostApi.disposeTag", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + try { + ArrayList args = (ArrayList) message; + assert args != null; + String handleArg = (String) args.get(0); + if (handleArg == null) { + throw new NullPointerException("handleArg unexpectedly null."); + } + api.disposeTag(handleArg); + wrapped.add(0, null); + } catch (Error | RuntimeException exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } +} diff --git a/android/src/main/kotlin/io/flutter/plugins/nfcmanager/NfcManagerPlugin.kt b/android/src/main/kotlin/io/flutter/plugins/nfcmanager/NfcManagerPlugin.kt deleted file mode 100644 index fea8aed..0000000 --- a/android/src/main/kotlin/io/flutter/plugins/nfcmanager/NfcManagerPlugin.kt +++ /dev/null @@ -1,348 +0,0 @@ -package io.flutter.plugins.nfcmanager - -import android.app.Activity -import android.nfc.NfcAdapter -import android.nfc.Tag -import android.nfc.tech.IsoDep -import android.nfc.tech.MifareClassic -import android.nfc.tech.MifareUltralight -import android.nfc.tech.Ndef -import android.nfc.tech.NdefFormatable -import android.nfc.tech.NfcA -import android.nfc.tech.NfcB -import android.nfc.tech.NfcF -import android.nfc.tech.NfcV -import android.nfc.tech.TagTechnology -import android.os.Build - -import io.flutter.embedding.engine.plugins.FlutterPlugin -import io.flutter.embedding.engine.plugins.activity.ActivityAware -import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding -import io.flutter.plugin.common.MethodCall -import io.flutter.plugin.common.MethodChannel -import io.flutter.plugin.common.MethodChannel.MethodCallHandler -import io.flutter.plugin.common.MethodChannel.Result -import java.io.IOException -import java.lang.Exception -import java.util.* - -class NfcManagerPlugin: FlutterPlugin, MethodCallHandler, ActivityAware { - private lateinit var channel : MethodChannel - private lateinit var activity: Activity - private lateinit var tags: MutableMap - private var adapter: NfcAdapter? = null - private var connectedTech: TagTechnology? = null - - override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) { - channel = MethodChannel(binding.binaryMessenger, "plugins.flutter.io/nfc_manager") - channel.setMethodCallHandler(this) - adapter = NfcAdapter.getDefaultAdapter(binding.applicationContext) - tags = mutableMapOf() - } - - override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) { - channel.setMethodCallHandler(null) - } - - override fun onAttachedToActivity(binding: ActivityPluginBinding) { - activity = binding.activity - } - - override fun onDetachedFromActivity() { - // no op - } - - override fun onReattachedToActivityForConfigChanges(binding: ActivityPluginBinding) { - activity = binding.activity - } - - override fun onDetachedFromActivityForConfigChanges() { - // no op - } - - override fun onMethodCall(call: MethodCall, result: Result) { - when (call.method) { - "Nfc#isAvailable" -> handleNfcIsAvailable(call, result) - "Nfc#startSession" -> handleNfcStartSession(call, result) - "Nfc#stopSession" -> handleNfcStopSession(call, result) - "Nfc#disposeTag" -> handleNfcDisposeTag(call, result) - "Ndef#read" -> handleNdefRead(call, result) - "Ndef#write" -> handleNdefWrite(call, result) - "Ndef#writeLock" -> handleNdefWriteLock(call, result) - "NfcA#transceive" -> handleNfcATransceive(call, result) - "NfcB#transceive" -> handleNfcBTransceive(call, result) - "NfcF#transceive" -> handleNfcFTransceive(call, result) - "NfcV#transceive" -> handleNfcVTransceive(call, result) - "IsoDep#transceive" -> handleIsoDepTransceive(call, result) - "MifareClassic#authenticateSectorWithKeyA" -> handleMifareClassicAuthenticateSectorWithKeyA(call, result) - "MifareClassic#authenticateSectorWithKeyB" -> handleMifareClassicAuthenticateSectorWithKeyB(call, result) - "MifareClassic#increment" -> handleMifareClassicIncrement(call, result) - "MifareClassic#decrement" -> handleMifareClassicDecrement(call, result) - "MifareClassic#readBlock" -> handleMifareClassicReadBlock(call, result) - "MifareClassic#writeBlock" -> handleMifareClassicWriteBlock(call, result) - "MifareClassic#restore" -> handleMifareClassicRestore(call, result) - "MifareClassic#transfer" -> handleMifareClassicTransfer(call, result) - "MifareClassic#transceive" -> handleMifareClassicTransceive(call, result) - "MifareUltralight#readPages" -> handleMifareUltralightReadPages(call, result) - "MifareUltralight#writePage" -> handleMifareUltralightWritePage(call, result) - "MifareUltralight#transceive" -> handleMifareUltralightTransceive(call, result) - "NdefFormatable#format" -> handleNdefFormatableFormat(call, result) - "NdefFormatable#formatReadOnly" -> handleNdefFormatableFormatReadOnly(call, result) - else -> result.notImplemented() - } - } - - private fun handleNfcIsAvailable(call: MethodCall, result: Result) { - result.success(adapter?.isEnabled == true) - } - - private fun handleNfcStartSession(call: MethodCall, result: Result) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - result.error("unavailable", "Requires API level 19.", null) - } else { - val adapter = adapter ?: run { - result.error("unavailable", "NFC is not available for device.", null) - return - } - adapter.enableReaderMode(activity, { - val handle = UUID.randomUUID().toString() - tags[handle] = it - activity.runOnUiThread { channel.invokeMethod("onDiscovered", getTagMap(it).toMutableMap().apply { put("handle", handle) }) } - }, getFlags(call.argument>("pollingOptions")!!), null) - result.success(null) - } - } - - private fun handleNfcStopSession(call: MethodCall, result: Result) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { - result.error("unavailable", "Requires API level 19.", null) - } else { - val adapter = adapter ?: run { - result.error("unavailable", "NFC is not available for device.", null) - return - } - adapter.disableReaderMode(activity) - result.success(null) - } - } - - private fun handleNfcDisposeTag(call: MethodCall, result: Result) { - val tag = tags.remove(call.argument("handle")!!) ?: run { - result.success(null) - return - } - - val tech = connectedTech ?: run { - result.success(null) - return - } - - if (tech.tag == tag && tech.isConnected) - try { tech.close() } catch (e: IOException) { /* no op */ } - - connectedTech = null - - result.success(null) - } - - private fun handleNdefRead(call: MethodCall, result: Result) { - tagHandler(call, result, { Ndef.get(it) }) { - val message = it.ndefMessage - result.success(if (message == null) null else getNdefMessageMap(message)) - } - } - - private fun handleNdefWrite(call: MethodCall, result: Result) { - tagHandler(call, result, { Ndef.get(it) }) { - val message = getNdefMessage(call.argument>("message")!!) - it.writeNdefMessage(message) - result.success(null) - } - } - - private fun handleNdefWriteLock(call: MethodCall, result: Result) { - tagHandler(call, result, { Ndef.get(it) }) { - it.makeReadOnly() - result.success(null) - } - } - - private fun handleNfcATransceive(call: MethodCall, result: Result) { - tagHandler(call, result, { NfcA.get(it) }) { - val data = call.argument("data")!! - result.success(it.transceive(data)) - } - } - - private fun handleNfcBTransceive(call: MethodCall, result: Result) { - tagHandler(call, result, { NfcB.get(it) }) { - val data = call.argument("data")!! - result.success(it.transceive(data)) - } - } - - private fun handleNfcFTransceive(call: MethodCall, result: Result) { - tagHandler(call, result, { NfcF.get(it) }) { - val data = call.argument("data")!! - result.success(it.transceive(data)) - } - } - - private fun handleNfcVTransceive(call: MethodCall, result: Result) { - tagHandler(call, result, { NfcV.get(it) }) { - val data = call.argument("data")!! - result.success(it.transceive(data)) - } - } - - private fun handleIsoDepTransceive(call: MethodCall, result: Result) { - tagHandler(call, result, { IsoDep.get(it) }) { - val data = call.argument("data")!! - result.success(it.transceive(data)) - } - } - - private fun handleMifareClassicAuthenticateSectorWithKeyA(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val sectorIndex = call.argument("sectorIndex")!! - val key = call.argument("key")!! - result.success(it.authenticateSectorWithKeyA(sectorIndex, key)) - } - } - - private fun handleMifareClassicAuthenticateSectorWithKeyB(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val sectorIndex = call.argument("sectorIndex")!! - val key = call.argument("key")!! - result.success(it.authenticateSectorWithKeyB(sectorIndex, key)) - } - } - - private fun handleMifareClassicIncrement(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val blockIndex = call.argument("blockIndex")!! - val value = call.argument("value")!! - it.increment(blockIndex, value) - result.success(null) - } - } - - private fun handleMifareClassicDecrement(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val blockIndex = call.argument("blockIndex")!! - val value = call.argument("value")!! - it.decrement(blockIndex, value) - result.success(null) - } - } - - private fun handleMifareClassicReadBlock(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val blockIndex = call.argument("blockIndex")!! - result.success(it.readBlock(blockIndex)) - } - } - - private fun handleMifareClassicWriteBlock(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val blockIndex = call.argument("blockIndex")!! - val data = call.argument("data")!! - it.writeBlock(blockIndex, data) - result.success(null) - } - } - - private fun handleMifareClassicRestore(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val blockIndex = call.argument("blockIndex")!! - it.restore(blockIndex) - result.success(null) - } - } - - private fun handleMifareClassicTransfer(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val blockIndex = call.argument("blockIndex")!! - it.transfer(blockIndex) - result.success(null) - } - } - - private fun handleMifareClassicTransceive(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareClassic.get(it) }) { - val data = call.argument("data")!! - result.success(it.transceive(data)) - } - } - - private fun handleMifareUltralightReadPages(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareUltralight.get(it) }) { - val pageOffset = call.argument("pageOffset")!! - result.success(it.readPages(pageOffset)) - } - } - - private fun handleMifareUltralightWritePage(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareUltralight.get(it) }) { - val pageOffset = call.argument("pageOffset")!! - val data = call.argument("data")!! - it.writePage(pageOffset, data) - result.success(null) - } - } - - private fun handleMifareUltralightTransceive(call: MethodCall, result: Result) { - tagHandler(call, result, { MifareUltralight.get(it) }) { - val data = call.argument("data")!! - result.success(it.transceive(data)) - } - } - - private fun handleNdefFormatableFormat(call: MethodCall, result: Result) { - tagHandler(call, result, { NdefFormatable.get(it) }) { - val firstMessage = getNdefMessage(call.argument>("firstMessage")!!) - it.format(firstMessage) - result.success(null) - } - } - - private fun handleNdefFormatableFormatReadOnly(call: MethodCall, result: Result) { - tagHandler(call, result, { NdefFormatable.get(it) }) { - val firstMessage = getNdefMessage(call.argument>("firstMessage")!!) - it.formatReadOnly(firstMessage) - result.success(null) - } - } - - private fun tagHandler(call: MethodCall, result: Result, getMethod: (Tag) -> T?, callback: (T) -> Unit) { - val tag = tags[call.argument("handle")!!] ?: run { - result.error("invalid_parameter", "Tag is not found", null) - return - } - - val tech = getMethod(tag) ?: run { - result.error("invalid_parameter", "Tech is not supported" , null) - return - } - - try { - forceConnect(tech) - callback(tech) - } catch (e: Exception) { - result.error("io_exception", e.localizedMessage, null) - } - } - - @Throws(IOException::class) - private fun forceConnect(tech: TagTechnology) { - connectedTech?.let { - if (it.tag == tech.tag && it::class.java.name == tech::class.java.name) return - try { tech.close() } catch (e: IOException) { /* no op */ } - tech.connect() - connectedTech = tech - } ?: run { - tech.connect() - connectedTech = tech - } - } -} diff --git a/android/src/main/kotlin/io/flutter/plugins/nfcmanager/Translator.kt b/android/src/main/kotlin/io/flutter/plugins/nfcmanager/Translator.kt deleted file mode 100644 index ec27a26..0000000 --- a/android/src/main/kotlin/io/flutter/plugins/nfcmanager/Translator.kt +++ /dev/null @@ -1,150 +0,0 @@ -package io.flutter.plugins.nfcmanager - -import android.nfc.NdefMessage -import android.nfc.NdefRecord -import android.nfc.NfcAdapter -import android.nfc.Tag -import android.nfc.tech.IsoDep -import android.nfc.tech.MifareClassic -import android.nfc.tech.MifareUltralight -import android.nfc.tech.Ndef -import android.nfc.tech.NfcA -import android.nfc.tech.NfcB -import android.nfc.tech.NfcF -import android.nfc.tech.NfcV -import android.os.Build -import androidx.annotation.RequiresApi -import java.util.* - -@RequiresApi(Build.VERSION_CODES.KITKAT) -fun getFlags(options: List = listOf()): Int { - var flags = 0 - - if (options.contains("iso14443")) { - flags = flags or NfcAdapter.FLAG_READER_NFC_A or NfcAdapter.FLAG_READER_NFC_B - } - - if (options.contains("iso15693")) { - flags = flags or NfcAdapter.FLAG_READER_NFC_V - } - - if (options.contains("iso18092")) { - flags = flags or NfcAdapter.FLAG_READER_NFC_F - } - - return flags -} - -fun getTagMap(arg: Tag): Map { - val data = mutableMapOf() - - arg.techList.forEach { tech -> - // normalize tech string (e.g. "android.nfc.tech.NfcA" => "nfca" - data[tech.toLowerCase(Locale.ROOT).split(".").last()] = when (tech) { - NfcA::class.java.name -> NfcA.get(arg).let { - mapOf( - "identifier" to arg.id, - "atqa" to it.atqa, - "maxTransceiveLength" to it.maxTransceiveLength, - "sak" to it.sak, - "timeout" to it.timeout - ) - } - NfcB::class.java.name -> NfcB.get(arg).let { - mapOf( - "identifier" to arg.id, - "applicationData" to it.applicationData, - "maxTransceiveLength" to it.maxTransceiveLength, - "protocolInfo" to it.protocolInfo - ) - } - NfcF::class.java.name -> NfcF.get(arg).let { - mapOf( - "identifier" to arg.id, - "manufacturer" to it.manufacturer, - "maxTransceiveLength" to it.maxTransceiveLength, - "systemCode" to it.systemCode, - "timeout" to it.timeout - ) - } - NfcV::class.java.name -> NfcV.get(arg).let { - mapOf( - "identifier" to arg.id, - "dsfId" to it.dsfId, - "responseFlags" to it.responseFlags, - "maxTransceiveLength" to it.maxTransceiveLength - ) - } - IsoDep::class.java.name -> IsoDep.get(arg).let { - mapOf( - "identifier" to arg.id, - "hiLayerResponse" to it.hiLayerResponse, - "historicalBytes" to it.historicalBytes, - "isExtendedLengthApduSupported" to it.isExtendedLengthApduSupported, - "maxTransceiveLength" to it.maxTransceiveLength, - "timeout" to it.timeout - ) - } - MifareClassic::class.java.name -> MifareClassic.get(arg).let { - mapOf( - "identifier" to arg.id, - "blockCount" to it.blockCount, - "maxTransceiveLength" to it.maxTransceiveLength, - "sectorCount" to it.sectorCount, - "size" to it.size, - "timeout" to it.timeout, - "type" to it.type - ) - } - MifareUltralight::class.java.name -> MifareUltralight.get(arg).let { - mapOf( - "identifier" to arg.id, - "maxTransceiveLength" to it.maxTransceiveLength, - "timeout" to it.timeout, - "type" to it.type - ) - } - Ndef::class.java.name -> Ndef.get(arg).let { - mapOf( - "identifier" to arg.id, - "isWritable" to it.isWritable, - "maxSize" to it.maxSize, - "canMakeReadOnly" to it.canMakeReadOnly(), - "cachedMessage" to if (it.cachedNdefMessage == null) null else getNdefMessageMap(it.cachedNdefMessage), - "type" to it.type - ) - } - // NdefFormatable or NfcBarcode - else -> mapOf( - "identifier" to arg.id - ) - } - } - - return data -} - -fun getNdefMessage(arg: Map): NdefMessage { - val records = (arg["records"] as List<*>).filterIsInstance>() - return NdefMessage(records.map { - NdefRecord( - (it["typeNameFormat"] as Int).toShort(), - it["type"] as ByteArray, - it["identifier"] as? ByteArray, - it["payload"] as ByteArray - ) - }.toTypedArray()) -} - -fun getNdefMessageMap(arg: NdefMessage): Map { - return mapOf( - "records" to arg.records.map { - mapOf( - "typeNameFormat" to it.tnf, - "type" to it.type, - "identifier" to it.id, - "payload" to it.payload - ) - }.toList() - ) -} diff --git a/example/README.md b/example/README.md deleted file mode 100644 index d3cf72b..0000000 --- a/example/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# nfc_manager_example - -Demonstrates how to use the nfc_manager plugin. diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index e689118..9ce6382 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -44,9 +44,9 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "io.flutter.plugins.nfcmanagerexample" + applicationId "dev.flutter.plugins.nfcmanagerexample" // You can update the following values to match your application needs. - // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion flutter.minSdkVersion targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index c45f5dc..fac50c7 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="dev.flutter.plugins.nfcmanagerexample">