objc2_crypto_token_kit/generated/
TKTokenWatcher.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenwatchertokeninfo?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct TKTokenWatcherTokenInfo;
15);
16
17extern_conformance!(
18    unsafe impl NSObjectProtocol for TKTokenWatcherTokenInfo {}
19);
20
21impl TKTokenWatcherTokenInfo {
22    extern_methods!(
23        /// TokenID
24        #[unsafe(method(tokenID))]
25        #[unsafe(method_family = none)]
26        pub unsafe fn tokenID(&self) -> Retained<NSString>;
27
28        /// The slot name (if available)
29        #[unsafe(method(slotName))]
30        #[unsafe(method_family = none)]
31        pub unsafe fn slotName(&self) -> Option<Retained<NSString>>;
32
33        /// Localized driver name (if available)
34        #[unsafe(method(driverName))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn driverName(&self) -> Option<Retained<NSString>>;
37
38        #[unsafe(method(init))]
39        #[unsafe(method_family = init)]
40        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
41
42        #[unsafe(method(new))]
43        #[unsafe(method_family = new)]
44        pub unsafe fn new() -> Retained<Self>;
45    );
46}
47
48extern_class!(
49    /// [Apple's documentation](https://developer.apple.com/documentation/cryptotokenkit/tktokenwatcher?language=objc)
50    #[unsafe(super(NSObject))]
51    #[derive(Debug, PartialEq, Eq, Hash)]
52    pub struct TKTokenWatcher;
53);
54
55extern_conformance!(
56    unsafe impl NSObjectProtocol for TKTokenWatcher {}
57);
58
59impl TKTokenWatcher {
60    extern_methods!(
61        /// Array of currently known TokenIDs in the system.  Tokens are identified by instance's names. It is possible to use KVO to be notified about token arrivals and removals.
62        #[unsafe(method(tokenIDs))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn tokenIDs(&self) -> Retained<NSArray<NSString>>;
65
66        /// Init watcher
67        #[unsafe(method(init))]
68        #[unsafe(method_family = init)]
69        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
70
71        #[cfg(feature = "block2")]
72        /// Init watcher with insertion handler
73        ///
74        /// init watcher with insertion handler which is called when a new token arrives
75        ///
76        /// Parameter `insertionHandler`: called when a new token is inserted
77        #[deprecated]
78        #[unsafe(method(initWithInsertionHandler:))]
79        #[unsafe(method_family = init)]
80        pub unsafe fn initWithInsertionHandler(
81            this: Allocated<Self>,
82            insertion_handler: &block2::DynBlock<dyn Fn(NonNull<NSString>)>,
83        ) -> Retained<Self>;
84
85        #[cfg(feature = "block2")]
86        /// Set insertion handler
87        ///
88        /// when an insertion handler is set the TokenWatcher will call this handler when new token appears in the system. TokenWatcher will call the handler also for tokens which was registered in the system before the handler was set.
89        ///
90        /// Parameter `insertionHandler`: called when a new token is inserted
91        #[unsafe(method(setInsertionHandler:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setInsertionHandler(
94            &self,
95            insertion_handler: &block2::DynBlock<dyn Fn(NonNull<NSString>)>,
96        );
97
98        #[cfg(feature = "block2")]
99        /// Add removal watcher for specific tokenID
100        ///
101        /// after removalHandler for a specific tokenID is called the reference to this handler is removed. For one tokenID just one handler can be added, so next call to addRemovalHandler will replace previous handler
102        ///
103        /// Parameter `removalHandler`: called when a token is removed
104        ///
105        /// Parameter `tokenID`: specified tokenID, if tokenID does not exist removal handler is called imediately
106        #[unsafe(method(addRemovalHandler:forTokenID:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn addRemovalHandler_forTokenID(
109            &self,
110            removal_handler: &block2::DynBlock<dyn Fn(NonNull<NSString>)>,
111            token_id: &NSString,
112        );
113
114        /// Return TokenInfo for specific tokenID
115        ///
116        /// Parameter `tokenID`: specified tokenID
117        ///
118        /// Returns: A TokenInfo object, or nil if tokenID does not exist
119        #[unsafe(method(tokenInfoForTokenID:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn tokenInfoForTokenID(
122            &self,
123            token_id: &NSString,
124        ) -> Option<Retained<TKTokenWatcherTokenInfo>>;
125    );
126}
127
128/// Methods declared on superclass `NSObject`.
129impl TKTokenWatcher {
130    extern_methods!(
131        #[unsafe(method(new))]
132        #[unsafe(method_family = new)]
133        pub unsafe fn new() -> Retained<Self>;
134    );
135}