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