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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
//! 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::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitemmetadataoption?language=objc)
// NS_TYPED_ENUM
pub type ICCameraItemMetadataOption = NSString;
/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitemthumbnailoption?language=objc)
// NS_TYPED_ENUM
pub type ICCameraItemThumbnailOption = NSString;
extern "C" {
/// Use of this key will override any custom thumbnail size requested, ignoring the ICImageSourceThumbnailMaxPixelSize
/// option entirely.
///
///
/// Use of this key will be ignored if ICImageSourceShouldCache has also been passed in. Custom thumbnail requests will never be
/// cached.
///
///
/// Only the embedded EXIF thumbnail, or a created thumbnail of EXIF standard size (160x120) will
/// be cached. Use of the ICImageSourceShouldCache flag is discouraged, as the framework shall not act as a
/// backing store out of convienence.
///
/// If use of this flag is required, it is highly recommeded to only keep the image cached within the framework temporarily,
/// using the method -[ICCameraItem flushThumbnailCache] to evict the thumbnail.
///
/// Multiple calls to both cache the EXIF thumbnail, and subsequently retrieve a larger thumbnail will work as defined.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icimagesourcethumbnailmaxpixelsize?language=objc)
pub static ICImageSourceThumbnailMaxPixelSize: &'static ICCameraItemThumbnailOption;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icimagesourceshouldcache?language=objc)
pub static ICImageSourceShouldCache: &'static ICCameraItemThumbnailOption;
}
/// [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadoption?language=objc)
// NS_TYPED_ENUM
pub type ICDownloadOption = NSString;
extern "C" {
/// ICDownloadsDirectoryURL
///
/// The value for this key should be an NSURL object referencing a writable directory. The downloaded files will be saved in that directory.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadsdirectoryurl?language=objc)
pub static ICDownloadsDirectoryURL: &'static ICDownloadOption;
}
extern "C" {
/// ICSaveAsFilename
///
/// The value for this key should be an NSString object containing the name to be used for the downloaded file.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsaveasfilename?language=objc)
pub static ICSaveAsFilename: &'static ICDownloadOption;
}
extern "C" {
/// ICSavedFilename
///
/// 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.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsavedfilename?language=objc)
pub static ICSavedFilename: &'static ICDownloadOption;
}
extern "C" {
/// ICSavedAncillaryFiles
///
/// 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.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icsavedancillaryfiles?language=objc)
pub static ICSavedAncillaryFiles: &'static ICDownloadOption;
}
extern "C" {
/// ICOverwrite
///
/// 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.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icoverwrite?language=objc)
pub static ICOverwrite: &'static ICDownloadOption;
}
extern "C" {
/// ICDeleteAfterSuccessfulDownload
///
/// 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.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdeleteaftersuccessfuldownload?language=objc)
pub static ICDeleteAfterSuccessfulDownload: &'static ICDownloadOption;
}
extern "C" {
/// ICDownloadSidecarFiles
///
/// 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.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/icdownloadsidecarfiles?language=objc)
pub static ICDownloadSidecarFiles: &'static ICDownloadOption;
}
extern "C" {
/// 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,
/// 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
/// option has no effect for images coming from devices without the ability to convert from HEIC to JPG.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/ictruncateaftersuccessfuldownload?language=objc)
pub static ICTruncateAfterSuccessfulDownload: &'static ICDownloadOption;
}
extern_class!(
/// ICCameraItem is an abstract class that represents an item in an ICCameraDevice object. ICCameraDevice object creates
/// instances of two concrete subclasses of ICCameraItem: ICCameraFolder and ICCameraFile.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/imagecapturecore/iccameraitem?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct ICCameraItem;
);
extern_conformance!(
unsafe impl NSObjectProtocol for ICCameraItem {}
);
impl ICCameraItem {
extern_methods!(
#[cfg(all(feature = "ICCameraDevice", feature = "ICDevice"))]
/// Parent device of this item.
#[unsafe(method(device))]
#[unsafe(method_family = none)]
pub unsafe fn device(&self) -> Option<Retained<ICCameraDevice>>;
#[cfg(feature = "ICCameraFolder")]
/// Parent folder of this folder. The root folder's parentFolder is nil.
#[unsafe(method(parentFolder))]
#[unsafe(method_family = none)]
pub unsafe fn parentFolder(&self) -> Option<Retained<ICCameraFolder>>;
/// Name of this item.
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub unsafe fn name(&self) -> Option<Retained<NSString>>;
/// Item UTI. This is an Uniform Type Identifier string. It is one of: kUTTypeFolder, kUTTypeImage, kUTTypeMovie, kUTTypeAudio, or kUTTypeData.
#[unsafe(method(UTI))]
#[unsafe(method_family = none)]
pub unsafe fn UTI(&self) -> Option<Retained<NSString>>;
/// The file system path of the item for items on a device with transportType of ICTransportTypeMassStorage.
#[unsafe(method(fileSystemPath))]
#[unsafe(method_family = none)]
pub unsafe fn fileSystemPath(&self) -> Option<Retained<NSString>>;
/// Indicates the protection state of this item. It is locked if the storage card in the camera is locked.
#[unsafe(method(isLocked))]
#[unsafe(method_family = none)]
pub unsafe fn isLocked(&self) -> bool;
/// Indicates if the file is a raw image file.
#[unsafe(method(isRaw))]
#[unsafe(method_family = none)]
pub unsafe fn isRaw(&self) -> bool;
/// Indicates if this folder is in a temporary store. A temporary store may be used by the device when images are
/// captures on the device when it is tethered to the computer.
#[unsafe(method(isInTemporaryStore))]
#[unsafe(method_family = none)]
pub unsafe fn isInTemporaryStore(&self) -> bool;
/// Creation date of this file. This information is usually the same as the EXIF creation date.
#[unsafe(method(creationDate))]
#[unsafe(method_family = none)]
pub unsafe fn creationDate(&self) -> Option<Retained<NSDate>>;
/// Modification date of this file. This information is usually the same as the EXIF modification date.
#[unsafe(method(modificationDate))]
#[unsafe(method_family = none)]
pub unsafe fn modificationDate(&self) -> Option<Retained<NSDate>>;
#[cfg(feature = "objc2-core-graphics")]
/// Thumbnail for the item. The value of this property is NULL unless a 'requestThumbnail' message is sent to this object.
#[unsafe(method(thumbnail))]
#[unsafe(method_family = none)]
pub unsafe fn thumbnail(&self) -> Option<Retained<CGImage>>;
/// Metadata for the item. The value of this property is NULL unless a 'requestMetadata' message is sent to this object.
#[unsafe(method(metadata))]
#[unsafe(method_family = none)]
pub unsafe fn metadata(&self) -> Option<Retained<NSDictionary>>;
/// A mutable dictionary to store arbitrary key-value pairs associated with a camera item object. This can be used by
/// view objects that bind to this object to store "house-keeping" information.
///
/// # Safety
///
/// The returned generic should be of the correct type.
#[unsafe(method(userData))]
#[unsafe(method_family = none)]
pub unsafe fn userData(&self) -> Option<Retained<NSMutableDictionary>>;
/// PTP object handle value if the item is on a camera that uses PTP protocol. The value of this property is set to 0
/// if the camera does not use PTP protocol.
#[unsafe(method(ptpObjectHandle))]
#[unsafe(method_family = none)]
pub unsafe fn ptpObjectHandle(&self) -> c_uint;
/// This property is set if the file is captured on the device after the device's content is fully enumerated. This does
/// not apply to files added as a result of adding a new store to the device.
#[unsafe(method(wasAddedAfterContentCatalogCompleted))]
#[unsafe(method_family = none)]
pub unsafe fn wasAddedAfterContentCatalogCompleted(&self) -> bool;
/// 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.
///
/// Note: Execution of the delegate callback will occur on the main thread.
#[unsafe(method(requestThumbnail))]
#[unsafe(method_family = none)]
pub unsafe fn requestThumbnail(&self);
/// 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.
///
/// Note: Execution of the delegate callback will occur on the main thread.
#[unsafe(method(requestMetadata))]
#[unsafe(method_family = none)]
pub unsafe fn requestMetadata(&self);
/// Deletes cached thumbnail for the item.
#[unsafe(method(flushThumbnailCache))]
#[unsafe(method_family = none)]
pub unsafe fn flushThumbnailCache(&self);
/// Deletes cached metadata for the item.
#[unsafe(method(flushMetadataCache))]
#[unsafe(method_family = none)]
pub unsafe fn flushMetadataCache(&self);
#[cfg(feature = "objc2-core-graphics")]
#[deprecated]
#[unsafe(method(thumbnailIfAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn thumbnailIfAvailable(&self) -> Option<Retained<CGImage>>;
#[cfg(feature = "objc2-core-graphics")]
#[deprecated]
#[unsafe(method(largeThumbnailIfAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn largeThumbnailIfAvailable(&self) -> Option<Retained<CGImage>>;
#[deprecated]
#[unsafe(method(metadataIfAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn metadataIfAvailable(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
);
}
/// Methods declared on superclass `NSObject`.
impl ICCameraItem {
extern_methods!(
#[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>;
);
}