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