objc2_car_play/generated/
CPNavigationSession.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-ui-kit")]
8use objc2_ui_kit::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/carplay/cptrippausereason?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct CPTripPauseReason(pub NSUInteger);
17impl CPTripPauseReason {
18    #[doc(alias = "CPTripPauseReasonArrived")]
19    pub const Arrived: Self = Self(1);
20    #[doc(alias = "CPTripPauseReasonLoading")]
21    pub const Loading: Self = Self(2);
22    #[doc(alias = "CPTripPauseReasonLocating")]
23    pub const Locating: Self = Self(3);
24    #[doc(alias = "CPTripPauseReasonRerouting")]
25    pub const Rerouting: Self = Self(4);
26    #[doc(alias = "CPTripPauseReasonProceedToRoute")]
27    pub const ProceedToRoute: Self = Self(5);
28}
29
30unsafe impl Encode for CPTripPauseReason {
31    const ENCODING: Encoding = NSUInteger::ENCODING;
32}
33
34unsafe impl RefEncode for CPTripPauseReason {
35    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38extern_class!(
39    /// `CPNavigationSession`represents the active navigation session. A
40    /// `CPNavigationSession`will be created for you
41    /// when calling startNavigationSessionForTrip: on
42    /// `CYMapTemplate`
43    ///
44    /// See also [Apple's documentation](https://developer.apple.com/documentation/carplay/cpnavigationsession?language=objc)
45    #[unsafe(super(NSObject))]
46    #[thread_kind = MainThreadOnly]
47    #[derive(Debug, PartialEq, Eq, Hash)]
48    pub struct CPNavigationSession;
49);
50
51extern_conformance!(
52    unsafe impl NSObjectProtocol for CPNavigationSession {}
53);
54
55impl CPNavigationSession {
56    extern_methods!(
57        #[unsafe(method(init))]
58        #[unsafe(method_family = init)]
59        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
60
61        #[unsafe(method(new))]
62        #[unsafe(method_family = new)]
63        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
64
65        /// Pause the current trip.
66        ///
67        ///
68        /// Parameter `reason`: The reason navigation was paused.
69        ///
70        /// Parameter `description`: An optional description of the pause reason. If
71        /// `nil,`a system-provided string will be used.
72        #[unsafe(method(pauseTripForReason:description:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn pauseTripForReason_description(
75            &self,
76            reason: CPTripPauseReason,
77            description: Option<&NSString>,
78        );
79
80        #[cfg(feature = "objc2-ui-kit")]
81        /// Pause the current trip.
82        ///
83        ///
84        /// Parameter `reason`: The reason navigation was paused.
85        ///
86        /// Parameter `description`: An optional description of the pause reason. If
87        /// `nil,`a system-provided string will be used.
88        ///
89        /// Parameter `turnCardColor`: An optional color of the pause card. If
90        /// `nil,`will fallback to the
91        /// `guidanceBackgroundColor`on
92        /// `CPMapTemplate.`If no color is specified there, will default to a system-provided color.
93        #[unsafe(method(pauseTripForReason:description:turnCardColor:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn pauseTripForReason_description_turnCardColor(
96            &self,
97            reason: CPTripPauseReason,
98            description: Option<&NSString>,
99            turn_card_color: Option<&UIColor>,
100        );
101
102        #[cfg(feature = "CPRouteInformation")]
103        /// Resume the current trip with updated route information
104        ///
105        ///
106        /// Parameter `routeInformation`: The updated route information for the current trip
107        #[unsafe(method(resumeTripWithUpdatedRouteInformation:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn resumeTripWithUpdatedRouteInformation(
110            &self,
111            route_information: &CPRouteInformation,
112        );
113
114        /// Finish the trip.
115        #[unsafe(method(finishTrip))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn finishTrip(&self);
118
119        /// Cancel the trip.
120        #[unsafe(method(cancelTrip))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn cancelTrip(&self);
123
124        #[cfg(feature = "CPManeuver")]
125        /// The next maneuvers that should be performed to follow the current route.
126        /// Multiple maneuvers are displayed simultaneously, however the system may limit the number of maneuvers shown at the same time.
127        #[unsafe(method(upcomingManeuvers))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn upcomingManeuvers(&self) -> Retained<NSArray<CPManeuver>>;
130
131        #[cfg(feature = "CPManeuver")]
132        /// Setter for [`upcomingManeuvers`][Self::upcomingManeuvers].
133        ///
134        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
135        #[unsafe(method(setUpcomingManeuvers:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setUpcomingManeuvers(&self, upcoming_maneuvers: &NSArray<CPManeuver>);
138
139        #[cfg(feature = "CPLaneGuidance")]
140        /// The current lane guidance to be used for navigation metdata.
141        /// Must be set to nil if there is no current lane guidance. CPLaneGuidances set here must first be added to the session using addLaneGuidances:
142        #[unsafe(method(currentLaneGuidance))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn currentLaneGuidance(&self) -> Option<Retained<CPLaneGuidance>>;
145
146        #[cfg(feature = "CPLaneGuidance")]
147        /// Setter for [`currentLaneGuidance`][Self::currentLaneGuidance].
148        ///
149        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
150        #[unsafe(method(setCurrentLaneGuidance:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setCurrentLaneGuidance(&self, current_lane_guidance: Option<&CPLaneGuidance>);
153
154        #[cfg(feature = "CPManeuver")]
155        /// Use this method to add CPManeuvers in chronological order to the navigation session.
156        /// The application must provide as many maneuvers as possible, as soon as they are available. All
157        /// maneuvers set in upcomingManeuvers must be first added using this method.
158        #[unsafe(method(addManeuvers:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn addManeuvers(&self, maneuvers: &NSArray<CPManeuver>);
161
162        #[cfg(feature = "CPLaneGuidance")]
163        /// Use this method to add CPLaneGuidances in chronological order to the navigation session.
164        /// CPLaneGuidance objects must be added as soon as they are available.
165        #[unsafe(method(addLaneGuidances:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn addLaneGuidances(&self, lane_guidances: &NSArray<CPLaneGuidance>);
168
169        /// Set this property with variants of the current road name. From most to least verbose.
170        #[unsafe(method(currentRoadNameVariants))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn currentRoadNameVariants(&self) -> Retained<NSArray<NSString>>;
173
174        /// Setter for [`currentRoadNameVariants`][Self::currentRoadNameVariants].
175        ///
176        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
177        #[unsafe(method(setCurrentRoadNameVariants:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setCurrentRoadNameVariants(
180            &self,
181            current_road_name_variants: &NSArray<NSString>,
182        );
183
184        #[cfg(feature = "CPManeuver")]
185        /// Set this property with the current maneuver state based on how close the maneuver is.
186        #[unsafe(method(maneuverState))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn maneuverState(&self) -> CPManeuverState;
189
190        #[cfg(feature = "CPManeuver")]
191        /// Setter for [`maneuverState`][Self::maneuverState].
192        #[unsafe(method(setManeuverState:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn setManeuverState(&self, maneuver_state: CPManeuverState);
195
196        #[cfg(feature = "CPTrip")]
197        /// The trip associated with this navigation session.
198        #[unsafe(method(trip))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn trip(&self) -> Retained<CPTrip>;
201
202        #[cfg(all(feature = "CPManeuver", feature = "CPTravelEstimates"))]
203        /// Update the travel estimates for the active navigation session and maneuver.
204        ///
205        ///
206        /// Parameter `estimates`: The updated travel estimates.
207        ///
208        /// Parameter `maneuver`: The maneuver pertaining to this update.
209        #[unsafe(method(updateTravelEstimates:forManeuver:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn updateTravelEstimates_forManeuver(
212            &self,
213            estimates: &CPTravelEstimates,
214            maneuver: &CPManeuver,
215        );
216    );
217}