image_capture_core/
scanner_device.rs1use cocoa::base::id;
2use objc::*;
3
4#[repr(u64)]
6#[derive(Clone, Copy, Debug, PartialEq)]
7pub enum ICScannerTransferMode {
8 ICScannerTransferModeFileBased = 0,
10 ICScannerTransferModeMemoryBased = 1,
12}
13
14pub trait ICScannerDevice: Sized {
15 unsafe fn availableFunctionalUnitTypes(self) -> id;
18 unsafe fn selectedFunctionalUnit(self) -> id;
20 unsafe fn transferMode(self) -> ICScannerTransferMode;
22 unsafe fn setTransferMode(self, transferMode: ICScannerTransferMode);
24 unsafe fn maxMemoryBandSize(self) -> u32;
26 unsafe fn setMaxMemoryBandSize(self, maxMemoryBandSize: u32);
28 unsafe fn downloadsDirectory(self) -> id;
30 unsafe fn setDownloadsDirectory(self, downloadsDirectory: id);
32 unsafe fn documentName(self) -> id;
34 unsafe fn setDocumentName(self, documentName: id);
36 unsafe fn documentUTI(self) -> id;
39 unsafe fn setDocumentUTI(self, documentUTI: id);
41 unsafe fn defaultUsername(self) -> id;
44 unsafe fn setDefaultUsername(self, defaultUsername: id);
46 unsafe fn requestOpenSessionWithCredentials(self, username: id, password: id);
50 unsafe fn requestSelectFunctionalUnit(self, type_: id);
52 unsafe fn requestOverviewScan(self);
54 unsafe fn requestScan(self);
56 unsafe fn cancelScan(self);
58}
59
60impl ICScannerDevice for id {
61 unsafe fn availableFunctionalUnitTypes(self) -> id {
62 msg_send![self, availableFunctionalUnitTypes]
63 }
64
65 unsafe fn selectedFunctionalUnit(self) -> id {
66 msg_send![self, selectedFunctionalUnit]
67 }
68
69 unsafe fn transferMode(self) -> ICScannerTransferMode {
70 msg_send![self, transferMode]
71 }
72
73 unsafe fn setTransferMode(self, transferMode: ICScannerTransferMode) {
74 msg_send![self, setTransferMode: transferMode]
75 }
76
77 unsafe fn maxMemoryBandSize(self) -> u32 {
78 msg_send![self, maxMemoryBandSize]
79 }
80
81 unsafe fn setMaxMemoryBandSize(self, maxMemoryBandSize: u32) {
82 msg_send![self, setMaxMemoryBandSize: maxMemoryBandSize]
83 }
84
85 unsafe fn downloadsDirectory(self) -> id {
86 msg_send![self, downloadsDirectory]
87 }
88
89 unsafe fn setDownloadsDirectory(self, downloadsDirectory: id) {
90 msg_send![self, setDownloadsDirectory: downloadsDirectory]
91 }
92
93 unsafe fn documentName(self) -> id {
94 msg_send![self, documentName]
95 }
96
97 unsafe fn setDocumentName(self, documentName: id) {
98 msg_send![self, setDocumentName: documentName]
99 }
100
101 unsafe fn documentUTI(self) -> id {
102 msg_send![self, documentUTI]
103 }
104
105 unsafe fn setDocumentUTI(self, documentUTI: id) {
106 msg_send![self, setDocumentUTI: documentUTI]
107 }
108
109 unsafe fn defaultUsername(self) -> id {
110 msg_send![self, defaultUsername]
111 }
112
113 unsafe fn setDefaultUsername(self, defaultUsername: id) {
114 msg_send![self, setDefaultUsername: defaultUsername]
115 }
116
117 unsafe fn requestOpenSessionWithCredentials(self, username: id, password: id) {
118 msg_send![self, requestOpenSessionWithCredentials:username password:password]
119 }
120
121 unsafe fn requestSelectFunctionalUnit(self, type_: id) {
122 msg_send![self, requestSelectFunctionalUnit: type_]
123 }
124
125 unsafe fn requestOverviewScan(self) {
126 msg_send![self, requestOverviewScan]
127 }
128
129 unsafe fn requestScan(self) {
130 msg_send![self, requestScan]
131 }
132
133 unsafe fn cancelScan(self) {
134 msg_send![self, cancelScan]
135 }
136}
137
138#[link(name = "ImageCaptureCore", kind = "framework")]
139extern "C" {
140 pub static ICScannerStatusWarmingUp: id;
144 pub static ICScannerStatusWarmUpDone: id;
146 pub static ICScannerStatusRequestsOverviewScan: id;
148}