objc2_home_kit/generated/
HMCameraSnapshotControl.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// This class can be used to take an image snapshot from a camera.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcamerasnapshotcontrol?language=objc)
14    #[unsafe(super(HMCameraControl, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(feature = "HMCameraControl")]
17    pub struct HMCameraSnapshotControl;
18);
19
20#[cfg(feature = "HMCameraControl")]
21unsafe impl Send for HMCameraSnapshotControl {}
22
23#[cfg(feature = "HMCameraControl")]
24unsafe impl Sync for HMCameraSnapshotControl {}
25
26#[cfg(feature = "HMCameraControl")]
27extern_conformance!(
28    unsafe impl NSObjectProtocol for HMCameraSnapshotControl {}
29);
30
31#[cfg(feature = "HMCameraControl")]
32impl HMCameraSnapshotControl {
33    extern_methods!(
34        /// Delegate that receives updates on the camera snapshot changes.
35        ///
36        /// This property is not atomic.
37        ///
38        /// # Safety
39        ///
40        /// This might not be thread-safe.
41        #[unsafe(method(delegate))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn delegate(
44            &self,
45        ) -> Option<Retained<ProtocolObject<dyn HMCameraSnapshotControlDelegate>>>;
46
47        /// Setter for [`delegate`][Self::delegate].
48        ///
49        /// This is a [weak property][objc2::topics::weak_property].
50        ///
51        /// # Safety
52        ///
53        /// This might not be thread-safe.
54        #[unsafe(method(setDelegate:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn setDelegate(
57            &self,
58            delegate: Option<&ProtocolObject<dyn HMCameraSnapshotControlDelegate>>,
59        );
60
61        #[cfg(all(feature = "HMCameraSnapshot", feature = "HMCameraSource"))]
62        /// Represents the most recent snapshot taken from the camera.
63        ///
64        /// This property is not atomic.
65        ///
66        /// # Safety
67        ///
68        /// This might not be thread-safe.
69        #[unsafe(method(mostRecentSnapshot))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn mostRecentSnapshot(&self) -> Option<Retained<HMCameraSnapshot>>;
72
73        /// Takes an image snapshot.
74        #[unsafe(method(takeSnapshot))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn takeSnapshot(&self);
77
78        #[deprecated = "HMCameraSnapshotControl objects are created by their parent container objects. Directly creating them is not supported."]
79        #[unsafe(method(init))]
80        #[unsafe(method_family = init)]
81        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
82    );
83}
84
85/// Methods declared on superclass `NSObject`.
86#[cfg(feature = "HMCameraControl")]
87impl HMCameraSnapshotControl {
88    extern_methods!(
89        #[unsafe(method(new))]
90        #[unsafe(method_family = new)]
91        pub unsafe fn new() -> Retained<Self>;
92    );
93}
94
95extern_protocol!(
96    /// This delegate receives updates on the camera snapshot.
97    ///
98    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcamerasnapshotcontroldelegate?language=objc)
99    pub unsafe trait HMCameraSnapshotControlDelegate: NSObjectProtocol {
100        #[cfg(all(
101            feature = "HMCameraControl",
102            feature = "HMCameraSnapshot",
103            feature = "HMCameraSource"
104        ))]
105        /// Informs the delegate that the snapshot was taken.
106        ///
107        ///
108        /// Parameter `cameraSnapshotControl`: Sender of this message.
109        ///
110        ///
111        /// Parameter `snapshot`: Snapshot will be valid if snapshot was successfully taken.
112        ///
113        ///
114        /// Parameter `error`: Error will be populated if the snapshot could not be taken.
115        #[optional]
116        #[unsafe(method(cameraSnapshotControl:didTakeSnapshot:error:))]
117        #[unsafe(method_family = none)]
118        unsafe fn cameraSnapshotControl_didTakeSnapshot_error(
119            &self,
120            camera_snapshot_control: &HMCameraSnapshotControl,
121            snapshot: Option<&HMCameraSnapshot>,
122            error: Option<&NSError>,
123        );
124
125        #[cfg(feature = "HMCameraControl")]
126        /// Informs the delegate that the mostRecentSnapshot was updated.
127        ///
128        ///
129        /// Parameter `cameraSnapshotControl`: Sender of this message.
130        #[optional]
131        #[unsafe(method(cameraSnapshotControlDidUpdateMostRecentSnapshot:))]
132        #[unsafe(method_family = none)]
133        unsafe fn cameraSnapshotControlDidUpdateMostRecentSnapshot(
134            &self,
135            camera_snapshot_control: &HMCameraSnapshotControl,
136        );
137    }
138);