objc2_io_usb_host/generated/
IOUSBHostIOSource.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-io-kit")]
6use objc2_io_kit::*;
7
8use crate::*;
9
10/// Encapsulates descriptors for a single endpoint
11///
12/// The IOUSBHostIOSourceDescriptors struct is used to initialize and adjust
13/// pipes in the system. The bcdUSB member must be initialized to the USB revision
14/// supported by the device. Acceptable values are 0x0110, 0x0200, 0x0300, 0x0310. The
15/// descriptor member must always be initialized with a valid endpoint descriptor. The
16/// ssCompanionDescriptor and sspCompanionDescriptor members may be
17/// required for bcdUSB versions 0x0300 and greater, depending on device operating
18/// speed and values set in the descriptors.  See USB 3.1 ยง 9.5 for more information on
19/// when these descriptors may be required.
20///
21/// See also [Apple's documentation](https://developer.apple.com/documentation/iousbhost/iousbhostiosourcedescriptors?language=objc)
22#[cfg(feature = "objc2-io-kit")]
23#[repr(C)]
24#[derive(Clone, Copy, Debug, PartialEq)]
25pub struct IOUSBHostIOSourceDescriptors {
26    pub bcdUSB: u16,
27    pub descriptor: IOUSBEndpointDescriptor,
28    pub ssCompanionDescriptor: IOUSBSuperSpeedEndpointCompanionDescriptor,
29    pub sspCompanionDescriptor: IOUSBSuperSpeedPlusIsochronousEndpointCompanionDescriptor,
30}
31
32#[cfg(feature = "objc2-io-kit")]
33unsafe impl Encode for IOUSBHostIOSourceDescriptors {
34    const ENCODING: Encoding = Encoding::Struct(
35        "IOUSBHostIOSourceDescriptors",
36        &[
37            <u16>::ENCODING,
38            <IOUSBEndpointDescriptor>::ENCODING,
39            <IOUSBSuperSpeedEndpointCompanionDescriptor>::ENCODING,
40            <IOUSBSuperSpeedPlusIsochronousEndpointCompanionDescriptor>::ENCODING,
41        ],
42    );
43}
44
45#[cfg(feature = "objc2-io-kit")]
46unsafe impl RefEncode for IOUSBHostIOSourceDescriptors {
47    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
48}
49
50extern_class!(
51    /// The abstract class IOUSBHostPipe and IOUSBHostStream derive from.
52    ///
53    /// Defines common methods that are shared between IOUSBHostPipe and IOUSBHostStream.
54    ///
55    /// See also [Apple's documentation](https://developer.apple.com/documentation/iousbhost/iousbhostiosource?language=objc)
56    #[unsafe(super(NSObject))]
57    #[derive(Debug, PartialEq, Eq, Hash)]
58    pub struct IOUSBHostIOSource;
59);
60
61extern_conformance!(
62    unsafe impl NSObjectProtocol for IOUSBHostIOSource {}
63);
64
65impl IOUSBHostIOSource {
66    extern_methods!(
67        #[unsafe(method(init))]
68        #[unsafe(method_family = init)]
69        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
70
71        #[cfg(all(feature = "IOUSBHostInterface", feature = "IOUSBHostObject"))]
72        /// Retrieve the source's IOUSBHostInterface
73        ///
74        /// Returns: IOUSBHostInterface pointer that the IOSource was created from.
75        #[unsafe(method(hostInterface))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn hostInterface(&self) -> Retained<IOUSBHostInterface>;
78
79        /// Retrieve the device's address
80        ///
81        /// Returns: Current address of the device
82        #[unsafe(method(deviceAddress))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn deviceAddress(&self) -> NSUInteger;
85
86        /// Retrieve the IOSource's endpoint address
87        ///
88        /// Returns: Current address of the endpoint
89        #[unsafe(method(endpointAddress))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn endpointAddress(&self) -> NSUInteger;
92    );
93}
94
95/// Methods declared on superclass `NSObject`.
96impl IOUSBHostIOSource {
97    extern_methods!(
98        #[unsafe(method(new))]
99        #[unsafe(method_family = new)]
100        pub unsafe fn new() -> Retained<Self>;
101    );
102}