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")]
27unsafe impl NSObjectProtocol for HMCameraStreamControl {}
28
29#[cfg(feature = "HMCameraControl")]
30impl HMCameraStreamControl {
31    extern_methods!(
32        /// Delegate that receives updates on the camera stream changes.
33        #[unsafe(method(delegate))]
34        #[unsafe(method_family = none)]
35        pub unsafe fn delegate(
36            &self,
37        ) -> Option<Retained<ProtocolObject<dyn HMCameraStreamControlDelegate>>>;
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 HMCameraStreamControlDelegate>>,
46        );
47
48        #[cfg(feature = "HMCameraDefines")]
49        /// Represents the current streaming state.
50        #[unsafe(method(streamState))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn streamState(&self) -> HMCameraStreamState;
53
54        #[cfg(all(feature = "HMCameraSource", feature = "HMCameraStream"))]
55        /// Represents the current camera stream.
56        #[unsafe(method(cameraStream))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn cameraStream(&self) -> Option<Retained<HMCameraStream>>;
59
60        /// Starts the camera stream. 'currentCameraStream' will be updated upon
61        /// successfully starting the stream.
62        #[unsafe(method(startStream))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn startStream(&self);
65
66        /// Stops the camera stream.
67        #[unsafe(method(stopStream))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn stopStream(&self);
70
71        #[deprecated = "HMCameraStreamControl objects are created by their parent container objects. Directly creating them is not supported."]
72        #[unsafe(method(init))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
75    );
76}
77
78/// Methods declared on superclass `NSObject`.
79#[cfg(feature = "HMCameraControl")]
80impl HMCameraStreamControl {
81    extern_methods!(
82        #[unsafe(method(new))]
83        #[unsafe(method_family = new)]
84        pub unsafe fn new() -> Retained<Self>;
85    );
86}
87
88extern_protocol!(
89    /// This delegate receives updates on the camera stream.
90    ///
91    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcamerastreamcontroldelegate?language=objc)
92    pub unsafe trait HMCameraStreamControlDelegate: NSObjectProtocol {
93        #[cfg(feature = "HMCameraControl")]
94        /// Informs the delegate that the stream has started.
95        ///
96        ///
97        /// Parameter `cameraStreamControl`: Sender of this message.
98        #[optional]
99        #[unsafe(method(cameraStreamControlDidStartStream:))]
100        #[unsafe(method_family = none)]
101        unsafe fn cameraStreamControlDidStartStream(
102            &self,
103            camera_stream_control: &HMCameraStreamControl,
104        );
105
106        #[cfg(feature = "HMCameraControl")]
107        /// Informs the delegate that the stream has stopped.
108        ///
109        ///
110        /// Parameter `cameraStreamControl`: Sender of this message.
111        ///
112        ///
113        /// Parameter `error`: When stream stops because of an error, 'error' will be populated.
114        #[optional]
115        #[unsafe(method(cameraStreamControl:didStopStreamWithError:))]
116        #[unsafe(method_family = none)]
117        unsafe fn cameraStreamControl_didStopStreamWithError(
118            &self,
119            camera_stream_control: &HMCameraStreamControl,
120            error: Option<&NSError>,
121        );
122    }
123);