objc2_push_to_talk/generated/
PTChannelManager.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
10/// [Apple's documentation](https://developer.apple.com/documentation/pushtotalk/ptservicestatus?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct PTServiceStatus(pub NSInteger);
15impl PTServiceStatus {
16    /// The service is available for use and ready for use by the client.
17    #[doc(alias = "PTServiceStatusReady")]
18    pub const Ready: Self = Self(0);
19    /// The client is attempting to establish a connection to the service.
20    #[doc(alias = "PTServiceStatusConnecting")]
21    pub const Connecting: Self = Self(1);
22    /// The service has become unavailable and availability needs to be re-established once conditions have changed.
23    #[doc(alias = "PTServiceStatusUnavailable")]
24    pub const Unavailable: Self = Self(2);
25}
26
27unsafe impl Encode for PTServiceStatus {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for PTServiceStatus {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// [Apple's documentation](https://developer.apple.com/documentation/pushtotalk/pttransmissionmode?language=objc)
36// NS_ENUM
37#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct PTTransmissionMode(pub NSInteger);
40impl PTTransmissionMode {
41    /// Users can transmit and receive simultaneously.
42    #[doc(alias = "PTTransmissionModeFullDuplex")]
43    pub const FullDuplex: Self = Self(0);
44    /// Users can transmit and receive but not simultaneously. This is the default value.
45    #[doc(alias = "PTTransmissionModeHalfDuplex")]
46    pub const HalfDuplex: Self = Self(1);
47    /// User is able to receive only, transmit is not permitted.
48    #[doc(alias = "PTTransmissionModeListenOnly")]
49    pub const ListenOnly: Self = Self(2);
50}
51
52unsafe impl Encode for PTTransmissionMode {
53    const ENCODING: Encoding = NSInteger::ENCODING;
54}
55
56unsafe impl RefEncode for PTTransmissionMode {
57    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
58}
59
60extern_class!(
61    /// [Apple's documentation](https://developer.apple.com/documentation/pushtotalk/ptchannelmanager?language=objc)
62    #[unsafe(super(NSObject))]
63    #[derive(Debug, PartialEq, Eq, Hash)]
64    pub struct PTChannelManager;
65);
66
67unsafe impl Send for PTChannelManager {}
68
69unsafe impl Sync for PTChannelManager {}
70
71extern_conformance!(
72    unsafe impl NSObjectProtocol for PTChannelManager {}
73);
74
75impl PTChannelManager {
76    extern_methods!(
77        #[cfg(all(
78            feature = "PTChannelManagerDelegate",
79            feature = "PTChannelRestorationDelegate",
80            feature = "block2"
81        ))]
82        /// You must instantiate a channel manager upon launching your app, otherwise the system will tear down channels and their ability to receive pushes. By providing a restoration delegate, you can decide whether to rejoin or leave any previously active channels that the system knows about. Once the channel restoration process is completed, you will be given the PTChannelManager instance.
83        #[unsafe(method(channelManagerWithDelegate:restorationDelegate:completionHandler:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn channelManagerWithDelegate_restorationDelegate_completionHandler(
86            delegate: &ProtocolObject<dyn PTChannelManagerDelegate>,
87            restoration_delegate: &ProtocolObject<dyn PTChannelRestorationDelegate>,
88            completion_handler: &block2::DynBlock<dyn Fn(*mut PTChannelManager, *mut NSError)>,
89        );
90
91        #[unsafe(method(new))]
92        #[unsafe(method_family = new)]
93        pub unsafe fn new() -> Retained<Self>;
94
95        #[unsafe(method(init))]
96        #[unsafe(method_family = init)]
97        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
98
99        /// Only one channel can be active at a time -- this is the channel that will handle user events
100        /// This being nonnull reflects whether the user can see this channel is active in the user interface
101        /// The ephemeral push token is only usable when this is nonnull.
102        #[unsafe(method(activeChannelUUID))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn activeChannelUUID(&self) -> Option<Retained<NSUUID>>;
105
106        #[cfg(feature = "PTChannelDescriptor")]
107        /// You may only join a channel in the foreground. If successful, you will receive the delegate callback channelManager:didJoinChannelWithUUID:reason: with reason PTChannelJoinReasonProgrammaticRequest. Otherwise, the delegate callback channelManager:failedToJoinChannelWithUUID:error: will be invoked if implemented.
108        #[unsafe(method(requestJoinChannelWithUUID:descriptor:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn requestJoinChannelWithUUID_descriptor(
111            &self,
112            channel_uuid: &NSUUID,
113            descriptor: &PTChannelDescriptor,
114        );
115
116        /// If successful, you will receive the delegate callback channelManager:channelUUID:didBeginTransmittingFromSource: with PTChannelTransmitRequestSourceProgrammaticRequest. Otherwise, the delegate callback channelManager:failedToBeginTransmittingInChannelWithUUID:error: will be invoked if implemented.
117        #[unsafe(method(requestBeginTransmittingWithChannelUUID:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn requestBeginTransmittingWithChannelUUID(&self, channel_uuid: &NSUUID);
120
121        /// If successful, you will receive the delegate callback channelManager:channelUUID:didEndTransmittingFromSource with request source PTChannelTransmitRequestSourceProgrammaticRequest. Otherwise, the delegate callback channelManager:failedToStopTransmittingInChannelWithUUID:error: will be invoked if implemented. Generally, this should always succeed, unless you are not currently transmitting or are not joined to a channel.
122        #[unsafe(method(stopTransmittingWithChannelUUID:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn stopTransmittingWithChannelUUID(&self, channel_uuid: &NSUUID);
125
126        /// If successful, you will receive the delegate callback channelManager:channelUUID:didLeaveChannelWithUUID:reason: with reason PTChannelLeaveReasonProgrammaticRequest, Otherwise, the delegate callback channelManager:failedToLeaveChannelWithUUID:error: will be invoked if implemented. Generally, this should always succeed so long as you are already joined to a channel.
127        #[unsafe(method(leaveChannelWithUUID:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn leaveChannelWithUUID(&self, channel_uuid: &NSUUID);
130
131        #[cfg(all(feature = "PTChannelDescriptor", feature = "block2"))]
132        /// Updates the channel descriptor
133        #[unsafe(method(setChannelDescriptor:forChannelUUID:completionHandler:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setChannelDescriptor_forChannelUUID_completionHandler(
136            &self,
137            channel_descriptor: &PTChannelDescriptor,
138            channel_uuid: &NSUUID,
139            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
140        );
141
142        #[cfg(all(feature = "PTParticipant", feature = "block2"))]
143        /// When receiving incoming audio from a remote participant, set the participant to a nonnull value, which will update the system user interface and block transmitting. When the user has stopped speaking, set the participant to nil.
144        #[unsafe(method(setActiveRemoteParticipant:forChannelUUID:completionHandler:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn setActiveRemoteParticipant_forChannelUUID_completionHandler(
147            &self,
148            participant: Option<&PTParticipant>,
149            channel_uuid: &NSUUID,
150            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
151        );
152
153        #[cfg(feature = "block2")]
154        /// The default value for service status is PTServiceStatusReady. If your underlying network connection is experiencing issues, set the appropriate service status. The service status will be reflected in the system user interface.
155        #[unsafe(method(setServiceStatus:forChannelUUID:completionHandler:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn setServiceStatus_forChannelUUID_completionHandler(
158            &self,
159            status: PTServiceStatus,
160            channel_uuid: &NSUUID,
161            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
162        );
163
164        #[cfg(feature = "block2")]
165        /// The default value for transmission mode is PTTransmissionModeHalfDuplex. If your application support one of the other transmission modes set it using this function. The system user interface will be updated to reflect the transmission mode.
166        #[unsafe(method(setTransmissionMode:forChannelUUID:completionHandler:))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn setTransmissionMode_forChannelUUID_completionHandler(
169            &self,
170            transmission_mode: PTTransmissionMode,
171            channel_uuid: &NSUUID,
172            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
173        );
174
175        #[cfg(feature = "block2")]
176        /// The default channel behavior is to map supported accessory button events to begin/end transmission actions. If your application does not wish to map these button events to transmission actions you can disable them by setting the enabled value to false.
177        #[unsafe(method(setAccessoryButtonEventsEnabled:forChannelUUID:completionHandler:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setAccessoryButtonEventsEnabled_forChannelUUID_completionHandler(
180            &self,
181            enabled: bool,
182            channel_uuid: &NSUUID,
183            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
184        );
185    );
186}