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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
//! 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::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cptrippausereason?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CPTripPauseReason(pub NSUInteger);
impl CPTripPauseReason {
#[doc(alias = "CPTripPauseReasonArrived")]
pub const Arrived: Self = Self(1);
#[doc(alias = "CPTripPauseReasonLoading")]
pub const Loading: Self = Self(2);
#[doc(alias = "CPTripPauseReasonLocating")]
pub const Locating: Self = Self(3);
#[doc(alias = "CPTripPauseReasonRerouting")]
pub const Rerouting: Self = Self(4);
#[doc(alias = "CPTripPauseReasonProceedToRoute")]
pub const ProceedToRoute: Self = Self(5);
}
unsafe impl Encode for CPTripPauseReason {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for CPTripPauseReason {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
/// `CPNavigationSession`represents the active navigation session. A
/// `CPNavigationSession`will be created for you
/// when calling startNavigationSessionForTrip: on
/// `CYMapTemplate`
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnavigationsession?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CPNavigationSession;
);
extern_conformance!(
unsafe impl NSObjectProtocol for CPNavigationSession {}
);
impl CPNavigationSession {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
/// Pause the current trip.
///
///
/// Parameter `reason`: The reason navigation was paused.
///
/// Parameter `description`: An optional description of the pause reason. If
/// `nil,`a system-provided string will be used.
#[unsafe(method(pauseTripForReason:description:))]
#[unsafe(method_family = none)]
pub unsafe fn pauseTripForReason_description(
&self,
reason: CPTripPauseReason,
description: Option<&NSString>,
);
#[cfg(feature = "objc2-ui-kit")]
/// Pause the current trip.
///
///
/// Parameter `reason`: The reason navigation was paused.
///
/// Parameter `description`: An optional description of the pause reason. If
/// `nil,`a system-provided string will be used.
///
/// Parameter `turnCardColor`: An optional color of the pause card. If
/// `nil,`will fallback to the
/// `guidanceBackgroundColor`on
/// `CPMapTemplate.`If no color is specified there, will default to a system-provided color.
#[unsafe(method(pauseTripForReason:description:turnCardColor:))]
#[unsafe(method_family = none)]
pub unsafe fn pauseTripForReason_description_turnCardColor(
&self,
reason: CPTripPauseReason,
description: Option<&NSString>,
turn_card_color: Option<&UIColor>,
);
#[cfg(feature = "CPRouteInformation")]
/// Resume the current trip with updated route information
///
///
/// Parameter `routeInformation`: The updated route information for the current trip
#[unsafe(method(resumeTripWithUpdatedRouteInformation:))]
#[unsafe(method_family = none)]
pub unsafe fn resumeTripWithUpdatedRouteInformation(
&self,
route_information: &CPRouteInformation,
);
/// Finish the trip.
#[unsafe(method(finishTrip))]
#[unsafe(method_family = none)]
pub unsafe fn finishTrip(&self);
/// Cancel the trip.
#[unsafe(method(cancelTrip))]
#[unsafe(method_family = none)]
pub unsafe fn cancelTrip(&self);
#[cfg(feature = "CPManeuver")]
/// The next maneuvers that should be performed to follow the current route.
/// Multiple maneuvers are displayed simultaneously, however the system may limit the number of maneuvers shown at the same time.
#[unsafe(method(upcomingManeuvers))]
#[unsafe(method_family = none)]
pub unsafe fn upcomingManeuvers(&self) -> Retained<NSArray<CPManeuver>>;
#[cfg(feature = "CPManeuver")]
/// Setter for [`upcomingManeuvers`][Self::upcomingManeuvers].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setUpcomingManeuvers:))]
#[unsafe(method_family = none)]
pub unsafe fn setUpcomingManeuvers(&self, upcoming_maneuvers: &NSArray<CPManeuver>);
#[cfg(feature = "CPLaneGuidance")]
/// The current lane guidance to be used for navigation metdata.
/// Must be set to nil if there is no current lane guidance. CPLaneGuidances set here must first be added to the session using addLaneGuidances:
#[unsafe(method(currentLaneGuidance))]
#[unsafe(method_family = none)]
pub unsafe fn currentLaneGuidance(&self) -> Option<Retained<CPLaneGuidance>>;
#[cfg(feature = "CPLaneGuidance")]
/// Setter for [`currentLaneGuidance`][Self::currentLaneGuidance].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setCurrentLaneGuidance:))]
#[unsafe(method_family = none)]
pub unsafe fn setCurrentLaneGuidance(&self, current_lane_guidance: Option<&CPLaneGuidance>);
#[cfg(feature = "CPManeuver")]
/// Use this method to add CPManeuvers in chronological order to the navigation session.
/// The application must provide as many maneuvers as possible, as soon as they are available. All
/// maneuvers set in upcomingManeuvers must be first added using this method.
#[unsafe(method(addManeuvers:))]
#[unsafe(method_family = none)]
pub unsafe fn addManeuvers(&self, maneuvers: &NSArray<CPManeuver>);
#[cfg(feature = "CPLaneGuidance")]
/// Use this method to add CPLaneGuidances in chronological order to the navigation session.
/// CPLaneGuidance objects must be added as soon as they are available.
#[unsafe(method(addLaneGuidances:))]
#[unsafe(method_family = none)]
pub unsafe fn addLaneGuidances(&self, lane_guidances: &NSArray<CPLaneGuidance>);
/// Set this property with variants of the current road name. From most to least verbose.
#[unsafe(method(currentRoadNameVariants))]
#[unsafe(method_family = none)]
pub unsafe fn currentRoadNameVariants(&self) -> Retained<NSArray<NSString>>;
/// Setter for [`currentRoadNameVariants`][Self::currentRoadNameVariants].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setCurrentRoadNameVariants:))]
#[unsafe(method_family = none)]
pub unsafe fn setCurrentRoadNameVariants(
&self,
current_road_name_variants: &NSArray<NSString>,
);
#[cfg(feature = "CPManeuver")]
/// Set this property with the current maneuver state based on how close the maneuver is.
#[unsafe(method(maneuverState))]
#[unsafe(method_family = none)]
pub unsafe fn maneuverState(&self) -> CPManeuverState;
#[cfg(feature = "CPManeuver")]
/// Setter for [`maneuverState`][Self::maneuverState].
#[unsafe(method(setManeuverState:))]
#[unsafe(method_family = none)]
pub unsafe fn setManeuverState(&self, maneuver_state: CPManeuverState);
#[cfg(feature = "CPTrip")]
/// The trip associated with this navigation session.
#[unsafe(method(trip))]
#[unsafe(method_family = none)]
pub unsafe fn trip(&self) -> Retained<CPTrip>;
#[cfg(all(feature = "CPManeuver", feature = "CPTravelEstimates"))]
/// Update the travel estimates for the active navigation session and maneuver.
///
///
/// Parameter `estimates`: The updated travel estimates.
///
/// Parameter `maneuver`: The maneuver pertaining to this update.
#[unsafe(method(updateTravelEstimates:forManeuver:))]
#[unsafe(method_family = none)]
pub unsafe fn updateTravelEstimates_forManeuver(
&self,
estimates: &CPTravelEstimates,
maneuver: &CPManeuver,
);
);
}