objc2_core_midi/generated/
MIDINetworkSession.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-foundation")]
8use objc2_foundation::*;
9
10use crate::*;
11
12extern "C" {
13    /// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinetworkbonjourservicetype?language=objc)
14    #[cfg(feature = "objc2-foundation")]
15    pub static MIDINetworkBonjourServiceType: &'static NSString;
16}
17
18extern "C" {
19    /// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinetworknotificationcontactsdidchange?language=objc)
20    #[cfg(feature = "objc2-foundation")]
21    pub static MIDINetworkNotificationContactsDidChange: &'static NSString;
22}
23
24extern "C" {
25    /// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinetworknotificationsessiondidchange?language=objc)
26    #[cfg(feature = "objc2-foundation")]
27    pub static MIDINetworkNotificationSessionDidChange: &'static NSString;
28}
29
30/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinetworkconnectionpolicy?language=objc)
31// NS_ENUM
32#[cfg(feature = "objc2")]
33#[repr(transparent)]
34#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35pub struct MIDINetworkConnectionPolicy(pub NSUInteger);
36#[cfg(feature = "objc2")]
37impl MIDINetworkConnectionPolicy {
38    #[doc(alias = "MIDINetworkConnectionPolicy_NoOne")]
39    pub const NoOne: Self = Self(0);
40    #[doc(alias = "MIDINetworkConnectionPolicy_HostsInContactList")]
41    pub const HostsInContactList: Self = Self(1);
42    #[doc(alias = "MIDINetworkConnectionPolicy_Anyone")]
43    pub const Anyone: Self = Self(2);
44}
45
46#[cfg(feature = "objc2")]
47unsafe impl Encode for MIDINetworkConnectionPolicy {
48    const ENCODING: Encoding = NSUInteger::ENCODING;
49}
50
51#[cfg(feature = "objc2")]
52unsafe impl RefEncode for MIDINetworkConnectionPolicy {
53    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
54}
55
56#[cfg(feature = "objc2")]
57extern_class!(
58    /// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinetworkhost?language=objc)
59    #[unsafe(super(NSObject))]
60    #[derive(Debug, PartialEq, Eq, Hash)]
61    #[cfg(feature = "objc2")]
62    pub struct MIDINetworkHost;
63);
64
65#[cfg(feature = "objc2")]
66extern_conformance!(
67    unsafe impl NSObjectProtocol for MIDINetworkHost {}
68);
69
70#[cfg(feature = "objc2")]
71impl MIDINetworkHost {
72    extern_methods!(
73        #[cfg(feature = "objc2-foundation")]
74        #[unsafe(method(hostWithName:address:port:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn hostWithName_address_port(
77            name: &NSString,
78            address: &NSString,
79            port: NSUInteger,
80        ) -> Retained<Self>;
81
82        #[cfg(feature = "objc2-foundation")]
83        #[unsafe(method(hostWithName:netService:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn hostWithName_netService(
86            name: &NSString,
87            net_service: &NSNetService,
88        ) -> Retained<Self>;
89
90        #[cfg(feature = "objc2-foundation")]
91        #[unsafe(method(hostWithName:netServiceName:netServiceDomain:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn hostWithName_netServiceName_netServiceDomain(
94            name: &NSString,
95            net_service_name: &NSString,
96            net_service_domain: &NSString,
97        ) -> Retained<Self>;
98
99        #[unsafe(method(hasSameAddressAs:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn hasSameAddressAs(&self, other: &MIDINetworkHost) -> bool;
102
103        #[cfg(feature = "objc2-foundation")]
104        #[unsafe(method(name))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn name(&self) -> Retained<NSString>;
107
108        #[cfg(feature = "objc2-foundation")]
109        #[unsafe(method(address))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn address(&self) -> Retained<NSString>;
112
113        #[unsafe(method(port))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn port(&self) -> NSUInteger;
116
117        #[cfg(feature = "objc2-foundation")]
118        #[unsafe(method(netServiceName))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn netServiceName(&self) -> Option<Retained<NSString>>;
121
122        #[cfg(feature = "objc2-foundation")]
123        #[unsafe(method(netServiceDomain))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn netServiceDomain(&self) -> Option<Retained<NSString>>;
126    );
127}
128
129/// Methods declared on superclass `NSObject`.
130#[cfg(feature = "objc2")]
131impl MIDINetworkHost {
132    extern_methods!(
133        #[unsafe(method(init))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
136
137        #[unsafe(method(new))]
138        #[unsafe(method_family = new)]
139        pub unsafe fn new() -> Retained<Self>;
140    );
141}
142
143#[cfg(feature = "objc2")]
144extern_class!(
145    /// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinetworkconnection?language=objc)
146    #[unsafe(super(NSObject))]
147    #[derive(Debug, PartialEq, Eq, Hash)]
148    #[cfg(feature = "objc2")]
149    pub struct MIDINetworkConnection;
150);
151
152#[cfg(feature = "objc2")]
153extern_conformance!(
154    unsafe impl NSObjectProtocol for MIDINetworkConnection {}
155);
156
157#[cfg(feature = "objc2")]
158impl MIDINetworkConnection {
159    extern_methods!(
160        #[unsafe(method(connectionWithHost:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn connectionWithHost(host: &MIDINetworkHost) -> Retained<Self>;
163
164        #[unsafe(method(host))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn host(&self) -> Retained<MIDINetworkHost>;
167    );
168}
169
170/// Methods declared on superclass `NSObject`.
171#[cfg(feature = "objc2")]
172impl MIDINetworkConnection {
173    extern_methods!(
174        #[unsafe(method(init))]
175        #[unsafe(method_family = init)]
176        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
177
178        #[unsafe(method(new))]
179        #[unsafe(method_family = new)]
180        pub unsafe fn new() -> Retained<Self>;
181    );
182}
183
184#[cfg(feature = "objc2")]
185extern_class!(
186    /// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midinetworksession?language=objc)
187    #[unsafe(super(NSObject))]
188    #[derive(Debug, PartialEq, Eq, Hash)]
189    #[cfg(feature = "objc2")]
190    pub struct MIDINetworkSession;
191);
192
193#[cfg(feature = "objc2")]
194extern_conformance!(
195    unsafe impl NSObjectProtocol for MIDINetworkSession {}
196);
197
198#[cfg(feature = "objc2")]
199impl MIDINetworkSession {
200    extern_methods!(
201        #[unsafe(method(defaultSession))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn defaultSession() -> Retained<MIDINetworkSession>;
204
205        #[unsafe(method(isEnabled))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn isEnabled(&self) -> bool;
208
209        /// Setter for [`isEnabled`][Self::isEnabled].
210        #[unsafe(method(setEnabled:))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn setEnabled(&self, enabled: bool);
213
214        #[unsafe(method(networkPort))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn networkPort(&self) -> NSUInteger;
217
218        #[cfg(feature = "objc2-foundation")]
219        #[unsafe(method(networkName))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn networkName(&self) -> Retained<NSString>;
222
223        #[cfg(feature = "objc2-foundation")]
224        #[unsafe(method(localName))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn localName(&self) -> Retained<NSString>;
227
228        #[unsafe(method(connectionPolicy))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn connectionPolicy(&self) -> MIDINetworkConnectionPolicy;
231
232        /// Setter for [`connectionPolicy`][Self::connectionPolicy].
233        #[unsafe(method(setConnectionPolicy:))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn setConnectionPolicy(&self, connection_policy: MIDINetworkConnectionPolicy);
236
237        #[cfg(feature = "objc2-foundation")]
238        #[unsafe(method(contacts))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn contacts(&self) -> Retained<NSSet<MIDINetworkHost>>;
241
242        #[unsafe(method(addContact:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn addContact(&self, contact: &MIDINetworkHost) -> bool;
245
246        #[unsafe(method(removeContact:))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn removeContact(&self, contact: &MIDINetworkHost) -> bool;
249
250        #[cfg(feature = "objc2-foundation")]
251        #[unsafe(method(connections))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn connections(&self) -> Retained<NSSet<MIDINetworkConnection>>;
254
255        #[unsafe(method(addConnection:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn addConnection(&self, connection: &MIDINetworkConnection) -> bool;
258
259        #[unsafe(method(removeConnection:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn removeConnection(&self, connection: &MIDINetworkConnection) -> bool;
262
263        #[cfg(feature = "MIDIServices")]
264        #[unsafe(method(sourceEndpoint))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn sourceEndpoint(&self) -> MIDIEndpointRef;
267
268        #[cfg(feature = "MIDIServices")]
269        #[unsafe(method(destinationEndpoint))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn destinationEndpoint(&self) -> MIDIEndpointRef;
272    );
273}
274
275/// Methods declared on superclass `NSObject`.
276#[cfg(feature = "objc2")]
277impl MIDINetworkSession {
278    extern_methods!(
279        #[unsafe(method(init))]
280        #[unsafe(method_family = init)]
281        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
282
283        #[unsafe(method(new))]
284        #[unsafe(method_family = new)]
285        pub unsafe fn new() -> Retained<Self>;
286    );
287}