objc2_game_controller/generated/GCDevicePhysicalInputState.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::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_protocol!(
10 /// An object conforming to
11 /// `GCDevicePhysicalInputState`contains the state of
12 /// a device's physical inputs. This may be either the "live" physical input
13 /// state if the same object also conforms to
14 /// `GCDevicePhysicalInput,`or a
15 /// snapshot of the physical input state.
16 ///
17 /// See also [Apple's documentation](https://developer.apple.com/documentation/gamecontroller/gcdevicephysicalinputstate?language=objc)
18 pub unsafe trait GCDevicePhysicalInputState: NSObjectProtocol {
19 #[cfg(feature = "GCDevice")]
20 /// The device that this profile is mapping input from.
21 #[unsafe(method(device))]
22 #[unsafe(method_family = none)]
23 unsafe fn device(&self) -> Option<Retained<ProtocolObject<dyn GCDevice>>>;
24
25 /// The internal time stamp of the last event.
26 ///
27 /// This time interval is not relative to any specific point in time. Your
28 /// application can subtract a previous timestamp from the returned timestamp to
29 /// determine the time (in seconds) between events. The
30 /// `lastEventTimestamp`of
31 /// the inputs from two different devices can be compared to determine which event
32 /// occurred first.
33 #[unsafe(method(lastEventTimestamp))]
34 #[unsafe(method_family = none)]
35 unsafe fn lastEventTimestamp(&self) -> NSTimeInterval;
36
37 /// The interval (in seconds) between the timestamp of the last event and the
38 /// current time.
39 ///
40 /// This value should be treated as a lower bound of the event latency. It may
41 /// not include (wired or wireless) transmission latency, or latency accrued on
42 /// the device before the event was transmitted to the host.
43 ///
44 ///
45 /// Note: If the system has gone to sleep between when the event occurred and when this
46 /// property is read, the returned value may not reflect the true latency.
47 #[unsafe(method(lastEventLatency))]
48 #[unsafe(method_family = none)]
49 unsafe fn lastEventLatency(&self) -> NSTimeInterval;
50
51 #[cfg(all(feature = "GCInputNames", feature = "GCPhysicalInputElement"))]
52 /// The following properties allow for runtime lookup of any input element on a
53 /// profile, when provided with a valid alias.
54 #[unsafe(method(elements))]
55 #[unsafe(method_family = none)]
56 unsafe fn elements(
57 &self,
58 ) -> Retained<
59 GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCPhysicalInputElement>>,
60 >;
61
62 #[cfg(all(
63 feature = "GCButtonElement",
64 feature = "GCInputNames",
65 feature = "GCPhysicalInputElement"
66 ))]
67 #[unsafe(method(buttons))]
68 #[unsafe(method_family = none)]
69 unsafe fn buttons(
70 &self,
71 ) -> Retained<GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCButtonElement>>>;
72
73 #[cfg(all(
74 feature = "GCAxisElement",
75 feature = "GCInputNames",
76 feature = "GCPhysicalInputElement"
77 ))]
78 #[unsafe(method(axes))]
79 #[unsafe(method_family = none)]
80 unsafe fn axes(
81 &self,
82 ) -> Retained<GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCAxisElement>>>;
83
84 #[cfg(all(
85 feature = "GCInputNames",
86 feature = "GCPhysicalInputElement",
87 feature = "GCSwitchElement"
88 ))]
89 #[unsafe(method(switches))]
90 #[unsafe(method_family = none)]
91 unsafe fn switches(
92 &self,
93 ) -> Retained<GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCSwitchElement>>>;
94
95 #[cfg(all(
96 feature = "GCDirectionPadElement",
97 feature = "GCInputNames",
98 feature = "GCPhysicalInputElement"
99 ))]
100 #[unsafe(method(dpads))]
101 #[unsafe(method_family = none)]
102 unsafe fn dpads(
103 &self,
104 ) -> Retained<
105 GCPhysicalInputElementCollection<NSString, ProtocolObject<dyn GCDirectionPadElement>>,
106 >;
107
108 #[cfg(feature = "GCPhysicalInputElement")]
109 /// Profile elements can be accessed using keyed subscript notation, with a valid alias of its inputs.
110 ///
111 ///
112 ///
113 ///
114 /// Note: Equivalent to -elements
115 #[unsafe(method(objectForKeyedSubscript:))]
116 #[unsafe(method_family = none)]
117 unsafe fn objectForKeyedSubscript(
118 &self,
119 key: &NSString,
120 ) -> Option<Retained<ProtocolObject<dyn GCPhysicalInputElement>>>;
121 }
122);