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")]
27unsafe impl NSObjectProtocol for HMCameraSnapshotControl {}
28
29#[cfg(feature = "HMCameraControl")]
30impl HMCameraSnapshotControl {
31    extern_methods!(
32        /// Delegate that receives updates on the camera snapshot changes.
33        #[unsafe(method(delegate))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn delegate(
36            &self,
37        ) -> Option<Retained<ProtocolObject<dyn HMCameraSnapshotControlDelegate>>>;
38
39        /// This is a [weak property][objc2::topics::weak_property].
40        /// Setter for [`delegate`][Self::delegate].
41        #[unsafe(method(setDelegate:))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn setDelegate(
44            &self,
45            delegate: Option<&ProtocolObject<dyn HMCameraSnapshotControlDelegate>>,
46        );
47
48        #[cfg(all(feature = "HMCameraSnapshot", feature = "HMCameraSource"))]
49        /// Represents the most recent snapshot taken from the camera.
50        #[unsafe(method(mostRecentSnapshot))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn mostRecentSnapshot(&self) -> Option<Retained<HMCameraSnapshot>>;
53
54        /// Takes an image snapshot.
55        #[unsafe(method(takeSnapshot))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn takeSnapshot(&self);
58
59        #[deprecated = "HMCameraSnapshotControl objects are created by their parent container objects. Directly creating them is not supported."]
60        #[unsafe(method(init))]
61        #[unsafe(method_family = init)]
62        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
63    );
64}
65
66/// Methods declared on superclass `NSObject`.
67#[cfg(feature = "HMCameraControl")]
68impl HMCameraSnapshotControl {
69    extern_methods!(
70        #[unsafe(method(new))]
71        #[unsafe(method_family = new)]
72        pub unsafe fn new() -> Retained<Self>;
73    );
74}
75
76extern_protocol!(
77    /// This delegate receives updates on the camera snapshot.
78    ///
79    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcamerasnapshotcontroldelegate?language=objc)
80    pub unsafe trait HMCameraSnapshotControlDelegate: NSObjectProtocol {
81        #[cfg(all(
82            feature = "HMCameraControl",
83            feature = "HMCameraSnapshot",
84            feature = "HMCameraSource"
85        ))]
86        /// Informs the delegate that the snapshot was taken.
87        ///
88        ///
89        /// Parameter `cameraSnapshotControl`: Sender of this message.
90        ///
91        ///
92        /// Parameter `snapshot`: Snapshot will be valid if snapshot was successfully taken.
93        ///
94        ///
95        /// Parameter `error`: Error will be populated if the snapshot could not be taken.
96        #[optional]
97        #[unsafe(method(cameraSnapshotControl:didTakeSnapshot:error:))]
98        #[unsafe(method_family = none)]
99        unsafe fn cameraSnapshotControl_didTakeSnapshot_error(
100            &self,
101            camera_snapshot_control: &HMCameraSnapshotControl,
102            snapshot: Option<&HMCameraSnapshot>,
103            error: Option<&NSError>,
104        );
105
106        #[cfg(feature = "HMCameraControl")]
107        /// Informs the delegate that the mostRecentSnapshot was updated.
108        ///
109        ///
110        /// Parameter `cameraSnapshotControl`: Sender of this message.
111        #[optional]
112        #[unsafe(method(cameraSnapshotControlDidUpdateMostRecentSnapshot:))]
113        #[unsafe(method_family = none)]
114        unsafe fn cameraSnapshotControlDidUpdateMostRecentSnapshot(
115            &self,
116            camera_snapshot_control: &HMCameraSnapshotControl,
117        );
118    }
119);