use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CMPedometerData;
);
extern_conformance!(
unsafe impl NSCoding for CMPedometerData {}
);
extern_conformance!(
unsafe impl NSCopying for CMPedometerData {}
);
unsafe impl CopyingHelper for CMPedometerData {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for CMPedometerData {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CMPedometerData {}
);
impl CMPedometerData {
extern_methods!(
#[unsafe(method(startDate))]
#[unsafe(method_family = none)]
pub unsafe fn startDate(&self) -> Retained<NSDate>;
#[unsafe(method(endDate))]
#[unsafe(method_family = none)]
pub unsafe fn endDate(&self) -> Retained<NSDate>;
#[unsafe(method(numberOfSteps))]
#[unsafe(method_family = none)]
pub unsafe fn numberOfSteps(&self) -> Retained<NSNumber>;
#[unsafe(method(distance))]
#[unsafe(method_family = none)]
pub unsafe fn distance(&self) -> Option<Retained<NSNumber>>;
#[unsafe(method(floorsAscended))]
#[unsafe(method_family = none)]
pub unsafe fn floorsAscended(&self) -> Option<Retained<NSNumber>>;
#[unsafe(method(floorsDescended))]
#[unsafe(method_family = none)]
pub unsafe fn floorsDescended(&self) -> Option<Retained<NSNumber>>;
#[unsafe(method(currentPace))]
#[unsafe(method_family = none)]
pub unsafe fn currentPace(&self) -> Option<Retained<NSNumber>>;
#[unsafe(method(currentCadence))]
#[unsafe(method_family = none)]
pub unsafe fn currentCadence(&self) -> Option<Retained<NSNumber>>;
#[unsafe(method(averageActivePace))]
#[unsafe(method_family = none)]
pub unsafe fn averageActivePace(&self) -> Option<Retained<NSNumber>>;
);
}
impl CMPedometerData {
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() -> Retained<Self>;
);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CMPedometerEventType(pub NSInteger);
impl CMPedometerEventType {
#[doc(alias = "CMPedometerEventTypePause")]
pub const Pause: Self = Self(0);
#[doc(alias = "CMPedometerEventTypeResume")]
pub const Resume: Self = Self(1);
}
unsafe impl Encode for CMPedometerEventType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for CMPedometerEventType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CMPedometerEvent;
);
extern_conformance!(
unsafe impl NSCoding for CMPedometerEvent {}
);
extern_conformance!(
unsafe impl NSCopying for CMPedometerEvent {}
);
unsafe impl CopyingHelper for CMPedometerEvent {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for CMPedometerEvent {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CMPedometerEvent {}
);
impl CMPedometerEvent {
extern_methods!(
#[unsafe(method(date))]
#[unsafe(method_family = none)]
pub unsafe fn date(&self) -> Retained<NSDate>;
#[unsafe(method(type))]
#[unsafe(method_family = none)]
pub unsafe fn r#type(&self) -> CMPedometerEventType;
);
}
impl CMPedometerEvent {
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() -> Retained<Self>;
);
}
#[cfg(feature = "block2")]
pub type CMPedometerHandler = *mut block2::DynBlock<dyn Fn(*mut CMPedometerData, *mut NSError)>;
#[cfg(feature = "block2")]
pub type CMPedometerEventHandler =
*mut block2::DynBlock<dyn Fn(*mut CMPedometerEvent, *mut NSError)>;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CMPedometer;
);
extern_conformance!(
unsafe impl NSObjectProtocol for CMPedometer {}
);
impl CMPedometer {
extern_methods!(
#[unsafe(method(isStepCountingAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn isStepCountingAvailable() -> bool;
#[unsafe(method(isDistanceAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn isDistanceAvailable() -> bool;
#[unsafe(method(isFloorCountingAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn isFloorCountingAvailable() -> bool;
#[unsafe(method(isPaceAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn isPaceAvailable() -> bool;
#[unsafe(method(isCadenceAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn isCadenceAvailable() -> bool;
#[unsafe(method(isPedometerEventTrackingAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn isPedometerEventTrackingAvailable() -> bool;
#[cfg(feature = "CMAuthorization")]
#[unsafe(method(authorizationStatus))]
#[unsafe(method_family = none)]
pub unsafe fn authorizationStatus() -> CMAuthorizationStatus;
#[cfg(feature = "block2")]
#[unsafe(method(queryPedometerDataFromDate:toDate:withHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn queryPedometerDataFromDate_toDate_withHandler(
&self,
start: &NSDate,
end: &NSDate,
handler: CMPedometerHandler,
);
#[cfg(feature = "block2")]
#[unsafe(method(startPedometerUpdatesFromDate:withHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn startPedometerUpdatesFromDate_withHandler(
&self,
start: &NSDate,
handler: CMPedometerHandler,
);
#[unsafe(method(stopPedometerUpdates))]
#[unsafe(method_family = none)]
pub unsafe fn stopPedometerUpdates(&self);
#[cfg(feature = "block2")]
#[unsafe(method(startPedometerEventUpdatesWithHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn startPedometerEventUpdatesWithHandler(
&self,
handler: CMPedometerEventHandler,
);
#[unsafe(method(stopPedometerEventUpdates))]
#[unsafe(method_family = none)]
pub unsafe fn stopPedometerEventUpdates(&self);
);
}
impl CMPedometer {
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() -> Retained<Self>;
);
}