objc2_home_kit/generated/
HMCameraStreamControl.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 control the stream from a camera.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcamerastreamcontrol?language=objc)
14    #[unsafe(super(HMCameraControl, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(feature = "HMCameraControl")]
17    pub struct HMCameraStreamControl;
18);
19
20#[cfg(feature = "HMCameraControl")]
21unsafe impl Send for HMCameraStreamControl {}
22
23#[cfg(feature = "HMCameraControl")]
24unsafe impl Sync for HMCameraStreamControl {}
25
26#[cfg(feature = "HMCameraControl")]
27extern_conformance!(
28    unsafe impl NSObjectProtocol for HMCameraStreamControl {}
29);
30
31#[cfg(feature = "HMCameraControl")]
32impl HMCameraStreamControl {
33    extern_methods!(
34        /// Delegate that receives updates on the camera stream 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 HMCameraStreamControlDelegate>>>;
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 HMCameraStreamControlDelegate>>,
59        );
60
61        #[cfg(feature = "HMCameraDefines")]
62        /// Represents the current streaming state.
63        ///
64        /// This property is not atomic.
65        ///
66        /// # Safety
67        ///
68        /// This might not be thread-safe.
69        #[unsafe(method(streamState))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn streamState(&self) -> HMCameraStreamState;
72
73        #[cfg(all(feature = "HMCameraSource", feature = "HMCameraStream"))]
74        /// Represents the current camera stream.
75        ///
76        /// This property is not atomic.
77        ///
78        /// # Safety
79        ///
80        /// This might not be thread-safe.
81        #[unsafe(method(cameraStream))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn cameraStream(&self) -> Option<Retained<HMCameraStream>>;
84
85        /// Starts the camera stream. 'currentCameraStream' will be updated upon
86        /// successfully starting the stream.
87        #[unsafe(method(startStream))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn startStream(&self);
90
91        /// Stops the camera stream.
92        #[unsafe(method(stopStream))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn stopStream(&self);
95
96        #[deprecated = "HMCameraStreamControl objects are created by their parent container objects. Directly creating them is not supported."]
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100    );
101}
102
103/// Methods declared on superclass `NSObject`.
104#[cfg(feature = "HMCameraControl")]
105impl HMCameraStreamControl {
106    extern_methods!(
107        #[unsafe(method(new))]
108        #[unsafe(method_family = new)]
109        pub unsafe fn new() -> Retained<Self>;
110    );
111}
112
113extern_protocol!(
114    /// This delegate receives updates on the camera stream.
115    ///
116    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcamerastreamcontroldelegate?language=objc)
117    pub unsafe trait HMCameraStreamControlDelegate: NSObjectProtocol {
118        #[cfg(feature = "HMCameraControl")]
119        /// Informs the delegate that the stream has started.
120        ///
121        ///
122        /// Parameter `cameraStreamControl`: Sender of this message.
123        #[optional]
124        #[unsafe(method(cameraStreamControlDidStartStream:))]
125        #[unsafe(method_family = none)]
126        unsafe fn cameraStreamControlDidStartStream(
127            &self,
128            camera_stream_control: &HMCameraStreamControl,
129        );
130
131        #[cfg(feature = "HMCameraControl")]
132        /// Informs the delegate that the stream has stopped.
133        ///
134        ///
135        /// Parameter `cameraStreamControl`: Sender of this message.
136        ///
137        ///
138        /// Parameter `error`: When stream stops because of an error, 'error' will be populated.
139        #[optional]
140        #[unsafe(method(cameraStreamControl:didStopStreamWithError:))]
141        #[unsafe(method_family = none)]
142        unsafe fn cameraStreamControl_didStopStreamWithError(
143            &self,
144            camera_stream_control: &HMCameraStreamControl,
145            error: Option<&NSError>,
146        );
147    }
148);