objc2_image_capture_core/generated/
ICCameraItem.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/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitemmetadataoption?language=objc)
13// NS_TYPED_ENUM
14pub type ICCameraItemMetadataOption = NSString;
15
16/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitemthumbnailoption?language=objc)
17// NS_TYPED_ENUM
18pub type ICCameraItemThumbnailOption = NSString;
19
20extern "C" {
21    /// Use of this key will override any custom thumbnail size requested, ignoring the ICImageSourceThumbnailMaxPixelSize
22    /// option entirely.
23    ///
24    ///
25    /// Use of this key will be ignored if ICImageSourceShouldCache has also been passed in.  Custom thumbnail requests will never be
26    /// cached.
27    ///
28    ///
29    /// Only the embedded EXIF thumbnail, or a created thumbnail of EXIF standard size (160x120) will
30    /// be cached. Use of the ICImageSourceShouldCache flag is discouraged, as the framework shall not act as a
31    /// backing store out of convienence.
32    ///
33    /// If use of this flag is required, it is highly recommeded to only keep the image cached within the framework temporarily,
34    /// using the method -[ICCameraItem flushThumbnailCache] to evict the thumbnail.
35    ///
36    /// Multiple calls to both cache the EXIF thumbnail, and subsequently retrieve a larger thumbnail will work as defined.
37    ///
38    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icimagesourcethumbnailmaxpixelsize?language=objc)
39    pub static ICImageSourceThumbnailMaxPixelSize: &'static ICCameraItemThumbnailOption;
40}
41
42extern "C" {
43    /// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icimagesourceshouldcache?language=objc)
44    pub static ICImageSourceShouldCache: &'static ICCameraItemThumbnailOption;
45}
46
47/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadoption?language=objc)
48// NS_TYPED_ENUM
49pub type ICDownloadOption = NSString;
50
51extern "C" {
52    /// ICDownloadsDirectoryURL
53    ///
54    /// The value for this key should be an NSURL object referencing a writable directory. The downloaded files will be saved in that directory.
55    ///
56    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadsdirectoryurl?language=objc)
57    pub static ICDownloadsDirectoryURL: &'static ICDownloadOption;
58}
59
60extern "C" {
61    /// ICSaveAsFilename
62    ///
63    /// The value for this key should be an NSString object containing the name to be used for the downloaded file.
64    ///
65    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsaveasfilename?language=objc)
66    pub static ICSaveAsFilename: &'static ICDownloadOption;
67}
68
69extern "C" {
70    /// ICSavedFilename
71    ///
72    /// The value for this key will be an NSString object containing the actual name of the saved file. The options dictionary returned in didDownloadFile:error:options:contextInfo: will have this key.
73    ///
74    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsavedfilename?language=objc)
75    pub static ICSavedFilename: &'static ICDownloadOption;
76}
77
78extern "C" {
79    /// ICSavedAncillaryFiles
80    ///
81    /// The value for this key will be an NSArray object containing names of files associated with the primary file that is downloaded. The options dictionary returned in didDownloadFile:error:options:contextInfo: may have this key.
82    ///
83    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsavedancillaryfiles?language=objc)
84    pub static ICSavedAncillaryFiles: &'static ICDownloadOption;
85}
86
87extern "C" {
88    /// ICOverwrite
89    ///
90    /// The value for this key should be an NSNumber object representing a boolean value. If this value is YES, the downloaded file will overwrite an existing file with the same name and extension.
91    ///
92    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icoverwrite?language=objc)
93    pub static ICOverwrite: &'static ICDownloadOption;
94}
95
96extern "C" {
97    /// ICDeleteAfterSuccessfulDownload
98    ///
99    /// The value for this key should be an NSNumber object representing a boolean value. If this value is YES, the file will be deleted from the device after it is succcessfully downloaded.
100    ///
101    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteaftersuccessfuldownload?language=objc)
102    pub static ICDeleteAfterSuccessfulDownload: &'static ICDownloadOption;
103}
104
105extern "C" {
106    /// ICDownloadSidecarFiles
107    ///
108    /// The value for this key should be an NSNumber object representing a boolean value. If this value is YES, all sidecar files will be downloaded along with the media file.
109    ///
110    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadsidecarfiles?language=objc)
111    pub static ICDownloadSidecarFiles: &'static ICDownloadOption;
112}
113
114extern "C" {
115    /// The value for this key should be an NSNumber object representing a boolean value. If this value is YES, and the file is a JPG converted from HEIC on device,
116    /// the padding will be stripped from the end of the file.  Note that the file size property of the ICCameraItem object will not be updated to reflect the newly truncated image.  This
117    /// option has no effect for images coming from devices without the ability to convert from HEIC to JPG.
118    ///
119    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictruncateaftersuccessfuldownload?language=objc)
120    pub static ICTruncateAfterSuccessfulDownload: &'static ICDownloadOption;
121}
122
123extern_class!(
124    /// ICCameraItem is an abstract class that represents an item in an ICCameraDevice object. ICCameraDevice object creates
125    /// instances of two concrete subclasses of ICCameraItem: ICCameraFolder and ICCameraFile.
126    ///
127    /// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitem?language=objc)
128    #[unsafe(super(NSObject))]
129    #[derive(Debug, PartialEq, Eq, Hash)]
130    pub struct ICCameraItem;
131);
132
133extern_conformance!(
134    unsafe impl NSObjectProtocol for ICCameraItem {}
135);
136
137impl ICCameraItem {
138    extern_methods!(
139        #[cfg(all(feature = "ICCameraDevice", feature = "ICDevice"))]
140        /// Parent device of this item.
141        #[unsafe(method(device))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn device(&self) -> Option<Retained<ICCameraDevice>>;
144
145        #[cfg(feature = "ICCameraFolder")]
146        /// Parent folder of this folder. The root folder's parentFolder is nil.
147        #[unsafe(method(parentFolder))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn parentFolder(&self) -> Option<Retained<ICCameraFolder>>;
150
151        /// Name of this item.
152        #[unsafe(method(name))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn name(&self) -> Option<Retained<NSString>>;
155
156        /// Item UTI. This is an Uniform Type Identifier string. It is one of: kUTTypeFolder, kUTTypeImage, kUTTypeMovie, kUTTypeAudio, or kUTTypeData.
157        #[unsafe(method(UTI))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn UTI(&self) -> Option<Retained<NSString>>;
160
161        /// The file system path of the item for items on a device with transportType of ICTransportTypeMassStorage.
162        #[unsafe(method(fileSystemPath))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn fileSystemPath(&self) -> Option<Retained<NSString>>;
165
166        /// Indicates the protection state of this item. It is locked if the storage card in the camera is locked.
167        #[unsafe(method(isLocked))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn isLocked(&self) -> bool;
170
171        /// Indicates if the file is a raw image file.
172        #[unsafe(method(isRaw))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn isRaw(&self) -> bool;
175
176        /// Indicates if this folder is in a temporary store. A temporary store may be used by the device when images are
177        /// captures on the device when it is tethered to the computer.
178        #[unsafe(method(isInTemporaryStore))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn isInTemporaryStore(&self) -> bool;
181
182        /// Creation date of this file. This information is usually the same as the EXIF creation date.
183        #[unsafe(method(creationDate))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
186
187        /// Modification date of this file. This information is usually the same as the EXIF modification date.
188        #[unsafe(method(modificationDate))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;
191
192        #[cfg(feature = "objc2-core-graphics")]
193        /// Thumbnail for the item. The value of this property is NULL unless a 'requestThumbnail' message is sent to this object.
194        #[unsafe(method(thumbnail))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn thumbnail(&self) -> Option<Retained<CGImage>>;
197
198        /// Metadata for the item. The value of this property is NULL unless a 'requestMetadata' message is sent to this object.
199        #[unsafe(method(metadata))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn metadata(&self) -> Option<Retained<NSDictionary>>;
202
203        /// A mutable dictionary to store arbitrary key-value pairs associated with a camera item object. This can be used by
204        /// view objects that bind to this object to store "house-keeping" information.
205        ///
206        /// # Safety
207        ///
208        /// The returned generic should be of the correct type.
209        #[unsafe(method(userData))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>;
212
213        /// PTP object handle value if the item is on a camera that uses PTP protocol. The value of this property is set to 0
214        /// if the camera does not use PTP protocol.
215        #[unsafe(method(ptpObjectHandle))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn ptpObjectHandle(&self) -> c_uint;
218
219        /// This property is set if the file is captured on the device after the device's content is fully enumerated. This does
220        /// not apply to files added as a result of adding a new store to the device.
221        #[unsafe(method(wasAddedAfterContentCatalogCompleted))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn wasAddedAfterContentCatalogCompleted(&self) -> bool;
224
225        /// This method requests thumbnail for the item. If one is not readily available, accessing this property will send a message to the device requesting a thumbnail for the file. The delegate of the device will be notified via method "cameraDevice:didReceiveThumbnail:forItem:error:", if this method is implemented by the delegate.
226        ///
227        /// Note: Execution of the delegate callback will occur on the main thread.
228        #[unsafe(method(requestThumbnail))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn requestThumbnail(&self);
231
232        /// Metadata for the file if one is readily available. If one is not readily available, accessing this property will send a message to the device requesting metadata for the file. The delegate of the device will be notified via method "cameraDevice:didReceiveMetadata:forItem:error:", if this method is implemented by the delegate.
233        ///
234        /// Note: Execution of the delegate callback will occur on the main thread.
235        #[unsafe(method(requestMetadata))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn requestMetadata(&self);
238
239        /// Deletes cached thumbnail for the item.
240        #[unsafe(method(flushThumbnailCache))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn flushThumbnailCache(&self);
243
244        /// Deletes cached metadata for the item.
245        #[unsafe(method(flushMetadataCache))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn flushMetadataCache(&self);
248
249        #[cfg(feature = "objc2-core-graphics")]
250        #[deprecated]
251        #[unsafe(method(thumbnailIfAvailable))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn thumbnailIfAvailable(&self) -> Option<Retained<CGImage>>;
254
255        #[cfg(feature = "objc2-core-graphics")]
256        #[deprecated]
257        #[unsafe(method(largeThumbnailIfAvailable))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn largeThumbnailIfAvailable(&self) -> Option<Retained<CGImage>>;
260
261        #[deprecated]
262        #[unsafe(method(metadataIfAvailable))]
263        #[unsafe(method_family = none)]
264        pub unsafe fn metadataIfAvailable(
265            &self,
266        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
267    );
268}
269
270/// Methods declared on superclass `NSObject`.
271impl ICCameraItem {
272    extern_methods!(
273        #[unsafe(method(init))]
274        #[unsafe(method_family = init)]
275        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
276
277        #[unsafe(method(new))]
278        #[unsafe(method_family = new)]
279        pub unsafe fn new() -> Retained<Self>;
280    );
281}