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