objc2-car-play 0.3.2

Bindings to the CarPlay framework
Documentation
//! 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,
        );
    );
}