1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// Class representing a USB controller in a virtual machine.
///
/// VZUSBController should not be instantiated directly.
/// USB controllers are first configured on the VZVirtualMachineConfiguration through a subclass of VZUSBControllerConfiguration.
/// When a VZVirtualMachine is created from the configuration, the USB controllers are available through the VZVirtualMachine.usbControllers property.
/// The real type of VZUSBController corresponds to the type used by the configuration.
/// For example, a VZXHCIControllerConfiguration leads to a device of type VZXHCIController.
///
/// See: VZUSBControllerConfiguration
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzusbcontroller?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VZUSBController;
);
extern_conformance!(
unsafe impl NSObjectProtocol for VZUSBController {}
);
impl VZUSBController {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "VZUSBDevice", feature = "block2"))]
/// Attach a USB device.
///
/// If the device is successfully attached to the controller, it will appear in the usbDevices property,
/// its usbController property will be set to point to the USB controller that it is attached to
/// and completion handler will return nil.
/// If the device was previously attached to this or another USB controller, attach function will fail
/// with the `VZErrorDeviceAlreadyAttached`. If the device cannot be initialized correctly, attach
/// function will fail with `VZErrorDeviceInitializationFailure`.
/// This method must be called on the virtual machine's queue.
///
/// Parameter `device`: USB device to attach.
///
/// Parameter `completionHandler`: Block called after the device has been attached or on error.
/// The error parameter passed to the block is nil if the attach was successful.
/// It will be also invoked on an virtual machine's queue.
///
/// See: VZUSBDevice
#[unsafe(method(attachDevice:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn attachDevice_completionHandler(
&self,
device: &ProtocolObject<dyn VZUSBDevice>,
completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[cfg(all(feature = "VZUSBDevice", feature = "block2"))]
/// Detach a USB device.
///
/// If the device is successfully detached from the controller, it will disappear from the usbDevices property,
/// its usbController property will be set to nil and completion handler will return nil.
/// If the device wasn't attached to the controller at the time of calling detach method, it will fail
/// with the `VZErrorDeviceNotFound` error.
/// This method must be called on the virtual machine's queue.
///
/// Parameter `device`: USB device to detach.
///
/// Parameter `completionHandler`: Block called after the device has been detached or on error.
/// The error parameter passed to the block is nil if the detach was successful.
/// It will be also invoked on an virtual machine's queue.
///
/// See: VZUSBDevice
#[unsafe(method(detachDevice:completionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn detachDevice_completionHandler(
&self,
device: &ProtocolObject<dyn VZUSBDevice>,
completion_handler: &block2::DynBlock<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "VZUSBDevice")]
/// Return a list of USB devices attached to controller.
///
/// If corresponding USB controller configuration included in VZVirtualMachineConfiguration contained any USB devices,
/// those devices will appear here when virtual machine is started.
///
/// See: VZUSBDevice
///
/// See: VZUSBDeviceConfiguration
///
/// See: VZUSBControllerConfiguration
///
/// See: VZVirtualMachineConfiguration
#[unsafe(method(usbDevices))]
#[unsafe(method_family = none)]
pub unsafe fn usbDevices(&self) -> Retained<NSArray<ProtocolObject<dyn VZUSBDevice>>>;
);
}