objc2_core_midi/generated/
MIDIUMPEndpoint.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
12#[cfg(feature = "objc2")]
13extern_class!(
14    /// An NSObject containing basic information about a MIDI 2.0 device. Used by
15    /// MIDIUMPEndpointPair and MIDICIDevice.
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midi2deviceinfo?language=objc)
18    #[unsafe(super(NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(feature = "objc2")]
21    pub struct MIDI2DeviceInfo;
22);
23
24#[cfg(feature = "objc2")]
25extern_conformance!(
26    unsafe impl NSObjectProtocol for MIDI2DeviceInfo {}
27);
28
29#[cfg(feature = "objc2")]
30impl MIDI2DeviceInfo {
31    extern_methods!(
32        #[cfg(feature = "MIDIUMPCI")]
33        /// The MIDI System Exclusive ID of the device manufacturer, up to 3-Bytes.
34        ///
35        /// One-byte SysEx IDs use only the least significant byte (e.g., Apple's System Exclusive ID, 0x11).
36        #[unsafe(method(manufacturerID))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn manufacturerID(&self) -> MIDI2DeviceManufacturer;
39
40        #[cfg(feature = "MIDIMessages")]
41        /// The family of models to which the device belongs, up to 14 bits.
42        #[unsafe(method(family))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn family(&self) -> MIDIUInteger14;
45
46        #[cfg(feature = "MIDIMessages")]
47        /// The specific model from the device manufacturer, up to 14 bits.
48        #[unsafe(method(modelNumber))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn modelNumber(&self) -> MIDIUInteger14;
51
52        #[cfg(feature = "MIDIUMPCI")]
53        /// The version number of a device model number.
54        #[unsafe(method(revisionLevel))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn revisionLevel(&self) -> MIDI2DeviceRevisionLevel;
57
58        #[unsafe(method(init))]
59        #[unsafe(method_family = init)]
60        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
61
62        #[cfg(all(feature = "MIDIMessages", feature = "MIDIUMPCI"))]
63        /// The initializer for constructing the MIDI2DeviceInfo object.
64        ///
65        ///
66        /// Parameter `manufacturerID`: The 3-Byte manufacturer System Exclusive ID.
67        ///
68        /// Parameter `family`: The 14-bit device family.
69        ///
70        /// Parameter `modelNumber`: The 14-bit model number.
71        ///
72        /// Parameter `revisionLevel`: The 4-Byte revision level.
73        ///
74        ///
75        /// Provided values for family or modelNumber must be within their expected
76        /// bit range. For example, if modelNumber is outside of the range of a 14-bit number.
77        #[unsafe(method(initWithManufacturerID:family:modelNumber:revisionLevel:))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn initWithManufacturerID_family_modelNumber_revisionLevel(
80            this: Allocated<Self>,
81            manufacturer_id: MIDI2DeviceManufacturer,
82            family: MIDIUInteger14,
83            model_number: MIDIUInteger14,
84            revision_level: MIDI2DeviceRevisionLevel,
85        ) -> Retained<Self>;
86    );
87}
88
89/// Methods declared on superclass `NSObject`.
90#[cfg(feature = "objc2")]
91impl MIDI2DeviceInfo {
92    extern_methods!(
93        #[unsafe(method(new))]
94        #[unsafe(method_family = new)]
95        pub unsafe fn new() -> Retained<Self>;
96    );
97}
98
99/// The UMP protocols that can be supported by a UMP endpoint.
100///
101///
102/// Support for MIDI 1.0 in Universal Packets, or MIDI-1UP.
103///
104///
105/// Support for MIDI 2.0 protocol.
106///
107/// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpprotocoloptions?language=objc)
108// NS_OPTIONS
109#[cfg(feature = "MIDIMessages")]
110#[repr(transparent)]
111#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
112pub struct MIDIUMPProtocolOptions(pub MIDIUInteger4);
113#[cfg(feature = "MIDIMessages")]
114bitflags::bitflags! {
115    impl MIDIUMPProtocolOptions: MIDIUInteger4 {
116        #[doc(alias = "kMIDIUMPProtocolOptionsMIDI1")]
117        const MIDI1 = 1;
118        #[doc(alias = "kMIDIUMPProtocolOptionsMIDI2")]
119        const MIDI2 = 1<<1;
120    }
121}
122
123#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
124unsafe impl Encode for MIDIUMPProtocolOptions {
125    const ENCODING: Encoding = MIDIUInteger4::ENCODING;
126}
127
128#[cfg(all(feature = "MIDIMessages", feature = "objc2"))]
129unsafe impl RefEncode for MIDIUMPProtocolOptions {
130    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
131}
132
133#[cfg(feature = "objc2")]
134extern_class!(
135    /// An object representating a UMP Endpoint.
136    ///
137    ///
138    /// MIDIUMPEndpoint encapsulates a MIDI source and MIDI destination as a
139    /// bidirectional MIDI 2.0 communication node along with any associated stream
140    /// configuration metadata.
141    ///
142    /// It is not necessary to create a MIDIUMPEndpoint or other MIDI endpoint in order to
143    /// use UMP natively. Any standard MIDI endpoint created with a specified MIDIProtocolID
144    /// is assumed to use all 16 UMP groups for the same unspecified function and to neither
145    /// transmit nor receive jitter-reduction timestamps.
146    ///
147    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiumpendpoint?language=objc)
148    #[unsafe(super(NSObject))]
149    #[derive(Debug, PartialEq, Eq, Hash)]
150    #[cfg(feature = "objc2")]
151    pub struct MIDIUMPEndpoint;
152);
153
154#[cfg(feature = "objc2")]
155extern_conformance!(
156    unsafe impl NSObjectProtocol for MIDIUMPEndpoint {}
157);
158
159#[cfg(feature = "objc2")]
160impl MIDIUMPEndpoint {
161    extern_methods!(
162        #[cfg(feature = "objc2-foundation")]
163        /// The UTF-8 encoded name of the UMP endpoint.
164        ///
165        ///
166        /// The name shall not be any longer than 98 bytes of UTF-8 Text.
167        #[unsafe(method(name))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn name(&self) -> Retained<NSString>;
170
171        #[cfg(feature = "MIDIServices")]
172        /// The MIDI protocol currently used by the UMP endpoint.
173        #[unsafe(method(MIDIProtocol))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn MIDIProtocol(&self) -> MIDIProtocolID;
176
177        #[cfg(feature = "MIDIMessages")]
178        /// All protocols the UMP endpoint is capable of using for communication.
179        #[unsafe(method(supportedMIDIProtocols))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn supportedMIDIProtocols(&self) -> MIDIUMPProtocolOptions;
182
183        #[cfg(feature = "MIDIServices")]
184        /// The MIDI destination for the UMP endpoint.
185        #[unsafe(method(MIDIDestination))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn MIDIDestination(&self) -> MIDIEndpointRef;
188
189        #[cfg(feature = "MIDIServices")]
190        /// The MIDI source for the UMP endpoint.
191        #[unsafe(method(MIDISource))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn MIDISource(&self) -> MIDIEndpointRef;
194
195        /// The MIDI 2.0 Device identity information associated with the device.
196        #[unsafe(method(deviceInfo))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn deviceInfo(&self) -> Retained<MIDI2DeviceInfo>;
199
200        #[cfg(feature = "objc2-foundation")]
201        /// Serial number (or similar value) uniquely identifying this manufacturer/family/model,
202        /// up to 42 bytes of ASCII Text in the ordinal range 32-126.
203        #[unsafe(method(productInstanceID))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn productInstanceID(&self) -> Retained<NSString>;
206
207        /// Indicates if the Function Block state will never change once discovered.
208        #[unsafe(method(hasStaticFunctionBlocks))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn hasStaticFunctionBlocks(&self) -> bool;
211
212        /// Jitter-reduction timestamp receive capability.
213        #[unsafe(method(hasJRTSReceiveCapability))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn hasJRTSReceiveCapability(&self) -> bool;
216
217        /// Jitter-reduction timestamp transmit capability
218        #[unsafe(method(hasJRTSTransmitCapability))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn hasJRTSTransmitCapability(&self) -> bool;
221
222        #[cfg(feature = "MIDIUMPCI")]
223        /// Indicates the type of UMP Endpoint, if known.
224        #[unsafe(method(endpointType))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn endpointType(&self) -> MIDIUMPCIObjectBackingType;
227
228        #[cfg(all(feature = "MIDIUMPFunctionBlock", feature = "objc2-foundation"))]
229        /// The Function Blocks associated with the UMP endpoint, if any.
230        #[unsafe(method(functionBlocks))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn functionBlocks(&self) -> Retained<NSArray<MIDIUMPFunctionBlock>>;
233
234        #[cfg(all(feature = "MIDIUMPFunctionBlock", feature = "objc2-foundation"))]
235        /// Setter for [`functionBlocks`][Self::functionBlocks].
236        ///
237        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
238        #[unsafe(method(setFunctionBlocks:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setFunctionBlocks(&self, function_blocks: &NSArray<MIDIUMPFunctionBlock>);
241
242        #[unsafe(method(init))]
243        #[unsafe(method_family = init)]
244        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
245    );
246}
247
248/// Methods declared on superclass `NSObject`.
249#[cfg(feature = "objc2")]
250impl MIDIUMPEndpoint {
251    extern_methods!(
252        #[unsafe(method(new))]
253        #[unsafe(method_family = new)]
254        pub unsafe fn new() -> Retained<Self>;
255    );
256}