objc2_core_nfc/generated/mod.rs
1// This file has been automatically generated by `objc2`'s `header-translator`.
2// DO NOT EDIT
3
4#![allow(unused_imports)]
5#![allow(deprecated)]
6#![allow(non_snake_case)]
7#![allow(non_camel_case_types)]
8#![allow(non_upper_case_globals)]
9#![allow(missing_docs)]
10#![allow(clippy::too_many_arguments)]
11#![allow(clippy::type_complexity)]
12#![allow(clippy::upper_case_acronyms)]
13#![allow(clippy::identity_op)]
14#![allow(clippy::missing_safety_doc)]
15#![allow(clippy::doc_lazy_continuation)]
16#![allow(rustdoc::broken_intra_doc_links)]
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::invalid_html_tags)]
19
20#[link(name = "CoreNFC", kind = "framework")]
21extern "C" {}
22
23use core::ffi::*;
24use core::ptr::NonNull;
25#[cfg(feature = "dispatch2")]
26use dispatch2::*;
27use objc2::__framework_prelude::*;
28use objc2_foundation::*;
29
30use crate::*;
31
32extern "C" {
33 /// [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcerrordomain?language=objc)
34 pub static NFCErrorDomain: &'static NSErrorDomain;
35}
36
37/// Possible errors returned by CoreNFC framework reader session.
38///
39/// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcreadererror?language=objc)
40// NS_ERROR_ENUM
41#[repr(transparent)]
42#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
43pub struct NFCReaderError(pub NSInteger);
44impl NFCReaderError {
45 #[doc(alias = "NFCReaderErrorUnsupportedFeature")]
46 pub const ReaderErrorUnsupportedFeature: Self = Self(1);
47 #[doc(alias = "NFCReaderErrorSecurityViolation")]
48 pub const ReaderErrorSecurityViolation: Self = Self(2);
49 #[doc(alias = "NFCReaderErrorInvalidParameter")]
50 pub const ReaderErrorInvalidParameter: Self = Self(3);
51 #[doc(alias = "NFCReaderErrorInvalidParameterLength")]
52 pub const ReaderErrorInvalidParameterLength: Self = Self(4);
53 #[doc(alias = "NFCReaderErrorParameterOutOfBound")]
54 pub const ReaderErrorParameterOutOfBound: Self = Self(5);
55 #[doc(alias = "NFCReaderErrorRadioDisabled")]
56 pub const ReaderErrorRadioDisabled: Self = Self(6);
57 #[doc(alias = "NFCReaderErrorIneligible")]
58 pub const ReaderErrorIneligible: Self = Self(7);
59 #[doc(alias = "NFCReaderErrorAccessNotAccepted")]
60 pub const ReaderErrorAccessNotAccepted: Self = Self(8);
61 #[doc(alias = "NFCReaderTransceiveErrorTagConnectionLost")]
62 pub const ReaderTransceiveErrorTagConnectionLost: Self = Self(100);
63 #[doc(alias = "NFCReaderTransceiveErrorRetryExceeded")]
64 pub const ReaderTransceiveErrorRetryExceeded: Self = Self(101);
65 #[doc(alias = "NFCReaderTransceiveErrorTagResponseError")]
66 pub const ReaderTransceiveErrorTagResponseError: Self = Self(102);
67 #[doc(alias = "NFCReaderTransceiveErrorSessionInvalidated")]
68 pub const ReaderTransceiveErrorSessionInvalidated: Self = Self(103);
69 #[doc(alias = "NFCReaderTransceiveErrorTagNotConnected")]
70 pub const ReaderTransceiveErrorTagNotConnected: Self = Self(104);
71 #[doc(alias = "NFCReaderTransceiveErrorPacketTooLong")]
72 pub const ReaderTransceiveErrorPacketTooLong: Self = Self(105);
73 #[doc(alias = "NFCReaderSessionInvalidationErrorUserCanceled")]
74 pub const ReaderSessionInvalidationErrorUserCanceled: Self = Self(200);
75 #[doc(alias = "NFCReaderSessionInvalidationErrorSessionTimeout")]
76 pub const ReaderSessionInvalidationErrorSessionTimeout: Self = Self(201);
77 #[doc(alias = "NFCReaderSessionInvalidationErrorSessionTerminatedUnexpectedly")]
78 pub const ReaderSessionInvalidationErrorSessionTerminatedUnexpectedly: Self = Self(202);
79 #[doc(alias = "NFCReaderSessionInvalidationErrorSystemIsBusy")]
80 pub const ReaderSessionInvalidationErrorSystemIsBusy: Self = Self(203);
81 #[doc(alias = "NFCReaderSessionInvalidationErrorFirstNDEFTagRead")]
82 pub const ReaderSessionInvalidationErrorFirstNDEFTagRead: Self = Self(204);
83 #[doc(alias = "NFCTagCommandConfigurationErrorInvalidParameters")]
84 pub const TagCommandConfigurationErrorInvalidParameters: Self = Self(300);
85 #[doc(alias = "NFCNdefReaderSessionErrorTagNotWritable")]
86 pub const NdefReaderSessionErrorTagNotWritable: Self = Self(400);
87 #[doc(alias = "NFCNdefReaderSessionErrorTagUpdateFailure")]
88 pub const NdefReaderSessionErrorTagUpdateFailure: Self = Self(401);
89 #[doc(alias = "NFCNdefReaderSessionErrorTagSizeTooSmall")]
90 pub const NdefReaderSessionErrorTagSizeTooSmall: Self = Self(402);
91 #[doc(alias = "NFCNdefReaderSessionErrorZeroLengthMessage")]
92 pub const NdefReaderSessionErrorZeroLengthMessage: Self = Self(403);
93}
94
95unsafe impl Encode for NFCReaderError {
96 const ENCODING: Encoding = NSInteger::ENCODING;
97}
98
99unsafe impl RefEncode for NFCReaderError {
100 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
101}
102
103extern "C" {
104 /// Key in NSError userInfo dictionary. The corresponding value is the NSUInteger error code from tag's response.
105 /// Refer to ISO15693 specification for the error code values.
106 ///
107 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso15693tagresponseerrorkey?language=objc)
108 pub static NFCISO15693TagResponseErrorKey: &'static NSString;
109}
110
111extern "C" {
112 /// Key in NSError userInfo dictionary. Presence of this key indicates the received response packet length is invalid.
113 ///
114 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfctagresponseunexpectedlengtherrorkey?language=objc)
115 pub static NFCTagResponseUnexpectedLengthErrorKey: &'static NSString;
116}
117
118extern_protocol!(
119 /// General reader session functions
120 ///
121 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcreadersessionprotocol?language=objc)
122 #[doc(alias = "NFCReaderSession")]
123 #[name = "NFCReaderSession"]
124 pub unsafe trait NFCReaderSessionProtocol: NSObjectProtocol {
125 /// Returns: <i>
126 /// YES
127 /// </i>
128 /// if the reader session is started and ready to use.
129 ///
130 ///
131 /// The RF discovery polling begins immediately when a reader session is activated successfully.
132 /// The
133 ///
134 /// ```text
135 /// readerSession:didDetectTags: @link/ will be called when a tag is detected.
136 ///
137 ///
138 /// ```
139 #[unsafe(method(isReady))]
140 #[unsafe(method_family = none)]
141 unsafe fn isReady(&self) -> bool;
142
143 /// Descriptive text message that is displayed on the alert action sheet once tag scanning has started. The string can be update
144 /// dynamically in any thread context as long as the session is valid. This should be set prior to calling
145 ///
146 /// ```text
147 /// beginSession @link/ to display
148 /// the correct message. Use this string to provide additional context about the NFC reader mode operation.
149 ///
150 ///
151 /// ```
152 #[unsafe(method(alertMessage))]
153 #[unsafe(method_family = none)]
154 unsafe fn alertMessage(&self) -> Retained<NSString>;
155
156 /// Setter for [`alertMessage`][Self::alertMessage].
157 ///
158 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
159 #[unsafe(method(setAlertMessage:))]
160 #[unsafe(method_family = none)]
161 unsafe fn setAlertMessage(&self, alert_message: &NSString);
162
163 /// Starts the session. The
164 ///
165 /// ```text
166 /// [NFCReaderSessionDelegate readerSessionDidBecomeActive:] @link/ will be called when the reader session
167 /// is activated successfully. @link [NFCReaderSessionDelegate readerSession:didDetectTags:] @link/ will return tag objects that are
168 /// conformed to the @link NFCTag @link/ protocol. @link [NFCReaderSessionDelegate readerSession:didInvalidateWithError:] will return
169 /// errors related to the session start.
170 ///
171 ///
172 /// ```
173 #[unsafe(method(beginSession))]
174 #[unsafe(method_family = none)]
175 unsafe fn beginSession(&self);
176
177 /// Closes the reader session. The session cannot be re-used.
178 #[unsafe(method(invalidateSession))]
179 #[unsafe(method_family = none)]
180 unsafe fn invalidateSession(&self);
181
182 /// Closes the reader session. The session cannot be re-used. The specified error message and an error symbol will be displayed momentarily
183 /// on the action sheet before it is automatically dismissed.
184 #[unsafe(method(invalidateSessionWithErrorMessage:))]
185 #[unsafe(method_family = none)]
186 unsafe fn invalidateSessionWithErrorMessage(&self, error_message: &NSString);
187 }
188);
189
190extern_protocol!(
191 /// General reader session callbacks
192 ///
193 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcreadersessiondelegate?language=objc)
194 pub unsafe trait NFCReaderSessionDelegate: NSObjectProtocol {
195 /// Parameter `session`: The session object in the active state.
196 ///
197 ///
198 /// Gets called when the NFC reader session has become active. RF is enabled and reader is scanning for tags.
199 /// The
200 ///
201 /// ```text
202 /// readerSession:didDetectTags: @link/ will be called when a tag is detected.
203 ///
204 ///
205 /// ```
206 #[unsafe(method(readerSessionDidBecomeActive:))]
207 #[unsafe(method_family = none)]
208 unsafe fn readerSessionDidBecomeActive(&self, session: &NFCReaderSession);
209
210 /// Parameter `session`: The session object that is invalidated.
211 ///
212 /// Parameter `error`: The error indicates the invalidation reason.
213 ///
214 ///
215 /// Gets called when a session becomes invalid. At this point the client is expected to discard
216 /// the returned session object.
217 #[unsafe(method(readerSession:didInvalidateWithError:))]
218 #[unsafe(method_family = none)]
219 unsafe fn readerSession_didInvalidateWithError(
220 &self,
221 session: &NFCReaderSession,
222 error: &NSError,
223 );
224
225 /// Parameter `session`: The session object used for tag detection.
226 ///
227 /// Parameter `tags`: Array of
228 ///
229 /// ```text
230 /// NFCTag @link/ objects.
231 ///
232 /// @discussion Gets called when the reader detects NFC tag(s) in the polling sequence.
233 ///
234 ///
235 /// ```
236 #[optional]
237 #[unsafe(method(readerSession:didDetectTags:))]
238 #[unsafe(method_family = none)]
239 unsafe fn readerSession_didDetectTags(
240 &self,
241 session: &NFCReaderSession,
242 tags: &NSArray<ProtocolObject<dyn NFCTag>>,
243 );
244 }
245);
246
247extern_class!(
248 /// This represents a NFC reader session for processing tags; this base class cannot be instantiate. Only one NFCReaderSession
249 /// can be active at any time in the system. Subsequent opened sessions will get queued up and processed by the system in FIFO order.
250 ///
251 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcreadersession?language=objc)
252 #[unsafe(super(NSObject))]
253 #[derive(Debug, PartialEq, Eq, Hash)]
254 pub struct NFCReaderSession;
255);
256
257extern_conformance!(
258 unsafe impl NFCReaderSessionProtocol for NFCReaderSession {}
259);
260
261extern_conformance!(
262 unsafe impl NSObjectProtocol for NFCReaderSession {}
263);
264
265impl NFCReaderSession {
266 extern_methods!(
267 #[unsafe(method(delegate))]
268 #[unsafe(method_family = none)]
269 pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
270
271 /// YES if device supports NFC tag reading.
272 #[unsafe(method(readingAvailable))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn readingAvailable() -> bool;
275
276 #[cfg(feature = "dispatch2")]
277 /// The NFCReaderSessionDelegate delegate callbacks and the completion block handlers for tag operation will be dispatched on this queue.
278 #[unsafe(method(sessionQueue))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn sessionQueue(&self) -> Retained<DispatchQueue>;
281
282 #[unsafe(method(init))]
283 #[unsafe(method_family = init)]
284 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
285 );
286}
287
288/// Methods declared on superclass `NSObject`.
289impl NFCReaderSession {
290 extern_methods!(
291 #[unsafe(method(new))]
292 #[unsafe(method_family = new)]
293 pub unsafe fn new() -> Retained<Self>;
294 );
295}
296
297/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfctagtype?language=objc)
298// NS_ENUM
299#[repr(transparent)]
300#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
301pub struct NFCTagType(pub NSUInteger);
302impl NFCTagType {
303 #[doc(alias = "NFCTagTypeISO15693")]
304 pub const ISO15693: Self = Self(1);
305 #[doc(alias = "NFCTagTypeFeliCa")]
306 pub const FeliCa: Self = Self(2);
307 #[doc(alias = "NFCTagTypeISO7816Compatible")]
308 pub const ISO7816Compatible: Self = Self(3);
309 #[doc(alias = "NFCTagTypeMiFare")]
310 pub const MiFare: Self = Self(4);
311}
312
313unsafe impl Encode for NFCTagType {
314 const ENCODING: Encoding = NSUInteger::ENCODING;
315}
316
317unsafe impl RefEncode for NFCTagType {
318 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
319}
320
321extern_protocol!(
322 /// A NFC / RFID tag object conforms to this protocol. The NFCReaderSession returns an instance of this type when a tag is detected.
323 ///
324 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfctag?language=objc)
325 pub unsafe trait NFCTag: NSObjectProtocol + NSSecureCoding + NSCopying {
326 /// See
327 ///
328 /// ```text
329 /// CNFCTagType @link/
330 ///
331 ///
332 /// ```
333 #[unsafe(method(type))]
334 #[unsafe(method_family = none)]
335 unsafe fn r#type(&self) -> NFCTagType;
336
337 /// Session that provides this tag.
338 #[unsafe(method(session))]
339 #[unsafe(method_family = none)]
340 unsafe fn session(&self) -> Option<Retained<ProtocolObject<dyn NFCReaderSessionProtocol>>>;
341
342 /// Returns: <i>
343 /// YES
344 /// </i>
345 /// if tag is available in the current reader session. A tag remove from the RF field will become
346 /// unavailable. Tag in disconnected state will return NO.
347 ///
348 ///
349 /// Check whether a detected tag is available.
350 #[unsafe(method(isAvailable))]
351 #[unsafe(method_family = none)]
352 unsafe fn isAvailable(&self) -> bool;
353
354 /// Returns: Returns self if it conforms to the NFCISO15693Tag protocol; else returns nil.
355 #[unsafe(method(asNFCISO15693Tag))]
356 #[unsafe(method_family = none)]
357 unsafe fn asNFCISO15693Tag(&self) -> Option<Retained<ProtocolObject<dyn NFCISO15693Tag>>>;
358
359 /// Returns: Returns self if it conforms to the NFCISO7816Tag protocol; else returns nil.
360 #[unsafe(method(asNFCISO7816Tag))]
361 #[unsafe(method_family = none)]
362 unsafe fn asNFCISO7816Tag(&self) -> Option<Retained<ProtocolObject<dyn NFCISO7816Tag>>>;
363
364 /// Returns nil if tag does not conform to NFCFeliCaTag.
365 #[unsafe(method(asNFCFeliCaTag))]
366 #[unsafe(method_family = none)]
367 unsafe fn asNFCFeliCaTag(&self) -> Option<Retained<ProtocolObject<dyn NFCFeliCaTag>>>;
368
369 /// Returns nil if tag does not conform to NFCMiFareTag.
370 #[unsafe(method(asNFCMiFareTag))]
371 #[unsafe(method_family = none)]
372 unsafe fn asNFCMiFareTag(&self) -> Option<Retained<ProtocolObject<dyn NFCMiFareTag>>>;
373 }
374);
375
376extern_class!(
377 /// Define configuration parameters for tag commands.
378 ///
379 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfctagcommandconfiguration?language=objc)
380 #[unsafe(super(NSObject))]
381 #[derive(Debug, PartialEq, Eq, Hash)]
382 pub struct NFCTagCommandConfiguration;
383);
384
385extern_conformance!(
386 unsafe impl NSCopying for NFCTagCommandConfiguration {}
387);
388
389unsafe impl CopyingHelper for NFCTagCommandConfiguration {
390 type Result = Self;
391}
392
393extern_conformance!(
394 unsafe impl NSObjectProtocol for NFCTagCommandConfiguration {}
395);
396
397impl NFCTagCommandConfiguration {
398 extern_methods!(
399 /// Maximum number of retries. Valid value is 0 to 256. Default is 0.
400 #[unsafe(method(maximumRetries))]
401 #[unsafe(method_family = none)]
402 pub unsafe fn maximumRetries(&self) -> NSUInteger;
403
404 /// Setter for [`maximumRetries`][Self::maximumRetries].
405 #[unsafe(method(setMaximumRetries:))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn setMaximumRetries(&self, maximum_retries: NSUInteger);
408
409 /// Delay in seconds before retry occurs. Default is 0.
410 #[unsafe(method(retryInterval))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn retryInterval(&self) -> NSTimeInterval;
413
414 /// Setter for [`retryInterval`][Self::retryInterval].
415 #[unsafe(method(setRetryInterval:))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn setRetryInterval(&self, retry_interval: NSTimeInterval);
418 );
419}
420
421/// Methods declared on superclass `NSObject`.
422impl NFCTagCommandConfiguration {
423 extern_methods!(
424 #[unsafe(method(init))]
425 #[unsafe(method_family = init)]
426 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
427
428 #[unsafe(method(new))]
429 #[unsafe(method_family = new)]
430 pub unsafe fn new() -> Retained<Self>;
431 );
432}
433
434extern_protocol!(
435 /// Tag reader session delegate
436 ///
437 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfctagreadersessiondelegate?language=objc)
438 pub unsafe trait NFCTagReaderSessionDelegate: NSObjectProtocol {
439 /// Parameter `session`: The session object that is invalidated.
440 ///
441 /// Parameter `error`: The error indicates the invalidation reason.
442 ///
443 ///
444 /// Gets called when a session becomes invalid. At this point the client is expected to discard
445 /// the returned session object.
446 #[unsafe(method(tagReaderSession:didInvalidateWithError:))]
447 #[unsafe(method_family = none)]
448 unsafe fn tagReaderSession_didInvalidateWithError(
449 &self,
450 session: &NFCTagReaderSession,
451 error: &NSError,
452 );
453
454 /// Parameter `session`: The session object in the active state.
455 ///
456 ///
457 /// Gets called when the NFC reader session has become active. RF is enabled and reader is scanning for tags.
458 /// The
459 ///
460 /// ```text
461 /// readerSession:didDetectTags: @link/ will be called when a tag is detected.
462 ///
463 ///
464 /// ```
465 #[optional]
466 #[unsafe(method(tagReaderSessionDidBecomeActive:))]
467 #[unsafe(method_family = none)]
468 unsafe fn tagReaderSessionDidBecomeActive(&self, session: &NFCTagReaderSession);
469
470 /// Parameter `session`: The session object used for tag detection.
471 ///
472 /// Parameter `tags`: Array of
473 ///
474 /// ```text
475 /// NFCTag @link/ objects.
476 ///
477 /// @discussion Gets called when the reader detects NFC tag(s) in the polling sequence.
478 ///
479 ///
480 /// ```
481 #[optional]
482 #[unsafe(method(tagReaderSession:didDetectTags:))]
483 #[unsafe(method_family = none)]
484 unsafe fn tagReaderSession_didDetectTags(
485 &self,
486 session: &NFCTagReaderSession,
487 tags: &NSArray<ProtocolObject<dyn NFCTag>>,
488 );
489 }
490);
491
492/// This is an exclusive value that cannot be combine with other NFCPollingOption values; this will override all other combinations.
493///
494/// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcpollingoption?language=objc)
495// NS_OPTIONS
496#[repr(transparent)]
497#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
498pub struct NFCPollingOption(pub NSInteger);
499bitflags::bitflags! {
500 impl NFCPollingOption: NSInteger {
501 #[doc(alias = "NFCPollingISO14443")]
502 const ISO14443 = 0x1;
503 #[doc(alias = "NFCPollingISO15693")]
504 const ISO15693 = 0x2;
505 #[doc(alias = "NFCPollingISO18092")]
506 const ISO18092 = 0x4;
507 #[doc(alias = "NFCPollingPACE")]
508 const PACE = 0x8;
509 }
510}
511
512unsafe impl Encode for NFCPollingOption {
513 const ENCODING: Encoding = NSInteger::ENCODING;
514}
515
516unsafe impl RefEncode for NFCPollingOption {
517 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
518}
519
520extern_class!(
521 /// Reader session for processing NFC tags supporting one of the
522 ///
523 /// ```text
524 /// NFCTagType @link/ types. @link [NFCTagReaderSessionDelegate readerSession:didDetectTags:] @link/
525 /// will return tag objects matching the requested type for the session. This session requires the "com.apple.developer.nfc.readersession.formats" entitlement
526 /// in your process. In addition your application's Info.plist must contain a non-empty usage description string. @link NFCReaderErrorSecurityViolation @link/ will be
527 /// returned from @link [NFCTagReaderSessionDelegate tagReaderSession:didInvalidateWithError:] @link/ if the required entitlement is missing when session is started.
528 ///
529 /// NOTE:
530 /// - Only one NFCReaderSession can be active at any time in the system. Subsequent opened sessions will get queued up and processed by the system in FIFO order.
531 /// - If the session is configured with @link NFCPollingISO14443 @link/ and an ISO7816 compliant MiFare tag that contains one of the applications listed in the
532 /// "com.apple.developer.nfc.readersession.iso7816.select-identifiers" array in Info.plist is found, then @link [NFCTagReaderSessionDelegate readerSession:didDetectTags:] @link/
533 /// will return a tag instance conform to the @link NFCISO7816Tag @link/ protocol.
534 /// - Use of @link NFCPollingPACE @link/ requires "PACE" to be added into the "com.apple.developer.nfc.readersession.formats" entitlement.
535 ///
536 ///
537 /// ```
538 ///
539 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfctagreadersession?language=objc)
540 #[unsafe(super(NFCReaderSession, NSObject))]
541 #[derive(Debug, PartialEq, Eq, Hash)]
542 pub struct NFCTagReaderSession;
543);
544
545extern_conformance!(
546 unsafe impl NFCReaderSessionProtocol for NFCTagReaderSession {}
547);
548
549extern_conformance!(
550 unsafe impl NSObjectProtocol for NFCTagReaderSession {}
551);
552
553impl NFCTagReaderSession {
554 extern_methods!(
555 #[unsafe(method(connectedTag))]
556 #[unsafe(method_family = none)]
557 pub unsafe fn connectedTag(&self) -> Option<Retained<ProtocolObject<dyn NFCTag>>>;
558
559 #[unsafe(method(init))]
560 #[unsafe(method_family = init)]
561 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
562
563 #[cfg(feature = "dispatch2")]
564 /// Parameter `pollingOption`: Configures the RF polling of the reader session; multiple options can be OR'ed together. This option affects the possible NFC tag type discover.
565 ///
566 /// Parameter `delegate`: The session will hold a weak ARC reference to this
567 ///
568 /// ```text
569 /// NFCTagReaderSessionDelegate @link/ object.
570 /// @param queue A dispatch queue where NFCTagReaderSessionDelegate delegate callbacks will be dispatched to. A <i>nil</i> value will
571 /// cause the creation of a serial dispatch queue internally for the session. The session object will retain the provided dispatch queue.
572 ///
573 /// @return A new NFCTagReaderSession instance.
574 ///
575 ///
576 /// ```
577 ///
578 /// # Safety
579 ///
580 /// `queue` possibly has additional threading requirements.
581 #[unsafe(method(initWithPollingOption:delegate:queue:))]
582 #[unsafe(method_family = init)]
583 pub unsafe fn initWithPollingOption_delegate_queue(
584 this: Allocated<Self>,
585 polling_option: NFCPollingOption,
586 delegate: &ProtocolObject<dyn NFCTagReaderSessionDelegate>,
587 queue: Option<&DispatchQueue>,
588 ) -> Retained<Self>;
589
590 /// Restart the polling sequence in this session to discover new tags. New tags discovered from polling will return in the subsequent
591 ///
592 /// ```text
593 /// [NFCTagReaderSessionDelegate tagReaderSession:didDetectTags:]
594 /// @link/ call. Tags that are returned previously by @link [NFCTagReaderSessionDelegate tagReaderSession:didDetectTags:] @link/ will become invalid,
595 /// and all references to these tags shall be removed to properly release the resources. Calling this method on an invalidated session
596 /// will have no effect; a new reader session is required to restart the reader.
597 ///
598 ///
599 /// ```
600 #[unsafe(method(restartPolling))]
601 #[unsafe(method_family = none)]
602 pub unsafe fn restartPolling(&self);
603
604 #[cfg(feature = "block2")]
605 /// Parameter `tag`: A NFCTag protocol compliant tag object that will be connected to.
606 ///
607 ///
608 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
609 /// A
610 ///
611 /// ```text
612 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
613 ///
614 /// @discussion This method establishes a tag connection and activates the tag. Connecting to the same tag that is currently opened has no effect.
615 /// Connecting to a different tag will automatically terminate the previous tag connection and put it into the halt state. Tag stays in the
616 /// connected state until another tag is connected or the polling is restarted.
617 ///
618 ///
619 /// ```
620 #[unsafe(method(connectToTag:completionHandler:))]
621 #[unsafe(method_family = none)]
622 pub unsafe fn connectToTag_completionHandler(
623 &self,
624 tag: &ProtocolObject<dyn NFCTag>,
625 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
626 );
627 );
628}
629
630/// Methods declared on superclass `NSObject`.
631impl NFCTagReaderSession {
632 extern_methods!(
633 #[unsafe(method(new))]
634 #[unsafe(method_family = new)]
635 pub unsafe fn new() -> Retained<Self>;
636 );
637}
638
639extern_protocol!(
640 /// NDEF reader session callbacks. Presence of the -readerSession:didDetectTags: optional method will change the session behavior
641 /// into a read-write session where
642 ///
643 /// ```text
644 /// NFCNDEFTag @link/ objects are returned.
645 ///
646 /// @note A read-write session does not trigger the -readerSession:didDetectNDEFs: method.
647 /// @note A read-write session does not get invalidate automatically after a successful tag detection. Invalidation occurs when
648 /// the invalidation method is called explicitly or the 60 seconds session time limit is reached.
649 ///
650 ///
651 /// ```
652 ///
653 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcndefreadersessiondelegate?language=objc)
654 pub unsafe trait NFCNDEFReaderSessionDelegate: NSObjectProtocol {
655 /// Parameter `session`: The session object that is invalidated.
656 ///
657 /// Parameter `error`: The error indicates the invalidation reason.
658 ///
659 ///
660 /// Gets called when a session becomes invalid. At this point the client is expected to discard
661 /// the returned session object.
662 #[unsafe(method(readerSession:didInvalidateWithError:))]
663 #[unsafe(method_family = none)]
664 unsafe fn readerSession_didInvalidateWithError(
665 &self,
666 session: &NFCNDEFReaderSession,
667 error: &NSError,
668 );
669
670 /// Parameter `session`: The session object used for tag detection.
671 ///
672 /// Parameter `messages`: Array of
673 ///
674 /// ```text
675 /// NFCNDEFMessage @link/ objects.
676 ///
677 /// @discussion Gets called when the reader detects NFC tag(s) with NDEF messages in the polling sequence. Polling
678 /// is automatically restarted once the detected tag is removed from the reader's read range. This method
679 /// is only get call if the optional -readerSession:didDetectTags: method is not
680 /// implemented.
681 ///
682 ///
683 /// ```
684 #[unsafe(method(readerSession:didDetectNDEFs:))]
685 #[unsafe(method_family = none)]
686 unsafe fn readerSession_didDetectNDEFs(
687 &self,
688 session: &NFCNDEFReaderSession,
689 messages: &NSArray<NFCNDEFMessage>,
690 );
691
692 /// Parameter `session`: The session object used for NDEF tag detection.
693 ///
694 /// Parameter `tags`: Array of
695 ///
696 /// ```text
697 /// NFCNDEFTag @link/ objects.
698 ///
699 /// @discussion Gets called when the reader detects NDEF tag(s) in the RF field. Presence of this method overrides -readerSession:didDetectNDEFs: and enables
700 /// read-write capability for the session.
701 ///
702 ///
703 /// ```
704 #[optional]
705 #[unsafe(method(readerSession:didDetectTags:))]
706 #[unsafe(method_family = none)]
707 unsafe fn readerSession_didDetectTags(
708 &self,
709 session: &NFCNDEFReaderSession,
710 tags: &NSArray<ProtocolObject<dyn NFCNDEFTag>>,
711 );
712
713 /// Parameter `session`: The session object in the active state.
714 ///
715 ///
716 /// Gets called when the NFC reader session has become active. RF is enabled and reader is scanning for tags.
717 #[optional]
718 #[unsafe(method(readerSessionDidBecomeActive:))]
719 #[unsafe(method_family = none)]
720 unsafe fn readerSessionDidBecomeActive(&self, session: &NFCNDEFReaderSession);
721 }
722);
723
724extern_class!(
725 /// NFC reader session for processing NFC Data Exchange Format (NDEF) tags. This session requires the "com.apple.developer.nfc.readersession.formats"
726 /// entitlement in your process. In addition your application's Info.plist must contain a non-empty usage description string.
727 ///
728 /// ```text
729 /// NFCReaderErrorSecurityViolation @link/ will be returned from @link [NFCNDEFReaderSessionDelegate readerSession:didInvalidateWithError:] @link/
730 /// if the required entitlement is missing when session is started.
731 ///
732 /// @note Only one NFCNDEFReaderSession can be active at any time in the system. Subsequent opened sessions will get queued up and processed by the system in FIFO order.
733 /// @note If the delegate object implements the optional -readerSession:didDetectTags: method the NFCNDEFReaderSession will become a read-write session; see @link
734 /// NFCNDEFReaderSessionDelegate @link/ for detail description.
735 /// @note The error symbol will not be drawn on the action sheet if -invalidateSessionWithError: method is called on a session that is not a read-write session;
736 /// -invalidateSession: method should be used in a read-only session.
737 ///
738 ///
739 /// ```
740 ///
741 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcndefreadersession?language=objc)
742 #[unsafe(super(NFCReaderSession, NSObject))]
743 #[derive(Debug, PartialEq, Eq, Hash)]
744 pub struct NFCNDEFReaderSession;
745);
746
747extern_conformance!(
748 unsafe impl NFCReaderSessionProtocol for NFCNDEFReaderSession {}
749);
750
751extern_conformance!(
752 unsafe impl NSObjectProtocol for NFCNDEFReaderSession {}
753);
754
755impl NFCNDEFReaderSession {
756 extern_methods!(
757 #[unsafe(method(init))]
758 #[unsafe(method_family = init)]
759 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
760
761 #[cfg(feature = "dispatch2")]
762 /// Parameter `delegate`: The session will hold a weak ARC reference to this
763 ///
764 /// ```text
765 /// NFCNDEFReaderSessionDelegate @link/ object.
766 /// @param queue A dispatch queue where NFCNDEFReaderSessionDelegate delegate callbacks will be dispatched to. A <i>nil</i> value will
767 /// cause the creation of a serial dispatch queue internally for the session. The session object will retain the provided dispatch queue.
768 /// @param invalidateAfterFirstRead Session will automatically invalidate after the first NDEF tag is read successfully when this is set to YES, and
769 /// -readerSession:didInvalidateWithError: will return NFCReaderSessionInvalidationErrorFirstNDEFTagRead in this case.
770 /// Set to NO if the delegate object implements the -readerSession:didDetectTags: optional method.
771 ///
772 /// @return A new NFCNDEFReaderSession instance.
773 ///
774 /// @discussion A NDEF reader session will scan and detect NFC Forum tags that contain a valid NDEF message. NFC Forum Tag type 1 to 5 that
775 /// is NDEF formatted are supported. A modal system UI will present once -beginSession is called to inform the start of the session; the UI sheet
776 /// is automatically dismissed when the session is invalidated either by the user or by calling -invalidateSession. The alertMessage property shall be set
777 /// prior to -beginSession to display a message on the action sheet UI for the tag scanning operation.
778 ///
779 /// The reader session has the following properties:
780 /// + An opened session has a 60 seconds time limit restriction after -beginSession is called; -readerSession:didInvalidateWithError: will return
781 /// NFCReaderSessionInvalidationErrorSessionTimeout error when the time limit is reached.
782 /// + Only 1 active reader session is allowed in the system; -readerSession:didInvalidateWithError: will return NFCReaderSessionInvalidationErrorSystemIsBusy
783 /// when a new reader session is initiated by -beginSession when there is an active reader session.
784 /// + -readerSession:didInvalidateWithError: will return NFCReaderSessionInvalidationErrorUserCanceled when user clicks on the done button on the UI.
785 /// + -readerSession:didInvalidateWithError: will return NFCReaderSessionInvalidationErrorSessionTerminatedUnexpectedly when the client application enters
786 /// the background state.
787 /// + -readerSession:didInvalidateWithError: will return NFCReaderErrorUnsupportedFeature when 1) reader mode feature is not available on the hardware,
788 /// 2) client application does not have the required entitlement.
789 ///
790 /// The session's mode of operation is determined by the implementation of the delegate object. The -readerSession:didDetectTags: optional method will
791 /// enable the read-write capability and suppress the -readerSession:didDetectNDEFs: callback for the session.
792 ///
793 ///
794 /// ```
795 ///
796 /// # Safety
797 ///
798 /// `queue` possibly has additional threading requirements.
799 #[unsafe(method(initWithDelegate:queue:invalidateAfterFirstRead:))]
800 #[unsafe(method_family = init)]
801 pub unsafe fn initWithDelegate_queue_invalidateAfterFirstRead(
802 this: Allocated<Self>,
803 delegate: &ProtocolObject<dyn NFCNDEFReaderSessionDelegate>,
804 queue: Option<&DispatchQueue>,
805 invalidate_after_first_read: bool,
806 ) -> Retained<Self>;
807
808 /// Restart the polling sequence in this session to discover new NDEF tags. New tags discovered from polling will return in the subsequent
809 ///
810 /// ```text
811 /// [NFCNDEFReaderSessionDelegate readerSession:didDetectTags:]
812 /// @link/ call. Tags that are returned previously by @link [NFCNDEFReaderSessionDelegate -readerSession:didDetectTags:] @link/ will become invalid,
813 /// and all references to these tags shall be removed to properly release the resources. Calling this method on an invalidated session
814 /// will have no effect; a new reader session is required to restart the reader. Calling this method on an instance initiated with a delegate object that does not implement
815 /// the optional -readerSession:didDetectTags: method has no effect as RF polling restart is done automatically.
816 ///
817 ///
818 /// ```
819 #[unsafe(method(restartPolling))]
820 #[unsafe(method_family = none)]
821 pub unsafe fn restartPolling(&self);
822
823 #[cfg(feature = "block2")]
824 /// Parameter `tag`: A NFCTag protocol compliant tag object that will be connect to.
825 ///
826 ///
827 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
828 /// A
829 ///
830 /// ```text
831 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
832 ///
833 /// @discussion This method establishes a tag connection and activates the tag. Connecting to the same tag that is currently opened has no effect.
834 /// Connecting to a different tag will automatically terminate the previous tag connection and put it into the halt state. Tag stays in the
835 /// connected state until another tag is connected or the polling is restarted.
836 ///
837 ///
838 /// ```
839 #[unsafe(method(connectToTag:completionHandler:))]
840 #[unsafe(method_family = none)]
841 pub unsafe fn connectToTag_completionHandler(
842 &self,
843 tag: &ProtocolObject<dyn NFCNDEFTag>,
844 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
845 );
846 );
847}
848
849/// Methods declared on superclass `NSObject`.
850impl NFCNDEFReaderSession {
851 extern_methods!(
852 #[unsafe(method(new))]
853 #[unsafe(method_family = new)]
854 pub unsafe fn new() -> Retained<Self>;
855 );
856}
857
858mod private_NSUserActivityCoreNFC {
859 pub trait Sealed {}
860}
861
862/// Category "CoreNFC" on [`NSUserActivity`].
863#[doc(alias = "CoreNFC")]
864pub unsafe trait NSUserActivityCoreNFC:
865 ClassType + Sized + private_NSUserActivityCoreNFC::Sealed
866{
867 extern_methods!(
868 /// The NFC NDEF message with an Universal Link object that triggers the application launch.
869 #[unsafe(method(ndefMessagePayload))]
870 #[unsafe(method_family = none)]
871 unsafe fn ndefMessagePayload(&self) -> Retained<NFCNDEFMessage>;
872 );
873}
874
875impl private_NSUserActivityCoreNFC::Sealed for NSUserActivity {}
876unsafe impl NSUserActivityCoreNFC for NSUserActivity {}
877
878/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso15693requestflag?language=objc)
879// NS_OPTIONS
880#[repr(transparent)]
881#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
882pub struct NFCISO15693RequestFlag(pub u8);
883bitflags::bitflags! {
884 impl NFCISO15693RequestFlag: u8 {
885 #[doc(alias = "NFCISO15693RequestFlagDualSubCarriers")]
886 const DualSubCarriers = 1<<0;
887 #[doc(alias = "NFCISO15693RequestFlagHighDataRate")]
888 const HighDataRate = 1<<1;
889 #[doc(alias = "NFCISO15693RequestFlagProtocolExtension")]
890 const ProtocolExtension = 1<<3;
891 #[doc(alias = "NFCISO15693RequestFlagSelect")]
892 const Select = 1<<4;
893 #[doc(alias = "NFCISO15693RequestFlagAddress")]
894 const Address = 1<<5;
895 #[doc(alias = "NFCISO15693RequestFlagOption")]
896 const Option = 1<<6;
897 #[doc(alias = "NFCISO15693RequestFlagCommandSpecificBit8")]
898 const CommandSpecificBit8 = 1<<7;
899#[deprecated]
900 const RequestFlagDualSubCarriers = NFCISO15693RequestFlag::DualSubCarriers.0;
901#[deprecated]
902 const RequestFlagHighDataRate = NFCISO15693RequestFlag::HighDataRate.0;
903#[deprecated]
904 const RequestFlagProtocolExtension = NFCISO15693RequestFlag::ProtocolExtension.0;
905#[deprecated]
906 const RequestFlagSelect = NFCISO15693RequestFlag::Select.0;
907#[deprecated]
908 const RequestFlagAddress = NFCISO15693RequestFlag::Address.0;
909#[deprecated]
910 const RequestFlagOption = NFCISO15693RequestFlag::Option.0;
911 }
912}
913
914unsafe impl Encode for NFCISO15693RequestFlag {
915 const ENCODING: Encoding = u8::ENCODING;
916}
917
918unsafe impl RefEncode for NFCISO15693RequestFlag {
919 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
920}
921
922/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/requestflag?language=objc)
923pub type RequestFlag = NFCISO15693RequestFlag;
924
925/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso15693responseflag?language=objc)
926// NS_OPTIONS
927#[repr(transparent)]
928#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
929pub struct NFCISO15693ResponseFlag(pub u8);
930bitflags::bitflags! {
931 impl NFCISO15693ResponseFlag: u8 {
932 #[doc(alias = "NFCISO15693ResponseFlagError")]
933 const Error = 1<<0;
934 #[doc(alias = "NFCISO15693ResponseFlagResponseBufferValid")]
935 const ResponseBufferValid = 1<<1;
936 #[doc(alias = "NFCISO15693ResponseFlagFinalResponse")]
937 const FinalResponse = 1<<2;
938 #[doc(alias = "NFCISO15693ResponseFlagProtocolExtension")]
939 const ProtocolExtension = 1<<3;
940 #[doc(alias = "NFCISO15693ResponseFlagBlockSecurityStatusBit5")]
941 const BlockSecurityStatusBit5 = 1<<4;
942 #[doc(alias = "NFCISO15693ResponseFlagBlockSecurityStatusBit6")]
943 const BlockSecurityStatusBit6 = 1<<5;
944 #[doc(alias = "NFCISO15693ResponseFlagWaitTimeExtension")]
945 const WaitTimeExtension = 1<<6;
946 }
947}
948
949unsafe impl Encode for NFCISO15693ResponseFlag {
950 const ENCODING: Encoding = u8::ENCODING;
951}
952
953unsafe impl RefEncode for NFCISO15693ResponseFlag {
954 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
955}
956
957extern_class!(
958 /// Configuration options for the Manufacturer Custom command.
959 ///
960 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso15693customcommandconfiguration?language=objc)
961 #[unsafe(super(NFCTagCommandConfiguration, NSObject))]
962 #[derive(Debug, PartialEq, Eq, Hash)]
963 pub struct NFCISO15693CustomCommandConfiguration;
964);
965
966extern_conformance!(
967 unsafe impl NSCopying for NFCISO15693CustomCommandConfiguration {}
968);
969
970unsafe impl CopyingHelper for NFCISO15693CustomCommandConfiguration {
971 type Result = Self;
972}
973
974extern_conformance!(
975 unsafe impl NSObjectProtocol for NFCISO15693CustomCommandConfiguration {}
976);
977
978impl NFCISO15693CustomCommandConfiguration {
979 extern_methods!(
980 /// Manufacturer code. Valid range is 0x00 to 0xFF.
981 #[unsafe(method(manufacturerCode))]
982 #[unsafe(method_family = none)]
983 pub unsafe fn manufacturerCode(&self) -> NSUInteger;
984
985 /// Setter for [`manufacturerCode`][Self::manufacturerCode].
986 #[unsafe(method(setManufacturerCode:))]
987 #[unsafe(method_family = none)]
988 pub unsafe fn setManufacturerCode(&self, manufacturer_code: NSUInteger);
989
990 /// Manufacturer Custom Command Index. Valid range is 0xA0 to 0xDF.
991 #[unsafe(method(customCommandCode))]
992 #[unsafe(method_family = none)]
993 pub unsafe fn customCommandCode(&self) -> NSUInteger;
994
995 /// Setter for [`customCommandCode`][Self::customCommandCode].
996 #[unsafe(method(setCustomCommandCode:))]
997 #[unsafe(method_family = none)]
998 pub unsafe fn setCustomCommandCode(&self, custom_command_code: NSUInteger);
999
1000 /// Custom request data.
1001 #[unsafe(method(requestParameters))]
1002 #[unsafe(method_family = none)]
1003 pub unsafe fn requestParameters(&self) -> Retained<NSData>;
1004
1005 /// Setter for [`requestParameters`][Self::requestParameters].
1006 ///
1007 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
1008 #[unsafe(method(setRequestParameters:))]
1009 #[unsafe(method_family = none)]
1010 pub unsafe fn setRequestParameters(&self, request_parameters: &NSData);
1011
1012 /// Parameter `manufacturerCode`: 8 bits manufacturer code.
1013 ///
1014 /// Parameter `customCommandCode`: 8 bits custom command code. Valid range is 0xA0 to 0xDF.
1015 ///
1016 /// Parameter `requestParameters`: Optional custom request parameters.
1017 ///
1018 ///
1019 /// Initialize with default zero maximum retry and zero retry interval.
1020 #[unsafe(method(initWithManufacturerCode:customCommandCode:requestParameters:))]
1021 #[unsafe(method_family = init)]
1022 pub unsafe fn initWithManufacturerCode_customCommandCode_requestParameters(
1023 this: Allocated<Self>,
1024 manufacturer_code: NSUInteger,
1025 custom_command_code: NSUInteger,
1026 request_parameters: Option<&NSData>,
1027 ) -> Retained<Self>;
1028
1029 /// Parameter `manufacturerCode`: 8 bits manufacturer code.
1030 ///
1031 /// Parameter `customCommandCode`: 8 bits custom command code. Valid range is 0xA0 to 0xDF.
1032 ///
1033 /// Parameter `requestParameters`: Optional custom request parameters.
1034 ///
1035 /// Parameter `maximumRetries`: Maximum number of retry attempt when tag response is not received.
1036 ///
1037 /// Parameter `retryInterval`: Time interval wait between each retry attempt.
1038 #[unsafe(method(initWithManufacturerCode:customCommandCode:requestParameters:maximumRetries:retryInterval:))]
1039 #[unsafe(method_family = init)]
1040 pub unsafe fn initWithManufacturerCode_customCommandCode_requestParameters_maximumRetries_retryInterval(
1041 this: Allocated<Self>,
1042 manufacturer_code: NSUInteger,
1043 custom_command_code: NSUInteger,
1044 request_parameters: Option<&NSData>,
1045 maximum_retries: NSUInteger,
1046 retry_interval: NSTimeInterval,
1047 ) -> Retained<Self>;
1048 );
1049}
1050
1051/// Methods declared on superclass `NSObject`.
1052impl NFCISO15693CustomCommandConfiguration {
1053 extern_methods!(
1054 #[unsafe(method(init))]
1055 #[unsafe(method_family = init)]
1056 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1057
1058 #[unsafe(method(new))]
1059 #[unsafe(method_family = new)]
1060 pub unsafe fn new() -> Retained<Self>;
1061 );
1062}
1063
1064extern_class!(
1065 /// Configuration options for the Read Multiple Blocks command.
1066 ///
1067 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso15693readmultipleblocksconfiguration?language=objc)
1068 #[unsafe(super(NFCTagCommandConfiguration, NSObject))]
1069 #[derive(Debug, PartialEq, Eq, Hash)]
1070 pub struct NFCISO15693ReadMultipleBlocksConfiguration;
1071);
1072
1073extern_conformance!(
1074 unsafe impl NSCopying for NFCISO15693ReadMultipleBlocksConfiguration {}
1075);
1076
1077unsafe impl CopyingHelper for NFCISO15693ReadMultipleBlocksConfiguration {
1078 type Result = Self;
1079}
1080
1081extern_conformance!(
1082 unsafe impl NSObjectProtocol for NFCISO15693ReadMultipleBlocksConfiguration {}
1083);
1084
1085impl NFCISO15693ReadMultipleBlocksConfiguration {
1086 extern_methods!(
1087 /// Range to read in blocks. Valid start index range is 0x00 to 0xFF. Length shall not be 0.
1088 #[unsafe(method(range))]
1089 #[unsafe(method_family = none)]
1090 pub unsafe fn range(&self) -> NSRange;
1091
1092 /// Setter for [`range`][Self::range].
1093 #[unsafe(method(setRange:))]
1094 #[unsafe(method_family = none)]
1095 pub unsafe fn setRange(&self, range: NSRange);
1096
1097 /// Number of blocks to read per Read Multiple Blocks command. This may be limited by the tag hardware.
1098 #[unsafe(method(chunkSize))]
1099 #[unsafe(method_family = none)]
1100 pub unsafe fn chunkSize(&self) -> NSUInteger;
1101
1102 /// Setter for [`chunkSize`][Self::chunkSize].
1103 #[unsafe(method(setChunkSize:))]
1104 #[unsafe(method_family = none)]
1105 pub unsafe fn setChunkSize(&self, chunk_size: NSUInteger);
1106
1107 /// Initialize with default zero maximum retry and zero retry interval.
1108 #[unsafe(method(initWithRange:chunkSize:))]
1109 #[unsafe(method_family = init)]
1110 pub unsafe fn initWithRange_chunkSize(
1111 this: Allocated<Self>,
1112 range: NSRange,
1113 chunk_size: NSUInteger,
1114 ) -> Retained<Self>;
1115
1116 /// Parameter `range`: Read range specify by the starting block index and the total number of blocks.
1117 ///
1118 /// Parameter `chunkSize`: Specify number of blocks parameter for the Read multiple blocks command.
1119 ///
1120 /// Parameter `maximumRetries`: Maximum number of retry attempt when tag response is not received.
1121 ///
1122 /// Parameter `retryInterval`: Time interval wait between each retry attempt.
1123 #[unsafe(method(initWithRange:chunkSize:maximumRetries:retryInterval:))]
1124 #[unsafe(method_family = init)]
1125 pub unsafe fn initWithRange_chunkSize_maximumRetries_retryInterval(
1126 this: Allocated<Self>,
1127 range: NSRange,
1128 chunk_size: NSUInteger,
1129 maximum_retries: NSUInteger,
1130 retry_interval: NSTimeInterval,
1131 ) -> Retained<Self>;
1132 );
1133}
1134
1135/// Methods declared on superclass `NSObject`.
1136impl NFCISO15693ReadMultipleBlocksConfiguration {
1137 extern_methods!(
1138 #[unsafe(method(init))]
1139 #[unsafe(method_family = init)]
1140 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1141
1142 #[unsafe(method(new))]
1143 #[unsafe(method_family = new)]
1144 pub unsafe fn new() -> Retained<Self>;
1145 );
1146}
1147
1148extern_protocol!(
1149 /// A
1150 ///
1151 /// ```text
1152 /// NFCISO15693ReaderSession @link/ or @link NFCTagReaderSession @link/ reader session returns an instance conforming
1153 /// to this protocol when an ISO15693 tag is detected. Unless it is specified all block completion handlers are dispatched on the
1154 /// reader session work queue that is associated with the tag. Your process requires to include the "com.apple.developer.nfc.readersession.formats"
1155 /// entitlement to receive this tag object from the @link NFCReaderSessionDelegate @link/ delegate.
1156 /// @link NFCReaderErrorSecurityViolation @link/ will be returned from the @link NFCTagReaderSessionDelegate @link/ invalidation method if the required
1157 /// entitlement is missing when session is started.
1158 /// Tag must be in the connected state for NFCNDEFTag protocol properties and methods to work correctly. Each data frame send out by the reader may not
1159 /// exceed 256 bytes total.
1160 ///
1161 ///
1162 /// ```
1163 ///
1164 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso15693tag?language=objc)
1165 pub unsafe trait NFCISO15693Tag: NFCTag + NFCNDEFTag {
1166 /// The 64 bit hardware UID of the tag. Data is in Big Endian byte order.
1167 #[unsafe(method(identifier))]
1168 #[unsafe(method_family = none)]
1169 unsafe fn identifier(&self) -> Retained<NSData>;
1170
1171 /// The IC manufacturer code (bits 56 – 49) in UID according to ISO/IEC 7816-6:2004.
1172 #[unsafe(method(icManufacturerCode))]
1173 #[unsafe(method_family = none)]
1174 unsafe fn icManufacturerCode(&self) -> NSUInteger;
1175
1176 /// The IC serial number (bits 48 – 1) in UID assigned by the manufacturer. Data is in Big Endian byte order.
1177 #[unsafe(method(icSerialNumber))]
1178 #[unsafe(method_family = none)]
1179 unsafe fn icSerialNumber(&self) -> Retained<NSData>;
1180
1181 #[cfg(feature = "block2")]
1182 /// Parameter `commandConfiguration`: Configuration for the Manufacturer Custom Command.
1183 ///
1184 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1185 /// A
1186 ///
1187 /// ```text
1188 /// NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1189 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1190 ///
1191 /// @discussion Send a manufacturer dependent custom command using command code range from 0xA0 to 0xDF. Refer to ISO15693-3
1192 /// specification for details.
1193 ///
1194 ///
1195 /// ```
1196 #[unsafe(method(sendCustomCommandWithConfiguration:completionHandler:))]
1197 #[unsafe(method_family = none)]
1198 unsafe fn sendCustomCommandWithConfiguration_completionHandler(
1199 &self,
1200 command_configuration: &NFCISO15693CustomCommandConfiguration,
1201 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, *mut NSError)>,
1202 );
1203
1204 #[cfg(feature = "block2")]
1205 /// Parameter `readConfiguration`: Configuration For the Read Multiple Blocks command.
1206 ///
1207 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1208 /// A
1209 ///
1210 /// ```text
1211 /// NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1212 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1213 /// Successfully read data blocks will be returned from NSData object. All blocks are concatenated into the NSData object.
1214 ///
1215 /// @discussion Performs read operation using Read Multiple Blocks command (0x23 command code) as defined in ISO15693-3 specification.
1216 /// Multiple Read Multiple Blocks commands will be sent if necessary to complete the operation.
1217 ///
1218 ///
1219 /// ```
1220 #[unsafe(method(readMultipleBlocksWithConfiguration:completionHandler:))]
1221 #[unsafe(method_family = none)]
1222 unsafe fn readMultipleBlocksWithConfiguration_completionHandler(
1223 &self,
1224 read_configuration: &NFCISO15693ReadMultipleBlocksConfiguration,
1225 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, *mut NSError)>,
1226 );
1227
1228 #[cfg(feature = "block2")]
1229 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1230 /// A
1231 ///
1232 /// ```text
1233 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1234 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1235 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1236 ///
1237 /// @discussion Stay quiet command (0x02 command code) as defined in ISO15693-3 specification.
1238 ///
1239 ///
1240 /// ```
1241 #[unsafe(method(stayQuietWithCompletionHandler:))]
1242 #[unsafe(method_family = none)]
1243 unsafe fn stayQuietWithCompletionHandler(
1244 &self,
1245 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1246 );
1247
1248 #[cfg(feature = "block2")]
1249 /// Parameter `flags`: Request flags.
1250 ///
1251 /// Parameter `blockNumber`: Block number. Blocks are numbered from 0 to 255 inclusively.
1252 ///
1253 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1254 /// A
1255 ///
1256 /// ```text
1257 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1258 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1259 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1260 /// Successfully read data blocks will be returned from NSData object. If Option flag in the request flags is set,
1261 /// then first byte of data block will contain the associated block security status.
1262 ///
1263 /// @discussion Read single block command (0x20 command code) as defined in ISO15693-3 specification. Address flag is automatically
1264 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1265 ///
1266 ///
1267 /// ```
1268 #[unsafe(method(readSingleBlockWithRequestFlags:blockNumber:completionHandler:))]
1269 #[unsafe(method_family = none)]
1270 unsafe fn readSingleBlockWithRequestFlags_blockNumber_completionHandler(
1271 &self,
1272 flags: NFCISO15693RequestFlag,
1273 block_number: u8,
1274 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, *mut NSError)>,
1275 );
1276
1277 #[cfg(feature = "block2")]
1278 /// Parameter `flags`: Request flags.
1279 ///
1280 /// Parameter `blockNumber`: Block number. Blocks are numbered from 0 to 255 inclusively.
1281 ///
1282 /// Parameter `dataBlock`: A single block of data.
1283 ///
1284 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1285 /// A
1286 ///
1287 /// ```text
1288 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1289 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1290 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1291 ///
1292 /// @discussion Write single block command (0x21 command code) as defined in ISO15693-3 specification. Address flag is automatically
1293 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1294 ///
1295 ///
1296 /// ```
1297 #[unsafe(method(writeSingleBlockWithRequestFlags:blockNumber:dataBlock:completionHandler:))]
1298 #[unsafe(method_family = none)]
1299 unsafe fn writeSingleBlockWithRequestFlags_blockNumber_dataBlock_completionHandler(
1300 &self,
1301 flags: NFCISO15693RequestFlag,
1302 block_number: u8,
1303 data_block: &NSData,
1304 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1305 );
1306
1307 #[cfg(feature = "block2")]
1308 /// Parameter `flags`: Request flags.
1309 ///
1310 /// Parameter `blockNumber`: Block number. Blocks are numbered from 0 to 255 inclusively.
1311 ///
1312 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1313 /// A
1314 ///
1315 /// ```text
1316 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1317 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1318 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1319 /// Successfully read data blocks will be returned from NSData object.
1320 ///
1321 /// @discussion Lock block command (0x22 command code) as defined in ISO15693-3 specification. Address flag is automatically
1322 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1323 ///
1324 /// ```
1325 #[unsafe(method(lockBlockWithRequestFlags:blockNumber:completionHandler:))]
1326 #[unsafe(method_family = none)]
1327 unsafe fn lockBlockWithRequestFlags_blockNumber_completionHandler(
1328 &self,
1329 flags: NFCISO15693RequestFlag,
1330 block_number: u8,
1331 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1332 );
1333
1334 #[cfg(feature = "block2")]
1335 /// Parameter `flags`: Request flags.
1336 ///
1337 /// Parameter `blockRange`: The range of blocks. Valid start index range is 0 to 255 inclusively. Valid length is 1 to 256 inclusively.
1338 ///
1339 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1340 /// A
1341 ///
1342 /// ```text
1343 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1344 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1345 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1346 /// Successfully read data blocks will be returned from NSArray of NSData object. If Option flag in the request flags is set,
1347 /// then first byte of each returned data block will contain the associated block security status. Each data block element
1348 /// would have identical size.
1349 ///
1350 /// @discussion Read multiple blocks command (0x23 command code) as defined in ISO15693-3 specification. Address flag is automatically
1351 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1352 ///
1353 ///
1354 /// ```
1355 #[unsafe(method(readMultipleBlocksWithRequestFlags:blockRange:completionHandler:))]
1356 #[unsafe(method_family = none)]
1357 unsafe fn readMultipleBlocksWithRequestFlags_blockRange_completionHandler(
1358 &self,
1359 flags: NFCISO15693RequestFlag,
1360 block_range: NSRange,
1361 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSData>>, *mut NSError)>,
1362 );
1363
1364 #[cfg(feature = "block2")]
1365 /// Parameter `flags`: Request flags.
1366 ///
1367 /// Parameter `blockRange`: The range of blocks. Valid start index range is 0 to 255 inclusively. Valid length is 1 to 256 inclusively.
1368 ///
1369 /// Parameter `dataBlocks`: Blocks of data represent in NSArray of NSData. The number of blocks shall match the length value of the blockRange parameter.
1370 /// Each block element should have identical size and should match the physical block size of the tag.
1371 ///
1372 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1373 /// A
1374 ///
1375 /// ```text
1376 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1377 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1378 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1379 ///
1380 /// @discussion Write multiple blocks command (0x24 command code) as defined in ISO15693-3 specification. Address flag is automatically
1381 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1382 ///
1383 ///
1384 /// ```
1385 #[unsafe(method(writeMultipleBlocksWithRequestFlags:blockRange:dataBlocks:completionHandler:))]
1386 #[unsafe(method_family = none)]
1387 unsafe fn writeMultipleBlocksWithRequestFlags_blockRange_dataBlocks_completionHandler(
1388 &self,
1389 flags: NFCISO15693RequestFlag,
1390 block_range: NSRange,
1391 data_blocks: &NSArray<NSData>,
1392 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1393 );
1394
1395 #[cfg(feature = "block2")]
1396 /// Parameter `flags`: Request flags.
1397 ///
1398 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1399 /// A
1400 ///
1401 /// ```text
1402 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1403 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1404 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1405 ///
1406 /// @discussion Select command (0x25 command code) as defined in ISO15693-3 specification. Address flag is automatically
1407 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1408 ///
1409 ///
1410 /// ```
1411 #[unsafe(method(selectWithRequestFlags:completionHandler:))]
1412 #[unsafe(method_family = none)]
1413 unsafe fn selectWithRequestFlags_completionHandler(
1414 &self,
1415 flags: NFCISO15693RequestFlag,
1416 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1417 );
1418
1419 #[cfg(feature = "block2")]
1420 /// Parameter `flags`: Request flags.
1421 ///
1422 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1423 /// A
1424 ///
1425 /// ```text
1426 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1427 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1428 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1429 ///
1430 /// @discussion Reset To Ready command (0x26 command code) as defined in ISO15693-3 specification. Address flag is automatically
1431 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1432 ///
1433 ///
1434 /// ```
1435 #[unsafe(method(resetToReadyWithRequestFlags:completionHandler:))]
1436 #[unsafe(method_family = none)]
1437 unsafe fn resetToReadyWithRequestFlags_completionHandler(
1438 &self,
1439 flags: NFCISO15693RequestFlag,
1440 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1441 );
1442
1443 #[cfg(feature = "block2")]
1444 /// Parameter `flags`: Request flags.
1445 ///
1446 /// Parameter `afi`: Application Family Identifier.
1447 ///
1448 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1449 /// A
1450 ///
1451 /// ```text
1452 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1453 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1454 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1455 ///
1456 /// @discussion Write AFI command (0x27 command code) as defined in ISO15693-3 specification. Address flag is automatically
1457 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1458 ///
1459 ///
1460 /// ```
1461 #[unsafe(method(writeAFIWithRequestFlag:afi:completionHandler:))]
1462 #[unsafe(method_family = none)]
1463 unsafe fn writeAFIWithRequestFlag_afi_completionHandler(
1464 &self,
1465 flags: NFCISO15693RequestFlag,
1466 afi: u8,
1467 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1468 );
1469
1470 #[cfg(feature = "block2")]
1471 /// Parameter `flags`: Request flags.
1472 ///
1473 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1474 /// A
1475 ///
1476 /// ```text
1477 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1478 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1479 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1480 ///
1481 /// @discussion Lock AFI command (0x28 command code) as defined in ISO15693-3 specification. Address flag is automatically
1482 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1483 ///
1484 ///
1485 /// ```
1486 #[unsafe(method(lockAFIWithRequestFlag:completionHandler:))]
1487 #[unsafe(method_family = none)]
1488 unsafe fn lockAFIWithRequestFlag_completionHandler(
1489 &self,
1490 flags: NFCISO15693RequestFlag,
1491 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1492 );
1493
1494 #[cfg(feature = "block2")]
1495 /// Parameter `flags`: Request flags.
1496 ///
1497 /// Parameter `dsfid`: Data Storage Format Identifier.
1498 ///
1499 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1500 /// A
1501 ///
1502 /// ```text
1503 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1504 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1505 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1506 ///
1507 /// @discussion Write DSFID command (0x29 command code) as defined in ISO15693-3 specification. Address flag is automatically
1508 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1509 ///
1510 ///
1511 /// ```
1512 #[unsafe(method(writeDSFIDWithRequestFlag:dsfid:completionHandler:))]
1513 #[unsafe(method_family = none)]
1514 unsafe fn writeDSFIDWithRequestFlag_dsfid_completionHandler(
1515 &self,
1516 flags: NFCISO15693RequestFlag,
1517 dsfid: u8,
1518 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1519 );
1520
1521 #[cfg(feature = "block2")]
1522 /// Parameter `flags`: Request flags.
1523 ///
1524 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1525 /// A
1526 ///
1527 /// ```text
1528 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1529 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1530 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1531 ///
1532 /// @discussion Use the replacement -lockDSFIDWithRequestFlag:completionHandler:.
1533 ///
1534 ///
1535 /// ```
1536 #[deprecated]
1537 #[unsafe(method(lockDFSIDWithRequestFlag:completionHandler:))]
1538 #[unsafe(method_family = none)]
1539 unsafe fn lockDFSIDWithRequestFlag_completionHandler(
1540 &self,
1541 flags: NFCISO15693RequestFlag,
1542 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1543 );
1544
1545 #[cfg(feature = "block2")]
1546 /// Parameter `flags`: Request flags.
1547 ///
1548 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1549 /// A
1550 ///
1551 /// ```text
1552 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1553 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1554 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1555 ///
1556 /// @discussion Lock DSFID command (0x2A command code) as defined in ISO15693-3 specification. Address flag is automatically
1557 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1558 ///
1559 ///
1560 /// ```
1561 #[unsafe(method(lockDSFIDWithRequestFlag:completionHandler:))]
1562 #[unsafe(method_family = none)]
1563 unsafe fn lockDSFIDWithRequestFlag_completionHandler(
1564 &self,
1565 flags: NFCISO15693RequestFlag,
1566 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1567 );
1568
1569 #[cfg(feature = "block2")]
1570 /// Parameter `flags`: Request flags.
1571 ///
1572 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1573 /// A
1574 ///
1575 /// ```text
1576 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1577 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1578 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1579 /// Value of -1 will be returned from dsfid, afi, blockSize, blockCount, or icReference if tag response does not contain the information.
1580 /// blockSize returns the actual block size in bytes ranged from 1 to 32. blockCount returns the actual number of blocks
1581 /// ranged from 1 to 256 blocks.
1582 ///
1583 /// @discussion Use the replacement -getSystemInfoAndUIDWithRequestFlag:completionHandler:.
1584 ///
1585 ///
1586 /// ```
1587 #[deprecated]
1588 #[unsafe(method(getSystemInfoWithRequestFlag:completionHandler:))]
1589 #[unsafe(method_family = none)]
1590 unsafe fn getSystemInfoWithRequestFlag_completionHandler(
1591 &self,
1592 flags: NFCISO15693RequestFlag,
1593 completion_handler: &block2::DynBlock<
1594 dyn Fn(NSInteger, NSInteger, NSInteger, NSInteger, NSInteger, *mut NSError),
1595 >,
1596 );
1597
1598 #[cfg(feature = "block2")]
1599 /// Parameter `flags`: Request flags.
1600 ///
1601 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1602 /// A
1603 ///
1604 /// ```text
1605 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1606 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1607 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1608 /// Value of -1 will be returned from dsfid, afi, blockSize, blockCount, or icReference, and a nil UID value if tag response does not contain the information.
1609 /// blockSize returns the actual block size in bytes ranged from 1 to 32. blockCount returns the actual number of blocks
1610 /// ranged from 1 to 256 blocks. 64bits UID value in little endian byte order from the response packet is returned.
1611 ///
1612 /// @discussion Get system information command (0x2B command code) as defined in ISO15693-3 specification. Address flag is automatically
1613 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1614 ///
1615 /// ```
1616 #[unsafe(method(getSystemInfoAndUIDWithRequestFlag:completionHandler:))]
1617 #[unsafe(method_family = none)]
1618 unsafe fn getSystemInfoAndUIDWithRequestFlag_completionHandler(
1619 &self,
1620 flags: NFCISO15693RequestFlag,
1621 completion_handler: &block2::DynBlock<
1622 dyn Fn(
1623 *mut NSData,
1624 NSInteger,
1625 NSInteger,
1626 NSInteger,
1627 NSInteger,
1628 NSInteger,
1629 *mut NSError,
1630 ),
1631 >,
1632 );
1633
1634 #[cfg(feature = "block2")]
1635 /// Parameter `flags`: Request flags.
1636 ///
1637 /// Parameter `blockRange`: The range of blocks. Valid start index range is 0 to 255 inclusively. Valid length is 1 to 256 inclusively.
1638 ///
1639 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1640 /// A
1641 ///
1642 /// ```text
1643 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1644 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1645 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1646 /// The 8 bits security status of the requested blocks are returned in NSArray; the array will be empty when error occurs.
1647 ///
1648 /// @discussion Get multiple block security status command (0x2C command code) as defined in ISO15693-3 specification. Address flag is automatically
1649 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1650 ///
1651 ///
1652 /// ```
1653 #[unsafe(method(getMultipleBlockSecurityStatusWithRequestFlag:blockRange:completionHandler:))]
1654 #[unsafe(method_family = none)]
1655 unsafe fn getMultipleBlockSecurityStatusWithRequestFlag_blockRange_completionHandler(
1656 &self,
1657 flags: NFCISO15693RequestFlag,
1658 block_range: NSRange,
1659 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSNumber>>, *mut NSError)>,
1660 );
1661
1662 #[cfg(feature = "block2")]
1663 /// Parameter `flags`: Request flags.
1664 ///
1665 /// Parameter `blockRange`: The range of blocks. Valid start index range is 0 to 255 inclusively. Valid length is 1 to 256 inclusively.
1666 ///
1667 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1668 ///
1669 ///
1670 /// Fast read multiple blocks command (0x2D command code) as defined in ISO15693-3 specification.
1671 #[unsafe(method(fastReadMultipleBlocksWithRequestFlag:blockRange:completionHandler:))]
1672 #[unsafe(method_family = none)]
1673 unsafe fn fastReadMultipleBlocksWithRequestFlag_blockRange_completionHandler(
1674 &self,
1675 flags: NFCISO15693RequestFlag,
1676 block_range: NSRange,
1677 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSData>>, *mut NSError)>,
1678 );
1679
1680 #[cfg(feature = "block2")]
1681 /// Parameter `flags`: Request flags.
1682 ///
1683 /// Parameter `customCommandCode`: Custom command code defined by the IC manufacturer. Valid range is 0xA0 to 0xDF inclusively.
1684 ///
1685 /// Parameter `customRequestParameters`: Custom request parameters defined by the command.
1686 ///
1687 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1688 /// A
1689 ///
1690 /// ```text
1691 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1692 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1693 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1694 /// The custom response parameters are returned on success.
1695 ///
1696 /// @discussion Custom command (0xA0 to 0xDF command code) as defined in ISO15693-3 specification. IC manufacturer code from the tag is
1697 /// automatically inserted after the command byte before appending the custom request parameters in forming the packet.
1698 ///
1699 ///
1700 /// ```
1701 #[unsafe(method(customCommandWithRequestFlag:customCommandCode:customRequestParameters:completionHandler:))]
1702 #[unsafe(method_family = none)]
1703 unsafe fn customCommandWithRequestFlag_customCommandCode_customRequestParameters_completionHandler(
1704 &self,
1705 flags: NFCISO15693RequestFlag,
1706 custom_command_code: NSInteger,
1707 custom_request_parameters: &NSData,
1708 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, *mut NSError)>,
1709 );
1710
1711 #[cfg(feature = "block2")]
1712 /// Parameter `flags`: Request flags.
1713 ///
1714 /// Parameter `blockNumber`: 2 bytes block number, valid range from 0 to 65535 inclusively.
1715 ///
1716 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1717 /// A
1718 ///
1719 /// ```text
1720 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1721 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1722 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1723 /// If Option flag in the request flags is set, then first byte of the returned data block will contain the associated block security status.
1724 ///
1725 /// @discussion Extended read single block command (0x30 command code) as defined in ISO15693-3 specification. Address flag is automatically
1726 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1727 ///
1728 ///
1729 /// ```
1730 #[unsafe(method(extendedReadSingleBlockWithRequestFlags:blockNumber:completionHandler:))]
1731 #[unsafe(method_family = none)]
1732 unsafe fn extendedReadSingleBlockWithRequestFlags_blockNumber_completionHandler(
1733 &self,
1734 flags: NFCISO15693RequestFlag,
1735 block_number: NSInteger,
1736 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, *mut NSError)>,
1737 );
1738
1739 #[cfg(feature = "block2")]
1740 /// Parameter `flags`: Request flags.
1741 ///
1742 /// Parameter `blockNumber`: 2 bytes block number, valid range from 0 to 65535 inclusively.
1743 ///
1744 /// Parameter `dataBlock`: A single block of data.
1745 ///
1746 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1747 /// A
1748 ///
1749 /// ```text
1750 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1751 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1752 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1753 ///
1754 /// @discussion Extended write single block command (0x31 command code) as defined in ISO15693-3 specification. Address flag is automatically
1755 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1756 ///
1757 ///
1758 /// ```
1759 #[unsafe(method(extendedWriteSingleBlockWithRequestFlags:blockNumber:dataBlock:completionHandler:))]
1760 #[unsafe(method_family = none)]
1761 unsafe fn extendedWriteSingleBlockWithRequestFlags_blockNumber_dataBlock_completionHandler(
1762 &self,
1763 flags: NFCISO15693RequestFlag,
1764 block_number: NSInteger,
1765 data_block: &NSData,
1766 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1767 );
1768
1769 #[cfg(feature = "block2")]
1770 /// Parameter `flags`: Request flags.
1771 ///
1772 /// Parameter `blockNumber`: 2 bytes block number, valid range from 0 to 65535 inclusively.
1773 ///
1774 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1775 /// A
1776 ///
1777 /// ```text
1778 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1779 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1780 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1781 ///
1782 /// @discussion Extended lock single block command (0x32 command code) as defined in ISO15693-3 specification. Address flag is automatically
1783 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1784 ///
1785 ///
1786 /// ```
1787 #[unsafe(method(extendedLockBlockWithRequestFlags:blockNumber:completionHandler:))]
1788 #[unsafe(method_family = none)]
1789 unsafe fn extendedLockBlockWithRequestFlags_blockNumber_completionHandler(
1790 &self,
1791 flags: NFCISO15693RequestFlag,
1792 block_number: NSInteger,
1793 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1794 );
1795
1796 #[cfg(feature = "block2")]
1797 /// Parameter `flags`: Request flags.
1798 ///
1799 /// Parameter `blockRange`: The range of blocks. Valid start index range is 0 to 65535 inclusively. Valid length is 1 to 65536 inclusively.
1800 ///
1801 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1802 /// A
1803 ///
1804 /// ```text
1805 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1806 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1807 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1808 /// Successfully read data blocks will be returned from NSData object. If Option flag in the request flags is set,
1809 /// then first byte of each returned data blocks will contain the associated block security status.
1810 ///
1811 /// @discussion Extended read multiple block command (0x33 command code) as defined in ISO15693-3 specification. Address flag is automatically
1812 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1813 ///
1814 ///
1815 /// ```
1816 #[unsafe(method(extendedReadMultipleBlocksWithRequestFlags:blockRange:completionHandler:))]
1817 #[unsafe(method_family = none)]
1818 unsafe fn extendedReadMultipleBlocksWithRequestFlags_blockRange_completionHandler(
1819 &self,
1820 flags: NFCISO15693RequestFlag,
1821 block_range: NSRange,
1822 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSData>>, *mut NSError)>,
1823 );
1824
1825 #[cfg(feature = "block2")]
1826 /// Parameter `flags`: Request flags.
1827 ///
1828 /// Parameter `blockRange`: The range of blocks. Valid start index range is 0 to 65535 inclusively. Valid length is 1 to 65536 inclusively.
1829 ///
1830 /// Parameter `dataBlocks`: Blocks of data represented in NSArray of NSData. The number of blocks shall match the length value of the blockRange parameter.
1831 /// Each block element should have identical size and should match the physical block size of the tag.
1832 ///
1833 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1834 /// A
1835 ///
1836 /// ```text
1837 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1838 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1839 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1840 ///
1841 /// @discussion Extended write multiple block command (0x34 command code) as defined in ISO15693-3 specification. Address flag is automatically
1842 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1843 ///
1844 ///
1845 /// ```
1846 #[unsafe(method(extendedWriteMultipleBlocksWithRequestFlags:blockRange:dataBlocks:completionHandler:))]
1847 #[unsafe(method_family = none)]
1848 unsafe fn extendedWriteMultipleBlocksWithRequestFlags_blockRange_dataBlocks_completionHandler(
1849 &self,
1850 flags: NFCISO15693RequestFlag,
1851 block_range: NSRange,
1852 data_blocks: &NSArray<NSData>,
1853 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1854 );
1855
1856 #[cfg(feature = "block2")]
1857 /// Parameter `flags`: Request flags.
1858 ///
1859 /// Parameter `cryptoSuiteIdentifier`: 8 bits Crypto Suite Indicator as defined in ISO/IEC 29167 specification.
1860 ///
1861 /// Parameter `message`: Content of the Authenticate command as dictated by the Crypto Suite Indicator.
1862 ///
1863 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1864 /// A
1865 ///
1866 /// ```text
1867 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1868 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1869 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1870 /// Successfully command response will be return as NSData object excluding the 8 bits response flag.
1871 ///
1872 /// @discussion Authenticate command (0x35 command code) as defined in ISO15693-3 specification. Please note that in-process reply is returned to the caller without any processing.
1873 ///
1874 ///
1875 /// ```
1876 #[unsafe(method(authenticateWithRequestFlags:cryptoSuiteIdentifier:message:completionHandler:))]
1877 #[unsafe(method_family = none)]
1878 unsafe fn authenticateWithRequestFlags_cryptoSuiteIdentifier_message_completionHandler(
1879 &self,
1880 flags: NFCISO15693RequestFlag,
1881 crypto_suite_identifier: NSInteger,
1882 message: &NSData,
1883 completion_handler: &block2::DynBlock<
1884 dyn Fn(NFCISO15693ResponseFlag, NonNull<NSData>, *mut NSError),
1885 >,
1886 );
1887
1888 #[cfg(feature = "block2")]
1889 /// Parameter `flags`: Request flags.
1890 ///
1891 /// Parameter `keyIdentifier`: 8 bits key identifier
1892 ///
1893 /// Parameter `message`: Content of the Key Update command as dictated by the Crypto Suite Indicator used in Authenticate.
1894 ///
1895 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1896 /// A
1897 ///
1898 /// ```text
1899 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1900 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1901 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1902 /// Successfully command response will be return as NSData object excluding the 8 bits response flag.
1903 ///
1904 /// @discussion Key update command (0x36 command code) as defined in ISO15693-3 specification. Please note that in-process reply is returned to the caller without any processing.
1905 ///
1906 ///
1907 /// ```
1908 #[unsafe(method(keyUpdateWithRequestFlags:keyIdentifier:message:completionHandler:))]
1909 #[unsafe(method_family = none)]
1910 unsafe fn keyUpdateWithRequestFlags_keyIdentifier_message_completionHandler(
1911 &self,
1912 flags: NFCISO15693RequestFlag,
1913 key_identifier: NSInteger,
1914 message: &NSData,
1915 completion_handler: &block2::DynBlock<
1916 dyn Fn(NFCISO15693ResponseFlag, NonNull<NSData>, *mut NSError),
1917 >,
1918 );
1919
1920 #[cfg(feature = "block2")]
1921 /// Parameter `flags`: Request flags.
1922 ///
1923 /// Parameter `cryptoSuiteIdentifier`: 8 bits Crypto Suite Indicator as defined in ISO/IEC 29167 specification.
1924 ///
1925 /// Parameter `message`: Content of the Key Update command as dictated by the Crypto Suite Indicator used in Authenticate.
1926 ///
1927 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1928 /// A
1929 ///
1930 /// ```text
1931 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1932 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1933 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1934 ///
1935 /// @discussion Challenge command (0x39 command code) as defined in ISO15693-3 specification.
1936 ///
1937 ///
1938 /// ```
1939 #[unsafe(method(challengeWithRequestFlags:cryptoSuiteIdentifier:message:completionHandler:))]
1940 #[unsafe(method_family = none)]
1941 unsafe fn challengeWithRequestFlags_cryptoSuiteIdentifier_message_completionHandler(
1942 &self,
1943 flags: NFCISO15693RequestFlag,
1944 crypto_suite_identifier: NSInteger,
1945 message: &NSData,
1946 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
1947 );
1948
1949 #[cfg(feature = "block2")]
1950 /// Parameter `flags`: Request flags.
1951 ///
1952 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1953 /// A
1954 ///
1955 /// ```text
1956 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1957 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1958 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1959 /// Successfully command response will be return as NSData object excluding the 8 bits response flag.
1960 ///
1961 /// @discussion Read buffer command (0x3A command code) as defined in ISO15693-3 specification.
1962 ///
1963 ///
1964 /// ```
1965 #[unsafe(method(readBufferWithRequestFlags:completionHandler:))]
1966 #[unsafe(method_family = none)]
1967 unsafe fn readBufferWithRequestFlags_completionHandler(
1968 &self,
1969 flags: NFCISO15693RequestFlag,
1970 completion_handler: &block2::DynBlock<
1971 dyn Fn(NFCISO15693ResponseFlag, NonNull<NSData>, *mut NSError),
1972 >,
1973 );
1974
1975 #[cfg(feature = "block2")]
1976 /// Parameter `flags`: Request flags.
1977 ///
1978 /// Parameter `blockRange`: The range of blocks. Valid start index range is 0 to 255 inclusively. Valid length is 1 to 256 inclusively.
1979 ///
1980 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
1981 /// A
1982 ///
1983 /// ```text
1984 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
1985 /// A @link NFCISO15693TagResponseErrorKey @link/ in NSError userInfo dictionary is returned when the tag
1986 /// responded to the command with an error, and the error code value is defined in ISO15693-3 specification.
1987 /// The 8 bits security status of the requested blocks are returned in NSArray; the array will be empty when error occurs.
1988 ///
1989 /// @discussion Get multiple block security status command (0x3C command code) as defined in ISO15693-3 specification. Address flag is automatically
1990 /// enforced by default and the tag's UID is sent with the command; setting RequestFlagSelect to flags will disable the Address flag.
1991 ///
1992 ///
1993 /// ```
1994 #[unsafe(method(extendedGetMultipleBlockSecurityStatusWithRequestFlag:blockRange:completionHandler:))]
1995 #[unsafe(method_family = none)]
1996 unsafe fn extendedGetMultipleBlockSecurityStatusWithRequestFlag_blockRange_completionHandler(
1997 &self,
1998 flags: NFCISO15693RequestFlag,
1999 block_range: NSRange,
2000 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSNumber>>, *mut NSError)>,
2001 );
2002
2003 #[cfg(feature = "block2")]
2004 /// Parameter `flags`: Request flags.
2005 ///
2006 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
2007 ///
2008 ///
2009 /// Fast read multiple blocks command (0x3D command code) as defined in ISO15693-3 specification.
2010 #[unsafe(method(extendedFastReadMultipleBlocksWithRequestFlag:blockRange:completionHandler:))]
2011 #[unsafe(method_family = none)]
2012 unsafe fn extendedFastReadMultipleBlocksWithRequestFlag_blockRange_completionHandler(
2013 &self,
2014 flags: NFCISO15693RequestFlag,
2015 block_range: NSRange,
2016 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSData>>, *mut NSError)>,
2017 );
2018
2019 #[cfg(feature = "block2")]
2020 /// Parameter `flags`: Request flags.
2021 ///
2022 /// Parameter `commandCode`: 8 bits command code.
2023 ///
2024 /// Parameter `data`: Data follows after the command code.
2025 ///
2026 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
2027 ///
2028 ///
2029 /// Send a command according to the ISO15693-3 specification. The request data frame is concatenation of 8 bits request flag, 8 bits command code, and optional data.
2030 /// Total length of the data frame cannot exceed 256 bytes. The 8 bits response flag and the data are returned in the completion handler.
2031 #[unsafe(method(sendRequestWithFlag:commandCode:data:completionHandler:))]
2032 #[unsafe(method_family = none)]
2033 unsafe fn sendRequestWithFlag_commandCode_data_completionHandler(
2034 &self,
2035 flags: NSInteger,
2036 command_code: NSInteger,
2037 data: Option<&NSData>,
2038 completion_handler: &block2::DynBlock<
2039 dyn Fn(NFCISO15693ResponseFlag, *mut NSData, *mut NSError),
2040 >,
2041 );
2042 }
2043);
2044
2045extern_class!(
2046 /// Reader session for processing ISO15693 tags.
2047 ///
2048 /// ```text
2049 /// [NFCReaderSessionDelegate readerSession:didDetectTags:] @link/ will return tag objects that
2050 /// are conformed to the NFCISO15693Tag protocol. This session requires the "com.apple.developer.nfc.readersession.formats" entitlement in your process.
2051 ///
2052 /// NOTE:
2053 /// Only one NFCReaderSession can be active at any time in the system. Subsequent opened sessions will get queued up and processed by the system in FIFO order.
2054 /// The NFCISO15693 tag object returned by this session will only respond to the legacy APIs that are introduced in iOS11.
2055 ///
2056 ///
2057 /// ```
2058 ///
2059 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso15693readersession?language=objc)
2060 #[unsafe(super(NFCReaderSession, NSObject))]
2061 #[derive(Debug, PartialEq, Eq, Hash)]
2062 #[deprecated]
2063 pub struct NFCISO15693ReaderSession;
2064);
2065
2066extern_conformance!(
2067 unsafe impl NFCReaderSessionProtocol for NFCISO15693ReaderSession {}
2068);
2069
2070extern_conformance!(
2071 unsafe impl NSObjectProtocol for NFCISO15693ReaderSession {}
2072);
2073
2074impl NFCISO15693ReaderSession {
2075 extern_methods!(
2076 #[deprecated]
2077 #[unsafe(method(init))]
2078 #[unsafe(method_family = init)]
2079 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2080
2081 #[cfg(feature = "dispatch2")]
2082 /// Parameter `delegate`: The session will hold a weak ARC reference to this
2083 ///
2084 /// ```text
2085 /// NFCReaderSessionDelegate @link/ object.
2086 /// @param queue A dispatch queue where NFCReaderSessionDelegate delegate callbacks will be dispatched to. A <i>nil</i> value will
2087 /// cause the creation of a serial dispatch queue internally for the session. The session object will retain the provided dispatch queue.
2088 ///
2089 /// @return A new NFCISO15693ReaderSession instance.
2090 ///
2091 ///
2092 /// ```
2093 ///
2094 /// # Safety
2095 ///
2096 /// `queue` possibly has additional threading requirements.
2097 #[deprecated = "No longer supported"]
2098 #[unsafe(method(initWithDelegate:queue:))]
2099 #[unsafe(method_family = init)]
2100 pub unsafe fn initWithDelegate_queue(
2101 this: Allocated<Self>,
2102 delegate: &ProtocolObject<dyn NFCReaderSessionDelegate>,
2103 queue: Option<&DispatchQueue>,
2104 ) -> Retained<Self>;
2105
2106 /// Restart the polling sequence in this session to discover new tags. Tags that are returned previously by
2107 ///
2108 /// ```text
2109 /// [NFCReaderSessionDelegate readerSession:didDetectTags:]
2110 /// @link/ will become invalid, and all references to these tags shall be removed to properly release the resources. Calling this method on an invalidated session
2111 /// will have no effect; a new reader session is required to restart the reader.
2112 ///
2113 ///
2114 /// ```
2115 #[deprecated = "No longer supported"]
2116 #[unsafe(method(restartPolling))]
2117 #[unsafe(method_family = none)]
2118 pub unsafe fn restartPolling(&self);
2119 );
2120}
2121
2122/// Methods declared on superclass `NSObject`.
2123impl NFCISO15693ReaderSession {
2124 extern_methods!(
2125 #[unsafe(method(new))]
2126 #[unsafe(method_family = new)]
2127 pub unsafe fn new() -> Retained<Self>;
2128 );
2129}
2130
2131/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcndefstatus?language=objc)
2132// NS_ENUM
2133#[repr(transparent)]
2134#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2135pub struct NFCNDEFStatus(pub NSUInteger);
2136impl NFCNDEFStatus {
2137 #[doc(alias = "NFCNDEFStatusNotSupported")]
2138 pub const NotSupported: Self = Self(1);
2139 #[doc(alias = "NFCNDEFStatusReadWrite")]
2140 pub const ReadWrite: Self = Self(2);
2141 #[doc(alias = "NFCNDEFStatusReadOnly")]
2142 pub const ReadOnly: Self = Self(3);
2143}
2144
2145unsafe impl Encode for NFCNDEFStatus {
2146 const ENCODING: Encoding = NSUInteger::ENCODING;
2147}
2148
2149unsafe impl RefEncode for NFCNDEFStatus {
2150 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2151}
2152
2153extern_protocol!(
2154 /// Operations on a NDEF formatted tag. Unless it is specified all block completion handlers are dispatched on the session work queue that is associated with the tag.
2155 ///
2156 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcndeftag?language=objc)
2157 pub unsafe trait NFCNDEFTag: NSObjectProtocol + NSSecureCoding + NSCopying {
2158 /// Returns: <i>
2159 /// YES
2160 /// </i>
2161 /// if NDEF tag is available in the current reader session. A tag remove from the RF field will become
2162 /// unavailable. Tag in disconnected state will return NO.
2163 ///
2164 ///
2165 /// Check whether a detected NDEF tag is available.
2166 #[unsafe(method(isAvailable))]
2167 #[unsafe(method_family = none)]
2168 unsafe fn isAvailable(&self) -> bool;
2169
2170 #[cfg(feature = "block2")]
2171 /// Parameter `completionHandler`: Return the NFCNDEFStatus of the tag. capacity indicates the maximum NDEF message size in bytes that can be store on the tag.
2172 /// error returns a valid NSError object when query fails.
2173 ///
2174 ///
2175 /// Query the NDEF support status of the tag.
2176 #[unsafe(method(queryNDEFStatusWithCompletionHandler:))]
2177 #[unsafe(method_family = none)]
2178 unsafe fn queryNDEFStatusWithCompletionHandler(
2179 &self,
2180 completion_handler: &block2::DynBlock<dyn Fn(NFCNDEFStatus, NSUInteger, *mut NSError)>,
2181 );
2182
2183 #[cfg(feature = "block2")]
2184 /// Parameter `completionHandler`: Returns the NDEF message from read operation. Successful read would return a valid NFCNDEFMessage object with NSError object set to nil;
2185 /// read failure returns a nil NFCNDEFMessage and a valid NSError object.
2186 ///
2187 ///
2188 /// Reads NDEF message from the tag.
2189 #[unsafe(method(readNDEFWithCompletionHandler:))]
2190 #[unsafe(method_family = none)]
2191 unsafe fn readNDEFWithCompletionHandler(
2192 &self,
2193 completion_handler: &block2::DynBlock<dyn Fn(*mut NFCNDEFMessage, *mut NSError)>,
2194 );
2195
2196 #[cfg(feature = "block2")]
2197 /// Parameter `completionHandler`: Returns operation status. A nil NSError object indicates a successful write operation.
2198 ///
2199 ///
2200 /// Writes a NDEF message to the tag.
2201 #[unsafe(method(writeNDEF:completionHandler:))]
2202 #[unsafe(method_family = none)]
2203 unsafe fn writeNDEF_completionHandler(
2204 &self,
2205 ndef_message: &NFCNDEFMessage,
2206 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
2207 );
2208
2209 #[cfg(feature = "block2")]
2210 /// Parameter `completionHandler`: Returns operation status. A nil NSError object indicates a successful lock operation.
2211 ///
2212 ///
2213 /// Locks the NDEF tag to read-only state; tag can no longer be written afterward. This is a permanent operation. A successful lock operation via this method
2214 /// will change the NFCNDEFStatus value of the tag to
2215 ///
2216 /// ```text
2217 /// NFCNDEFStatusReadOnly @link/.
2218 ///
2219 ///
2220 /// ```
2221 #[unsafe(method(writeLockWithCompletionHandler:))]
2222 #[unsafe(method_family = none)]
2223 unsafe fn writeLockWithCompletionHandler(
2224 &self,
2225 completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
2226 );
2227 }
2228);
2229
2230/// Request code parameter for the polling command
2231///
2232/// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcfelicapollingrequestcode?language=objc)
2233// NS_ENUM
2234#[repr(transparent)]
2235#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2236pub struct NFCFeliCaPollingRequestCode(pub NSInteger);
2237impl NFCFeliCaPollingRequestCode {
2238 #[doc(alias = "NFCFeliCaPollingRequestCodeNoRequest")]
2239 pub const NoRequest: Self = Self(0);
2240 #[doc(alias = "NFCFeliCaPollingRequestCodeSystemCode")]
2241 pub const SystemCode: Self = Self(1);
2242 #[doc(alias = "NFCFeliCaPollingRequestCodeCommunicationPerformance")]
2243 pub const CommunicationPerformance: Self = Self(2);
2244 #[deprecated]
2245 pub const PollingRequestCodeNoRequest: Self = Self(NFCFeliCaPollingRequestCode::NoRequest.0);
2246 #[deprecated]
2247 pub const PollingRequestCodeSystemCode: Self = Self(NFCFeliCaPollingRequestCode::SystemCode.0);
2248 #[deprecated]
2249 pub const PollingRequestCodeCommunicationPerformance: Self =
2250 Self(NFCFeliCaPollingRequestCode::CommunicationPerformance.0);
2251}
2252
2253unsafe impl Encode for NFCFeliCaPollingRequestCode {
2254 const ENCODING: Encoding = NSInteger::ENCODING;
2255}
2256
2257unsafe impl RefEncode for NFCFeliCaPollingRequestCode {
2258 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2259}
2260
2261/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/pollingrequestcode?language=objc)
2262#[deprecated]
2263pub type PollingRequestCode = NFCFeliCaPollingRequestCode;
2264
2265/// Time slot parameter for the polling command
2266///
2267/// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcfelicapollingtimeslot?language=objc)
2268// NS_ENUM
2269#[repr(transparent)]
2270#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2271pub struct NFCFeliCaPollingTimeSlot(pub NSInteger);
2272impl NFCFeliCaPollingTimeSlot {
2273 #[doc(alias = "NFCFeliCaPollingTimeSlotMax1")]
2274 pub const Max1: Self = Self(0);
2275 #[doc(alias = "NFCFeliCaPollingTimeSlotMax2")]
2276 pub const Max2: Self = Self(1);
2277 #[doc(alias = "NFCFeliCaPollingTimeSlotMax4")]
2278 pub const Max4: Self = Self(3);
2279 #[doc(alias = "NFCFeliCaPollingTimeSlotMax8")]
2280 pub const Max8: Self = Self(7);
2281 #[doc(alias = "NFCFeliCaPollingTimeSlotMax16")]
2282 pub const Max16: Self = Self(15);
2283 #[deprecated]
2284 pub const PollingTimeSlotMax1: Self = Self(NFCFeliCaPollingTimeSlot::Max1.0);
2285 #[deprecated]
2286 pub const PollingTimeSlotMax2: Self = Self(NFCFeliCaPollingTimeSlot::Max2.0);
2287 #[deprecated]
2288 pub const PollingTimeSlotMax4: Self = Self(NFCFeliCaPollingTimeSlot::Max4.0);
2289 #[deprecated]
2290 pub const PollingTimeSlotMax8: Self = Self(NFCFeliCaPollingTimeSlot::Max8.0);
2291 #[deprecated]
2292 pub const PollingTimeSlotMax16: Self = Self(NFCFeliCaPollingTimeSlot::Max16.0);
2293}
2294
2295unsafe impl Encode for NFCFeliCaPollingTimeSlot {
2296 const ENCODING: Encoding = NSInteger::ENCODING;
2297}
2298
2299unsafe impl RefEncode for NFCFeliCaPollingTimeSlot {
2300 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2301}
2302
2303/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/pollingtimeslot?language=objc)
2304#[deprecated]
2305pub type PollingTimeSlot = NFCFeliCaPollingTimeSlot;
2306
2307/// Encryption Identifier parameter in response of Request Service V2
2308///
2309/// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcfelicaencryptionid?language=objc)
2310// NS_ENUM
2311#[repr(transparent)]
2312#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2313pub struct NFCFeliCaEncryptionId(pub NSInteger);
2314impl NFCFeliCaEncryptionId {
2315 #[doc(alias = "NFCFeliCaEncryptionIdAES")]
2316 pub const AES: Self = Self(0x4F);
2317 #[doc(alias = "NFCFeliCaEncryptionIdAES_DES")]
2318 pub const AES_DES: Self = Self(0x41);
2319 #[deprecated]
2320 pub const EncryptionIdAES: Self = Self(NFCFeliCaEncryptionId::AES.0);
2321 #[deprecated]
2322 pub const EncryptionIdAES_DES: Self = Self(NFCFeliCaEncryptionId::AES_DES.0);
2323}
2324
2325unsafe impl Encode for NFCFeliCaEncryptionId {
2326 const ENCODING: Encoding = NSInteger::ENCODING;
2327}
2328
2329unsafe impl RefEncode for NFCFeliCaEncryptionId {
2330 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2331}
2332
2333/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/encryptionid?language=objc)
2334#[deprecated]
2335pub type EncryptionId = NFCFeliCaEncryptionId;
2336
2337extern_protocol!(
2338 /// A
2339 ///
2340 /// ```text
2341 /// NFCTagReaderSession @link/ reader session returns an instance conforming to this protocol
2342 /// when a FeliCa tag is detected. Unless it is specified all block completion handlers are dispatched on the
2343 /// session work queue that is associated with the tag. Your process requires to include the
2344 /// "com.apple.developer.nfc.readersession.formats" entitlement and the "com.apple.developer.nfc.readersession.felica.systemcodes"
2345 /// key in the application's Info.plist to receive this tag object from the @link NFCTagReaderSessionDelegate @link/ delegate.
2346 /// @link NFCReaderErrorSecurityViolation @link/ will be returned from the @link NFCTagReaderSessionDelegate @link/ invalidation
2347 /// method if the required entitlement is missing or "com.apple.developer.nfc.readersession.felica.systemcodes" does not contain
2348 /// at least one valid entry.
2349 /// When the reader discovers a FeliCa tag it automatically performs a Polling command using the system code values provided in the
2350 /// "com.apple.developer.nfc.readersession.felica.systemcodes" in the specified array order. System code
2351 /// specified in the array must not contain a wildcard value (0xFF) in the upper or the lower byte, i.e. full
2352 /// matching value is required. The tag is returned from the [NFCTagReaderSessionDelegate readerSession:didDetectTags:] call
2353 /// on the first successful Polling command matching one of the system codes. Tag will not be returned
2354 /// to the NFCTagReaderSessionDelegate if no matching system is found based on entries listed in the Info.plist.
2355 /// Tag must be in the connected state for NFCNDEFTag protocol properties and methods to work correctly.
2356 ///
2357 ///
2358 /// ```
2359 ///
2360 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcfelicatag?language=objc)
2361 pub unsafe trait NFCFeliCaTag: NFCTag + NFCNDEFTag {
2362 /// This will match one of the entries in the "com.apple.developer.nfc.readersession.felica.systemcodes"
2363 /// in the Info.plist.
2364 #[unsafe(method(currentSystemCode))]
2365 #[unsafe(method_family = none)]
2366 unsafe fn currentSystemCode(&self) -> Retained<NSData>;
2367
2368 /// It will be empty if system selection fails.
2369 #[unsafe(method(currentIDm))]
2370 #[unsafe(method_family = none)]
2371 unsafe fn currentIDm(&self) -> Retained<NSData>;
2372
2373 #[cfg(feature = "block2")]
2374 /// Parameter `systemCode`: Designation of System Code. Wildcard value (0xFF) in the upper or the lower byte is not supported.
2375 ///
2376 /// Parameter `requestCode`: Designation of Request Data output.
2377 ///
2378 /// Parameter `timeSlot`: Maximum number of slots possible to respond.
2379 ///
2380 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation
2381 /// succeeds, else all other return values shall be ignored. Non-zero length requestData is return when
2382 /// requestCode is a non-zero parameter and feature is supported by the tag. The
2383 ///
2384 /// ```text
2385 /// currentIDM @link/ property will be updated
2386 /// on each execution, except when an invalid systemCode is provided and the existing selected system will stay selected.
2387 ///
2388 /// @discussion Polling command defined by FeliCa card specification. Refer to the FeliCa specification for details.
2389 /// System code must be one of the provided values in the "com.apple.developer.nfc.readersession.felica.systemcodes"
2390 /// in the Info.plist; @link NFCReaderErrorSecurityViolation @link/ will be returned when an invalid system code is used.
2391 /// Polling with wildcard value in the upper or lower byte is not supported.
2392 ///
2393 ///
2394 /// ```
2395 #[unsafe(method(pollingWithSystemCode:requestCode:timeSlot:completionHandler:))]
2396 #[unsafe(method_family = none)]
2397 unsafe fn pollingWithSystemCode_requestCode_timeSlot_completionHandler(
2398 &self,
2399 system_code: &NSData,
2400 request_code: NFCFeliCaPollingRequestCode,
2401 time_slot: NFCFeliCaPollingTimeSlot,
2402 completion_handler: &block2::DynBlock<
2403 dyn Fn(NonNull<NSData>, NonNull<NSData>, *mut NSError),
2404 >,
2405 );
2406
2407 #[cfg(feature = "block2")]
2408 /// Parameter `nodeCodeList`: Node Code list represented in a NSArray of NSData objects. Number of nodes specified should be between 1 to 32 inclusive.
2409 /// Each node code should be 2 bytes stored in Little Endian format.
2410 ///
2411 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation succeeds,
2412 /// else all other return values shall be ignored. Node key version list is return as NSArray of NSData objects,
2413 /// and each data object is stored in Little Endian format per FeliCa specification.
2414 ///
2415 ///
2416 /// Request Service command defined by FeliCa card specification. Refer to the FeliCa specification for details.
2417 #[unsafe(method(requestServiceWithNodeCodeList:completionHandler:))]
2418 #[unsafe(method_family = none)]
2419 unsafe fn requestServiceWithNodeCodeList_completionHandler(
2420 &self,
2421 node_code_list: &NSArray<NSData>,
2422 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSData>>, *mut NSError)>,
2423 );
2424
2425 #[cfg(feature = "block2")]
2426 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation succeeds,
2427 /// else all other return values shall be ignored. Valid mode value ranges from 0 to 3 inclusively.
2428 ///
2429 ///
2430 /// Request Response command defined by FeliCa card specification. Refer to the FeliCa specification for details.
2431 #[unsafe(method(requestResponseWithCompletionHandler:))]
2432 #[unsafe(method_family = none)]
2433 unsafe fn requestResponseWithCompletionHandler(
2434 &self,
2435 completion_handler: &block2::DynBlock<dyn Fn(NSInteger, *mut NSError)>,
2436 );
2437
2438 #[cfg(feature = "block2")]
2439 /// Parameter `serviceCodeList`: Service Code list represented in a NSArray of NSData objects. Number of nodes specified should be between 1 to 16 inclusive.
2440 /// Each service code should be 2 bytes stored in Little Endian format.
2441 ///
2442 /// Parameter `blockList`: Block List represent in a NSArray of NSData objects. 2-Byte or 3-Byte block list element is supported.
2443 ///
2444 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation succeeds,
2445 /// else all other return values shall be ignored. Valid read data blocks (block length of 16 bytes)
2446 /// are returned in NSArray of NSData objects when Status Flag 1 equals zero.
2447 ///
2448 ///
2449 /// Read Without Encryption command defined by FeliCa card specification. Refer to the FeliCa specification for details.
2450 #[unsafe(method(readWithoutEncryptionWithServiceCodeList:blockList:completionHandler:))]
2451 #[unsafe(method_family = none)]
2452 unsafe fn readWithoutEncryptionWithServiceCodeList_blockList_completionHandler(
2453 &self,
2454 service_code_list: &NSArray<NSData>,
2455 block_list: &NSArray<NSData>,
2456 completion_handler: &block2::DynBlock<
2457 dyn Fn(NSInteger, NSInteger, NonNull<NSArray<NSData>>, *mut NSError),
2458 >,
2459 );
2460
2461 #[cfg(feature = "block2")]
2462 /// Parameter `serviceCodeList`: Service Code list represented in a NSArray of NSData objects. Number of nodes specified should be between 1 to 16 inclusive.
2463 /// Each service code should be 2 bytes stored in Little Endian format.
2464 ///
2465 /// Parameter `blockList`: Block List represent in a NSArray of NSData objects. Total blockList items and blockData items should match.
2466 /// 2-Byte or 3-Byte block list element is supported.
2467 ///
2468 /// Parameter `blockData`: Block data represent in a NSArray of NSData objects. Total blockList items and blockData items should match.
2469 /// Data block should be 16 bytes in length.
2470 ///
2471 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation succeeds,
2472 /// else all other return values shall be ignored.
2473 ///
2474 ///
2475 /// Write Without Encryption command defined by FeliCa card specification. Refer to the FeliCa specification for details.
2476 #[unsafe(method(writeWithoutEncryptionWithServiceCodeList:blockList:blockData:completionHandler:))]
2477 #[unsafe(method_family = none)]
2478 unsafe fn writeWithoutEncryptionWithServiceCodeList_blockList_blockData_completionHandler(
2479 &self,
2480 service_code_list: &NSArray<NSData>,
2481 block_list: &NSArray<NSData>,
2482 block_data: &NSArray<NSData>,
2483 completion_handler: &block2::DynBlock<dyn Fn(NSInteger, NSInteger, *mut NSError)>,
2484 );
2485
2486 #[cfg(feature = "block2")]
2487 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation succeeds,
2488 /// else all other return values shall be ignored. Each system code is 2 bytes stored in Little Endian format.
2489 ///
2490 ///
2491 /// Request System Code command defined by FeliCa card specification. Refer to the FeliCa specification for details.
2492 #[unsafe(method(requestSystemCodeWithCompletionHandler:))]
2493 #[unsafe(method_family = none)]
2494 unsafe fn requestSystemCodeWithCompletionHandler(
2495 &self,
2496 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSData>>, *mut NSError)>,
2497 );
2498
2499 #[cfg(feature = "block2")]
2500 /// Parameter `nodeCodeList`: Node Code list represent in a NSArray of NSData. Number of nodes specified should be between 1 to 32 inclusive.
2501 /// Each node code should be 2 bytes stored in Little Endian format.
2502 ///
2503 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation succeeds,
2504 /// else all other return values shall be ignored. encryptionIdentifier value shall be ignored if Status Flag 1 value indicates an error.
2505 /// nodeKeyVersionListAES and nodeKeyVersionListDES may be empty depending on the Status Flag 1 value and the Encryption Identifier value.
2506 /// The 2 bytes node key version (AES and DES) is in Little Endian format.
2507 ///
2508 ///
2509 /// Request Service V2 command defined by FeliCa card specification. Refer to the FeliCa specification for details.
2510 #[unsafe(method(requestServiceV2WithNodeCodeList:completionHandler:))]
2511 #[unsafe(method_family = none)]
2512 unsafe fn requestServiceV2WithNodeCodeList_completionHandler(
2513 &self,
2514 node_code_list: &NSArray<NSData>,
2515 completion_handler: &block2::DynBlock<
2516 dyn Fn(
2517 NSInteger,
2518 NSInteger,
2519 NFCFeliCaEncryptionId,
2520 NonNull<NSArray<NSData>>,
2521 NonNull<NSArray<NSData>>,
2522 *mut NSError,
2523 ),
2524 >,
2525 );
2526
2527 #[cfg(feature = "block2")]
2528 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation succeeds,
2529 /// else all other return values shall be ignored. basicVersion and optionVersion may be empty depending on the Status Flag 1 value
2530 /// and if the tag supports AES/DES.
2531 ///
2532 ///
2533 /// Request Specification Version command defined by FeliCa card specification. This command supports response format version `00`h.
2534 /// Refer to the FeliCa specification for details.
2535 #[unsafe(method(requestSpecificationVersionWithCompletionHandler:))]
2536 #[unsafe(method_family = none)]
2537 unsafe fn requestSpecificationVersionWithCompletionHandler(
2538 &self,
2539 completion_handler: &block2::DynBlock<
2540 dyn Fn(NSInteger, NSInteger, NonNull<NSData>, NonNull<NSData>, *mut NSError),
2541 >,
2542 );
2543
2544 #[cfg(feature = "block2")]
2545 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if the contactless transceive operation succeeds,
2546 /// else all other return values shall be ignored.
2547 ///
2548 ///
2549 /// Reset Mode command defined by FeliCa card specification. Refer to the FeliCa specification for details.
2550 #[unsafe(method(resetModeWithCompletionHandler:))]
2551 #[unsafe(method_family = none)]
2552 unsafe fn resetModeWithCompletionHandler(
2553 &self,
2554 completion_handler: &block2::DynBlock<dyn Fn(NSInteger, NSInteger, *mut NSError)>,
2555 );
2556
2557 #[cfg(feature = "block2")]
2558 /// Parameter `commandPacket`: Command packet send to the FeliCa card. Maximum packet length is 254. Data length (LEN) byte and CRC bytes are calculated and inserted
2559 /// automatically to the provided packet data frame.
2560 ///
2561 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
2562 /// A
2563 ///
2564 /// ```text
2565 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag.
2566 ///
2567 /// @discussion Transmission of FeliCa Command Packet Data at the application layer. Refer to the FeliCa specification for details.
2568 /// Manufacturer ID (IDm) of the currently selected system can be read from the currentIDm property.
2569 ///
2570 ///
2571 /// ```
2572 #[unsafe(method(sendFeliCaCommandPacket:completionHandler:))]
2573 #[unsafe(method_family = none)]
2574 unsafe fn sendFeliCaCommandPacket_completionHandler(
2575 &self,
2576 command_packet: &NSData,
2577 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, *mut NSError)>,
2578 );
2579 }
2580);
2581
2582extern_class!(
2583 /// ISO7816 Application Data Unit (APDU).
2584 ///
2585 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso7816apdu?language=objc)
2586 #[unsafe(super(NSObject))]
2587 #[derive(Debug, PartialEq, Eq, Hash)]
2588 pub struct NFCISO7816APDU;
2589);
2590
2591extern_conformance!(
2592 unsafe impl NSCopying for NFCISO7816APDU {}
2593);
2594
2595unsafe impl CopyingHelper for NFCISO7816APDU {
2596 type Result = Self;
2597}
2598
2599extern_conformance!(
2600 unsafe impl NSObjectProtocol for NFCISO7816APDU {}
2601);
2602
2603impl NFCISO7816APDU {
2604 extern_methods!(
2605 #[unsafe(method(instructionClass))]
2606 #[unsafe(method_family = none)]
2607 pub unsafe fn instructionClass(&self) -> u8;
2608
2609 #[unsafe(method(instructionCode))]
2610 #[unsafe(method_family = none)]
2611 pub unsafe fn instructionCode(&self) -> u8;
2612
2613 #[unsafe(method(p1Parameter))]
2614 #[unsafe(method_family = none)]
2615 pub unsafe fn p1Parameter(&self) -> u8;
2616
2617 #[unsafe(method(p2Parameter))]
2618 #[unsafe(method_family = none)]
2619 pub unsafe fn p2Parameter(&self) -> u8;
2620
2621 #[unsafe(method(data))]
2622 #[unsafe(method_family = none)]
2623 pub unsafe fn data(&self) -> Option<Retained<NSData>>;
2624
2625 #[unsafe(method(expectedResponseLength))]
2626 #[unsafe(method_family = none)]
2627 pub unsafe fn expectedResponseLength(&self) -> NSInteger;
2628
2629 #[unsafe(method(init))]
2630 #[unsafe(method_family = init)]
2631 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2632
2633 /// Parameter `instructionClass`: Instruction class (CLA) byte
2634 ///
2635 /// Parameter `instructionCode`: Instruction code (INS) byte
2636 ///
2637 /// Parameter `p1Parameter`: P1 parameter byte
2638 ///
2639 /// Parameter `p2Parameter`: P2 parameter byte
2640 ///
2641 /// Parameter `data`: Data to transmit. Value of Lc field is set according to the data size.
2642 ///
2643 /// Parameter `expectedResponseLength`: Response data length (Le) in bytes. Valid range is from 1 to 65536 inclusively;
2644 /// -1 means no response data field is expected. Use 256 if you want to send '00' as the short Le field
2645 /// assuming the data field is less than 256 bytes. Use 65536 if you want to send '0000' as the extended
2646 /// Le field.
2647 ///
2648 ///
2649 /// Generates an ISO7816 APDU object. The Lc value is generated base on the size of the data object; possible value ranges from
2650 /// 1 to 65535 inclusively. Use
2651 ///
2652 /// ```text
2653 /// -initWithData: @link/ in cases where a finer control on the APDU format is required.
2654 ///
2655 ///
2656 /// ```
2657 #[unsafe(method(initWithInstructionClass:instructionCode:p1Parameter:p2Parameter:data:expectedResponseLength:))]
2658 #[unsafe(method_family = init)]
2659 pub unsafe fn initWithInstructionClass_instructionCode_p1Parameter_p2Parameter_data_expectedResponseLength(
2660 this: Allocated<Self>,
2661 instruction_class: u8,
2662 instruction_code: u8,
2663 p1_parameter: u8,
2664 p2_parameter: u8,
2665 data: &NSData,
2666 expected_response_length: NSInteger,
2667 ) -> Retained<Self>;
2668
2669 /// Parameter `data`: Data buffer containing the full APDU.
2670 ///
2671 ///
2672 /// Returns: nil if input data does not contain a valid APDU.
2673 #[unsafe(method(initWithData:))]
2674 #[unsafe(method_family = init)]
2675 pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Option<Retained<Self>>;
2676 );
2677}
2678
2679/// Methods declared on superclass `NSObject`.
2680impl NFCISO7816APDU {
2681 extern_methods!(
2682 #[unsafe(method(new))]
2683 #[unsafe(method_family = new)]
2684 pub unsafe fn new() -> Retained<Self>;
2685 );
2686}
2687
2688extern_protocol!(
2689 /// A
2690 ///
2691 /// ```text
2692 /// NFCTagReaderSession @link/ reader session returns an instance conforming to this protocol
2693 /// when an ISO7816 compatible tag is detected. Unless it is specified all block completion handlers are dispatched on the
2694 /// session work queue that is associated with the tag. Your process requires to include the
2695 /// "com.apple.developer.nfc.readersession.formats" entitlement and the "com.apple.developer.nfc.readersession.iso7816.select-identifiers"
2696 /// key in the application's Info.plist to receive this tag object from the @link NFCTagReaderSessionDelegate @link/ delegate.
2697 /// @link NFCReaderErrorSecurityViolation @link/ will be returned from the @link NFCTagReaderSessionDelegate @link/ invalidation
2698 /// method if the required entitlement is missing or "com.apple.developer.nfc.readersession.iso7816.select-identifiers" does not contain
2699 /// at least one valid entry.
2700 /// When the reader discovered a compatible ISO7816 tag it automatically performs a SELECT command (by DF name) using the values provided in
2701 /// "com.apple.developer.nfc.readersession.iso7816.select-identifiers" in the specified array order. The tag is
2702 /// returned from the [NFCTagReaderSessionDelegate readerSession:didDetectTags:] call on the first successful SELECT command.
2703 /// The initialSelectedAID property returns the application identifier of the selected application. Tag will not be returned
2704 /// to the NFCTagReaderSessionDelegate if no application described in "com.apple.developer.nfc.readersession.iso7816.select-identifiers"
2705 /// is found. Tag must be in the connected state for NFCNDEFTag protocol properties and methods to work correctly.
2706 ///
2707 ///
2708 ///
2709 /// ```
2710 ///
2711 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfciso7816tag?language=objc)
2712 pub unsafe trait NFCISO7816Tag: NFCTag + NFCNDEFTag {
2713 /// This will match one of the entries in the "com.apple.developer.nfc.readersession.iso7816.select-identifiers"
2714 /// in the Info.plist.
2715 #[unsafe(method(initialSelectedAID))]
2716 #[unsafe(method_family = none)]
2717 unsafe fn initialSelectedAID(&self) -> Retained<NSString>;
2718
2719 /// The hardware UID of the tag.
2720 #[unsafe(method(identifier))]
2721 #[unsafe(method_family = none)]
2722 unsafe fn identifier(&self) -> Retained<NSData>;
2723
2724 /// The optional historical bytes extracted from the Type A Answer To Select response.
2725 #[unsafe(method(historicalBytes))]
2726 #[unsafe(method_family = none)]
2727 unsafe fn historicalBytes(&self) -> Option<Retained<NSData>>;
2728
2729 /// The optional Application Data bytes extracted from the Type B Answer To Request response.
2730 #[unsafe(method(applicationData))]
2731 #[unsafe(method_family = none)]
2732 unsafe fn applicationData(&self) -> Option<Retained<NSData>>;
2733
2734 /// Indicates if
2735 ///
2736 /// ```text
2737 /// applicationData @link/ follows proprietary data coding. If false, the format of the application data is
2738 /// defined in the ISO14443-3 specification.
2739 ///
2740 ///
2741 /// ```
2742 #[unsafe(method(proprietaryApplicationDataCoding))]
2743 #[unsafe(method_family = none)]
2744 unsafe fn proprietaryApplicationDataCoding(&self) -> bool;
2745
2746 #[cfg(feature = "block2")]
2747 /// Parameter `apdu`: The command APDU object
2748 ///
2749 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
2750 /// A
2751 ///
2752 /// ```text
2753 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag. responseData may be
2754 /// empty. Command processing status bytes (SW1-SW2) are always valid.
2755 ///
2756 /// @discussion Send a command APDU to the tag and receives a response APDU. Note that a SELECT command with a P1 value of 0x04 (selection by DF name)
2757 /// will be checked against the values listed in the "com.apple.developer.nfc.readersession.iso7816.select-identifiers" in the Info.plist.
2758 /// Selecting an application outside of the permissible list will result in a NFCReaderErrorSecurityViolation error.
2759 ///
2760 ///
2761 /// ```
2762 #[unsafe(method(sendCommandAPDU:completionHandler:))]
2763 #[unsafe(method_family = none)]
2764 unsafe fn sendCommandAPDU_completionHandler(
2765 &self,
2766 apdu: &NFCISO7816APDU,
2767 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, u8, u8, *mut NSError)>,
2768 );
2769 }
2770);
2771
2772/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcmifarefamily?language=objc)
2773// NS_ENUM
2774#[repr(transparent)]
2775#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2776pub struct NFCMiFareFamily(pub NSUInteger);
2777impl NFCMiFareFamily {
2778 #[doc(alias = "NFCMiFareUnknown")]
2779 pub const Unknown: Self = Self(1);
2780 #[doc(alias = "NFCMiFareUltralight")]
2781 pub const Ultralight: Self = Self(2);
2782 #[doc(alias = "NFCMiFarePlus")]
2783 pub const Plus: Self = Self(3);
2784 #[doc(alias = "NFCMiFareDESFire")]
2785 pub const DESFire: Self = Self(4);
2786}
2787
2788unsafe impl Encode for NFCMiFareFamily {
2789 const ENCODING: Encoding = NSUInteger::ENCODING;
2790}
2791
2792unsafe impl RefEncode for NFCMiFareFamily {
2793 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2794}
2795
2796extern_protocol!(
2797 /// A
2798 ///
2799 /// ```text
2800 /// NFCTagReaderSession @link/ reader session returns an instance conforming to this protocol when a MiFare tag is detected. Unless it is specified
2801 /// all block completion handlers are dispatched on the session work queue that is associated with the tag. Your process requires to include the
2802 /// "com.apple.developer.nfc.readersession.formats" entitlement to receive this tag object from the @link NFCTagReaderSessionDelegate @link/ delegate.
2803 /// Tag must be in the connected state for NFCNDEFTag protocol properties and methods to work correctly.
2804 /// @link NFCReaderErrorSecurityViolation @link/ will be returned from the @link NFCTagReaderSessionDelegate @link/ invalidation method if the required entitlement
2805 /// is missing when session is started.
2806 ///
2807 ///
2808 /// ```
2809 ///
2810 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcmifaretag?language=objc)
2811 pub unsafe trait NFCMiFareTag: NFCTag + NFCNDEFTag {
2812 #[unsafe(method(mifareFamily))]
2813 #[unsafe(method_family = none)]
2814 unsafe fn mifareFamily(&self) -> NFCMiFareFamily;
2815
2816 /// The hardware UID of the tag.
2817 #[unsafe(method(identifier))]
2818 #[unsafe(method_family = none)]
2819 unsafe fn identifier(&self) -> Retained<NSData>;
2820
2821 /// The optional historical bytes extracted from the Answer To Select response.
2822 #[unsafe(method(historicalBytes))]
2823 #[unsafe(method_family = none)]
2824 unsafe fn historicalBytes(&self) -> Option<Retained<NSData>>;
2825
2826 #[cfg(feature = "block2")]
2827 /// Parameter `command`: The complete MiFare command. CRC bytes are calculated and inserted automatically to the provided packet data frame.
2828 ///
2829 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds. A
2830 ///
2831 /// ```text
2832 /// NFCErrorDomain @link/ error
2833 /// is returned when there is a communication issue with the tag. Successfully read data blocks will be returned from the NSData object.
2834 ///
2835 /// @discussion Send native MIFARE command to a tag. Support MIFARE UltraLight, Plus, and DESFire products.
2836 /// Crypto1 protocol is not supported. Command chaining is handled internally by the method and the full response composed of the
2837 /// individual fragment is returned in the completion handler.
2838 ///
2839 ///
2840 /// ```
2841 #[unsafe(method(sendMiFareCommand:completionHandler:))]
2842 #[unsafe(method_family = none)]
2843 unsafe fn sendMiFareCommand_completionHandler(
2844 &self,
2845 command: &NSData,
2846 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, *mut NSError)>,
2847 );
2848
2849 #[cfg(feature = "block2")]
2850 /// Parameter `apdu`: The ISO7816-4 command APDU object.
2851 ///
2852 /// Parameter `completionHandler`: Completion handler called when the operation is completed. error is nil if operation succeeds.
2853 /// A
2854 ///
2855 /// ```text
2856 /// NFCErrorDomain @link/ error is returned when there is a communication issue with the tag or tag does not support ISO7816-4 commands,
2857 /// and all other parameters should be ignore.
2858 ///
2859 /// @discussion Send a ISO7816 command APDU to the tag and receives a response APDU. Only available when @link mifareFamily @link/ returns NFCMiFarePlus, NFCMiFareDESFire.
2860 ///
2861 ///
2862 /// ```
2863 #[unsafe(method(sendMiFareISO7816Command:completionHandler:))]
2864 #[unsafe(method_family = none)]
2865 unsafe fn sendMiFareISO7816Command_completionHandler(
2866 &self,
2867 apdu: &NFCISO7816APDU,
2868 completion_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>, u8, u8, *mut NSError)>,
2869 );
2870 }
2871);
2872
2873/// Type Name Format value defined by NFC Data Exchange Format (NDEF) Technical Specification
2874/// from NFC Forum.
2875///
2876/// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfctypenameformat?language=objc)
2877// NS_ENUM
2878#[repr(transparent)]
2879#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2880pub struct NFCTypeNameFormat(pub u8);
2881impl NFCTypeNameFormat {
2882 #[doc(alias = "NFCTypeNameFormatEmpty")]
2883 pub const Empty: Self = Self(0x00);
2884 #[doc(alias = "NFCTypeNameFormatNFCWellKnown")]
2885 pub const NFCWellKnown: Self = Self(0x01);
2886 #[doc(alias = "NFCTypeNameFormatMedia")]
2887 pub const Media: Self = Self(0x02);
2888 #[doc(alias = "NFCTypeNameFormatAbsoluteURI")]
2889 pub const AbsoluteURI: Self = Self(0x03);
2890 #[doc(alias = "NFCTypeNameFormatNFCExternal")]
2891 pub const NFCExternal: Self = Self(0x04);
2892 #[doc(alias = "NFCTypeNameFormatUnknown")]
2893 pub const Unknown: Self = Self(0x05);
2894 #[doc(alias = "NFCTypeNameFormatUnchanged")]
2895 pub const Unchanged: Self = Self(0x06);
2896}
2897
2898unsafe impl Encode for NFCTypeNameFormat {
2899 const ENCODING: Encoding = u8::ENCODING;
2900}
2901
2902unsafe impl RefEncode for NFCTypeNameFormat {
2903 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2904}
2905
2906extern_class!(
2907 /// A NDEF message payload consists of Type Name Format, Type, Payload Identifier, and Payload data.
2908 /// The NDEF payload cannot result into a record that is greater than 128KB in size.
2909 ///
2910 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcndefpayload?language=objc)
2911 #[unsafe(super(NSObject))]
2912 #[derive(Debug, PartialEq, Eq, Hash)]
2913 pub struct NFCNDEFPayload;
2914);
2915
2916extern_conformance!(
2917 unsafe impl NSCoding for NFCNDEFPayload {}
2918);
2919
2920extern_conformance!(
2921 unsafe impl NSObjectProtocol for NFCNDEFPayload {}
2922);
2923
2924extern_conformance!(
2925 unsafe impl NSSecureCoding for NFCNDEFPayload {}
2926);
2927
2928impl NFCNDEFPayload {
2929 extern_methods!(
2930 #[unsafe(method(typeNameFormat))]
2931 #[unsafe(method_family = none)]
2932 pub unsafe fn typeNameFormat(&self) -> NFCTypeNameFormat;
2933
2934 /// Setter for [`typeNameFormat`][Self::typeNameFormat].
2935 #[unsafe(method(setTypeNameFormat:))]
2936 #[unsafe(method_family = none)]
2937 pub unsafe fn setTypeNameFormat(&self, type_name_format: NFCTypeNameFormat);
2938
2939 #[unsafe(method(type))]
2940 #[unsafe(method_family = none)]
2941 pub unsafe fn r#type(&self) -> Retained<NSData>;
2942
2943 /// Setter for [`type`][Self::type].
2944 ///
2945 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
2946 #[unsafe(method(setType:))]
2947 #[unsafe(method_family = none)]
2948 pub unsafe fn setType(&self, r#type: &NSData);
2949
2950 #[unsafe(method(identifier))]
2951 #[unsafe(method_family = none)]
2952 pub unsafe fn identifier(&self) -> Retained<NSData>;
2953
2954 /// Setter for [`identifier`][Self::identifier].
2955 ///
2956 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
2957 #[unsafe(method(setIdentifier:))]
2958 #[unsafe(method_family = none)]
2959 pub unsafe fn setIdentifier(&self, identifier: &NSData);
2960
2961 #[unsafe(method(payload))]
2962 #[unsafe(method_family = none)]
2963 pub unsafe fn payload(&self) -> Retained<NSData>;
2964
2965 /// Setter for [`payload`][Self::payload].
2966 ///
2967 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
2968 #[unsafe(method(setPayload:))]
2969 #[unsafe(method_family = none)]
2970 pub unsafe fn setPayload(&self, payload: &NSData);
2971
2972 #[unsafe(method(init))]
2973 #[unsafe(method_family = init)]
2974 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2975
2976 /// Parameter `format`: NFCTypeNameFormat value.
2977 ///
2978 /// Parameter `type`: Identifier describing the type of the payload. Empty data indicates field is absent from the payload.
2979 ///
2980 /// Parameter `identifier`: Identifier in the form of a URI reference. Empty data indicates field is absent from the payload.
2981 ///
2982 /// Parameter `payload`: Payload data. Empty data indicates field is absent from the payload.
2983 ///
2984 /// This initializer uses the maximum payload chunk size defined by the NFC NDEF specification, i.e. 2^32-1 octets.
2985 #[unsafe(method(initWithFormat:type:identifier:payload:))]
2986 #[unsafe(method_family = init)]
2987 pub unsafe fn initWithFormat_type_identifier_payload(
2988 this: Allocated<Self>,
2989 format: NFCTypeNameFormat,
2990 r#type: &NSData,
2991 identifier: &NSData,
2992 payload: &NSData,
2993 ) -> Retained<Self>;
2994
2995 /// Parameter `format`: NFCTypeNameFormat value.
2996 ///
2997 /// Parameter `type`: Identifier describing the type of the payload. Empty data indicates field is absent from the payload.
2998 ///
2999 /// Parameter `identifier`: Identifier in the form of a URI reference. Empty data indicates field is absent from the payload.
3000 ///
3001 /// Parameter `payload`: Payload data. Empty data indicates field is absent from the payload.
3002 ///
3003 /// Parameter `chunkSize`: Maximum size of a payload chunk. 0 means no chunking on the payload, i.e. payload is fit in a single record.
3004 #[unsafe(method(initWithFormat:type:identifier:payload:chunkSize:))]
3005 #[unsafe(method_family = init)]
3006 pub unsafe fn initWithFormat_type_identifier_payload_chunkSize(
3007 this: Allocated<Self>,
3008 format: NFCTypeNameFormat,
3009 r#type: &NSData,
3010 identifier: &NSData,
3011 payload: &NSData,
3012 chunk_size: usize,
3013 ) -> Retained<Self>;
3014 );
3015}
3016
3017/// Methods declared on superclass `NSObject`.
3018impl NFCNDEFPayload {
3019 extern_methods!(
3020 #[unsafe(method(new))]
3021 #[unsafe(method_family = new)]
3022 pub unsafe fn new() -> Retained<Self>;
3023 );
3024}
3025
3026/// ConvenienceHelpers.
3027impl NFCNDEFPayload {
3028 extern_methods!(
3029 /// Parameter `uri`: URI string. UTF-8 encoding representation will be used.
3030 ///
3031 ///
3032 /// Used for creating NDEF URI payloads which cannot be represented with NSURL object. These are URIs that contain characters
3033 /// such as 'ä' and 'ö' which cannot be represent by the 7 bits ASCII encoding.
3034 #[unsafe(method(wellKnownTypeURIPayloadWithString:))]
3035 #[unsafe(method_family = none)]
3036 pub unsafe fn wellKnownTypeURIPayloadWithString(uri: &NSString) -> Option<Retained<Self>>;
3037
3038 /// Parameter `url`: NSURL object.
3039 ///
3040 ///
3041 /// Preferred convenience function for creating NDEF URI payload with common URLs such as "https://www.apple.com" or "tel:+1-555-555-5555".
3042 #[unsafe(method(wellKnownTypeURIPayloadWithURL:))]
3043 #[unsafe(method_family = none)]
3044 pub unsafe fn wellKnownTypeURIPayloadWithURL(url: &NSURL) -> Option<Retained<Self>>;
3045
3046 /// Parameter `text`: Text message.
3047 ///
3048 /// Parameter `locale`: NSLocale object. IANA language code specified by the locale will be saved with the payload.
3049 #[unsafe(method(wellKnownTypeTextPayloadWithString:locale:))]
3050 #[unsafe(method_family = none)]
3051 pub unsafe fn wellKnownTypeTextPayloadWithString_locale(
3052 text: &NSString,
3053 locale: &NSLocale,
3054 ) -> Option<Retained<Self>>;
3055
3056 #[deprecated]
3057 #[unsafe(method(wellKnowTypeTextPayloadWithString:locale:))]
3058 #[unsafe(method_family = none)]
3059 pub unsafe fn wellKnowTypeTextPayloadWithString_locale(
3060 text: &NSString,
3061 locale: &NSLocale,
3062 ) -> Option<Retained<Self>>;
3063
3064 /// Returns: NSURL object base on a valid Well Known Type URI payload. nil if payload is not a URI.
3065 #[unsafe(method(wellKnownTypeURIPayload))]
3066 #[unsafe(method_family = none)]
3067 pub unsafe fn wellKnownTypeURIPayload(&self) -> Option<Retained<NSURL>>;
3068
3069 /// Parameter `locale`: Returns NSLocale object that is constructed from the IANA language code stored with the text payload.
3070 ///
3071 /// Returns: NSString object base on a valid Well Known Type Text payload. nil if payload is not a text.
3072 #[unsafe(method(wellKnownTypeTextPayloadWithLocale:))]
3073 #[unsafe(method_family = none)]
3074 pub unsafe fn wellKnownTypeTextPayloadWithLocale(
3075 &self,
3076 locale: &mut Option<Retained<NSLocale>>,
3077 ) -> Option<Retained<NSString>>;
3078 );
3079}
3080
3081extern_class!(
3082 /// A NDEF message consists of payload records. The maximum size of the NDEF message is limited to 128KB.
3083 ///
3084 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcndefmessage?language=objc)
3085 #[unsafe(super(NSObject))]
3086 #[derive(Debug, PartialEq, Eq, Hash)]
3087 pub struct NFCNDEFMessage;
3088);
3089
3090extern_conformance!(
3091 unsafe impl NSCoding for NFCNDEFMessage {}
3092);
3093
3094extern_conformance!(
3095 unsafe impl NSObjectProtocol for NFCNDEFMessage {}
3096);
3097
3098extern_conformance!(
3099 unsafe impl NSSecureCoding for NFCNDEFMessage {}
3100);
3101
3102impl NFCNDEFMessage {
3103 extern_methods!(
3104 /// Array of NFCNDEFPayload records contained in this message.
3105 #[unsafe(method(records))]
3106 #[unsafe(method_family = none)]
3107 pub unsafe fn records(&self) -> Retained<NSArray<NFCNDEFPayload>>;
3108
3109 /// Setter for [`records`][Self::records].
3110 ///
3111 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
3112 #[unsafe(method(setRecords:))]
3113 #[unsafe(method_family = none)]
3114 pub unsafe fn setRecords(&self, records: &NSArray<NFCNDEFPayload>);
3115
3116 /// Length of the resulting NDEF message in bytes as it would be stored on a NFC tag.
3117 #[unsafe(method(length))]
3118 #[unsafe(method_family = none)]
3119 pub unsafe fn length(&self) -> NSUInteger;
3120
3121 #[unsafe(method(init))]
3122 #[unsafe(method_family = init)]
3123 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3124
3125 /// Parameter `records`: NSArray of NFCNDEFPayload object. An empty array will create an empty NDEF message.
3126 #[unsafe(method(initWithNDEFRecords:))]
3127 #[unsafe(method_family = init)]
3128 pub unsafe fn initWithNDEFRecords(
3129 this: Allocated<Self>,
3130 records: &NSArray<NFCNDEFPayload>,
3131 ) -> Retained<Self>;
3132
3133 /// Parameter `data`: NSData storing raw bytes of a complete NDEF message. The data content will be validated; all NDEF payloads must
3134 /// be valid according to the NFC Forum NDEF RTD specification and it shall only contain a single NDEF message.
3135 #[unsafe(method(ndefMessageWithData:))]
3136 #[unsafe(method_family = none)]
3137 pub unsafe fn ndefMessageWithData(data: &NSData) -> Option<Retained<Self>>;
3138 );
3139}
3140
3141/// Methods declared on superclass `NSObject`.
3142impl NFCNDEFMessage {
3143 extern_methods!(
3144 #[unsafe(method(new))]
3145 #[unsafe(method_family = new)]
3146 pub unsafe fn new() -> Retained<Self>;
3147 );
3148}
3149
3150/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcvasmode?language=objc)
3151// NS_ENUM
3152#[repr(transparent)]
3153#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3154pub struct NFCVASMode(pub NSInteger);
3155impl NFCVASMode {
3156 #[doc(alias = "NFCVASModeURLOnly")]
3157 pub const URLOnly: Self = Self(0);
3158 #[doc(alias = "NFCVASModeNormal")]
3159 pub const Normal: Self = Self(1);
3160 #[deprecated]
3161 pub const VASModeURLOnly: Self = Self(NFCVASMode::URLOnly.0);
3162 #[deprecated]
3163 pub const VASModeNormal: Self = Self(NFCVASMode::Normal.0);
3164}
3165
3166unsafe impl Encode for NFCVASMode {
3167 const ENCODING: Encoding = NSInteger::ENCODING;
3168}
3169
3170unsafe impl RefEncode for NFCVASMode {
3171 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3172}
3173
3174/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/vasmode?language=objc)
3175#[deprecated]
3176pub type VASMode = NFCVASMode;
3177
3178extern_class!(
3179 /// Configuration for one GET VAS DATA command.
3180 ///
3181 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcvascommandconfiguration?language=objc)
3182 #[unsafe(super(NSObject))]
3183 #[derive(Debug, PartialEq, Eq, Hash)]
3184 pub struct NFCVASCommandConfiguration;
3185);
3186
3187extern_conformance!(
3188 unsafe impl NSCopying for NFCVASCommandConfiguration {}
3189);
3190
3191unsafe impl CopyingHelper for NFCVASCommandConfiguration {
3192 type Result = Self;
3193}
3194
3195extern_conformance!(
3196 unsafe impl NSObjectProtocol for NFCVASCommandConfiguration {}
3197);
3198
3199impl NFCVASCommandConfiguration {
3200 extern_methods!(
3201 /// VAS protocol mode.
3202 #[unsafe(method(mode))]
3203 #[unsafe(method_family = none)]
3204 pub unsafe fn mode(&self) -> NFCVASMode;
3205
3206 /// Setter for [`mode`][Self::mode].
3207 #[unsafe(method(setMode:))]
3208 #[unsafe(method_family = none)]
3209 pub unsafe fn setMode(&self, mode: NFCVASMode);
3210
3211 /// Wallet Pass Type Identifier of the Wallet Pass. The string value will be used to calculate the
3212 /// Merchant ID value for the GET VAS DATA command.
3213 #[unsafe(method(passTypeIdentifier))]
3214 #[unsafe(method_family = none)]
3215 pub unsafe fn passTypeIdentifier(&self) -> Retained<NSString>;
3216
3217 /// Setter for [`passTypeIdentifier`][Self::passTypeIdentifier].
3218 #[unsafe(method(setPassTypeIdentifier:))]
3219 #[unsafe(method_family = none)]
3220 pub unsafe fn setPassTypeIdentifier(&self, pass_type_identifier: &NSString);
3221
3222 /// Merchant URL object. Maximum length of the URL is 64 characters, including the schema.
3223 /// Set to nil to disable the merchant URL.
3224 #[unsafe(method(url))]
3225 #[unsafe(method_family = none)]
3226 pub unsafe fn url(&self) -> Option<Retained<NSURL>>;
3227
3228 /// Setter for [`url`][Self::url].
3229 #[unsafe(method(setUrl:))]
3230 #[unsafe(method_family = none)]
3231 pub unsafe fn setUrl(&self, url: Option<&NSURL>);
3232
3233 /// Parameter `mode`: VAS operation mode
3234 ///
3235 /// Parameter `passTypeIdentifier`: Pass type identifier of the Wallet pass.
3236 ///
3237 /// Parameter `url`: URL for VAR URL Only mode. Set to
3238 /// <i>
3239 /// nil
3240 /// </i>
3241 /// for VAS normal mode.
3242 #[unsafe(method(initWithVASMode:passTypeIdentifier:url:))]
3243 #[unsafe(method_family = init)]
3244 pub unsafe fn initWithVASMode_passTypeIdentifier_url(
3245 this: Allocated<Self>,
3246 mode: NFCVASMode,
3247 pass_type_identifier: &NSString,
3248 url: Option<&NSURL>,
3249 ) -> Retained<Self>;
3250 );
3251}
3252
3253/// Methods declared on superclass `NSObject`.
3254impl NFCVASCommandConfiguration {
3255 extern_methods!(
3256 #[unsafe(method(init))]
3257 #[unsafe(method_family = init)]
3258 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3259
3260 #[unsafe(method(new))]
3261 #[unsafe(method_family = new)]
3262 pub unsafe fn new() -> Retained<Self>;
3263 );
3264}
3265
3266/// Response APDU status word.
3267///
3268/// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcvaserrorcode?language=objc)
3269// NS_ENUM
3270#[repr(transparent)]
3271#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3272pub struct NFCVASErrorCode(pub NSInteger);
3273impl NFCVASErrorCode {
3274 #[doc(alias = "NFCVASErrorCodeSuccess")]
3275 pub const Success: Self = Self(0x9000);
3276 #[doc(alias = "NFCVASErrorCodeDataNotFound")]
3277 pub const DataNotFound: Self = Self(0x6A83);
3278 #[doc(alias = "NFCVASErrorCodeDataNotActivated")]
3279 pub const DataNotActivated: Self = Self(0x6287);
3280 #[doc(alias = "NFCVASErrorCodeWrongParameters")]
3281 pub const WrongParameters: Self = Self(0x6B00);
3282 #[doc(alias = "NFCVASErrorCodeWrongLCField")]
3283 pub const WrongLCField: Self = Self(0x6700);
3284 #[doc(alias = "NFCVASErrorCodeUserIntervention")]
3285 pub const UserIntervention: Self = Self(0x6984);
3286 #[doc(alias = "NFCVASErrorCodeIncorrectData")]
3287 pub const IncorrectData: Self = Self(0x6A80);
3288 #[doc(alias = "NFCVASErrorCodeUnsupportedApplicationVersion")]
3289 pub const UnsupportedApplicationVersion: Self = Self(0x6340);
3290 #[deprecated]
3291 pub const VASErrorCodeSuccess: Self = Self(NFCVASErrorCode::Success.0);
3292 #[deprecated]
3293 pub const VASErrorCodeDataNotFound: Self = Self(NFCVASErrorCode::DataNotFound.0);
3294 #[deprecated]
3295 pub const VASErrorCodeDataNotActivated: Self = Self(NFCVASErrorCode::DataNotActivated.0);
3296 #[deprecated]
3297 pub const VASErrorCodeWrongParameters: Self = Self(NFCVASErrorCode::WrongParameters.0);
3298 #[deprecated]
3299 pub const VASErrorCodeWrongLCField: Self = Self(NFCVASErrorCode::WrongLCField.0);
3300 #[deprecated]
3301 pub const VASErrorCodeUserIntervention: Self = Self(NFCVASErrorCode::UserIntervention.0);
3302 #[deprecated]
3303 pub const VASErrorCodeIncorrectData: Self = Self(NFCVASErrorCode::IncorrectData.0);
3304 #[deprecated]
3305 pub const VASErrorCodeUnsupportedApplicationVersion: Self =
3306 Self(NFCVASErrorCode::UnsupportedApplicationVersion.0);
3307}
3308
3309unsafe impl Encode for NFCVASErrorCode {
3310 const ENCODING: Encoding = NSInteger::ENCODING;
3311}
3312
3313unsafe impl RefEncode for NFCVASErrorCode {
3314 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3315}
3316
3317/// [Apple's documentation](https://developer.apple.com/documentation/corenfc/vaserrorcode?language=objc)
3318#[deprecated]
3319pub type VASErrorCode = NFCVASErrorCode;
3320
3321extern_class!(
3322 /// Response from one GET VAS DATA command.
3323 ///
3324 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcvasresponse?language=objc)
3325 #[unsafe(super(NSObject))]
3326 #[derive(Debug, PartialEq, Eq, Hash)]
3327 pub struct NFCVASResponse;
3328);
3329
3330extern_conformance!(
3331 unsafe impl NSCopying for NFCVASResponse {}
3332);
3333
3334unsafe impl CopyingHelper for NFCVASResponse {
3335 type Result = Self;
3336}
3337
3338extern_conformance!(
3339 unsafe impl NSObjectProtocol for NFCVASResponse {}
3340);
3341
3342impl NFCVASResponse {
3343 extern_methods!(
3344 /// Response APDU status.
3345 #[unsafe(method(status))]
3346 #[unsafe(method_family = none)]
3347 pub unsafe fn status(&self) -> NFCVASErrorCode;
3348
3349 /// VAS data.
3350 #[unsafe(method(vasData))]
3351 #[unsafe(method_family = none)]
3352 pub unsafe fn vasData(&self) -> Retained<NSData>;
3353
3354 /// Mobile token value.
3355 #[unsafe(method(mobileToken))]
3356 #[unsafe(method_family = none)]
3357 pub unsafe fn mobileToken(&self) -> Retained<NSData>;
3358 );
3359}
3360
3361/// Methods declared on superclass `NSObject`.
3362impl NFCVASResponse {
3363 extern_methods!(
3364 #[unsafe(method(init))]
3365 #[unsafe(method_family = init)]
3366 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3367
3368 #[unsafe(method(new))]
3369 #[unsafe(method_family = new)]
3370 pub unsafe fn new() -> Retained<Self>;
3371 );
3372}
3373
3374extern_protocol!(
3375 /// Value Added Service (VAS) reader session callbacks.
3376 ///
3377 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcvasreadersessiondelegate?language=objc)
3378 pub unsafe trait NFCVASReaderSessionDelegate: NSObjectProtocol {
3379 /// Parameter `session`: The session object in the active state.
3380 ///
3381 ///
3382 /// Gets called when the NFC reader session has become active. RF is enabled and reader is scanning for VAS tags.
3383 /// The
3384 ///
3385 /// ```text
3386 /// readerSession:didReceiveVASResponses: @link/ will be called when a VAS transaction is completed.
3387 ///
3388 ///
3389 /// ```
3390 #[optional]
3391 #[unsafe(method(readerSessionDidBecomeActive:))]
3392 #[unsafe(method_family = none)]
3393 unsafe fn readerSessionDidBecomeActive(&self, session: &NFCVASReaderSession);
3394
3395 /// Parameter `session`: The session object that is invalidated.
3396 ///
3397 /// Parameter `error`: The error indicates the invalidation reason.
3398 ///
3399 ///
3400 /// Gets called when a session becomes invalid. At this point the client is expected to discard
3401 /// the returned session object.
3402 #[unsafe(method(readerSession:didInvalidateWithError:))]
3403 #[unsafe(method_family = none)]
3404 unsafe fn readerSession_didInvalidateWithError(
3405 &self,
3406 session: &NFCVASReaderSession,
3407 error: &NSError,
3408 );
3409
3410 /// Parameter `session`: The session object used for tag detection.
3411 ///
3412 /// Parameter `responses`: Array of
3413 ///
3414 /// ```text
3415 /// NFCVASResponse @link/ objects. The order of the response objects follows the
3416 /// sequence of GET VAS DATA sent by the reader session.
3417 ///
3418 /// @discussion Gets called when the reader completes the requested VAS transaction. Polling
3419 /// is automatically restarted once the detected tag is removed from the reader's read range.
3420 ///
3421 ///
3422 /// ```
3423 #[unsafe(method(readerSession:didReceiveVASResponses:))]
3424 #[unsafe(method_family = none)]
3425 unsafe fn readerSession_didReceiveVASResponses(
3426 &self,
3427 session: &NFCVASReaderSession,
3428 responses: &NSArray<NFCVASResponse>,
3429 );
3430 }
3431);
3432
3433extern_class!(
3434 /// Reader session for processing Value Added Service (VAS) tags. This session requires the "com.apple.developer.nfc.readersession.formats"
3435 /// entitlement in your process. In addition your application's Info.plist must contain a non-empty usage description string.
3436 ///
3437 /// ```text
3438 /// NFCReaderErrorSecurityViolation @link/ will be returned from @link [NFCVASReaderSessionDelegate readerSession:didInvalidateWithError:] @link/
3439 /// if the required entitlement is missing when session is started.
3440 ///
3441 /// NOTE:
3442 /// Only one NFCReaderSession can be active at any time in the system. Subsequent opened sessions will get queued up and processed by the system in FIFO order.
3443 ///
3444 ///
3445 /// ```
3446 ///
3447 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcvasreadersession?language=objc)
3448 #[unsafe(super(NFCReaderSession, NSObject))]
3449 #[derive(Debug, PartialEq, Eq, Hash)]
3450 pub struct NFCVASReaderSession;
3451);
3452
3453extern_conformance!(
3454 unsafe impl NFCReaderSessionProtocol for NFCVASReaderSession {}
3455);
3456
3457extern_conformance!(
3458 unsafe impl NSObjectProtocol for NFCVASReaderSession {}
3459);
3460
3461impl NFCVASReaderSession {
3462 extern_methods!(
3463 #[unsafe(method(init))]
3464 #[unsafe(method_family = init)]
3465 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3466
3467 #[cfg(feature = "dispatch2")]
3468 /// Parameter `commandConfigurations`: NSArray of NFCVASCommandConfiguration objects. Each NFCVASCommandConfiguration defines one GET VAS DATA command send to
3469 /// a compatible tag when discovered. The order of elements in the array defines the order of the command execution.
3470 ///
3471 /// Parameter `delegate`: The session will hold a weak ARC reference to this
3472 ///
3473 /// ```text
3474 /// NFCVASReaderSessionDelegate @link/ object.
3475 /// @param queue A dispatch queue where NFCVASReaderSessionDelegate delegate callbacks will be dispatched to. A <i>nil</i> value will
3476 /// cause the creation of a serial dispatch queue internally for the session. The session object will retain the provided dispatch queue.
3477 ///
3478 /// @return A new NFCVASReaderSession instance.
3479 ///
3480 /// @discussion A VAS reader session will automatically scan and detect tag that is compatible with the VAS protocol. The session will advertise as a
3481 /// VAS App Only terminal. A modal system UI will present once -beginSession is called to inform the start of the session; the UI sheet
3482 /// is automatically dismissed when the session is invalidated either by the user or by calling -invalidateSession. The alertMessage property shall be set
3483 /// prior to -beginSession to display a message on the action sheet UI for the tag scanning operation.
3484 ///
3485 /// The reader session has the following properties:
3486 /// + An opened session has a 60 seconds time limit restriction after -beginSession is called; -readerSession:didInvalidateWithError: will return
3487 /// NFCReaderSessionInvalidationErrorSessionTimeout error when the time limit is reached.
3488 /// + Only 1 active reader session is allowed in the system; -readerSession:didInvalidateWithError: will return NFCReaderSessionInvalidationErrorSystemIsBusy
3489 /// when a new reader session is initiated by -beginSession when there is an active reader session.
3490 /// + -readerSession:didInvalidateWithError: will return NFCReaderSessionInvalidationErrorUserCanceled when user clicks on the done button on the UI.
3491 /// + -readerSession:didInvalidateWithError: will return NFCReaderSessionInvalidationErrorSessionTerminatedUnexpectedly when the client application enters
3492 /// the background state.
3493 /// + -readerSession:didInvalidateWithError: will return NFCReaderErrorUnsupportedFeature when 1) reader mode feature is not available on the hardware,
3494 /// 2) client application does not have the required entitlement.
3495 ///
3496 ///
3497 /// ```
3498 ///
3499 /// # Safety
3500 ///
3501 /// `queue` possibly has additional threading requirements.
3502 #[unsafe(method(initWithVASCommandConfigurations:delegate:queue:))]
3503 #[unsafe(method_family = init)]
3504 pub unsafe fn initWithVASCommandConfigurations_delegate_queue(
3505 this: Allocated<Self>,
3506 command_configurations: &NSArray<NFCVASCommandConfiguration>,
3507 delegate: &ProtocolObject<dyn NFCVASReaderSessionDelegate>,
3508 queue: Option<&DispatchQueue>,
3509 ) -> Retained<Self>;
3510 );
3511}
3512
3513/// Methods declared on superclass `NSObject`.
3514impl NFCVASReaderSession {
3515 extern_methods!(
3516 #[unsafe(method(new))]
3517 #[unsafe(method_family = new)]
3518 pub unsafe fn new() -> Retained<Self>;
3519 );
3520}
3521
3522extern_class!(
3523 /// Reader session for processing NFC payment tags supporting the
3524 ///
3525 /// ```text
3526 /// NFCTagTypeISO7816Compatible @link/ type.
3527 /// @link [NFCTagReaderSessionDelegate readerSession:didDetectTags:] @link/ will return a @link NFCISO7816Tag @link /. object.
3528 /// This session requires the "com.apple.developer.nfc.readersession.formats" entitlement in your process.
3529 /// In addition your application's Info.plist must contain a non-empty usage description string. @link NFCReaderErrorSecurityViolation @link/ will be
3530 /// returned from @link [NFCTagReaderSessionDelegate tagReaderSession:didInvalidateWithError:] @link/ if the required entitlement is missing when session is started.
3531 ///
3532 /// When the reader discovers a compatible ISO7816 tag it automatically performs a SELECT command (by DF name) using the values provided in
3533 /// "com.apple.developer.nfc.readersession.iso7816.select-identifiers" in the specified array order. The tag is
3534 /// returned from the [NFCTagReaderSessionDelegate readerSession:didDetectTags:] call on the first successful SELECT command.
3535 /// The initialSelectedAID property returns the application identifier of the selected application. Tag will not be returned
3536 /// to the NFCTagReaderSessionDelegate if no application described in "com.apple.developer.nfc.readersession.iso7816.select-identifiers"
3537 /// is found.
3538 ///
3539 /// NOTE:
3540 /// - Only one NFCReaderSession can be active at any time in the system. Subsequent opened sessions will get queued up and processed by the system in FIFO order.
3541 ///
3542 ///
3543 /// ```
3544 ///
3545 /// See also [Apple's documentation](https://developer.apple.com/documentation/corenfc/nfcpaymenttagreadersession?language=objc)
3546 #[unsafe(super(NFCTagReaderSession, NFCReaderSession, NSObject))]
3547 #[derive(Debug, PartialEq, Eq, Hash)]
3548 pub struct NFCPaymentTagReaderSession;
3549);
3550
3551extern_conformance!(
3552 unsafe impl NFCReaderSessionProtocol for NFCPaymentTagReaderSession {}
3553);
3554
3555extern_conformance!(
3556 unsafe impl NSObjectProtocol for NFCPaymentTagReaderSession {}
3557);
3558
3559impl NFCPaymentTagReaderSession {
3560 extern_methods!(
3561 #[cfg(feature = "dispatch2")]
3562 /// Parameter `delegate`: The session will hold a weak ARC reference to this
3563 ///
3564 /// ```text
3565 /// NFCTagReaderSessionDelegate @link/ object.
3566 /// @param queue A dispatch queue where NFCTagReaderSessionDelegate delegate callbacks will be dispatched to. A <i>nil</i> value will
3567 /// cause the creation of a serial dispatch queue internally for the session. The session object will retain the provided dispatch queue.
3568 ///
3569 /// @return A new NFCPaymentTagReaderSession instance.
3570 ///
3571 /// NOTE:
3572 /// The super class `-initWithPollingOption:delegate:queue:` initializer would only accept NFCPollingOption.NFCPollingISO14443; all other options will be ignored.
3573 ///
3574 ///
3575 /// ```
3576 ///
3577 /// # Safety
3578 ///
3579 /// `queue` possibly has additional threading requirements.
3580 #[unsafe(method(initWithDelegate:queue:))]
3581 #[unsafe(method_family = init)]
3582 pub unsafe fn initWithDelegate_queue(
3583 this: Allocated<Self>,
3584 delegate: &ProtocolObject<dyn NFCTagReaderSessionDelegate>,
3585 queue: Option<&DispatchQueue>,
3586 ) -> Retained<Self>;
3587 );
3588}
3589
3590/// Methods declared on superclass `NFCTagReaderSession`.
3591impl NFCPaymentTagReaderSession {
3592 extern_methods!(
3593 #[unsafe(method(init))]
3594 #[unsafe(method_family = init)]
3595 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3596
3597 #[cfg(feature = "dispatch2")]
3598 /// Parameter `pollingOption`: Configures the RF polling of the reader session; multiple options can be OR'ed together. This option affects the possible NFC tag type discover.
3599 ///
3600 /// Parameter `delegate`: The session will hold a weak ARC reference to this
3601 ///
3602 /// ```text
3603 /// NFCTagReaderSessionDelegate @link/ object.
3604 /// @param queue A dispatch queue where NFCTagReaderSessionDelegate delegate callbacks will be dispatched to. A <i>nil</i> value will
3605 /// cause the creation of a serial dispatch queue internally for the session. The session object will retain the provided dispatch queue.
3606 ///
3607 /// @return A new NFCTagReaderSession instance.
3608 ///
3609 ///
3610 /// ```
3611 ///
3612 /// # Safety
3613 ///
3614 /// `queue` possibly has additional threading requirements.
3615 #[unsafe(method(initWithPollingOption:delegate:queue:))]
3616 #[unsafe(method_family = init)]
3617 pub unsafe fn initWithPollingOption_delegate_queue(
3618 this: Allocated<Self>,
3619 polling_option: NFCPollingOption,
3620 delegate: &ProtocolObject<dyn NFCTagReaderSessionDelegate>,
3621 queue: Option<&DispatchQueue>,
3622 ) -> Retained<Self>;
3623 );
3624}
3625
3626/// Methods declared on superclass `NSObject`.
3627impl NFCPaymentTagReaderSession {
3628 extern_methods!(
3629 #[unsafe(method(new))]
3630 #[unsafe(method_family = new)]
3631 pub unsafe fn new() -> Retained<Self>;
3632 );
3633}