objc2_image_capture_core/generated/
ICDevice.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::*;
6#[cfg(feature = "objc2-core-graphics")]
7use objc2_core_graphics::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// Image Capture Device Types
13///
14/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicetype?language=objc)
15// NS_ENUM
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct ICDeviceType(pub NSUInteger);
19impl ICDeviceType {
20    #[doc(alias = "ICDeviceTypeCamera")]
21    pub const Camera: Self = Self(0x00000001);
22    #[doc(alias = "ICDeviceTypeScanner")]
23    pub const Scanner: Self = Self(0x00000002);
24}
25
26unsafe impl Encode for ICDeviceType {
27    const ENCODING: Encoding = NSUInteger::ENCODING;
28}
29
30unsafe impl RefEncode for ICDeviceType {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// Image Capture Device Location Types
35///
36/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicelocationtype?language=objc)
37// NS_ENUM
38#[repr(transparent)]
39#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
40pub struct ICDeviceLocationType(pub NSUInteger);
41impl ICDeviceLocationType {
42    #[doc(alias = "ICDeviceLocationTypeLocal")]
43    pub const Local: Self = Self(0x00000100);
44    #[doc(alias = "ICDeviceLocationTypeShared")]
45    pub const Shared: Self = Self(0x00000200);
46    #[doc(alias = "ICDeviceLocationTypeBonjour")]
47    pub const Bonjour: Self = Self(0x00000400);
48    #[doc(alias = "ICDeviceLocationTypeBluetooth")]
49    pub const Bluetooth: Self = Self(0x00000800);
50}
51
52unsafe impl Encode for ICDeviceLocationType {
53    const ENCODING: Encoding = NSUInteger::ENCODING;
54}
55
56unsafe impl RefEncode for ICDeviceLocationType {
57    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
58}
59
60/// Image Capture Device Type Mask
61///
62/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicetypemask?language=objc)
63// NS_ENUM
64#[repr(transparent)]
65#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
66pub struct ICDeviceTypeMask(pub NSUInteger);
67impl ICDeviceTypeMask {
68    #[doc(alias = "ICDeviceTypeMaskCamera")]
69    pub const Camera: Self = Self(0x00000001);
70    #[doc(alias = "ICDeviceTypeMaskScanner")]
71    pub const Scanner: Self = Self(0x00000002);
72}
73
74unsafe impl Encode for ICDeviceTypeMask {
75    const ENCODING: Encoding = NSUInteger::ENCODING;
76}
77
78unsafe impl RefEncode for ICDeviceTypeMask {
79    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
80}
81
82/// Image Capture Device Location Type Mask
83///
84/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicelocationtypemask?language=objc)
85// NS_ENUM
86#[repr(transparent)]
87#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
88pub struct ICDeviceLocationTypeMask(pub NSUInteger);
89impl ICDeviceLocationTypeMask {
90    #[doc(alias = "ICDeviceLocationTypeMaskLocal")]
91    pub const Local: Self = Self(0x00000100);
92    #[doc(alias = "ICDeviceLocationTypeMaskShared")]
93    pub const Shared: Self = Self(0x00000200);
94    #[doc(alias = "ICDeviceLocationTypeMaskBonjour")]
95    pub const Bonjour: Self = Self(0x00000400);
96    #[doc(alias = "ICDeviceLocationTypeMaskBluetooth")]
97    pub const Bluetooth: Self = Self(0x00000800);
98    #[doc(alias = "ICDeviceLocationTypeMaskRemote")]
99    pub const Remote: Self = Self(0x0000FE00);
100}
101
102unsafe impl Encode for ICDeviceLocationTypeMask {
103    const ENCODING: Encoding = NSUInteger::ENCODING;
104}
105
106unsafe impl RefEncode for ICDeviceLocationTypeMask {
107    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
108}
109
110/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicetransport?language=objc)
111// NS_TYPED_ENUM
112pub type ICDeviceTransport = NSString;
113
114extern "C" {
115    /// Indicates that the device uses USB transport.
116    ///
117    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictransporttypeusb?language=objc)
118    pub static ICTransportTypeUSB: &'static ICDeviceTransport;
119}
120
121extern "C" {
122    /// Indicates that the device uses FireWire transport.
123    ///
124    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictransporttypefirewire?language=objc)
125    pub static ICTransportTypeFireWire: &'static ICDeviceTransport;
126}
127
128extern "C" {
129    /// Indicates that the device uses Bluetooth transport.
130    ///
131    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictransporttypebluetooth?language=objc)
132    pub static ICTransportTypeBluetooth: &'static ICDeviceTransport;
133}
134
135extern "C" {
136    /// Indicates that the device use mounts as a mass-storage volume.
137    ///
138    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictransporttypemassstorage?language=objc)
139    pub static ICTransportTypeMassStorage: &'static ICDeviceTransport;
140}
141
142extern "C" {
143    /// Indicates that the device use mounts as a exFat storage volume.
144    ///
145    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictransporttypeexfat?language=objc)
146    pub static ICTransportTypeExFAT: &'static ICDeviceTransport;
147}
148
149extern "C" {
150    /// Indicates that the device uses TCP/IP transport. These devices are discovered using Bonjour.
151    ///
152    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictransporttypetcpip?language=objc)
153    pub static ICTransportTypeTCPIP: &'static ICDeviceTransport;
154}
155
156extern "C" {
157    /// Indicates that the device transport is based on proximity instead of a predefined phyiscal layer.
158    ///
159    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictransporttypeproximity?language=objc)
160    pub static ICTransportTypeProximity: &'static ICDeviceTransport;
161}
162
163/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicestatus?language=objc)
164// NS_TYPED_ENUM
165pub type ICDeviceStatus = NSString;
166
167extern "C" {
168    /// Key for a non-localized notification string.
169    ///
170    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icstatusnotificationkey?language=objc)
171    pub static ICStatusNotificationKey: &'static ICDeviceStatus;
172}
173
174extern "C" {
175    /// One of values defined in ICReturnCode.
176    ///
177    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icstatuscodekey?language=objc)
178    pub static ICStatusCodeKey: &'static ICDeviceStatus;
179}
180
181extern "C" {
182    /// Key for a localized notification string.
183    ///
184    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iclocalizedstatusnotificationkey?language=objc)
185    pub static ICLocalizedStatusNotificationKey: &'static ICDeviceStatus;
186}
187
188/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicecapability?language=objc)
189// NS_TYPED_ENUM
190pub type ICDeviceCapability = NSString;
191
192extern "C" {
193    /// Indicates either the device is mounted as a mass-storage volume and can be ejected or the it is a remote device with an active connection that can be disconnected.
194    ///
195    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicecanejectordisconnect?language=objc)
196    pub static ICDeviceCanEjectOrDisconnect: &'static ICDeviceCapability;
197}
198
199/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsessionoptions?language=objc)
200// NS_TYPED_ENUM
201pub type ICSessionOptions = NSString;
202
203extern "C" {
204    /// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icenumerationchronologicalorder?language=objc)
205    pub static ICEnumerationChronologicalOrder: &'static ICSessionOptions;
206}
207
208/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicelocationoptions?language=objc)
209// NS_TYPED_ENUM
210pub type ICDeviceLocationOptions = NSString;
211
212extern "C" {
213    /// This description is returned for locationDescription property of a device connected to a USB port.
214    ///
215    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicelocationdescriptionusb?language=objc)
216    pub static ICDeviceLocationDescriptionUSB: &'static ICDeviceLocationOptions;
217}
218
219extern "C" {
220    /// This description is returned for locationDescription property of a device connected to a FireWire port.
221    ///
222    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicelocationdescriptionfirewire?language=objc)
223    pub static ICDeviceLocationDescriptionFireWire: &'static ICDeviceLocationOptions;
224}
225
226extern "C" {
227    /// This description is returned for locationDescription property of a device connected via Bluetooth.
228    ///
229    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicelocationdescriptionbluetooth?language=objc)
230    pub static ICDeviceLocationDescriptionBluetooth: &'static ICDeviceLocationOptions;
231}
232
233extern "C" {
234    /// This description is returned for locationDescription property of a device that is mounted as a mass-storage volume.
235    ///
236    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicelocationdescriptionmassstorage?language=objc)
237    pub static ICDeviceLocationDescriptionMassStorage: &'static ICDeviceLocationOptions;
238}
239
240extern_class!(
241    /// ICDevice is an abstract class that represents a device supported by Image Capture facility. ImageCaptureCore defines two concrete subclasses of ICDevice, ICCameraDevice and ICScannerDevice. ICDeviceBrowser creates instances of these two subclasses to represent cameras and scanners it finds.
242    ///
243    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevice?language=objc)
244    #[unsafe(super(NSObject))]
245    #[derive(Debug, PartialEq, Eq, Hash)]
246    pub struct ICDevice;
247);
248
249extern_conformance!(
250    unsafe impl NSObjectProtocol for ICDevice {}
251);
252
253impl ICDevice {
254    extern_methods!(
255        /// The delegate to receive messages once a session is opened on the device.
256        ///
257        /// The delegate must conform ICDeviceDelegate protocol. In addition it should respond to selectors defined in ICCameraDeviceDelegate protocol in order to effectively interact with the device object. The messages this delegate can expect to receive are described by these protocols.
258        ///
259        /// # Safety
260        ///
261        /// This is not retained internally, you must ensure the object is still alive.
262        #[unsafe(method(delegate))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn ICDeviceDelegate>>>;
265
266        /// Setter for [`delegate`][Self::delegate].
267        ///
268        /// # Safety
269        ///
270        /// This is unretained, you must ensure the object is kept alive while in use.
271        #[unsafe(method(setDelegate:))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn ICDeviceDelegate>>);
274
275        /// The type of the device as defined by ICDeviceType OR'd with its ICDeviceLocationType.
276        ///
277        /// Note: The type of this device can be obtained by AND'ing the value retuned by this property with an appropriate ICDeviceTypeMask.
278        ///
279        /// Note: The location type of this device can be obtained by AND'ing the value retuned by this property with an appropriate ICDeviceLocationTypeMask.
280        #[unsafe(method(type))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn r#type(&self) -> ICDeviceType;
283
284        /// The capabilities of the device as reported by the device module.
285        #[unsafe(method(capabilities))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn capabilities(&self) -> Retained<NSArray<NSString>>;
288
289        /// Name of the device as reported by the device module or by the device transport when a device module is not in control of this device.
290        ///
291        /// Note: This name may change if the device module overrides the default name of the device reported by the device's transport, or if the name of the filesystem volume mounted by the device is changed by the user.
292        #[unsafe(method(name))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn name(&self) -> Option<Retained<NSString>>;
295
296        /// Type of the device. Possible values are:
297        /// "
298        /// iPhone", @"iPod", @"iPad", @"Camera", @"Scanner"
299        #[unsafe(method(productKind))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn productKind(&self) -> Option<Retained<NSString>>;
302
303        #[cfg(feature = "objc2-core-graphics")]
304        /// Icon image for the device class.  If there is no custom icon present from a device manufacturer, this will be a rendered version of the system symbol for the device class.  Using a rendered system symbol instead of the systemSymbolName is discouraged.
305        #[unsafe(method(icon))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn icon(&self) -> Option<Retained<CGImage>>;
308
309        /// Standard system symbol used to represent the device class.  Using the symbol to render an appropriate device icon will ensure proper scaling for high resolution devices.
310        #[unsafe(method(systemSymbolName))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn systemSymbolName(&self) -> Option<Retained<NSString>>;
313
314        /// The transport type used by the device. The possible values are: ICTransportTypeUSB or ICTransportTypeMassStorage.
315        #[unsafe(method(transportType))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn transportType(&self) -> Option<Retained<NSString>>;
318
319        /// A string representation of the Universally Unique ID of the device.
320        #[unsafe(method(UUIDString))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn UUIDString(&self) -> Option<Retained<NSString>>;
323
324        /// A non-localized location description string for the device.
325        ///
326        /// The value returned in one of the location description strings defined above, or location obtained from the Bonjour TXT record of a network device.
327        #[unsafe(method(locationDescription))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn locationDescription(&self) -> Option<Retained<NSString>>;
330
331        /// Indicates whether the device has an open session.
332        #[unsafe(method(hasOpenSession))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn hasOpenSession(&self) -> bool;
335
336        /// Client convenience bookkeeping object retained by the framework.
337        ///
338        /// # Safety
339        ///
340        /// The returned generic should be of the correct type.
341        #[unsafe(method(userData))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>;
344
345        /// Filesystem path of the device module that is associated with this device. Camera-specific capabilities are defined in ICCameraDevice.h and scanner-specific capabilities are defined in ICScannerDevice.h.
346        #[unsafe(method(modulePath))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn modulePath(&self) -> Retained<NSString>;
349
350        /// The bundle version of the device module associated with this device.
351        ///
352        /// Note: This may change if an existing device module associated with this device is updated or a new device module for this device is installed.
353        #[unsafe(method(moduleVersion))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn moduleVersion(&self) -> Option<Retained<NSString>>;
356
357        /// The serial number of the device. This will be NULL if the device does not provide a serial number.
358        #[unsafe(method(serialNumberString))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn serialNumberString(&self) -> Option<Retained<NSString>>;
361
362        /// The USB location of which the device is occupying.
363        #[unsafe(method(usbLocationID))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn usbLocationID(&self) -> c_int;
366
367        /// The USB PID associated with the device attached.
368        #[unsafe(method(usbProductID))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn usbProductID(&self) -> c_int;
371
372        /// The USB VID associated with the device attached.
373        #[unsafe(method(usbVendorID))]
374        #[unsafe(method_family = none)]
375        pub unsafe fn usbVendorID(&self) -> c_int;
376
377        /// This message requests to open a session on the device.
378        ///
379        /// Make sure the receiver's delegate is set prior to sending this message; otherwise this message will be ignored. This request is completed when the delegate receives a "device:didOpenSessionWithError:" message.
380        ///
381        /// Note: Execution of the delegate callback will occur on the main thread.
382        #[unsafe(method(requestOpenSession))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn requestOpenSession(&self);
385
386        /// This message requests to close a previously opened session on this device.
387        ///
388        /// This request is completed when the delegate receives a "device:didCloseSessionWithError:" message.
389        ///
390        /// Note: Execution of the delegate callback will occur on the main thread.
391        #[unsafe(method(requestCloseSession))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn requestCloseSession(&self);
394
395        /// Eject the media if permitted by the device, or disconnect from a remote device.
396        #[unsafe(method(requestEject))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn requestEject(&self);
399
400        #[cfg(feature = "block2")]
401        /// This message requests to open a session on the device.
402        ///
403        /// This request will execute the completion handler provided upon return.
404        ///
405        /// Note: The completion block will execute on an any available queue, often this will not be the main queue.
406        ///
407        /// # Safety
408        ///
409        /// `options` generic should be of the correct type.
410        #[unsafe(method(requestOpenSessionWithOptions:completion:))]
411        #[unsafe(method_family = none)]
412        pub unsafe fn requestOpenSessionWithOptions_completion(
413            &self,
414            options: Option<&NSDictionary<ICSessionOptions, AnyObject>>,
415            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
416        );
417
418        #[cfg(feature = "block2")]
419        /// This message requests to close a previously opened session on this device.
420        ///
421        /// This request will execute the completion handler provided upon return.
422        ///
423        /// Note: The completion block will execute on an any available queue, often this will not be the main queue.
424        ///
425        /// # Safety
426        ///
427        /// `options` generic should be of the correct type.
428        #[unsafe(method(requestCloseSessionWithOptions:completion:))]
429        #[unsafe(method_family = none)]
430        pub unsafe fn requestCloseSessionWithOptions_completion(
431            &self,
432            options: Option<&NSDictionary<ICSessionOptions, AnyObject>>,
433            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
434        );
435
436        #[cfg(feature = "block2")]
437        /// Eject the media, or disconnect the device - if permitted by the device.
438        ///
439        /// This request will execute the completion handler provided upon return.
440        ///
441        /// Note: The completion block will execute on an any available queue, often this will not be the main queue.
442        #[unsafe(method(requestEjectWithCompletion:))]
443        #[unsafe(method_family = none)]
444        pub unsafe fn requestEjectWithCompletion(
445            &self,
446            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
447        );
448
449        /// Filesystem path of an application that is to be automatically launched when this device is added.
450        ///
451        /// This property is unavailable for devices of ICTransportTypeProximity.
452        #[unsafe(method(autolaunchApplicationPath))]
453        #[unsafe(method_family = none)]
454        pub unsafe fn autolaunchApplicationPath(&self) -> Option<Retained<NSString>>;
455
456        /// Setter for [`autolaunchApplicationPath`][Self::autolaunchApplicationPath].
457        ///
458        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
459        #[unsafe(method(setAutolaunchApplicationPath:))]
460        #[unsafe(method_family = none)]
461        pub unsafe fn setAutolaunchApplicationPath(
462            &self,
463            autolaunch_application_path: Option<&NSString>,
464        );
465
466        /// Indicates whether the device is a remote device published by Image Capture device sharing facility.
467        ///
468        ///
469        /// Name of the device as reported by the device module or by the device transport when a device module is not in control of this device.
470        ///
471        /// Note: This name may change if the device module overrides the default name of the device reported by the device's transport, or if the name of the filesystem volume mounted by the device is changed by the user.
472        #[unsafe(method(isRemote))]
473        #[unsafe(method_family = none)]
474        pub unsafe fn isRemote(&self) -> bool;
475
476        /// A string representation of the persistent ID of the device.
477        #[unsafe(method(persistentIDString))]
478        #[unsafe(method_family = none)]
479        pub unsafe fn persistentIDString(&self) -> Option<Retained<NSString>>;
480
481        /// This method asynchronously sends an arbitrary message with optional data to a device.
482        ///
483        /// This method allows developers to send a private message from a client application to a device module.
484        ///
485        /// The response to this command will be delivered using didSendMessageSelector of sendMessageDelegate.
486        /// The didSendMessageSelector should have the same signature as: - (void)didSendMessage:(UInt32)messageCode inData:(NSData*)data error:(NSError*)error contextInfo:(void*)contextInfo.
487        ///
488        /// The content of error returned should be examined to determine if the request completed successfully.
489        ///
490        /// Note: This method should not be used to send PTP pass-through commands to a PTP camera.
491        /// Please refer to 'requestSendPTPCommand:outData:sendCommandDelegate:sendCommandDelegate:contextInfo:' defined in ICCameraDevice.h for sending PTP pass-through commands.
492        ///
493        /// Note: Execution of the delegate callback will occur on the main thread.
494        ///
495        /// # Safety
496        ///
497        /// - `send_message_delegate` should be of the correct type.
498        /// - `selector` must be a valid selector.
499        /// - `context_info` must be a valid pointer or null.
500        #[unsafe(method(requestSendMessage:outData:maxReturnedDataSize:sendMessageDelegate:didSendMessageSelector:contextInfo:))]
501        #[unsafe(method_family = none)]
502        pub unsafe fn requestSendMessage_outData_maxReturnedDataSize_sendMessageDelegate_didSendMessageSelector_contextInfo(
503            &self,
504            message_code: c_uint,
505            data: &NSData,
506            max_returned_data_size: c_uint,
507            send_message_delegate: &AnyObject,
508            selector: Sel,
509            context_info: *mut c_void,
510        );
511
512        /// Eject the media if permitted by the device, or disconnect from a remote device.
513        #[deprecated]
514        #[unsafe(method(requestEjectOrDisconnect))]
515        #[unsafe(method_family = none)]
516        pub unsafe fn requestEjectOrDisconnect(&self);
517
518        /// This message requests the device module in control of this device to yield control.
519        ///
520        /// This message should be used only if the client is planning on communicating with the device directly. The device module may not yield control of the device if it has an open session.
521        #[deprecated = "Requesting a device yield is no longer avaialble"]
522        #[unsafe(method(requestYield))]
523        #[unsafe(method_family = none)]
524        pub unsafe fn requestYield(&self);
525
526        /// Reports the device module servicing the requests executable architecture.
527        #[deprecated = "Module executable architecture is no longer available"]
528        #[unsafe(method(moduleExecutableArchitecture))]
529        #[unsafe(method_family = none)]
530        pub unsafe fn moduleExecutableArchitecture(&self) -> c_int;
531    );
532}
533
534/// Methods declared on superclass `NSObject`.
535impl ICDevice {
536    extern_methods!(
537        #[unsafe(method(init))]
538        #[unsafe(method_family = init)]
539        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
540
541        #[unsafe(method(new))]
542        #[unsafe(method_family = new)]
543        pub unsafe fn new() -> Retained<Self>;
544    );
545}
546
547extern_protocol!(
548    /// A delegate of ICDevice must conform to ICDeviceDelegate protocol.
549    ///
550    /// Note: Unless otherwise noted, all delegate callbacks will occur on the main thread.
551    ///
552    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdevicedelegate?language=objc)
553    pub unsafe trait ICDeviceDelegate: NSObjectProtocol {
554        /// This message is sent when a session is closed on a device.
555        ///
556        /// This message completes the process initiated by the message "requestCloseSession" sent to the device object. This message is also sent if the device module in control of the device ceases to control the device.
557        ///
558        /// Note: Execution of the delegate callback will occur on the main thread.
559        #[unsafe(method(device:didCloseSessionWithError:))]
560        #[unsafe(method_family = none)]
561        unsafe fn device_didCloseSessionWithError(
562            &self,
563            device: &ICDevice,
564            error: Option<&NSError>,
565        );
566
567        /// This message is sent to the delegate to inform that a device has been removed.
568        #[unsafe(method(didRemoveDevice:))]
569        #[unsafe(method_family = none)]
570        unsafe fn didRemoveDevice(&self, device: &ICDevice);
571
572        /// This message is sent when a session is opened on a device.
573        ///
574        /// This message completes the process initiated by the message "requestOpenSession" sent to the device object.
575        ///
576        /// Note: Execution of the delegate callback will occur on the main thread.
577        #[unsafe(method(device:didOpenSessionWithError:))]
578        #[unsafe(method_family = none)]
579        unsafe fn device_didOpenSessionWithError(&self, device: &ICDevice, error: Option<&NSError>);
580
581        /// This message is sent when the device is ready to receive requests.
582        ///
583        /// Note: Execution of the delegate callback will occur on the main thread.
584        #[optional]
585        #[unsafe(method(deviceDidBecomeReady:))]
586        #[unsafe(method_family = none)]
587        unsafe fn deviceDidBecomeReady(&self, device: &ICDevice);
588
589        /// This message is sent if the name of a device changes.
590        ///
591        /// This happens if the device module overrides the default name of the device reported by the device's transport layer, or if the name of the filesystem volume mounted by the device is changed by the user.
592        ///
593        /// Note: Execution of the delegate callback will occur on the main thread.
594        #[optional]
595        #[unsafe(method(deviceDidChangeName:))]
596        #[unsafe(method_family = none)]
597        unsafe fn deviceDidChangeName(&self, device: &ICDevice);
598
599        /// This message is sent to the device delegate when status information is received from a device.
600        ///
601        /// The 'status' dictionary contains two keys, ICStatusNotificationKey and ICLocalizedStatusNotificationKey, which are defined above.  Status information keys are located in their respective ICDevice type class header.
602        ///
603        /// Note: Execution of the delegate callback will occur on the main thread.
604        ///
605        /// # Safety
606        ///
607        /// `status` generic should be of the correct type.
608        #[optional]
609        #[unsafe(method(device:didReceiveStatusInformation:))]
610        #[unsafe(method_family = none)]
611        unsafe fn device_didReceiveStatusInformation(
612            &self,
613            device: &ICDevice,
614            status: &NSDictionary<ICDeviceStatus, AnyObject>,
615        );
616
617        /// This message is sent to the device delegate a device encounters an error.
618        ///
619        /// Note: Execution of the delegate callback will occur on the main thread.
620        #[optional]
621        #[unsafe(method(device:didEncounterError:))]
622        #[unsafe(method_family = none)]
623        unsafe fn device_didEncounterError(&self, device: &ICDevice, error: Option<&NSError>);
624
625        /// This message is sent to the device delegate when the eject has completed.
626        ///
627        /// Note: Execution of the delegate callback will occur on the main thread.
628        #[optional]
629        #[unsafe(method(device:didEjectWithError:))]
630        #[unsafe(method_family = none)]
631        unsafe fn device_didEjectWithError(&self, device: &ICDevice, error: Option<&NSError>);
632
633        /// This message is sent when the sharing state of a device has changes.
634        ///
635        /// Any Image Capture client application can choose to share the device over the network using the sharing or webSharing facility in Image Capture.
636        ///
637        /// Note: Execution of the delegate callback will occur on the main thread.
638        #[deprecated = "Device sharing is no longer available"]
639        #[optional]
640        #[unsafe(method(deviceDidChangeSharingState:))]
641        #[unsafe(method_family = none)]
642        unsafe fn deviceDidChangeSharingState(&self, device: &ICDevice);
643    }
644);