objc2_core_midi/generated/
MIDICIDeviceManager.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-foundation")]
7use objc2_foundation::*;
8
9use crate::*;
10
11extern "C" {
12    /// A notification posted when a MIDI-CI Device has been added to the subsystem.
13    ///
14    ///
15    /// The userInfo dictionary will contain a MIDICIDeviceObjectKey with the
16    /// MIDI-CI Device which has been added to the subsystem.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicidevicewasaddednotification?language=objc)
19    #[cfg(feature = "objc2-foundation")]
20    pub static MIDICIDeviceWasAddedNotification: &'static NSNotificationName;
21}
22
23extern "C" {
24    /// A notification posted when a MIDI-CI Device has been removed or has had its MUID invalidated.
25    ///
26    ///
27    /// Any previously discovered MIDICIDevice that fails to respond to a discovery message
28    /// will be removed. The userInfo dictionary will contain a MIDICIDeviceObjectKey with the
29    /// MIDI-CI Device which has been removed or has had its MUID invalidated.
30    ///
31    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicidevicewasremovednotification?language=objc)
32    #[cfg(feature = "objc2-foundation")]
33    pub static MIDICIDeviceWasRemovedNotification: &'static NSNotificationName;
34}
35
36extern "C" {
37    /// A notification posted when a MIDI-CI Device has been enabled/disabled or updated.
38    ///
39    ///
40    /// The userInfo dictionary will contain a MIDICIDeviceObjectKey and
41    /// MIDICIProfileObjectKey with the MIDICIDevice and MIDI-CI Profile which
42    /// was recently enabled or disabled.
43    ///
44    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprofilewasupdatednotification?language=objc)
45    #[cfg(feature = "objc2-foundation")]
46    pub static MIDICIProfileWasUpdatedNotification: &'static NSNotificationName;
47}
48
49extern "C" {
50    /// A notification posted when a MIDI-CI Device has been removed.
51    ///
52    ///
53    /// The userInfo dictionary will contain a MIDICIDeviceObjectKey and
54    /// MIDICIProfileObjectKey with the MIDICIDevice and MIDI-CI Profile which
55    /// has been removed.
56    ///
57    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprofilewasremovednotification?language=objc)
58    #[cfg(feature = "objc2-foundation")]
59    pub static MIDICIProfileWasRemovedNotification: &'static NSNotificationName;
60}
61
62/// [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicidevicemanagerdictionarykey?language=objc)
63// NS_TYPED_ENUM
64#[cfg(feature = "objc2-foundation")]
65pub type MIDICIDeviceManagerDictionaryKey = NSString;
66
67extern "C" {
68    /// Value is an MIDIUMPEndpoint.
69    ///
70    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicideviceobjectkey?language=objc)
71    #[cfg(feature = "objc2-foundation")]
72    pub static MIDICIDeviceObjectKey: &'static MIDICIDeviceManagerDictionaryKey;
73}
74
75extern "C" {
76    /// Value is an MIDIUMPCIProfile
77    ///
78    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midiciprofileobjectkey?language=objc)
79    #[cfg(feature = "objc2-foundation")]
80    pub static MIDICIProfileObjectKey: &'static MIDICIDeviceManagerDictionaryKey;
81}
82
83#[cfg(feature = "objc2")]
84extern_class!(
85    /// A singleton object that performs system-wide MIDI-CI Device bookkeeping.
86    ///
87    ///
88    /// MIDICIDeviceManager is used to retrieve information about MIDI-CI devices that
89    /// to MIDI-CI Discovery.
90    ///
91    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremidi/midicidevicemanager?language=objc)
92    #[unsafe(super(NSObject))]
93    #[derive(Debug, PartialEq, Eq, Hash)]
94    #[cfg(feature = "objc2")]
95    pub struct MIDICIDeviceManager;
96);
97
98#[cfg(feature = "objc2")]
99extern_conformance!(
100    unsafe impl NSObjectProtocol for MIDICIDeviceManager {}
101);
102
103#[cfg(feature = "objc2")]
104impl MIDICIDeviceManager {
105    extern_methods!(
106        /// Retrieve the shared MIDI-CI device manager for the client process.
107        ///
108        ///
109        /// After the first access of the property, the client process may observe notifications which are
110        /// posted when the system-wide cache changes. In environments where virtual MIDI endpoint
111        /// creation is not allowed, callbacks are only invoked when the process is not suspended.
112        /// However, any suspended process will receive an updated copy of the cache when it
113        /// resumes its running state.
114        #[unsafe(method(sharedInstance))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn sharedInstance() -> Retained<MIDICIDeviceManager>;
117
118        #[cfg(all(feature = "MIDICIDevice", feature = "objc2-foundation"))]
119        /// A list of MIDICIDevices that responded to the last MIDI-CI discovery request.
120        #[unsafe(method(discoveredCIDevices))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn discoveredCIDevices(&self) -> Retained<NSArray<MIDICIDevice>>;
123    );
124}
125
126/// Methods declared on superclass `NSObject`.
127#[cfg(feature = "objc2")]
128impl MIDICIDeviceManager {
129    extern_methods!(
130        #[unsafe(method(init))]
131        #[unsafe(method_family = init)]
132        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
133
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub unsafe fn new() -> Retained<Self>;
137    );
138}