objc2_pass_kit/generated/
PKVehicleConnectionSession.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct PKVehicleConnectionErrorCode(pub NSInteger);
15impl PKVehicleConnectionErrorCode {
16 #[doc(alias = "PKVehicleConnectionErrorCodeUnknown")]
17 pub const Unknown: Self = Self(0);
18 #[doc(alias = "PKVehicleConnectionErrorCodeSessionUnableToStart")]
19 pub const SessionUnableToStart: Self = Self(1);
20 #[doc(alias = "PKVehicleConnectionErrorCodeSessionNotActive")]
21 pub const SessionNotActive: Self = Self(2);
22}
23
24unsafe impl Encode for PKVehicleConnectionErrorCode {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for PKVehicleConnectionErrorCode {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct PKVehicleConnectionSessionConnectionState(pub NSInteger);
37impl PKVehicleConnectionSessionConnectionState {
38 #[doc(alias = "PKVehicleConnectionSessionConnectionStateDisconnected")]
39 pub const Disconnected: Self = Self(0);
40 #[doc(alias = "PKVehicleConnectionSessionConnectionStateConnected")]
41 pub const Connected: Self = Self(1);
42 #[doc(alias = "PKVehicleConnectionSessionConnectionStateConnecting")]
43 pub const Connecting: Self = Self(2);
44 #[doc(alias = "PKVehicleConnectionSessionConnectionStateFailedToConnect")]
45 pub const FailedToConnect: Self = Self(3);
46}
47
48unsafe impl Encode for PKVehicleConnectionSessionConnectionState {
49 const ENCODING: Encoding = NSInteger::ENCODING;
50}
51
52unsafe impl RefEncode for PKVehicleConnectionSessionConnectionState {
53 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
54}
55
56extern_protocol!(
57 pub unsafe trait PKVehicleConnectionDelegate: NSObjectProtocol {
59 #[unsafe(method(sessionDidChangeConnectionState:))]
60 #[unsafe(method_family = none)]
61 unsafe fn sessionDidChangeConnectionState(
62 &self,
63 new_state: PKVehicleConnectionSessionConnectionState,
64 );
65
66 #[unsafe(method(sessionDidReceiveData:))]
67 #[unsafe(method_family = none)]
68 unsafe fn sessionDidReceiveData(&self, data: &NSData);
69 }
70);
71
72extern_class!(
73 #[unsafe(super(NSObject))]
75 #[derive(Debug, PartialEq, Eq, Hash)]
76 pub struct PKVehicleConnectionSession;
77);
78
79extern_conformance!(
80 unsafe impl NSObjectProtocol for PKVehicleConnectionSession {}
81);
82
83impl PKVehicleConnectionSession {
84 extern_methods!(
85 #[unsafe(method(init))]
86 #[unsafe(method_family = init)]
87 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
88
89 #[unsafe(method(new))]
90 #[unsafe(method_family = new)]
91 pub unsafe fn new() -> Retained<Self>;
92
93 #[unsafe(method(delegate))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn delegate(
96 &self,
97 ) -> Option<Retained<ProtocolObject<dyn PKVehicleConnectionDelegate>>>;
98
99 #[unsafe(method(connectionStatus))]
100 #[unsafe(method_family = none)]
101 pub unsafe fn connectionStatus(&self) -> PKVehicleConnectionSessionConnectionState;
102
103 #[cfg(all(
104 feature = "PKObject",
105 feature = "PKPass",
106 feature = "PKSecureElementPass",
107 feature = "block2"
108 ))]
109 #[unsafe(method(sessionForPass:delegate:completion:))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn sessionForPass_delegate_completion(
112 pass: &PKSecureElementPass,
113 delegate: &ProtocolObject<dyn PKVehicleConnectionDelegate>,
114 completion: &block2::DynBlock<dyn Fn(*mut PKVehicleConnectionSession, *mut NSError)>,
115 );
116
117 #[unsafe(method(sendData:error:_))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn sendData_error(&self, message: &NSData) -> Result<(), Retained<NSError>>;
120
121 #[unsafe(method(invalidate))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn invalidate(&self);
124 );
125}