objc2_image_capture_core/generated/ICCameraDevice.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
12extern "C" {
13 /// Indicates that the camera can capture a picture while it is connected, if the client sends a 'requestTakePicture' message to it.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicecantakepicture?language=objc)
16 #[cfg(feature = "ICDevice")]
17 pub static ICCameraDeviceCanTakePicture: &'static ICDeviceCapability;
18}
19
20extern "C" {
21 /// Indicates that the camera can capture a picture while it is connected, if the user presses the shutter release on the camera.
22 ///
23 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicecantakepictureusingshutterreleaseoncamera?language=objc)
24 #[cfg(feature = "ICDevice")]
25 pub static ICCameraDeviceCanTakePictureUsingShutterReleaseOnCamera: &'static ICDeviceCapability;
26}
27
28extern "C" {
29 /// Indicates that the camera can delete a file at a time while it is connected.
30 ///
31 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicecandeleteonefile?language=objc)
32 #[cfg(feature = "ICDevice")]
33 pub static ICCameraDeviceCanDeleteOneFile: &'static ICDeviceCapability;
34}
35
36extern "C" {
37 /// Indicates that the camera can delete all files in a single operation while it is connected.
38 ///
39 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicecandeleteallfiles?language=objc)
40 #[cfg(feature = "ICDevice")]
41 pub static ICCameraDeviceCanDeleteAllFiles: &'static ICDeviceCapability;
42}
43
44extern "C" {
45 /// Indicates that the camera can synchronize its date and time with that of the host computer.
46 ///
47 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicecansyncclock?language=objc)
48 #[cfg(feature = "ICDevice")]
49 pub static ICCameraDeviceCanSyncClock: &'static ICDeviceCapability;
50}
51
52extern "C" {
53 /// Indicates that the host can upload files to the camera.
54 ///
55 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicecanreceivefile?language=objc)
56 #[cfg(feature = "ICDevice")]
57 pub static ICCameraDeviceCanReceiveFile: &'static ICDeviceCapability;
58}
59
60extern "C" {
61 /// Indicates that the camera can accept PTP commands.
62 ///
63 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicecanacceptptpcommands?language=objc)
64 #[cfg(feature = "ICDevice")]
65 pub static ICCameraDeviceCanAcceptPTPCommands: &'static ICDeviceCapability;
66}
67
68extern "C" {
69 /// Indicates that the camera supports HEIF transcoding, and can change the presentation of converted assets and original assets on the fly.
70 ///
71 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicesupportsheif?language=objc)
72 #[cfg(feature = "ICDevice")]
73 pub static ICCameraDeviceSupportsHEIF: &'static ICDeviceCapability;
74}
75
76/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icuploadoption?language=objc)
77// NS_TYPED_ENUM
78pub type ICUploadOption = NSString;
79
80/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteresult?language=objc)
81// NS_TYPED_ENUM
82pub type ICDeleteResult = NSString;
83
84extern "C" {
85 /// The value for this key should be an NSArray
86 /// <ICCameraItem
87 /// *>*
88 ///
89 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeletesuccessful?language=objc)
90 pub static ICDeleteSuccessful: &'static ICDeleteResult;
91}
92
93extern "C" {
94 /// The value for this key should be an NSArray
95 /// <ICCameraItem
96 /// *>*
97 ///
98 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeletecanceled?language=objc)
99 pub static ICDeleteCanceled: &'static ICDeleteResult;
100}
101
102extern "C" {
103 /// The value for this key should be an NSArray
104 /// <ICCameraItem
105 /// *>*
106 ///
107 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeletefailed?language=objc)
108 pub static ICDeleteFailed: &'static ICDeleteResult;
109}
110
111/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteerror?language=objc)
112// NS_TYPED_ENUM
113pub type ICDeleteError = NSString;
114
115extern "C" {
116 /// The value for this key should be an ICCameraItem*
117 ///
118 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteerrorreadonly?language=objc)
119 pub static ICDeleteErrorReadOnly: &'static ICDeleteError;
120}
121
122extern "C" {
123 /// The value for this key should be an ICCameraItem*
124 ///
125 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteerrorfilemissing?language=objc)
126 pub static ICDeleteErrorFileMissing: &'static ICDeleteError;
127}
128
129extern "C" {
130 /// The value for this key should be an ICCameraItem*
131 ///
132 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteerrordevicemissing?language=objc)
133 pub static ICDeleteErrorDeviceMissing: &'static ICDeleteError;
134}
135
136extern "C" {
137 /// The value for this key should be an ICCameraItem*
138 ///
139 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteerrorcanceled?language=objc)
140 pub static ICDeleteErrorCanceled: &'static ICDeleteError;
141}
142
143/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icmediapresentation?language=objc)
144// NS_ENUM
145#[repr(transparent)]
146#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
147pub struct ICMediaPresentation(pub NSUInteger);
148impl ICMediaPresentation {
149 #[doc(alias = "ICMediaPresentationConvertedAssets")]
150 pub const ConvertedAssets: Self = Self(1);
151 #[doc(alias = "ICMediaPresentationOriginalAssets")]
152 pub const OriginalAssets: Self = Self(2);
153}
154
155unsafe impl Encode for ICMediaPresentation {
156 const ENCODING: Encoding = NSUInteger::ENCODING;
157}
158
159unsafe impl RefEncode for ICMediaPresentation {
160 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
161}
162
163extern_class!(
164 /// ICCameraDevice is a concrete subclass of ICDevice class. ICDeviceBrowser creates instances of this class.
165 ///
166 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevice?language=objc)
167 #[unsafe(super(ICDevice, NSObject))]
168 #[derive(Debug, PartialEq, Eq, Hash)]
169 #[cfg(feature = "ICDevice")]
170 pub struct ICCameraDevice;
171);
172
173#[cfg(feature = "ICDevice")]
174extern_conformance!(
175 unsafe impl NSObjectProtocol for ICCameraDevice {}
176);
177
178#[cfg(feature = "ICDevice")]
179impl ICCameraDevice {
180 extern_methods!(
181 /// Indicates the percentage of content cataloging completed on the device. Its value ranges from 0 to 100.
182 #[unsafe(method(contentCatalogPercentCompleted))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn contentCatalogPercentCompleted(&self) -> NSUInteger;
185
186 #[cfg(feature = "ICCameraItem")]
187 /// Contents of the camera. The structure of the elements in this array will reflect the folder structure of the storage reported by the camera. Each item in this array will correspond to a storage on the camera.
188 #[unsafe(method(contents))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn contents(&self) -> Option<Retained<NSArray<ICCameraItem>>>;
191
192 #[cfg(feature = "ICCameraItem")]
193 /// The property mediaFiles represents all image, movie and audio files on the camera. These files are returned as a single array without regard to the folder hierarchy used to store these files on the camera.
194 #[unsafe(method(mediaFiles))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn mediaFiles(&self) -> Option<Retained<NSArray<ICCameraItem>>>;
197
198 /// Indicates whether the device can be 'soft' removed or disconnected.
199 #[unsafe(method(isEjectable))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn isEjectable(&self) -> bool;
202
203 /// Indicates whether the device is locked. A locked device does not allow for deletion of any asset.
204 #[unsafe(method(isLocked))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn isLocked(&self) -> bool;
207
208 /// Set to YES if the device is made by Apple and is pass-coded locked and connected to an untrusted host.
209 #[unsafe(method(isAccessRestrictedAppleDevice))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn isAccessRestrictedAppleDevice(&self) -> bool;
212
213 /// Set to YES if the device is made by Apple and is pass-coded locked and connected to an untrusted host.
214 #[unsafe(method(iCloudPhotosEnabled))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn iCloudPhotosEnabled(&self) -> bool;
217
218 /// Filesystem mount point for a device with transportType of ICTransportTypeMassStorage. This will be NULL for all other devices.
219 #[unsafe(method(mountPoint))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn mountPoint(&self) -> Option<Retained<NSString>>;
222
223 /// The media presentation describes the visible assets from a device that may contain multiple formats of each media asset. The asigngments are of the type ICMediaPresentation enumeration. This property is available only if the capability ICCameraDeviceSupportsHEIF is present.
224 ///
225 ///
226 /// A device supporting this capability can specify the
227 /// following presentations:
228 ///
229 /// ICMediaPresentationConverted - The default behavior for applications retrieving images from a device supporting HEIF is to show only converted JPG from HEIF originals, and only H264 encoded video assets from HEVC.
230 /// ICMediaPresentationOriginal - This presentation will show only original images from a device supporting HEIF and HEVC. Burned in renders are always exported in JPG, as are burned in effects for MOV clips.
231 #[unsafe(method(mediaPresentation))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn mediaPresentation(&self) -> ICMediaPresentation;
234
235 /// Setter for [`mediaPresentation`][Self::mediaPresentation].
236 #[unsafe(method(setMediaPresentation:))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn setMediaPresentation(&self, media_presentation: ICMediaPresentation);
239
240 /// This method returns an array of files on the camera of type fileType.
241 ///
242 /// The fileType string is one of the following Uniform Type Identifier strings: kUTTypeImage, kUTTypeMovie, kUTTypeAudio, or kUTTypeData.
243 #[unsafe(method(filesOfType:))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn filesOfType(
246 &self,
247 file_ut_type: &NSString,
248 ) -> Option<Retained<NSArray<NSString>>>;
249
250 #[cfg(all(feature = "ICCameraFile", feature = "ICCameraItem", feature = "libc"))]
251 /// This method asynchronously reads data of a specified length from a specified offset.
252 ///
253 /// The readDelegate passed must not be nil. When this request is completed, the didReadDataSelector of the readDelegate object is called. The didReadDataSelector should have the same signature as: - (void)didReadData:(NSData*)data fromFile:(ICCameraFile*)file error:(NSError*)error contextInfo:(void*)contextInfo. The content of error returned should be examined to determine if the request completed successfully.
254 ///
255 /// # Safety
256 ///
257 /// - `read_delegate` should be of the correct type.
258 /// - `selector` must be a valid selector.
259 /// - `context_info` must be a valid pointer or null.
260 #[unsafe(method(requestReadDataFromFile:atOffset:length:readDelegate:didReadDataSelector:contextInfo:))]
261 #[unsafe(method_family = none)]
262 pub unsafe fn requestReadDataFromFile_atOffset_length_readDelegate_didReadDataSelector_contextInfo(
263 &self,
264 file: &ICCameraFile,
265 offset: libc::off_t,
266 length: libc::off_t,
267 read_delegate: &AnyObject,
268 selector: Sel,
269 context_info: *mut c_void,
270 );
271
272 #[cfg(all(feature = "ICCameraFile", feature = "ICCameraItem"))]
273 /// Download a file from the camera. Please refer to the top of this header for information about the options.
274 ///
275 /// The downloadDelegate passed must not be nil. When this request is completed, the didDownloadSelector of the downloadDelegate object is called.The didDownloadSelector should have the same signature as: - (void)didDownloadFile:(ICCameraFile*)file error:(NSError*)error options:(NSDictionary*)options contextInfo:(void*)contextInfo. The content of error returned should be examined to determine if the request completed successfully.
276 ///
277 /// # Safety
278 ///
279 /// - `options` generic should be of the correct type.
280 /// - `selector` must be a valid selector.
281 /// - `context_info` must be a valid pointer or null.
282 #[unsafe(method(requestDownloadFile:options:downloadDelegate:didDownloadSelector:contextInfo:))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn requestDownloadFile_options_downloadDelegate_didDownloadSelector_contextInfo(
285 &self,
286 file: &ICCameraFile,
287 options: &NSDictionary<ICDownloadOption, AnyObject>,
288 download_delegate: &ProtocolObject<dyn ICCameraDeviceDownloadDelegate>,
289 selector: Sel,
290 context_info: *mut c_void,
291 );
292
293 /// Cancels the current download operation if supported
294 #[unsafe(method(cancelDownload))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn cancelDownload(&self);
297
298 #[cfg(feature = "ICCameraItem")]
299 /// Deletes files.
300 #[unsafe(method(requestDeleteFiles:))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn requestDeleteFiles(&self, files: &NSArray<ICCameraItem>);
303
304 #[cfg(all(feature = "ICCameraItem", feature = "block2"))]
305 /// Allows for deletion of an array of ICCameraItem objects, with the added ability to catch delete failures using the
306 /// 'deleteFailed' block, and a completion block that will return the overall state of the request.
307 ///
308 /// The deleteFailed block will return:
309 /// - NSDictionary
310 /// <ICDeleteError
311 /// , ICCameraItem*>*
312 ///
313 /// The completion block will return:
314 /// — error:
315 /// - nil if successful
316 /// - NSError* with an code set to ICReturnDeleteFilesFailed if any file failed.
317 ///
318 /// - result: NSDictionary
319 /// <ICDeleteResult
320 /// , NSArray
321 /// <ICCameraItem
322 /// *>*>* result
323 /// - ICDeleteSuccessful: NSArray
324 /// <ICCameraItem
325 /// *>* success
326 /// - ICDeleteFailed: NSArray
327 /// <ICCameraItem
328 /// *>* failed
329 #[unsafe(method(requestDeleteFiles:deleteFailed:completion:))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn requestDeleteFiles_deleteFailed_completion(
332 &self,
333 files: &NSArray<ICCameraItem>,
334 delete_failed: &block2::DynBlock<
335 dyn Fn(NonNull<NSDictionary<ICDeleteError, ICCameraItem>>),
336 >,
337 completion: &block2::DynBlock<
338 dyn Fn(NonNull<NSDictionary<ICDeleteResult, NSArray<ICCameraItem>>>, *mut NSError),
339 >,
340 ) -> Option<Retained<NSProgress>>;
341
342 /// Cancels the current delete operation started by sending a 'requestDeleteFiles:'. This will only cancel operations in flight when a batch of files have been requested for deletion.
343 #[unsafe(method(cancelDelete))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn cancelDelete(&self);
346
347 /// Synchronize camera's clock with the computer's clock. You should send this request only if the camera has the 'ICCameraDeviceCanSyncClock' capability.
348 #[unsafe(method(requestSyncClock))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn requestSyncClock(&self);
351
352 /// Indicates the time offset, in seconds, between the camera's clock and the computer's clock. This value is positive if the camera's clock is ahead of the computer's clock. This property should be ignored if the camera's capabilities property does not contain ICCameraDeviceCanSyncClock.
353 #[unsafe(method(timeOffset))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn timeOffset(&self) -> NSTimeInterval;
356
357 /// Indicates if the device has reported battery charge level.
358 #[unsafe(method(batteryLevelAvailable))]
359 #[unsafe(method_family = none)]
360 pub unsafe fn batteryLevelAvailable(&self) -> bool;
361
362 /// Indicates the battery charge level. Its value ranges from 0 to 100.
363 #[unsafe(method(batteryLevel))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn batteryLevel(&self) -> NSUInteger;
366
367 /// Upload a file at fileURL to the camera. The options dictionary is not used in this version.
368 ///
369 /// The uploadDelegate passed must not be nil. When this request is completed, the didUploadSelector of the uploadDelegate object is called. The didUploadSelector should have the same signature as: - (void)didUploadFile:(NSURL*)fileURL error:(NSError*)error contextInfo:(void*)contextInfo. The content of error returned should be examined to determine if the request completed successfully.
370 ///
371 /// # Safety
372 ///
373 /// - `options` generic should be of the correct type.
374 /// - `upload_delegate` should be of the correct type.
375 /// - `selector` must be a valid selector.
376 /// - `context_info` must be a valid pointer or null.
377 #[deprecated = "Sandbox restrictions prohibit writing directly to device hardware"]
378 #[unsafe(method(requestUploadFile:options:uploadDelegate:didUploadSelector:contextInfo:))]
379 #[unsafe(method_family = none)]
380 pub unsafe fn requestUploadFile_options_uploadDelegate_didUploadSelector_contextInfo(
381 &self,
382 file_url: &NSURL,
383 options: &NSDictionary<ICUploadOption, AnyObject>,
384 upload_delegate: &AnyObject,
385 selector: Sel,
386 context_info: *mut c_void,
387 );
388
389 /// This property is always set to YES when the device has the capability 'ICCameraDeviceCanTakePicture'
390 ///
391 /// requestEnableTethering/requestDisableTethering is no longer required to setup and destroy the standard
392 /// take picture functionality of supported cameras.
393 #[unsafe(method(tetheredCaptureEnabled))]
394 #[unsafe(method_family = none)]
395 pub unsafe fn tetheredCaptureEnabled(&self) -> bool;
396
397 /// Capture a new image using the camera, the camera capabilities include 'ICCameraDeviceCanTakePicture'.
398 #[unsafe(method(requestTakePicture))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn requestTakePicture(&self);
401
402 /// Send this message to enable tethered capture on the camera device if the camera has the 'ICCameraDeviceCanTakePicture' capability.
403 #[deprecated = "Third party cameras that support the standard take picture command will have the capability enabled by default. This call will have no effect"]
404 #[unsafe(method(requestEnableTethering))]
405 #[unsafe(method_family = none)]
406 pub unsafe fn requestEnableTethering(&self);
407
408 /// Send this message to disable tethered capture on the camera device if the camera has the 'ICCameraDeviceCanTakePicture' capability and if your process has already sent a 'requestEnableTethering' to it.
409 #[deprecated = "Third party cameras that support the standard take picture command will have the capability enabled by default. This call will have no effect"]
410 #[unsafe(method(requestDisableTethering))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn requestDisableTethering(&self);
413
414 #[cfg(feature = "block2")]
415 /// As an alternative to setting up an object to handle PTP event packets, a handler can be set. The handler will always be called in place of the delegate if non-nil. If the handler is not present, the delegate will be called if present. It is guaranteed only one of the methods will be called if both are implemented.
416 ///
417 /// # Safety
418 ///
419 /// The returned block's argument must be a valid pointer.
420 #[unsafe(method(ptpEventHandler))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn ptpEventHandler(&self) -> NonNull<block2::DynBlock<dyn Fn(NonNull<NSData>)>>;
423
424 #[cfg(feature = "block2")]
425 /// Setter for [`ptpEventHandler`][Self::ptpEventHandler].
426 ///
427 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
428 #[unsafe(method(setPtpEventHandler:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn setPtpEventHandler(
431 &self,
432 ptp_event_handler: &block2::DynBlock<dyn Fn(NonNull<NSData>)>,
433 );
434
435 /// This method asynchronously sends a PTP command to a camera.
436 ///
437 /// This should be sent only if the 'capabilities' property contains 'ICCameraDeviceCanAcceptPTPCommands'. All PTP cameras have this capability. The response to this command will be delivered using didSendCommandSelector of sendCommandDelegate. The didSendCommandSelector should have the same signature as: - (void)didSendPTPCommand:(NSData*)command inData:(NSData*)data response:(NSData*)response error:(NSError*)error contextInfo:(void*)contextInfo. The content of error returned should be examined to determine if the request completed successfully.
438 ///
439 /// # Safety
440 ///
441 /// - `send_command_delegate` should be of the correct type.
442 /// - `selector` must be a valid selector.
443 /// - `context_info` must be a valid pointer or null.
444 #[unsafe(method(requestSendPTPCommand:outData:sendCommandDelegate:didSendCommandSelector:contextInfo:))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn requestSendPTPCommand_outData_sendCommandDelegate_didSendCommandSelector_contextInfo(
447 &self,
448 command: &NSData,
449 data: Option<&NSData>,
450 send_command_delegate: &AnyObject,
451 selector: Sel,
452 context_info: *mut c_void,
453 );
454
455 #[cfg(feature = "block2")]
456 /// This method asynchronously sends a PTP command to a camera.
457 ///
458 /// The response, data, and any error message will be returned the block.
459 #[unsafe(method(requestSendPTPCommand:outData:completion:))]
460 #[unsafe(method_family = none)]
461 pub unsafe fn requestSendPTPCommand_outData_completion(
462 &self,
463 ptp_command: &NSData,
464 ptp_data: Option<&NSData>,
465 completion: &block2::DynBlock<dyn Fn(NonNull<NSData>, NonNull<NSData>, *mut NSError)>,
466 );
467 );
468}
469
470/// Methods declared on superclass `NSObject`.
471#[cfg(feature = "ICDevice")]
472impl ICCameraDevice {
473 extern_methods!(
474 #[unsafe(method(init))]
475 #[unsafe(method_family = init)]
476 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
477
478 #[unsafe(method(new))]
479 #[unsafe(method_family = new)]
480 pub unsafe fn new() -> Retained<Self>;
481 );
482}
483
484extern_protocol!(
485 /// A delegate of ICCameraDevice must conform to ICCameraDeviceDelegate protocol.
486 ///
487 /// The ICCameraDeviceDelegate protocol inherits from the ICDeviceDelegate protocol.
488 ///
489 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicedelegate?language=objc)
490 #[cfg(feature = "ICDevice")]
491 pub unsafe trait ICCameraDeviceDelegate: ICDeviceDelegate {
492 #[cfg(feature = "ICCameraItem")]
493 /// This message is sent when objects are added to the device.
494 ///
495 /// The objects in items are instances ICCameraFile class.
496 #[unsafe(method(cameraDevice:didAddItems:))]
497 #[unsafe(method_family = none)]
498 unsafe fn cameraDevice_didAddItems(
499 &self,
500 camera: &ICCameraDevice,
501 items: &NSArray<ICCameraItem>,
502 );
503
504 #[cfg(feature = "ICCameraItem")]
505 /// This message is sent when objects are removed from the device.
506 ///
507 /// The objects in items are instances ICCameraFile class.
508 #[unsafe(method(cameraDevice:didRemoveItems:))]
509 #[unsafe(method_family = none)]
510 unsafe fn cameraDevice_didRemoveItems(
511 &self,
512 camera: &ICCameraDevice,
513 items: &NSArray<ICCameraItem>,
514 );
515
516 #[cfg(all(feature = "ICCameraItem", feature = "objc2-core-graphics"))]
517 /// This message is sent when the thumbnail requested for an item on a device is available.
518 #[unsafe(method(cameraDevice:didReceiveThumbnail:forItem:error:))]
519 #[unsafe(method_family = none)]
520 unsafe fn cameraDevice_didReceiveThumbnail_forItem_error(
521 &self,
522 camera: &ICCameraDevice,
523 thumbnail: Option<&CGImage>,
524 item: &ICCameraItem,
525 error: Option<&NSError>,
526 );
527
528 #[cfg(feature = "ICCameraItem")]
529 /// This message is sent when the metadata requested for an item on a device is available.
530 ///
531 /// # Safety
532 ///
533 /// `metadata` generic should be of the correct type.
534 #[unsafe(method(cameraDevice:didReceiveMetadata:forItem:error:))]
535 #[unsafe(method_family = none)]
536 unsafe fn cameraDevice_didReceiveMetadata_forItem_error(
537 &self,
538 camera: &ICCameraDevice,
539 metadata: Option<&NSDictionary>,
540 item: &ICCameraItem,
541 error: Option<&NSError>,
542 );
543
544 #[cfg(feature = "ICCameraItem")]
545 /// This message is sent when an object or objects are renamed on the device.
546 ///
547 /// The objects may be instances of ICCameraFolder or ICCameraFile class.
548 #[unsafe(method(cameraDevice:didRenameItems:))]
549 #[unsafe(method_family = none)]
550 unsafe fn cameraDevice_didRenameItems(
551 &self,
552 camera: &ICCameraDevice,
553 items: &NSArray<ICCameraItem>,
554 );
555
556 /// This message is sent when a capability of a device changes.
557 ///
558 /// Detailed capabilitiy descriptions are provided at the top of this header file.
559 #[unsafe(method(cameraDeviceDidChangeCapability:))]
560 #[unsafe(method_family = none)]
561 unsafe fn cameraDeviceDidChangeCapability(&self, camera: &ICCameraDevice);
562
563 /// This message is sent to the delegate to convey a PTP event.
564 #[unsafe(method(cameraDevice:didReceivePTPEvent:))]
565 #[unsafe(method_family = none)]
566 unsafe fn cameraDevice_didReceivePTPEvent(
567 &self,
568 camera: &ICCameraDevice,
569 event_data: &NSData,
570 );
571
572 /// This message is sent when the camera device is done enumerating its content and is ready to receive requests.
573 ///
574 /// A session must be opened on the device in order to enumerate its content and make it ready to receive requests.
575 #[unsafe(method(deviceDidBecomeReadyWithCompleteContentCatalog:))]
576 #[unsafe(method_family = none)]
577 unsafe fn deviceDidBecomeReadyWithCompleteContentCatalog(&self, device: &ICCameraDevice);
578
579 /// This message is sent when an Apple device has been unlocked, paired to the host, and media is available.
580 #[unsafe(method(cameraDeviceDidRemoveAccessRestriction:))]
581 #[unsafe(method_family = none)]
582 unsafe fn cameraDeviceDidRemoveAccessRestriction(&self, device: &ICDevice);
583
584 /// This message is sent when an Apple device has been locked, and media is unavailable until the restriction
585 /// has been removed.
586 #[unsafe(method(cameraDeviceDidEnableAccessRestriction:))]
587 #[unsafe(method_family = none)]
588 unsafe fn cameraDeviceDidEnableAccessRestriction(&self, device: &ICDevice);
589
590 #[cfg(feature = "ICCameraItem")]
591 /// This message is sent when the camera device is about to execute queued requests for the thumbnail of a specific item.
592 /// If the request is no longer wanted, eg: the item is no longer displayed on the screen, the client can return NO and abort sending
593 /// a request down to the camera device, speeding up the exection queue.
594 #[optional]
595 #[unsafe(method(cameraDevice:shouldGetThumbnailOfItem:))]
596 #[unsafe(method_family = none)]
597 unsafe fn cameraDevice_shouldGetThumbnailOfItem(
598 &self,
599 camera_device: &ICCameraDevice,
600 item: &ICCameraItem,
601 ) -> bool;
602
603 #[cfg(feature = "ICCameraItem")]
604 /// This message is sent when the camera device is about to execute queued requests for the metadata of a specific item.
605 /// If the request is no longer wanted, eg: the item is no longer displayed on the screen, the client can return NO and abort sending
606 /// a request down to the camera device, speeding up the execution queue.
607 #[optional]
608 #[unsafe(method(cameraDevice:shouldGetMetadataOfItem:))]
609 #[unsafe(method_family = none)]
610 unsafe fn cameraDevice_shouldGetMetadataOfItem(
611 &self,
612 camera_device: &ICCameraDevice,
613 item: &ICCameraItem,
614 ) -> bool;
615
616 /// This message is sent after the camera device completes a delete operation initiated by sending a 'requestDeleteFiles:' message to that device.
617 ///
618 /// This message is sent after the camera device completes a delete operation initiated by sending a 'requestDeleteFiles:' message to that device.
619 #[optional]
620 #[unsafe(method(cameraDevice:didCompleteDeleteFilesWithError:))]
621 #[unsafe(method_family = none)]
622 unsafe fn cameraDevice_didCompleteDeleteFilesWithError(
623 &self,
624 camera: &ICCameraDevice,
625 error: Option<&NSError>,
626 );
627
628 #[cfg(feature = "ICCameraItem")]
629 #[deprecated]
630 #[optional]
631 #[unsafe(method(cameraDevice:didAddItem:))]
632 #[unsafe(method_family = none)]
633 unsafe fn cameraDevice_didAddItem(&self, camera: &ICCameraDevice, item: &ICCameraItem);
634
635 #[cfg(feature = "ICCameraItem")]
636 #[deprecated]
637 #[optional]
638 #[unsafe(method(cameraDevice:didRemoveItem:))]
639 #[unsafe(method_family = none)]
640 unsafe fn cameraDevice_didRemoveItem(&self, camera: &ICCameraDevice, item: &ICCameraItem);
641
642 #[cfg(feature = "ICCameraItem")]
643 #[deprecated]
644 #[optional]
645 #[unsafe(method(cameraDevice:didReceiveThumbnailForItem:))]
646 #[unsafe(method_family = none)]
647 unsafe fn cameraDevice_didReceiveThumbnailForItem(
648 &self,
649 camera: &ICCameraDevice,
650 item: &ICCameraItem,
651 );
652
653 #[cfg(feature = "ICCameraItem")]
654 #[deprecated]
655 #[optional]
656 #[unsafe(method(cameraDevice:didReceiveMetadataForItem:))]
657 #[unsafe(method_family = none)]
658 unsafe fn cameraDevice_didReceiveMetadataForItem(
659 &self,
660 camera: &ICCameraDevice,
661 item: &ICCameraItem,
662 );
663 }
664);
665
666extern_protocol!(
667 /// The object passed in as 'downloadDelegate' in the 'requestDownloadFile:options:downloadDelegate:didDownloadSelector:contextInfo:' message must conform to ICCameraDeviceDownloadDelegate protocol.
668 ///
669 /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameradevicedownloaddelegate?language=objc)
670 pub unsafe trait ICCameraDeviceDownloadDelegate: NSObjectProtocol {
671 #[cfg(all(feature = "ICCameraFile", feature = "ICCameraItem"))]
672 /// This message is sent to the delegate when the requested download operation is complete.
673 ///
674 /// # Safety
675 ///
676 /// - `options` generic should be of the correct type.
677 /// - `context_info` must be a valid pointer or null.
678 #[optional]
679 #[unsafe(method(didDownloadFile:error:options:contextInfo:))]
680 #[unsafe(method_family = none)]
681 unsafe fn didDownloadFile_error_options_contextInfo(
682 &self,
683 file: &ICCameraFile,
684 error: Option<&NSError>,
685 options: &NSDictionary<NSString, AnyObject>,
686 context_info: *mut c_void,
687 );
688
689 #[cfg(all(feature = "ICCameraFile", feature = "ICCameraItem", feature = "libc"))]
690 /// This message is sent to the delegate to provide status of the download operation.
691 #[optional]
692 #[unsafe(method(didReceiveDownloadProgressForFile:downloadedBytes:maxBytes:))]
693 #[unsafe(method_family = none)]
694 unsafe fn didReceiveDownloadProgressForFile_downloadedBytes_maxBytes(
695 &self,
696 file: &ICCameraFile,
697 downloaded_bytes: libc::off_t,
698 max_bytes: libc::off_t,
699 );
700 }
701);