objc2_sensor_kit/generated/
mod.rs

1// This file has been automatically generated by `objc2`'s `header-translator`.
2// DO NOT EDIT
3
4#![allow(unused_imports)]
5#![allow(deprecated)]
6#![allow(non_snake_case)]
7#![allow(non_camel_case_types)]
8#![allow(non_upper_case_globals)]
9#![allow(missing_docs)]
10#![allow(clippy::too_many_arguments)]
11#![allow(clippy::type_complexity)]
12#![allow(clippy::upper_case_acronyms)]
13#![allow(clippy::identity_op)]
14#![allow(clippy::missing_safety_doc)]
15#![allow(clippy::doc_lazy_continuation)]
16#![allow(rustdoc::broken_intra_doc_links)]
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::unportable_markdown)]
19#![allow(rustdoc::invalid_html_tags)]
20
21#[link(name = "SensorKit", kind = "framework")]
22extern "C" {}
23
24use core::ffi::*;
25use core::ptr::NonNull;
26use objc2::__framework_prelude::*;
27#[cfg(feature = "objc2-ar-kit")]
28use objc2_ar_kit::*;
29#[cfg(feature = "objc2-core-foundation")]
30use objc2_core_foundation::*;
31#[cfg(feature = "objc2-core-location")]
32use objc2_core_location::*;
33#[cfg(feature = "objc2-core-media")]
34use objc2_core_media::*;
35use objc2_foundation::*;
36#[cfg(feature = "objc2-sound-analysis")]
37use objc2_sound_analysis::*;
38#[cfg(feature = "objc2-speech")]
39use objc2_speech::*;
40
41use crate::*;
42
43/// A type of data stream stored in the SensorKit data store.
44///
45/// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensor?language=objc)
46// NS_TYPED_ENUM
47pub type SRSensor = NSString;
48
49extern "C" {
50    /// Sensor stream for Environmental Brightness and Color.
51    ///
52    ///
53    /// This data stream stores ambient light sensor data from devices when the screen is on.
54    /// Fetches from this stream return objects of type SRAmbientLightSample.
55    ///
56    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorambientlightsensor?language=objc)
57    pub static SRSensorAmbientLightSensor: &'static SRSensor;
58}
59
60extern "C" {
61    /// Accelerometer sensor stream for Motion.
62    ///
63    ///
64    /// This data stream stores acceleration measured by the device's accelerometer.
65    /// Fetches from this stream return objects of type NSArray
66    /// <CMRecordedAccelerometerData
67    /// *> * as defined in the CoreMotion framework.
68    ///
69    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensoraccelerometer?language=objc)
70    pub static SRSensorAccelerometer: &'static SRSensor;
71}
72
73extern "C" {
74    /// Rotation rate sensor stream for Motion.
75    ///
76    ///
77    /// This data stream stores rotation rate measured by the device's gyroscope.
78    /// Fetches from this stream return objects of type NSArray
79    /// <CMRecordedRotationRateData
80    /// *> * as defined in the CoreMotion framework.
81    ///
82    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorrotationrate?language=objc)
83    pub static SRSensorRotationRate: &'static SRSensor;
84}
85
86extern "C" {
87    /// Sensor stream for Frequently Visited Locations.
88    ///
89    ///
90    /// This data stream stores visit information from frequently visited locations including:
91    ///
92    /// ```text
93    ///    - arrival and departure times
94    ///    - distance from your home
95    ///    - an anonymous location identifier but no specific location information
96    /// ```
97    ///
98    /// Fetches from this stream return objects of type SRVisit.
99    ///
100    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorvisits?language=objc)
101    pub static SRSensorVisits: &'static SRSensor;
102}
103
104extern "C" {
105    /// Sensor stream for Pedometer.
106    ///
107    ///
108    /// This stream stores information about your step count.
109    /// Fetches from this stream return objects of type CMPedometerData as defined in the CoreMotion framework.
110    ///
111    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorpedometerdata?language=objc)
112    pub static SRSensorPedometerData: &'static SRSensor;
113}
114
115extern "C" {
116    /// Sensor stream for Device Usage.
117    ///
118    ///
119    /// This stream stores information about device usage including:
120    ///
121    /// ```text
122    ///    - Types of apps used
123    ///    - Types of notifications received
124    ///    - Types of websites visited
125    ///    - Number of device unlocks and unlock duration
126    ///    - Number of times the screen is on and the duration
127    /// ```
128    ///
129    /// Fetches from this stream return objects of type SRDeviceUsageReport.
130    ///
131    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensordeviceusagereport?language=objc)
132    pub static SRSensorDeviceUsageReport: &'static SRSensor;
133}
134
135extern "C" {
136    /// Sensor stream for Messages Usage.
137    ///
138    ///
139    /// This streams stores information about messages usage including:
140    ///
141    /// ```text
142    ///    - The number of incoming and outgoing messages
143    ///    - The number of individuals contacted but none of their personal information
144    /// ```
145    ///
146    /// Fetches from this stream return objects of type SRMessagesUsageReport.
147    ///
148    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensormessagesusagereport?language=objc)
149    pub static SRSensorMessagesUsageReport: &'static SRSensor;
150}
151
152extern "C" {
153    /// Sensor stream for Phone Usage
154    ///
155    ///
156    /// This streams stores information about phone usage including:
157    ///
158    /// ```text
159    ///    - The number of incoming and outgoing calls
160    ///    - The number of individuals contacted but none of their personal information
161    /// ```
162    ///
163    /// Fetches from this stream return objects of type SRPhoneUsageReport.
164    ///
165    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorphoneusagereport?language=objc)
166    pub static SRSensorPhoneUsageReport: &'static SRSensor;
167}
168
169extern "C" {
170    /// Sensor stream for Watch on Wrist
171    ///
172    ///
173    /// This streams stores information about Apple Watch wear including:
174    ///
175    /// ```text
176    ///    - When the watch is worn
177    ///    - Digital crown and orientation settings
178    /// ```
179    ///
180    /// Fetches from this stream return objects of type SRWristDetection.
181    ///
182    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensoronwriststate?language=objc)
183    pub static SRSensorOnWristState: &'static SRSensor;
184}
185
186extern "C" {
187    /// Sensor stream for Keyboard Usage
188    ///
189    ///
190    /// This stream stores information about keyboard usage from all apps where a keyboard is used including:
191    ///
192    /// ```text
193    ///    - Metrics about typing speed and accuracy
194    ///    - Metrics about the length of typed or swiped words
195    ///    - Metrics about the typing errors made
196    ///    - The number of words and emojis that convey emotion
197    /// ```
198    ///
199    /// Fetches from this stream return objects of type SRKeyboardMetrics.
200    ///
201    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorkeyboardmetrics?language=objc)
202    pub static SRSensorKeyboardMetrics: &'static SRSensor;
203}
204
205extern "C" {
206    /// Siri sensor stream for Speech Metrics
207    ///
208    ///
209    /// This stream stores information data about your voice during Siri sessions including:
210    ///
211    /// ```text
212    ///    - Tenor, pitch, and cadence
213    ///    - Metrics such as average words per minute and average pause length
214    /// ```
215    ///
216    /// This steam does not store any raw audio nor any audio or data from other parties.
217    ///
218    /// Fetches from this stream return objects of type
219    /// `SRSpeechMetrics`
220    ///
221    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorsirispeechmetrics?language=objc)
222    pub static SRSensorSiriSpeechMetrics: &'static SRSensor;
223}
224
225extern "C" {
226    /// Telephony sensor stream for Speech Metrics
227    ///
228    ///
229    /// This stream stores information data about your voice during phone calls including:
230    ///
231    /// ```text
232    ///    - Tenor, pitch, and cadence
233    ///    - Metrics such as average words per minute and average pause length
234    /// ```
235    ///
236    /// This steam does not store any raw audio nor any audio or data from other parties.
237    ///
238    /// Fetches from this stream return objects of type
239    /// `SRSpeechMetrics`
240    ///
241    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensortelephonyspeechmetrics?language=objc)
242    pub static SRSensorTelephonySpeechMetrics: &'static SRSensor;
243}
244
245extern "C" {
246    /// Ambient pressure sensor stream
247    ///
248    ///
249    /// This stream stores simple pressure and temperature measurements including:
250    ///
251    /// ```text
252    ///    - Pressure and temperature
253    ///    - Date when metric was collected
254    /// ```
255    ///
256    /// Fetches from this stream return objects of type NSArray
257    /// <CMRecordedPressureData
258    /// *> * as defined in the CoreMotion framework.
259    ///
260    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorambientpressure?language=objc)
261    pub static SRSensorAmbientPressure: &'static SRSensor;
262}
263
264extern "C" {
265    /// Media events sensor stream
266    ///
267    ///
268    /// This stream stores data about user interaction with photo and video content in messaging apps including:
269    ///
270    /// ```text
271    ///    - Event type
272    ///    - Media identifier
273    /// ```
274    ///
275    /// Fetches from this stream return objects of type SRMediaEvent.
276    ///
277    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensormediaevents?language=objc)
278    pub static SRSensorMediaEvents: &'static SRSensor;
279}
280
281extern "C" {
282    /// Sensor stream for Apple Watch temperatures on wrist while sleeping
283    ///
284    ///
285    /// This stream stores Apple Watch on wrist temperature measurements including:
286    ///
287    /// ```text
288    ///    - StartTime
289    ///    - Duration of collected temperature measurements
290    ///    - version of algorithm
291    ///    - Temperature samples
292    /// ```
293    ///
294    /// Fetches from this stream return objects of type SRWristTemperatureSession.
295    ///
296    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorwristtemperature?language=objc)
297    pub static SRSensorWristTemperature: &'static SRSensor;
298}
299
300extern "C" {
301    /// Estimated heart rate
302    ///
303    ///
304    /// Fetches from this stream return objects of type
305    /// `CMHighFrequencyHeartRateData`
306    ///
307    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorheartrate?language=objc)
308    pub static SRSensorHeartRate: &'static SRSensor;
309}
310
311extern "C" {
312    /// Sensor stream for face metrics collection
313    ///
314    ///
315    /// This stream stores face metrics including:
316    ///
317    /// ```text
318    ///    - algorithm version
319    ///    - face description and face expressions
320    ///    - data collection session identifier
321    /// ```
322    ///
323    /// Fetches from this stream return objects of type SRFaceMetrics.
324    ///
325    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorfacemetrics?language=objc)
326    pub static SRSensorFaceMetrics: &'static SRSensor;
327}
328
329extern "C" {
330    /// Odometer sensor stream
331    ///
332    ///
333    /// This stream stores measurements of your distance and speed
334    /// Fetches from this stream return objects of type
335    /// `CMOdometerData`as defined in the CoreMotion framework.
336    ///
337    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorodometer?language=objc)
338    pub static SRSensorOdometer: &'static SRSensor;
339}
340
341extern "C" {
342    /// ECG sensor stream
343    ///
344    ///
345    /// This stream stores samples of the ECG sensor
346    /// Fetches from this stream return objects of type
347    /// `NSArray<SRElectrocardiogramSample`*> *
348    ///
349    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorelectrocardiogram?language=objc)
350    pub static SRSensorElectrocardiogram: &'static SRSensor;
351}
352
353extern "C" {
354    /// PPG sensor stream
355    ///
356    ///
357    /// This stream stores samples of the PPG sensor
358    /// Fetches from this stream return objects of type
359    /// `NSArray<SRPhotoplethysmogramSample`*> *
360    ///
361    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorphotoplethysmogram?language=objc)
362    pub static SRSensorPhotoplethysmogram: &'static SRSensor;
363}
364
365/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srabsolutetime?language=objc)
366#[cfg(feature = "objc2-core-foundation")]
367pub type SRAbsoluteTime = CFTimeInterval;
368
369extern "C-unwind" {
370    /// Get the current SRAbsoluteTime for this device.
371    ///
372    /// This timestamp ticks across sleeps and reboots.
373    #[cfg(feature = "objc2-core-foundation")]
374    pub fn SRAbsoluteTimeGetCurrent() -> SRAbsoluteTime;
375}
376
377extern "C-unwind" {
378    /// Convert a mach_continuous_time to an SRAbsoluteTime.
379    ///
380    /// Because mach_continuous_time is volatile and hardware specific, the
381    /// mach_continuous_time must originate from the same device and boot session
382    /// that SRAbsoluteTimeFromContinuousTime() is called from.
383    /// The return value for mach_continuous_times spanning boot sessions or devices
384    /// is undefined.
385    #[cfg(feature = "objc2-core-foundation")]
386    pub fn SRAbsoluteTimeFromContinuousTime(cont: u64) -> SRAbsoluteTime;
387}
388
389extern "C-unwind" {
390    /// Convert a SRAbsoluteTime to a CFAbsoluteTime.
391    ///
392    /// The CFAbsoluteTime returned is based on calculations relative to the current
393    /// wall clock. This means that if the system time is 5 seconds fast against UTC,
394    /// the result will be 5 seconds fast to when the event happened relative to UTC.
395    #[cfg(feature = "objc2-core-foundation")]
396    pub fn SRAbsoluteTimeToCFAbsoluteTime(sr: SRAbsoluteTime) -> CFAbsoluteTime;
397}
398
399extern "C-unwind" {
400    /// Convert a CFAbsoluteTime to an SRAbsoluteTime.
401    ///
402    /// The SRAbsoluteTime returned is based on calculations relative to the current
403    /// wall clock. This means that if the system time is 5 seconds fast against UTC,
404    /// the result will be 5 seconds fast to when the event happened relative to UTC.
405    #[cfg(feature = "objc2-core-foundation")]
406    pub fn SRAbsoluteTimeFromCFAbsoluteTime(cf: CFAbsoluteTime) -> SRAbsoluteTime;
407}
408
409mod private_NSDateSensorKit {
410    pub trait Sealed {}
411}
412
413/// Category "SensorKit" on [`NSDate`].
414#[doc(alias = "SensorKit")]
415pub unsafe trait NSDateSensorKit:
416    ClassType + Sized + private_NSDateSensorKit::Sealed
417{
418    extern_methods!(
419        #[cfg(feature = "objc2-core-foundation")]
420        #[unsafe(method(dateWithSRAbsoluteTime:))]
421        #[unsafe(method_family = none)]
422        unsafe fn dateWithSRAbsoluteTime(time: SRAbsoluteTime) -> Retained<Self>;
423
424        #[cfg(feature = "objc2-core-foundation")]
425        #[unsafe(method(initWithSRAbsoluteTime:))]
426        #[unsafe(method_family = init)]
427        unsafe fn initWithSRAbsoluteTime(
428            this: Allocated<Self>,
429            time: SRAbsoluteTime,
430        ) -> Retained<Self>;
431
432        #[cfg(feature = "objc2-core-foundation")]
433        #[unsafe(method(srAbsoluteTime))]
434        #[unsafe(method_family = none)]
435        unsafe fn srAbsoluteTime(&self) -> SRAbsoluteTime;
436    );
437}
438
439impl private_NSDateSensorKit::Sealed for NSDate {}
440unsafe impl NSDateSensorKit for NSDate {}
441
442extern_class!(
443    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srfetchresult?language=objc)
444    #[unsafe(super(NSObject))]
445    #[derive(Debug, PartialEq, Eq, Hash)]
446    pub struct SRFetchResult<SampleType: ?Sized = AnyObject>;
447);
448
449extern_conformance!(
450    unsafe impl<SampleType: ?Sized> NSCopying for SRFetchResult<SampleType> {}
451);
452
453unsafe impl<SampleType: ?Sized + Message> CopyingHelper for SRFetchResult<SampleType> {
454    type Result = Self;
455}
456
457extern_conformance!(
458    unsafe impl<SampleType: ?Sized> NSObjectProtocol for SRFetchResult<SampleType> {}
459);
460
461impl<SampleType: Message> SRFetchResult<SampleType> {
462    extern_methods!(
463        /// Retrieves the resultant sample
464        ///
465        /// The caller is expected to know what the result type should be
466        ///
467        /// Note: This may thrown an exception if the sample could not be constructed from
468        /// the data in the datastore
469        #[unsafe(method(sample))]
470        #[unsafe(method_family = none)]
471        pub unsafe fn sample(&self) -> Retained<SampleType>;
472
473        #[cfg(feature = "objc2-core-foundation")]
474        /// the timestamp the sample was written to the data store
475        #[unsafe(method(timestamp))]
476        #[unsafe(method_family = none)]
477        pub unsafe fn timestamp(&self) -> SRAbsoluteTime;
478
479        #[unsafe(method(init))]
480        #[unsafe(method_family = init)]
481        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
482
483        #[unsafe(method(new))]
484        #[unsafe(method_family = new)]
485        pub unsafe fn new() -> Retained<Self>;
486    );
487}
488
489extern_class!(
490    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdevice?language=objc)
491    #[unsafe(super(NSObject))]
492    #[derive(Debug, PartialEq, Eq, Hash)]
493    pub struct SRDevice;
494);
495
496extern_conformance!(
497    unsafe impl NSCoding for SRDevice {}
498);
499
500extern_conformance!(
501    unsafe impl NSCopying for SRDevice {}
502);
503
504unsafe impl CopyingHelper for SRDevice {
505    type Result = Self;
506}
507
508extern_conformance!(
509    unsafe impl NSObjectProtocol for SRDevice {}
510);
511
512extern_conformance!(
513    unsafe impl NSSecureCoding for SRDevice {}
514);
515
516impl SRDevice {
517    extern_methods!(
518        #[unsafe(method(currentDevice))]
519        #[unsafe(method_family = none)]
520        pub unsafe fn currentDevice() -> Retained<SRDevice>;
521
522        #[unsafe(method(name))]
523        #[unsafe(method_family = none)]
524        pub unsafe fn name(&self) -> Retained<NSString>;
525
526        #[unsafe(method(model))]
527        #[unsafe(method_family = none)]
528        pub unsafe fn model(&self) -> Retained<NSString>;
529
530        #[unsafe(method(systemName))]
531        #[unsafe(method_family = none)]
532        pub unsafe fn systemName(&self) -> Retained<NSString>;
533
534        #[unsafe(method(systemVersion))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn systemVersion(&self) -> Retained<NSString>;
537
538        #[unsafe(method(productType))]
539        #[unsafe(method_family = none)]
540        pub unsafe fn productType(&self) -> Retained<NSString>;
541    );
542}
543
544/// Methods declared on superclass `NSObject`.
545impl SRDevice {
546    extern_methods!(
547        #[unsafe(method(init))]
548        #[unsafe(method_family = init)]
549        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
550
551        #[unsafe(method(new))]
552        #[unsafe(method_family = new)]
553        pub unsafe fn new() -> Retained<Self>;
554    );
555}
556
557extern_class!(
558    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srfetchrequest?language=objc)
559    #[unsafe(super(NSObject))]
560    #[derive(Debug, PartialEq, Eq, Hash)]
561    pub struct SRFetchRequest;
562);
563
564extern_conformance!(
565    unsafe impl NSObjectProtocol for SRFetchRequest {}
566);
567
568impl SRFetchRequest {
569    extern_methods!(
570        #[cfg(feature = "objc2-core-foundation")]
571        /// Fetch data starting after this time.
572        ///
573        /// This value must be specified for a valid request to be performed.
574        /// If it is not specified, this will result in a SRErrorInvalidRequest error in the
575        /// -sensorReader:fetchingRequest:failedWithError: SRSensorReaderDelegate callback.
576        ///
577        /// The time range for fetching will be exclusive of start time and inclusive of end time:
578        /// (start, end] . An SRSensorReader can use this to continue fetching a stream of
579        /// data based on the last sample timestamp they have read.
580        #[unsafe(method(from))]
581        #[unsafe(method_family = none)]
582        pub unsafe fn from(&self) -> SRAbsoluteTime;
583
584        #[cfg(feature = "objc2-core-foundation")]
585        /// Setter for [`from`][Self::from].
586        #[unsafe(method(setFrom:))]
587        #[unsafe(method_family = none)]
588        pub unsafe fn setFrom(&self, from: SRAbsoluteTime);
589
590        #[cfg(feature = "objc2-core-foundation")]
591        /// Fetch data ending at this time.
592        ///
593        /// This value must be specified for a valid request to be performed.
594        /// If it is not specified, this will result in a SRErrorInvalidRequest error in the
595        /// -sensorReader:fetchingRequest:failedWithError: SRSensorReaderDelegate callback.
596        #[unsafe(method(to))]
597        #[unsafe(method_family = none)]
598        pub unsafe fn to(&self) -> SRAbsoluteTime;
599
600        #[cfg(feature = "objc2-core-foundation")]
601        /// Setter for [`to`][Self::to].
602        #[unsafe(method(setTo:))]
603        #[unsafe(method_family = none)]
604        pub unsafe fn setTo(&self, to: SRAbsoluteTime);
605
606        /// Fetch data generated on this device
607        ///
608        /// If this is not specified, the current device will be used.
609        #[unsafe(method(device))]
610        #[unsafe(method_family = none)]
611        pub unsafe fn device(&self) -> Retained<SRDevice>;
612
613        /// Setter for [`device`][Self::device].
614        #[unsafe(method(setDevice:))]
615        #[unsafe(method_family = none)]
616        pub unsafe fn setDevice(&self, device: &SRDevice);
617    );
618}
619
620/// Methods declared on superclass `NSObject`.
621impl SRFetchRequest {
622    extern_methods!(
623        #[unsafe(method(init))]
624        #[unsafe(method_family = init)]
625        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
626
627        #[unsafe(method(new))]
628        #[unsafe(method_family = new)]
629        pub unsafe fn new() -> Retained<Self>;
630    );
631}
632
633/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srauthorizationstatus?language=objc)
634// NS_ENUM
635#[repr(transparent)]
636#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
637pub struct SRAuthorizationStatus(pub NSInteger);
638impl SRAuthorizationStatus {
639    /// User has not yet made a choice regarding this application
640    #[doc(alias = "SRAuthorizationStatusNotDetermined")]
641    pub const NotDetermined: Self = Self(0);
642    /// User has granted authorization to this application
643    #[doc(alias = "SRAuthorizationStatusAuthorized")]
644    pub const Authorized: Self = Self(1);
645    /// User has denied authorization to this application or
646    /// data collection is disabled in Settings.
647    #[doc(alias = "SRAuthorizationStatusDenied")]
648    pub const Denied: Self = Self(2);
649}
650
651unsafe impl Encode for SRAuthorizationStatus {
652    const ENCODING: Encoding = NSInteger::ENCODING;
653}
654
655unsafe impl RefEncode for SRAuthorizationStatus {
656    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
657}
658
659extern_protocol!(
660    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorreaderdelegate?language=objc)
661    pub unsafe trait SRSensorReaderDelegate: NSObjectProtocol {
662        /// Invoked when a sample has been fetched
663        ///
664        /// This callback can be called multiple times
665        /// when there are multiple results.
666        ///
667        ///
668        /// Parameter `fetchRequest`: The request corresponding to the this result
669        ///
670        /// Parameter `result`: One result of the fetch. The caller is expected to
671        /// know what type of sample is returned.
672        ///
673        ///
674        /// Note: The fetchResult is not valid after the callback is complete. If the caller needs
675        /// to access the result at a later time, it must be copied not merely retained
676        ///
677        ///
678        /// Returns: The delegate should return YES if the fetch should continue, NO if the fetch should stop
679        #[optional]
680        #[unsafe(method(sensorReader:fetchingRequest:didFetchResult:))]
681        #[unsafe(method_family = none)]
682        unsafe fn sensorReader_fetchingRequest_didFetchResult(
683            &self,
684            reader: &SRSensorReader,
685            fetch_request: &SRFetchRequest,
686            result: &SRFetchResult,
687        ) -> bool;
688
689        /// Invoked when a fetch has been completed successfully
690        #[optional]
691        #[unsafe(method(sensorReader:didCompleteFetch:))]
692        #[unsafe(method_family = none)]
693        unsafe fn sensorReader_didCompleteFetch(
694            &self,
695            reader: &SRSensorReader,
696            fetch_request: &SRFetchRequest,
697        );
698
699        /// Invoked when a fetch has completed with an error
700        #[optional]
701        #[unsafe(method(sensorReader:fetchingRequest:failedWithError:))]
702        #[unsafe(method_family = none)]
703        unsafe fn sensorReader_fetchingRequest_failedWithError(
704            &self,
705            reader: &SRSensorReader,
706            fetch_request: &SRFetchRequest,
707            error: &NSError,
708        );
709
710        /// Invoked when authorization status has changed
711        #[optional]
712        #[unsafe(method(sensorReader:didChangeAuthorizationStatus:))]
713        #[unsafe(method_family = none)]
714        unsafe fn sensorReader_didChangeAuthorizationStatus(
715            &self,
716            reader: &SRSensorReader,
717            authorization_status: SRAuthorizationStatus,
718        );
719
720        /// Invoked after a SRSensorReader has request that recording be
721        /// started for a sensor
722        #[optional]
723        #[unsafe(method(sensorReaderWillStartRecording:))]
724        #[unsafe(method_family = none)]
725        unsafe fn sensorReaderWillStartRecording(&self, reader: &SRSensorReader);
726
727        /// Invoked if there was an error starting recording for a given sensor
728        #[optional]
729        #[unsafe(method(sensorReader:startRecordingFailedWithError:))]
730        #[unsafe(method_family = none)]
731        unsafe fn sensorReader_startRecordingFailedWithError(
732            &self,
733            reader: &SRSensorReader,
734            error: &NSError,
735        );
736
737        /// Invoked after a SRSensorReader has request that recording be
738        /// stopped for a sensor
739        #[optional]
740        #[unsafe(method(sensorReaderDidStopRecording:))]
741        #[unsafe(method_family = none)]
742        unsafe fn sensorReaderDidStopRecording(&self, reader: &SRSensorReader);
743
744        /// Invoked if there was an error starting recording for a given sensor
745        #[optional]
746        #[unsafe(method(sensorReader:stopRecordingFailedWithError:))]
747        #[unsafe(method_family = none)]
748        unsafe fn sensorReader_stopRecordingFailedWithError(
749            &self,
750            reader: &SRSensorReader,
751            error: &NSError,
752        );
753
754        #[optional]
755        #[unsafe(method(sensorReader:didFetchDevices:))]
756        #[unsafe(method_family = none)]
757        unsafe fn sensorReader_didFetchDevices(
758            &self,
759            reader: &SRSensorReader,
760            devices: &NSArray<SRDevice>,
761        );
762
763        #[optional]
764        #[unsafe(method(sensorReader:fetchDevicesDidFailWithError:))]
765        #[unsafe(method_family = none)]
766        unsafe fn sensorReader_fetchDevicesDidFailWithError(
767            &self,
768            reader: &SRSensorReader,
769            error: &NSError,
770        );
771    }
772);
773
774extern_class!(
775    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsensorreader?language=objc)
776    #[unsafe(super(NSObject))]
777    #[derive(Debug, PartialEq, Eq, Hash)]
778    pub struct SRSensorReader;
779);
780
781extern_conformance!(
782    unsafe impl NSObjectProtocol for SRSensorReader {}
783);
784
785impl SRSensorReader {
786    extern_methods!(
787        /// Initializes an SRSensorReader that will fetch data for the current device
788        /// and any companion
789        #[unsafe(method(initWithSensor:))]
790        #[unsafe(method_family = init)]
791        pub unsafe fn initWithSensor(this: Allocated<Self>, sensor: &SRSensor) -> Retained<Self>;
792
793        #[unsafe(method(init))]
794        #[unsafe(method_family = init)]
795        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
796
797        #[unsafe(method(new))]
798        #[unsafe(method_family = new)]
799        pub unsafe fn new() -> Retained<Self>;
800
801        /// Starts recording for the reader's sensor
802        ///
803        ///
804        /// The reader must be authorized for the sensor for this to succeed.
805        /// This starts recording on this device and any paired devices.
806        /// If other readers have already started the sensor recording this
807        /// reader's interest in recording will be maintained. Other readers in
808        /// other apps for the same sensor will not affect the recording status
809        /// of this reader.
810        ///
811        /// In the case of success, completion notification will be delivered
812        /// to the delegate in the sensorReaderWillStartRecording:
813        /// delegate method.
814        ///
815        /// In the case of failure, error notification will be delivered
816        /// to the delegate in the sensorReader:startRecordingFailedWithError:
817        /// delegate method.
818        #[unsafe(method(startRecording))]
819        #[unsafe(method_family = none)]
820        pub unsafe fn startRecording(&self);
821
822        /// Stops recording for the reader's sensor
823        ///
824        ///
825        /// The reader must be authorized for the sensor for this to succeed.
826        /// This stops recording on this device and any paired devices.
827        /// Sensor recording will continue until the last interested reader has
828        /// stopped recording.
829        ///
830        /// In the case of success, completion notification will be delivered
831        /// to the delegate in the sensorReaderDidStopRecording:
832        /// delegate method.
833        ///
834        /// In the case of failure, error notification will be delivered
835        /// to the delegate in the sensorReader:stopRecordingFailedWithError:
836        /// delegate method.
837        #[unsafe(method(stopRecording))]
838        #[unsafe(method_family = none)]
839        pub unsafe fn stopRecording(&self);
840
841        /// Fetches device information for all devices that have stored data for
842        /// the given sensor in SensorKit
843        ///
844        /// If the request completes successfully, devices will be returned to the
845        /// delegate in the sensorReader:fetchedDevices: callback. If the request
846        /// failed, an error will be returned to the delegate in the
847        /// sensorReader:fetchDevicesFailedWithError:
848        /// method
849        #[unsafe(method(fetchDevices))]
850        #[unsafe(method_family = none)]
851        pub unsafe fn fetchDevices(&self);
852
853        /// Fetches samples for the reader's sensor for given request parameters
854        ///
855        ///
856        /// The reader must be authorized for the sensor for this to succeed.
857        ///
858        /// Samples will be delivered to the delegate through multiple calls
859        /// to the sensorReader:fetchingRequest:didFetchResult: delegate method
860        ///
861        /// In the case of a failure, any error will be delivered to the delegate in the
862        /// sensorReader:fetchingRequest:failedWithError: method.
863        ///
864        /// In the case of success, completion notification will be delivered
865        /// to the delegate in the sensorReader:didCompleteFetch: method.
866        ///
867        ///
868        /// Parameter `request`: The query parameters for this fetch
869        #[unsafe(method(fetch:))]
870        #[unsafe(method_family = none)]
871        pub unsafe fn fetch(&self, request: &SRFetchRequest);
872
873        /// The current authorization status of the calling application.
874        #[unsafe(method(authorizationStatus))]
875        #[unsafe(method_family = none)]
876        pub unsafe fn authorizationStatus(&self) -> SRAuthorizationStatus;
877
878        /// the sensor this reader was initialized with
879        #[unsafe(method(sensor))]
880        #[unsafe(method_family = none)]
881        pub unsafe fn sensor(&self) -> Retained<SRSensor>;
882
883        #[unsafe(method(delegate))]
884        #[unsafe(method_family = none)]
885        pub unsafe fn delegate(
886            &self,
887        ) -> Option<Retained<ProtocolObject<dyn SRSensorReaderDelegate>>>;
888
889        /// This is a [weak property][objc2::topics::weak_property].
890        /// Setter for [`delegate`][Self::delegate].
891        #[unsafe(method(setDelegate:))]
892        #[unsafe(method_family = none)]
893        pub unsafe fn setDelegate(
894            &self,
895            delegate: Option<&ProtocolObject<dyn SRSensorReaderDelegate>>,
896        );
897
898        #[cfg(feature = "block2")]
899        /// Request authorization to a given set of sensors
900        ///
901        ///
902        /// If the SRSensorReader instance is not authorized, this
903        /// method must be called before any other methods. Failure to request
904        /// authorization will cause errors to be returned from the other methods.
905        ///
906        /// When SensorKit prepares the prompt for display, it will look at the
907        /// NSSensorKitUsageDetail key in your Info.plist.  The value should be
908        /// a dictionary containing usage descriptions for all of the sensors being
909        /// requested.  The description key you provide to this method must
910        /// correspond to an entry in that dictionary.  To retrieve a localized
911        /// string, SensorKit will load your InfoPlist.strings file and try to look
912        /// up a string using the description key you provided.  If that fails,
913        /// SensorKit will use the content provided in your Info.plist.
914        ///
915        /// SensorKit may decide against showing the user a prompt.  For example,
916        /// if the user has already chosen whether to grant the application access
917        /// to all of the types provided.  When that happens, your completion block
918        /// will be called with an appropriate  NSError.  If the user responded to
919        /// the prompt, your completion block will be called with a nil error.
920        /// Changes in authorization status will delivered to the delegate in the
921        /// sensorReader:didChangeAuthorizationStatus: method.
922        #[unsafe(method(requestAuthorizationForSensors:completion:))]
923        #[unsafe(method_family = none)]
924        pub unsafe fn requestAuthorizationForSensors_completion(
925            sensors: &NSSet<SRSensor>,
926            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
927        );
928    );
929}
930
931extern "C" {
932    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srerrordomain?language=objc)
933    pub static SRErrorDomain: &'static NSErrorDomain;
934}
935
936/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srerrorcode?language=objc)
937// NS_ERROR_ENUM
938#[repr(transparent)]
939#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
940pub struct SRErrorCode(pub NSInteger);
941impl SRErrorCode {
942    /// No valid entitlement found
943    #[doc(alias = "SRErrorInvalidEntitlement")]
944    pub const InvalidEntitlement: Self = Self(0);
945    /// Insufficient authorization to perform the action.
946    #[doc(alias = "SRErrorNoAuthorization")]
947    pub const NoAuthorization: Self = Self(1);
948    /// Data is not accessible at this time
949    #[doc(alias = "SRErrorDataInaccessible")]
950    pub const DataInaccessible: Self = Self(2);
951    /// Fetch request contained invalid values
952    #[doc(alias = "SRErrorFetchRequestInvalid")]
953    pub const FetchRequestInvalid: Self = Self(3);
954    /// Authorization request not completed
955    #[doc(alias = "SRErrorPromptDeclined")]
956    pub const PromptDeclined: Self = Self(4);
957}
958
959unsafe impl Encode for SRErrorCode {
960    const ENCODING: Encoding = NSInteger::ENCODING;
961}
962
963unsafe impl RefEncode for SRErrorCode {
964    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
965}
966
967/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srambientlightsensorplacement?language=objc)
968// NS_ENUM
969#[repr(transparent)]
970#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
971pub struct SRAmbientLightSensorPlacement(pub NSInteger);
972impl SRAmbientLightSensorPlacement {
973    #[doc(alias = "SRAmbientLightSensorPlacementUnknown")]
974    pub const Unknown: Self = Self(0);
975    #[doc(alias = "SRAmbientLightSensorPlacementFrontTop")]
976    pub const FrontTop: Self = Self(1);
977    #[doc(alias = "SRAmbientLightSensorPlacementFrontBottom")]
978    pub const FrontBottom: Self = Self(2);
979    #[doc(alias = "SRAmbientLightSensorPlacementFrontRight")]
980    pub const FrontRight: Self = Self(3);
981    #[doc(alias = "SRAmbientLightSensorPlacementFrontLeft")]
982    pub const FrontLeft: Self = Self(4);
983    #[doc(alias = "SRAmbientLightSensorPlacementFrontTopRight")]
984    pub const FrontTopRight: Self = Self(5);
985    #[doc(alias = "SRAmbientLightSensorPlacementFrontTopLeft")]
986    pub const FrontTopLeft: Self = Self(6);
987    #[doc(alias = "SRAmbientLightSensorPlacementFrontBottomRight")]
988    pub const FrontBottomRight: Self = Self(7);
989    #[doc(alias = "SRAmbientLightSensorPlacementFrontBottomLeft")]
990    pub const FrontBottomLeft: Self = Self(8);
991}
992
993unsafe impl Encode for SRAmbientLightSensorPlacement {
994    const ENCODING: Encoding = NSInteger::ENCODING;
995}
996
997unsafe impl RefEncode for SRAmbientLightSensorPlacement {
998    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
999}
1000
1001/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srambientlightchromaticity?language=objc)
1002#[repr(C)]
1003#[derive(Clone, Copy, Debug, PartialEq)]
1004pub struct SRAmbientLightChromaticity {
1005    pub x: f32,
1006    pub y: f32,
1007}
1008
1009unsafe impl Encode for SRAmbientLightChromaticity {
1010    const ENCODING: Encoding = Encoding::Struct("?", &[<f32>::ENCODING, <f32>::ENCODING]);
1011}
1012
1013unsafe impl RefEncode for SRAmbientLightChromaticity {
1014    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1015}
1016
1017extern_class!(
1018    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srambientlightsample?language=objc)
1019    #[unsafe(super(NSObject))]
1020    #[derive(Debug, PartialEq, Eq, Hash)]
1021    pub struct SRAmbientLightSample;
1022);
1023
1024extern_conformance!(
1025    unsafe impl NSObjectProtocol for SRAmbientLightSample {}
1026);
1027
1028impl SRAmbientLightSample {
1029    extern_methods!(
1030        #[unsafe(method(placement))]
1031        #[unsafe(method_family = none)]
1032        pub unsafe fn placement(&self) -> SRAmbientLightSensorPlacement;
1033
1034        /// Chromaticity is only valid on supporting devices. If not supported,
1035        /// the values will be zero.
1036        #[unsafe(method(chromaticity))]
1037        #[unsafe(method_family = none)]
1038        pub unsafe fn chromaticity(&self) -> SRAmbientLightChromaticity;
1039
1040        #[unsafe(method(lux))]
1041        #[unsafe(method_family = none)]
1042        pub unsafe fn lux(&self) -> Retained<NSMeasurement<NSUnitIlluminance>>;
1043    );
1044}
1045
1046/// Methods declared on superclass `NSObject`.
1047impl SRAmbientLightSample {
1048    extern_methods!(
1049        #[unsafe(method(init))]
1050        #[unsafe(method_family = init)]
1051        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1052
1053        #[unsafe(method(new))]
1054        #[unsafe(method_family = new)]
1055        pub unsafe fn new() -> Retained<Self>;
1056    );
1057}
1058
1059/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srlocationcategory?language=objc)
1060// NS_ENUM
1061#[repr(transparent)]
1062#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1063pub struct SRLocationCategory(pub NSInteger);
1064impl SRLocationCategory {
1065    #[doc(alias = "SRLocationCategoryUnknown")]
1066    pub const Unknown: Self = Self(0);
1067    #[doc(alias = "SRLocationCategoryHome")]
1068    pub const Home: Self = Self(1);
1069    #[doc(alias = "SRLocationCategoryWork")]
1070    pub const Work: Self = Self(2);
1071    #[doc(alias = "SRLocationCategorySchool")]
1072    pub const School: Self = Self(3);
1073    #[doc(alias = "SRLocationCategoryGym")]
1074    pub const Gym: Self = Self(4);
1075}
1076
1077unsafe impl Encode for SRLocationCategory {
1078    const ENCODING: Encoding = NSInteger::ENCODING;
1079}
1080
1081unsafe impl RefEncode for SRLocationCategory {
1082    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1083}
1084
1085extern_class!(
1086    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srvisit?language=objc)
1087    #[unsafe(super(NSObject))]
1088    #[derive(Debug, PartialEq, Eq, Hash)]
1089    pub struct SRVisit;
1090);
1091
1092extern_conformance!(
1093    unsafe impl NSObjectProtocol for SRVisit {}
1094);
1095
1096impl SRVisit {
1097    extern_methods!(
1098        #[cfg(feature = "objc2-core-location")]
1099        /// The distance between the location of interest to home
1100        #[unsafe(method(distanceFromHome))]
1101        #[unsafe(method_family = none)]
1102        pub unsafe fn distanceFromHome(&self) -> CLLocationDistance;
1103
1104        /// The range of time the arrival to a location of interest occurred
1105        #[unsafe(method(arrivalDateInterval))]
1106        #[unsafe(method_family = none)]
1107        pub unsafe fn arrivalDateInterval(&self) -> Retained<NSDateInterval>;
1108
1109        /// The range of time the departure from a location of interest occurred
1110        #[unsafe(method(departureDateInterval))]
1111        #[unsafe(method_family = none)]
1112        pub unsafe fn departureDateInterval(&self) -> Retained<NSDateInterval>;
1113
1114        #[unsafe(method(locationCategory))]
1115        #[unsafe(method_family = none)]
1116        pub unsafe fn locationCategory(&self) -> SRLocationCategory;
1117
1118        /// An identifier for the location of interest.
1119        /// This can be used to identify the same location regardless of type
1120        #[unsafe(method(identifier))]
1121        #[unsafe(method_family = none)]
1122        pub unsafe fn identifier(&self) -> Retained<NSUUID>;
1123    );
1124}
1125
1126/// Methods declared on superclass `NSObject`.
1127impl SRVisit {
1128    extern_methods!(
1129        #[unsafe(method(init))]
1130        #[unsafe(method_family = init)]
1131        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1132
1133        #[unsafe(method(new))]
1134        #[unsafe(method_family = new)]
1135        pub unsafe fn new() -> Retained<Self>;
1136    );
1137}
1138
1139/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorykey?language=objc)
1140// NS_TYPED_ENUM
1141pub type SRDeviceUsageCategoryKey = NSString;
1142
1143extern "C" {
1144    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorygames?language=objc)
1145    pub static SRDeviceUsageCategoryGames: &'static SRDeviceUsageCategoryKey;
1146}
1147
1148extern "C" {
1149    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorybusiness?language=objc)
1150    pub static SRDeviceUsageCategoryBusiness: &'static SRDeviceUsageCategoryKey;
1151}
1152
1153extern "C" {
1154    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryweather?language=objc)
1155    pub static SRDeviceUsageCategoryWeather: &'static SRDeviceUsageCategoryKey;
1156}
1157
1158extern "C" {
1159    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryutilities?language=objc)
1160    pub static SRDeviceUsageCategoryUtilities: &'static SRDeviceUsageCategoryKey;
1161}
1162
1163extern "C" {
1164    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorytravel?language=objc)
1165    pub static SRDeviceUsageCategoryTravel: &'static SRDeviceUsageCategoryKey;
1166}
1167
1168extern "C" {
1169    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorysports?language=objc)
1170    pub static SRDeviceUsageCategorySports: &'static SRDeviceUsageCategoryKey;
1171}
1172
1173extern "C" {
1174    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorysocialnetworking?language=objc)
1175    pub static SRDeviceUsageCategorySocialNetworking: &'static SRDeviceUsageCategoryKey;
1176}
1177
1178extern "C" {
1179    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryreference?language=objc)
1180    pub static SRDeviceUsageCategoryReference: &'static SRDeviceUsageCategoryKey;
1181}
1182
1183extern "C" {
1184    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryproductivity?language=objc)
1185    pub static SRDeviceUsageCategoryProductivity: &'static SRDeviceUsageCategoryKey;
1186}
1187
1188extern "C" {
1189    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryphotoandvideo?language=objc)
1190    pub static SRDeviceUsageCategoryPhotoAndVideo: &'static SRDeviceUsageCategoryKey;
1191}
1192
1193extern "C" {
1194    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorynews?language=objc)
1195    pub static SRDeviceUsageCategoryNews: &'static SRDeviceUsageCategoryKey;
1196}
1197
1198extern "C" {
1199    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorynavigation?language=objc)
1200    pub static SRDeviceUsageCategoryNavigation: &'static SRDeviceUsageCategoryKey;
1201}
1202
1203extern "C" {
1204    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorymusic?language=objc)
1205    pub static SRDeviceUsageCategoryMusic: &'static SRDeviceUsageCategoryKey;
1206}
1207
1208extern "C" {
1209    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorylifestyle?language=objc)
1210    pub static SRDeviceUsageCategoryLifestyle: &'static SRDeviceUsageCategoryKey;
1211}
1212
1213extern "C" {
1214    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryhealthandfitness?language=objc)
1215    pub static SRDeviceUsageCategoryHealthAndFitness: &'static SRDeviceUsageCategoryKey;
1216}
1217
1218extern "C" {
1219    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryfinance?language=objc)
1220    pub static SRDeviceUsageCategoryFinance: &'static SRDeviceUsageCategoryKey;
1221}
1222
1223extern "C" {
1224    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryentertainment?language=objc)
1225    pub static SRDeviceUsageCategoryEntertainment: &'static SRDeviceUsageCategoryKey;
1226}
1227
1228extern "C" {
1229    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryeducation?language=objc)
1230    pub static SRDeviceUsageCategoryEducation: &'static SRDeviceUsageCategoryKey;
1231}
1232
1233extern "C" {
1234    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorybooks?language=objc)
1235    pub static SRDeviceUsageCategoryBooks: &'static SRDeviceUsageCategoryKey;
1236}
1237
1238extern "C" {
1239    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorymedical?language=objc)
1240    pub static SRDeviceUsageCategoryMedical: &'static SRDeviceUsageCategoryKey;
1241}
1242
1243extern "C" {
1244    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorynewsstand?language=objc)
1245    pub static SRDeviceUsageCategoryNewsstand: &'static SRDeviceUsageCategoryKey;
1246}
1247
1248extern "C" {
1249    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorycatalogs?language=objc)
1250    pub static SRDeviceUsageCategoryCatalogs: &'static SRDeviceUsageCategoryKey;
1251}
1252
1253extern "C" {
1254    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorykids?language=objc)
1255    pub static SRDeviceUsageCategoryKids: &'static SRDeviceUsageCategoryKey;
1256}
1257
1258extern "C" {
1259    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorymiscellaneous?language=objc)
1260    pub static SRDeviceUsageCategoryMiscellaneous: &'static SRDeviceUsageCategoryKey;
1261}
1262
1263extern "C" {
1264    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryfoodanddrink?language=objc)
1265    pub static SRDeviceUsageCategoryFoodAndDrink: &'static SRDeviceUsageCategoryKey;
1266}
1267
1268extern "C" {
1269    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorydevelopertools?language=objc)
1270    pub static SRDeviceUsageCategoryDeveloperTools: &'static SRDeviceUsageCategoryKey;
1271}
1272
1273extern "C" {
1274    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorygraphicsanddesign?language=objc)
1275    pub static SRDeviceUsageCategoryGraphicsAndDesign: &'static SRDeviceUsageCategoryKey;
1276}
1277
1278extern "C" {
1279    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategoryshopping?language=objc)
1280    pub static SRDeviceUsageCategoryShopping: &'static SRDeviceUsageCategoryKey;
1281}
1282
1283extern "C" {
1284    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagecategorystickers?language=objc)
1285    pub static SRDeviceUsageCategoryStickers: &'static SRDeviceUsageCategoryKey;
1286}
1287
1288extern_class!(
1289    /// A supplemental category to provide more context than just the app category
1290    ///
1291    ///
1292    /// The app categories from
1293    /// `SRDeviceUsageCategoryKey`are very general.
1294    /// Providing a supplemental category allows more context about the specific app while
1295    /// not revealing the exact app identity.
1296    ///
1297    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srsupplementalcategory?language=objc)
1298    #[unsafe(super(NSObject))]
1299    #[derive(Debug, PartialEq, Eq, Hash)]
1300    pub struct SRSupplementalCategory;
1301);
1302
1303unsafe impl Send for SRSupplementalCategory {}
1304
1305unsafe impl Sync for SRSupplementalCategory {}
1306
1307extern_conformance!(
1308    unsafe impl NSCoding for SRSupplementalCategory {}
1309);
1310
1311extern_conformance!(
1312    unsafe impl NSCopying for SRSupplementalCategory {}
1313);
1314
1315unsafe impl CopyingHelper for SRSupplementalCategory {
1316    type Result = Self;
1317}
1318
1319extern_conformance!(
1320    unsafe impl NSObjectProtocol for SRSupplementalCategory {}
1321);
1322
1323extern_conformance!(
1324    unsafe impl NSSecureCoding for SRSupplementalCategory {}
1325);
1326
1327impl SRSupplementalCategory {
1328    extern_methods!(
1329        /// An opaque identifier for the supplemental category
1330        ///
1331        /// More information about what this category represents can be found in Apple's developer documentation
1332        #[unsafe(method(identifier))]
1333        #[unsafe(method_family = none)]
1334        pub unsafe fn identifier(&self) -> Retained<NSString>;
1335
1336        #[unsafe(method(init))]
1337        #[unsafe(method_family = init)]
1338        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1339
1340        #[unsafe(method(new))]
1341        #[unsafe(method_family = new)]
1342        pub unsafe fn new() -> Retained<Self>;
1343    );
1344}
1345
1346extern_class!(
1347    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeviceusagereport?language=objc)
1348    #[unsafe(super(NSObject))]
1349    #[derive(Debug, PartialEq, Eq, Hash)]
1350    pub struct SRDeviceUsageReport;
1351);
1352
1353extern_conformance!(
1354    unsafe impl NSObjectProtocol for SRDeviceUsageReport {}
1355);
1356
1357impl SRDeviceUsageReport {
1358    extern_methods!(
1359        /// The duration of this report
1360        #[unsafe(method(duration))]
1361        #[unsafe(method_family = none)]
1362        pub unsafe fn duration(&self) -> NSTimeInterval;
1363
1364        /// Usage time of applications per category
1365        ///
1366        ///
1367        /// category is the primary genre from the app's iTunesMetadata.plist.
1368        #[unsafe(method(applicationUsageByCategory))]
1369        #[unsafe(method_family = none)]
1370        pub unsafe fn applicationUsageByCategory(
1371            &self,
1372        ) -> Retained<NSDictionary<SRDeviceUsageCategoryKey, NSArray<SRApplicationUsage>>>;
1373
1374        /// Usage time of notifications per category
1375        ///
1376        ///
1377        /// category is the primary genre from the notifying app's iTunesMetadata.plist.
1378        #[unsafe(method(notificationUsageByCategory))]
1379        #[unsafe(method_family = none)]
1380        pub unsafe fn notificationUsageByCategory(
1381            &self,
1382        ) -> Retained<NSDictionary<SRDeviceUsageCategoryKey, NSArray<SRNotificationUsage>>>;
1383
1384        /// Usage time of web domains per category
1385        ///
1386        ///
1387        /// category based on the primary Screen Time category of the web domain
1388        #[unsafe(method(webUsageByCategory))]
1389        #[unsafe(method_family = none)]
1390        pub unsafe fn webUsageByCategory(
1391            &self,
1392        ) -> Retained<NSDictionary<SRDeviceUsageCategoryKey, NSArray<SRWebUsage>>>;
1393
1394        /// Total number of screen wakes over this duration
1395        #[unsafe(method(totalScreenWakes))]
1396        #[unsafe(method_family = none)]
1397        pub unsafe fn totalScreenWakes(&self) -> NSInteger;
1398
1399        /// Total number of unlocks over this duration
1400        #[unsafe(method(totalUnlocks))]
1401        #[unsafe(method_family = none)]
1402        pub unsafe fn totalUnlocks(&self) -> NSInteger;
1403
1404        /// Total amount of time the device was unlocked over this duration
1405        #[unsafe(method(totalUnlockDuration))]
1406        #[unsafe(method_family = none)]
1407        pub unsafe fn totalUnlockDuration(&self) -> NSTimeInterval;
1408
1409        /// Version of the algorithm used to produce the report
1410        #[unsafe(method(version))]
1411        #[unsafe(method_family = none)]
1412        pub unsafe fn version(&self) -> Retained<NSString>;
1413    );
1414}
1415
1416/// Methods declared on superclass `NSObject`.
1417impl SRDeviceUsageReport {
1418    extern_methods!(
1419        #[unsafe(method(init))]
1420        #[unsafe(method_family = init)]
1421        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1422
1423        #[unsafe(method(new))]
1424        #[unsafe(method_family = new)]
1425        pub unsafe fn new() -> Retained<Self>;
1426    );
1427}
1428
1429/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srtextinputsessiontype?language=objc)
1430// NS_ENUM
1431#[repr(transparent)]
1432#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1433pub struct SRTextInputSessionType(pub NSInteger);
1434impl SRTextInputSessionType {
1435    #[doc(alias = "SRTextInputSessionTypeKeyboard")]
1436    pub const Keyboard: Self = Self(1);
1437    #[doc(alias = "SRTextInputSessionTypeThirdPartyKeyboard")]
1438    pub const ThirdPartyKeyboard: Self = Self(2);
1439    #[doc(alias = "SRTextInputSessionTypePencil")]
1440    pub const Pencil: Self = Self(3);
1441    #[doc(alias = "SRTextInputSessionTypeDictation")]
1442    pub const Dictation: Self = Self(4);
1443}
1444
1445unsafe impl Encode for SRTextInputSessionType {
1446    const ENCODING: Encoding = NSInteger::ENCODING;
1447}
1448
1449unsafe impl RefEncode for SRTextInputSessionType {
1450    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1451}
1452
1453extern_class!(
1454    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srtextinputsession?language=objc)
1455    #[unsafe(super(NSObject))]
1456    #[derive(Debug, PartialEq, Eq, Hash)]
1457    pub struct SRTextInputSession;
1458);
1459
1460extern_conformance!(
1461    unsafe impl NSObjectProtocol for SRTextInputSession {}
1462);
1463
1464impl SRTextInputSession {
1465    extern_methods!(
1466        #[unsafe(method(duration))]
1467        #[unsafe(method_family = none)]
1468        pub unsafe fn duration(&self) -> NSTimeInterval;
1469
1470        #[unsafe(method(sessionType))]
1471        #[unsafe(method_family = none)]
1472        pub unsafe fn sessionType(&self) -> SRTextInputSessionType;
1473
1474        /// Unique identifier of keyboard session
1475        #[unsafe(method(sessionIdentifier))]
1476        #[unsafe(method_family = none)]
1477        pub unsafe fn sessionIdentifier(&self) -> Retained<NSString>;
1478    );
1479}
1480
1481/// Methods declared on superclass `NSObject`.
1482impl SRTextInputSession {
1483    extern_methods!(
1484        #[unsafe(method(init))]
1485        #[unsafe(method_family = init)]
1486        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1487
1488        #[unsafe(method(new))]
1489        #[unsafe(method_family = new)]
1490        pub unsafe fn new() -> Retained<Self>;
1491    );
1492}
1493
1494extern_class!(
1495    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srapplicationusage?language=objc)
1496    #[unsafe(super(NSObject))]
1497    #[derive(Debug, PartialEq, Eq, Hash)]
1498    pub struct SRApplicationUsage;
1499);
1500
1501extern_conformance!(
1502    unsafe impl NSObjectProtocol for SRApplicationUsage {}
1503);
1504
1505impl SRApplicationUsage {
1506    extern_methods!(
1507        /// The bundle identifier of the app in use. Only populated for Apple apps.
1508        #[unsafe(method(bundleIdentifier))]
1509        #[unsafe(method_family = none)]
1510        pub unsafe fn bundleIdentifier(&self) -> Option<Retained<NSString>>;
1511
1512        /// The amount of time the app is used
1513        #[unsafe(method(usageTime))]
1514        #[unsafe(method_family = none)]
1515        pub unsafe fn usageTime(&self) -> NSTimeInterval;
1516
1517        /// An application identifier that is valid for the duration of the report.
1518        ///
1519        ///
1520        /// This is useful for identifying distinct application uses within the same
1521        /// report duration without revealing the actual application identifier.
1522        #[unsafe(method(reportApplicationIdentifier))]
1523        #[unsafe(method_family = none)]
1524        pub unsafe fn reportApplicationIdentifier(&self) -> Retained<NSString>;
1525
1526        /// The text input session types that occurred during this application usage
1527        ///
1528        ///
1529        /// The list of text input sessions describes the order and type of text input that may
1530        /// have occured during an application usage. Multiple sessions of the same text input
1531        /// type will appear as separate array entries. If no text input occurred, this array
1532        /// will be empty.
1533        #[unsafe(method(textInputSessions))]
1534        #[unsafe(method_family = none)]
1535        pub unsafe fn textInputSessions(&self) -> Retained<NSArray<SRTextInputSession>>;
1536
1537        /// Additional categories that describe this app
1538        #[unsafe(method(supplementalCategories))]
1539        #[unsafe(method_family = none)]
1540        pub unsafe fn supplementalCategories(&self) -> Retained<NSArray<SRSupplementalCategory>>;
1541
1542        /// App start time relative to the first app start time in the report interval
1543        ///
1544        ///
1545        /// relativeStartTime value for the very first app in the report interval is equal to 0, N seconds for the seccond app and so on.
1546        /// This will allow to order app uses and determine the time between app uses.
1547        #[unsafe(method(relativeStartTime))]
1548        #[unsafe(method_family = none)]
1549        pub unsafe fn relativeStartTime(&self) -> NSTimeInterval;
1550    );
1551}
1552
1553/// Methods declared on superclass `NSObject`.
1554impl SRApplicationUsage {
1555    extern_methods!(
1556        #[unsafe(method(init))]
1557        #[unsafe(method_family = init)]
1558        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1559
1560        #[unsafe(method(new))]
1561        #[unsafe(method_family = new)]
1562        pub unsafe fn new() -> Retained<Self>;
1563    );
1564}
1565
1566/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srnotificationevent?language=objc)
1567// NS_ENUM
1568#[repr(transparent)]
1569#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1570pub struct SRNotificationEvent(pub NSInteger);
1571impl SRNotificationEvent {
1572    #[doc(alias = "SRNotificationEventUnknown")]
1573    pub const Unknown: Self = Self(0);
1574    #[doc(alias = "SRNotificationEventReceived")]
1575    pub const Received: Self = Self(1);
1576    #[doc(alias = "SRNotificationEventDefaultAction")]
1577    pub const DefaultAction: Self = Self(2);
1578    #[doc(alias = "SRNotificationEventSupplementaryAction")]
1579    pub const SupplementaryAction: Self = Self(3);
1580    #[doc(alias = "SRNotificationEventClear")]
1581    pub const Clear: Self = Self(4);
1582    #[doc(alias = "SRNotificationEventNotificationCenterClearAll")]
1583    pub const NotificationCenterClearAll: Self = Self(5);
1584    #[doc(alias = "SRNotificationEventRemoved")]
1585    pub const Removed: Self = Self(6);
1586    #[doc(alias = "SRNotificationEventHide")]
1587    pub const Hide: Self = Self(7);
1588    #[doc(alias = "SRNotificationEventLongLook")]
1589    pub const LongLook: Self = Self(8);
1590    #[doc(alias = "SRNotificationEventSilence")]
1591    pub const Silence: Self = Self(9);
1592    #[doc(alias = "SRNotificationEventAppLaunch")]
1593    pub const AppLaunch: Self = Self(10);
1594    #[doc(alias = "SRNotificationEventExpired")]
1595    pub const Expired: Self = Self(11);
1596    #[doc(alias = "SRNotificationEventBannerPulldown")]
1597    pub const BannerPulldown: Self = Self(12);
1598    #[doc(alias = "SRNotificationEventTapCoalesce")]
1599    pub const TapCoalesce: Self = Self(13);
1600    #[doc(alias = "SRNotificationEventDeduped")]
1601    pub const Deduped: Self = Self(14);
1602    #[doc(alias = "SRNotificationEventDeviceActivated")]
1603    pub const DeviceActivated: Self = Self(15);
1604    #[doc(alias = "SRNotificationEventDeviceUnlocked")]
1605    pub const DeviceUnlocked: Self = Self(16);
1606}
1607
1608unsafe impl Encode for SRNotificationEvent {
1609    const ENCODING: Encoding = NSInteger::ENCODING;
1610}
1611
1612unsafe impl RefEncode for SRNotificationEvent {
1613    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1614}
1615
1616extern_class!(
1617    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srnotificationusage?language=objc)
1618    #[unsafe(super(NSObject))]
1619    #[derive(Debug, PartialEq, Eq, Hash)]
1620    pub struct SRNotificationUsage;
1621);
1622
1623extern_conformance!(
1624    unsafe impl NSObjectProtocol for SRNotificationUsage {}
1625);
1626
1627impl SRNotificationUsage {
1628    extern_methods!(
1629        /// The bundle identifier of the application that corresponds to the notification. Only populated for Apple apps.
1630        #[unsafe(method(bundleIdentifier))]
1631        #[unsafe(method_family = none)]
1632        pub unsafe fn bundleIdentifier(&self) -> Option<Retained<NSString>>;
1633
1634        #[unsafe(method(event))]
1635        #[unsafe(method_family = none)]
1636        pub unsafe fn event(&self) -> SRNotificationEvent;
1637    );
1638}
1639
1640/// Methods declared on superclass `NSObject`.
1641impl SRNotificationUsage {
1642    extern_methods!(
1643        #[unsafe(method(init))]
1644        #[unsafe(method_family = init)]
1645        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1646
1647        #[unsafe(method(new))]
1648        #[unsafe(method_family = new)]
1649        pub unsafe fn new() -> Retained<Self>;
1650    );
1651}
1652
1653extern_class!(
1654    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srwebusage?language=objc)
1655    #[unsafe(super(NSObject))]
1656    #[derive(Debug, PartialEq, Eq, Hash)]
1657    pub struct SRWebUsage;
1658);
1659
1660extern_conformance!(
1661    unsafe impl NSObjectProtocol for SRWebUsage {}
1662);
1663
1664impl SRWebUsage {
1665    extern_methods!(
1666        #[unsafe(method(totalUsageTime))]
1667        #[unsafe(method_family = none)]
1668        pub unsafe fn totalUsageTime(&self) -> NSTimeInterval;
1669    );
1670}
1671
1672/// Methods declared on superclass `NSObject`.
1673impl SRWebUsage {
1674    extern_methods!(
1675        #[unsafe(method(init))]
1676        #[unsafe(method_family = init)]
1677        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1678
1679        #[unsafe(method(new))]
1680        #[unsafe(method_family = new)]
1681        pub unsafe fn new() -> Retained<Self>;
1682    );
1683}
1684
1685extern_class!(
1686    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srmessagesusagereport?language=objc)
1687    #[unsafe(super(NSObject))]
1688    #[derive(Debug, PartialEq, Eq, Hash)]
1689    pub struct SRMessagesUsageReport;
1690);
1691
1692extern_conformance!(
1693    unsafe impl NSObjectProtocol for SRMessagesUsageReport {}
1694);
1695
1696impl SRMessagesUsageReport {
1697    extern_methods!(
1698        #[unsafe(method(duration))]
1699        #[unsafe(method_family = none)]
1700        pub unsafe fn duration(&self) -> NSTimeInterval;
1701
1702        #[unsafe(method(totalOutgoingMessages))]
1703        #[unsafe(method_family = none)]
1704        pub unsafe fn totalOutgoingMessages(&self) -> NSInteger;
1705
1706        #[unsafe(method(totalIncomingMessages))]
1707        #[unsafe(method_family = none)]
1708        pub unsafe fn totalIncomingMessages(&self) -> NSInteger;
1709
1710        #[unsafe(method(totalUniqueContacts))]
1711        #[unsafe(method_family = none)]
1712        pub unsafe fn totalUniqueContacts(&self) -> NSInteger;
1713    );
1714}
1715
1716/// Methods declared on superclass `NSObject`.
1717impl SRMessagesUsageReport {
1718    extern_methods!(
1719        #[unsafe(method(init))]
1720        #[unsafe(method_family = init)]
1721        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1722
1723        #[unsafe(method(new))]
1724        #[unsafe(method_family = new)]
1725        pub unsafe fn new() -> Retained<Self>;
1726    );
1727}
1728
1729extern_class!(
1730    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphoneusagereport?language=objc)
1731    #[unsafe(super(NSObject))]
1732    #[derive(Debug, PartialEq, Eq, Hash)]
1733    pub struct SRPhoneUsageReport;
1734);
1735
1736extern_conformance!(
1737    unsafe impl NSObjectProtocol for SRPhoneUsageReport {}
1738);
1739
1740impl SRPhoneUsageReport {
1741    extern_methods!(
1742        #[unsafe(method(duration))]
1743        #[unsafe(method_family = none)]
1744        pub unsafe fn duration(&self) -> NSTimeInterval;
1745
1746        #[unsafe(method(totalOutgoingCalls))]
1747        #[unsafe(method_family = none)]
1748        pub unsafe fn totalOutgoingCalls(&self) -> NSInteger;
1749
1750        #[unsafe(method(totalIncomingCalls))]
1751        #[unsafe(method_family = none)]
1752        pub unsafe fn totalIncomingCalls(&self) -> NSInteger;
1753
1754        #[unsafe(method(totalUniqueContacts))]
1755        #[unsafe(method_family = none)]
1756        pub unsafe fn totalUniqueContacts(&self) -> NSInteger;
1757
1758        #[unsafe(method(totalPhoneCallDuration))]
1759        #[unsafe(method_family = none)]
1760        pub unsafe fn totalPhoneCallDuration(&self) -> NSTimeInterval;
1761    );
1762}
1763
1764/// Methods declared on superclass `NSObject`.
1765impl SRPhoneUsageReport {
1766    extern_methods!(
1767        #[unsafe(method(init))]
1768        #[unsafe(method_family = init)]
1769        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1770
1771        #[unsafe(method(new))]
1772        #[unsafe(method_family = new)]
1773        pub unsafe fn new() -> Retained<Self>;
1774    );
1775}
1776
1777extern_class!(
1778    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srkeyboardmetrics?language=objc)
1779    #[unsafe(super(NSObject))]
1780    #[derive(Debug, PartialEq, Eq, Hash)]
1781    pub struct SRKeyboardMetrics;
1782);
1783
1784extern_conformance!(
1785    unsafe impl NSObjectProtocol for SRKeyboardMetrics {}
1786);
1787
1788impl SRKeyboardMetrics {
1789    extern_methods!(
1790        /// The duration over which these metrics were calculated
1791        #[unsafe(method(duration))]
1792        #[unsafe(method_family = none)]
1793        pub unsafe fn duration(&self) -> NSTimeInterval;
1794
1795        /// The identifier of the keyboard in the keyboard list
1796        #[unsafe(method(keyboardIdentifier))]
1797        #[unsafe(method_family = none)]
1798        pub unsafe fn keyboardIdentifier(&self) -> Retained<NSString>;
1799
1800        /// The version of keyboard metrics
1801        #[unsafe(method(version))]
1802        #[unsafe(method_family = none)]
1803        pub unsafe fn version(&self) -> Retained<NSString>;
1804
1805        /// The width of the keyboard in mm in the session
1806        #[unsafe(method(width))]
1807        #[unsafe(method_family = none)]
1808        pub unsafe fn width(&self) -> Retained<NSMeasurement<NSUnitLength>>;
1809
1810        /// The height of the keyboard in mm in the session
1811        #[unsafe(method(height))]
1812        #[unsafe(method_family = none)]
1813        pub unsafe fn height(&self) -> Retained<NSMeasurement<NSUnitLength>>;
1814
1815        /// The input modes used during a keyboard session
1816        #[unsafe(method(inputModes))]
1817        #[unsafe(method_family = none)]
1818        pub unsafe fn inputModes(&self) -> Retained<NSArray<NSString>>;
1819
1820        /// The keyboard session identifiers. These are the identifiers of the keyboard sessions that contributed to keyboard metrics sample to correlate current stream with another stream using the same keyboard session indentifiers
1821        #[unsafe(method(sessionIdentifiers))]
1822        #[unsafe(method_family = none)]
1823        pub unsafe fn sessionIdentifiers(&self) -> Retained<NSArray<NSString>>;
1824    );
1825}
1826
1827/// Methods declared on superclass `NSObject`.
1828impl SRKeyboardMetrics {
1829    extern_methods!(
1830        #[unsafe(method(init))]
1831        #[unsafe(method_family = init)]
1832        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1833
1834        #[unsafe(method(new))]
1835        #[unsafe(method_family = new)]
1836        pub unsafe fn new() -> Retained<Self>;
1837    );
1838}
1839
1840/// ScalarMetrics.
1841impl SRKeyboardMetrics {
1842    extern_methods!(
1843        /// The total number of words typed during the session
1844        #[unsafe(method(totalWords))]
1845        #[unsafe(method_family = none)]
1846        pub unsafe fn totalWords(&self) -> NSInteger;
1847
1848        /// The total number of altered words during the session
1849        #[unsafe(method(totalAlteredWords))]
1850        #[unsafe(method_family = none)]
1851        pub unsafe fn totalAlteredWords(&self) -> NSInteger;
1852
1853        /// The total number of taps during the session
1854        #[unsafe(method(totalTaps))]
1855        #[unsafe(method_family = none)]
1856        pub unsafe fn totalTaps(&self) -> NSInteger;
1857
1858        /// The total number of drags during the session
1859        #[unsafe(method(totalDrags))]
1860        #[unsafe(method_family = none)]
1861        pub unsafe fn totalDrags(&self) -> NSInteger;
1862
1863        /// The total number of deletes during the session
1864        #[unsafe(method(totalDeletes))]
1865        #[unsafe(method_family = none)]
1866        pub unsafe fn totalDeletes(&self) -> NSInteger;
1867
1868        /// The total number of emojis used during the session
1869        #[unsafe(method(totalEmojis))]
1870        #[unsafe(method_family = none)]
1871        pub unsafe fn totalEmojis(&self) -> NSInteger;
1872
1873        /// The total number of paths used during the sesion
1874        #[unsafe(method(totalPaths))]
1875        #[unsafe(method_family = none)]
1876        pub unsafe fn totalPaths(&self) -> NSInteger;
1877
1878        /// The total time taken to complete paths in the session
1879        #[unsafe(method(totalPathTime))]
1880        #[unsafe(method_family = none)]
1881        pub unsafe fn totalPathTime(&self) -> NSTimeInterval;
1882
1883        /// The total length of paths completed in the session
1884        #[unsafe(method(totalPathLength))]
1885        #[unsafe(method_family = none)]
1886        pub unsafe fn totalPathLength(&self) -> Retained<NSMeasurement<NSUnitLength>>;
1887
1888        /// The total number of autocorrections in the session
1889        #[unsafe(method(totalAutoCorrections))]
1890        #[unsafe(method_family = none)]
1891        pub unsafe fn totalAutoCorrections(&self) -> NSInteger;
1892
1893        /// The total number of space corrections in the session
1894        #[unsafe(method(totalSpaceCorrections))]
1895        #[unsafe(method_family = none)]
1896        pub unsafe fn totalSpaceCorrections(&self) -> NSInteger;
1897
1898        /// The total number of retro corrections in the session
1899        #[unsafe(method(totalRetroCorrections))]
1900        #[unsafe(method_family = none)]
1901        pub unsafe fn totalRetroCorrections(&self) -> NSInteger;
1902
1903        /// The total number of transposition corrections in the session
1904        #[unsafe(method(totalTranspositionCorrections))]
1905        #[unsafe(method_family = none)]
1906        pub unsafe fn totalTranspositionCorrections(&self) -> NSInteger;
1907
1908        /// The total number of insert key corrections in the session
1909        #[unsafe(method(totalInsertKeyCorrections))]
1910        #[unsafe(method_family = none)]
1911        pub unsafe fn totalInsertKeyCorrections(&self) -> NSInteger;
1912
1913        /// The total number of skip touch corrections in the session
1914        #[unsafe(method(totalSkipTouchCorrections))]
1915        #[unsafe(method_family = none)]
1916        pub unsafe fn totalSkipTouchCorrections(&self) -> NSInteger;
1917
1918        /// The total number of near key corrections in the session
1919        #[unsafe(method(totalNearKeyCorrections))]
1920        #[unsafe(method_family = none)]
1921        pub unsafe fn totalNearKeyCorrections(&self) -> NSInteger;
1922
1923        /// The total number of substitution corrections in the session
1924        #[unsafe(method(totalSubstitutionCorrections))]
1925        #[unsafe(method_family = none)]
1926        pub unsafe fn totalSubstitutionCorrections(&self) -> NSInteger;
1927
1928        /// The total number of hit test corrections in the session
1929        #[unsafe(method(totalHitTestCorrections))]
1930        #[unsafe(method_family = none)]
1931        pub unsafe fn totalHitTestCorrections(&self) -> NSInteger;
1932
1933        /// The total amount of time typing during the session
1934        #[unsafe(method(totalTypingDuration))]
1935        #[unsafe(method_family = none)]
1936        pub unsafe fn totalTypingDuration(&self) -> NSTimeInterval;
1937    );
1938}
1939
1940extern_class!(
1941    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srkeyboardprobabilitymetric?language=objc)
1942    #[unsafe(super(NSObject))]
1943    #[derive(Debug, PartialEq, Eq, Hash)]
1944    pub struct SRKeyboardProbabilityMetric<UnitType: ?Sized = AnyObject>;
1945);
1946
1947extern_conformance!(
1948    unsafe impl<UnitType: ?Sized> NSObjectProtocol for SRKeyboardProbabilityMetric<UnitType> {}
1949);
1950
1951impl<UnitType: Message> SRKeyboardProbabilityMetric<UnitType> {
1952    extern_methods!(
1953        /// Sample values from probability distribution
1954        #[unsafe(method(distributionSampleValues))]
1955        #[unsafe(method_family = none)]
1956        pub unsafe fn distributionSampleValues(&self)
1957            -> Retained<NSArray<NSMeasurement<UnitType>>>;
1958    );
1959}
1960
1961/// Methods declared on superclass `NSObject`.
1962impl<UnitType: Message> SRKeyboardProbabilityMetric<UnitType> {
1963    extern_methods!(
1964        #[unsafe(method(init))]
1965        #[unsafe(method_family = init)]
1966        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1967
1968        #[unsafe(method(new))]
1969        #[unsafe(method_family = new)]
1970        pub unsafe fn new() -> Retained<Self>;
1971    );
1972}
1973
1974/// ProbabilityMetrics.
1975impl SRKeyboardMetrics {
1976    extern_methods!(
1977        /// The distance from the touch up to the center of any key
1978        #[unsafe(method(upErrorDistance))]
1979        #[unsafe(method_family = none)]
1980        pub unsafe fn upErrorDistance(&self)
1981            -> Retained<SRKeyboardProbabilityMetric<NSUnitLength>>;
1982
1983        /// The distance from the touch down to the center of any key
1984        #[unsafe(method(downErrorDistance))]
1985        #[unsafe(method_family = none)]
1986        pub unsafe fn downErrorDistance(
1987            &self,
1988        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitLength>>;
1989
1990        /// The distance from the touch up to the right centroid of the space key
1991        #[unsafe(method(spaceUpErrorDistance))]
1992        #[unsafe(method_family = none)]
1993        pub unsafe fn spaceUpErrorDistance(
1994            &self,
1995        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitLength>>;
1996
1997        /// The distance from the touch down to the right centroid of the space key
1998        #[unsafe(method(spaceDownErrorDistance))]
1999        #[unsafe(method_family = none)]
2000        pub unsafe fn spaceDownErrorDistance(
2001            &self,
2002        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitLength>>;
2003
2004        /// The distance from the touch up to the center of the delete key
2005        #[unsafe(method(deleteUpErrorDistance))]
2006        #[unsafe(method_family = none)]
2007        pub unsafe fn deleteUpErrorDistance(
2008            &self,
2009        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitLength>>;
2010
2011        /// The distance from the touch down to the center of the delete key
2012        #[unsafe(method(deleteDownErrorDistance))]
2013        #[unsafe(method_family = none)]
2014        pub unsafe fn deleteDownErrorDistance(
2015            &self,
2016        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitLength>>;
2017
2018        /// The distance from the touch up to the center of the intended key of a character in a short word
2019        #[unsafe(method(shortWordCharKeyUpErrorDistance))]
2020        #[unsafe(method_family = none)]
2021        pub unsafe fn shortWordCharKeyUpErrorDistance(
2022            &self,
2023        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitLength>>;
2024
2025        /// The distance from the touch down to the center of the intended key of a character in a short word
2026        #[unsafe(method(shortWordCharKeyDownErrorDistance))]
2027        #[unsafe(method_family = none)]
2028        pub unsafe fn shortWordCharKeyDownErrorDistance(
2029            &self,
2030        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitLength>>;
2031
2032        /// The duration between touch down to touchup for any key
2033        #[unsafe(method(touchDownUp))]
2034        #[unsafe(method_family = none)]
2035        pub unsafe fn touchDownUp(&self) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2036
2037        /// The duration between touch down and touchup of all space key events in the session.
2038        #[unsafe(method(spaceTouchDownUp))]
2039        #[unsafe(method_family = none)]
2040        pub unsafe fn spaceTouchDownUp(
2041            &self,
2042        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2043
2044        /// The duration between touch down and touchup of all delete key events in the session.
2045        #[unsafe(method(deleteTouchDownUp))]
2046        #[unsafe(method_family = none)]
2047        pub unsafe fn deleteTouchDownUp(
2048            &self,
2049        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2050
2051        /// The duration between touch down and touchup of all character keys in short words in the session.
2052        #[unsafe(method(shortWordCharKeyTouchDownUp))]
2053        #[unsafe(method_family = none)]
2054        pub unsafe fn shortWordCharKeyTouchDownUp(
2055            &self,
2056        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2057
2058        /// The duration between touch down to touch down for any key
2059        #[unsafe(method(touchDownDown))]
2060        #[unsafe(method_family = none)]
2061        pub unsafe fn touchDownDown(&self)
2062            -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2063
2064        /// The duration between touch up and touch down for any key
2065        #[unsafe(method(touchUpDown))]
2066        #[unsafe(method_family = none)]
2067        pub unsafe fn touchUpDown(&self) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2068
2069        /// The duration between touchup on a character key and touch down on a word in the prediction bar
2070        #[unsafe(method(charKeyToPrediction))]
2071        #[unsafe(method_family = none)]
2072        pub unsafe fn charKeyToPrediction(
2073            &self,
2074        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2075
2076        /// The duration between touchup on a character key and touch down on any sequential character key in a short word
2077        #[unsafe(method(shortWordCharKeyToCharKey))]
2078        #[unsafe(method_family = none)]
2079        pub unsafe fn shortWordCharKeyToCharKey(
2080            &self,
2081        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2082
2083        /// The duration between touchup on a character key and touch down on the next sequential key (any key)
2084        #[unsafe(method(charKeyToAnyTapKey))]
2085        #[unsafe(method_family = none)]
2086        pub unsafe fn charKeyToAnyTapKey(
2087            &self,
2088        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2089
2090        /// The duration between touchup of any key and touch down on a sequential character key
2091        #[unsafe(method(anyTapToCharKey))]
2092        #[unsafe(method_family = none)]
2093        pub unsafe fn anyTapToCharKey(
2094            &self,
2095        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2096
2097        /// The duration between touchup of a space key and touch down of a sequential character key
2098        #[unsafe(method(spaceToCharKey))]
2099        #[unsafe(method_family = none)]
2100        pub unsafe fn spaceToCharKey(
2101            &self,
2102        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2103
2104        /// The duration between touchup of a character key and touch down of a sequential space key
2105        #[unsafe(method(charKeyToSpaceKey))]
2106        #[unsafe(method_family = none)]
2107        pub unsafe fn charKeyToSpaceKey(
2108            &self,
2109        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2110
2111        /// The duration between touchup of a space key and touch down of a sequential delete key
2112        #[unsafe(method(spaceToDeleteKey))]
2113        #[unsafe(method_family = none)]
2114        pub unsafe fn spaceToDeleteKey(
2115            &self,
2116        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2117
2118        /// The duration between touchup of a delete key and touch down of a sequential space key
2119        #[unsafe(method(deleteToSpaceKey))]
2120        #[unsafe(method_family = none)]
2121        pub unsafe fn deleteToSpaceKey(
2122            &self,
2123        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2124
2125        /// The duration between touchup of a space key and touch down of a sequential space key
2126        #[unsafe(method(spaceToSpaceKey))]
2127        #[unsafe(method_family = none)]
2128        pub unsafe fn spaceToSpaceKey(
2129            &self,
2130        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2131
2132        /// The duration between touchup of a space key and touch down of a sequential Shift key
2133        #[unsafe(method(spaceToShiftKey))]
2134        #[unsafe(method_family = none)]
2135        pub unsafe fn spaceToShiftKey(
2136            &self,
2137        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2138
2139        /// The duration between touchup of a space key and touch down of a sequential plane change key
2140        #[unsafe(method(spaceToPlaneChangeKey))]
2141        #[unsafe(method_family = none)]
2142        pub unsafe fn spaceToPlaneChangeKey(
2143            &self,
2144        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2145
2146        /// The duration between touchup on the space key and touch down of a sequential selection from the prediction bar
2147        #[unsafe(method(spaceToPredictionKey))]
2148        #[unsafe(method_family = none)]
2149        pub unsafe fn spaceToPredictionKey(
2150            &self,
2151        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2152
2153        /// The duration between touchup of a delete key and touch down of a sequential character key
2154        #[unsafe(method(deleteToCharKey))]
2155        #[unsafe(method_family = none)]
2156        pub unsafe fn deleteToCharKey(
2157            &self,
2158        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2159
2160        /// The duration between touchup of a character key and touch down of a sequential delete key
2161        #[unsafe(method(charKeyToDelete))]
2162        #[unsafe(method_family = none)]
2163        pub unsafe fn charKeyToDelete(
2164            &self,
2165        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2166
2167        /// The duration between touchup of a delete key and touch down of a sequential delete key
2168        #[unsafe(method(deleteToDelete))]
2169        #[unsafe(method_family = none)]
2170        pub unsafe fn deleteToDelete(
2171            &self,
2172        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2173
2174        /// The duration between touchup of a delete key and touch down of a sequential Shift key
2175        #[unsafe(method(deleteToShiftKey))]
2176        #[unsafe(method_family = none)]
2177        pub unsafe fn deleteToShiftKey(
2178            &self,
2179        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2180
2181        /// The duration between touchup of a delete key and touch down of a sequential plane change key
2182        #[unsafe(method(deleteToPlaneChangeKey))]
2183        #[unsafe(method_family = none)]
2184        pub unsafe fn deleteToPlaneChangeKey(
2185            &self,
2186        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2187
2188        /// The duration between touchup of any key and touch down on a plane change key
2189        #[unsafe(method(anyTapToPlaneChangeKey))]
2190        #[unsafe(method_family = none)]
2191        pub unsafe fn anyTapToPlaneChangeKey(
2192            &self,
2193        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2194
2195        /// The duration between touchup on a plane change key and touch down on the next sequential key
2196        #[unsafe(method(planeChangeToAnyTap))]
2197        #[unsafe(method_family = none)]
2198        pub unsafe fn planeChangeToAnyTap(
2199            &self,
2200        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2201
2202        /// The duration between touchup of a character key and touch down of a sequential plane change key
2203        #[unsafe(method(charKeyToPlaneChangeKey))]
2204        #[unsafe(method_family = none)]
2205        pub unsafe fn charKeyToPlaneChangeKey(
2206            &self,
2207        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2208
2209        /// The duration between touchup of a plane change key and touch down of any key
2210        #[unsafe(method(planeChangeKeyToCharKey))]
2211        #[unsafe(method_family = none)]
2212        pub unsafe fn planeChangeKeyToCharKey(
2213            &self,
2214        ) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2215
2216        /// sample values of the ratio of error distance between intended and actual path
2217        #[unsafe(method(pathErrorDistanceRatio))]
2218        #[unsafe(method_family = none)]
2219        pub unsafe fn pathErrorDistanceRatio(&self) -> Retained<NSArray<NSNumber>>;
2220
2221        /// The duration between touchup of a delete key and touch down of a sequential path
2222        #[unsafe(method(deleteToPath))]
2223        #[unsafe(method_family = none)]
2224        pub unsafe fn deleteToPath(&self) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2225
2226        /// The duration between touchup of a delete key and touch down of a sequential path (ie. Continuous Path)
2227        #[unsafe(method(pathToDelete))]
2228        #[unsafe(method_family = none)]
2229        pub unsafe fn pathToDelete(&self) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2230
2231        /// The duration between touchup on the space key and touch down to begin a sequential path
2232        #[unsafe(method(spaceToPath))]
2233        #[unsafe(method_family = none)]
2234        pub unsafe fn spaceToPath(&self) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2235
2236        /// The duration between touchup of a path and touch down of a sequential space key
2237        #[unsafe(method(pathToSpace))]
2238        #[unsafe(method_family = none)]
2239        pub unsafe fn pathToSpace(&self) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2240
2241        /// The duration between touchup of a path and touch down of a sequential path
2242        #[unsafe(method(pathToPath))]
2243        #[unsafe(method_family = none)]
2244        pub unsafe fn pathToPath(&self) -> Retained<SRKeyboardProbabilityMetric<NSUnitDuration>>;
2245    );
2246}
2247
2248/// PositionalMetrics.
2249/// Probability metrics for each character in a word in their respective positions (first, second, third, fourth, fifth, and the rest)
2250impl SRKeyboardMetrics {
2251    extern_methods!(
2252        /// The distance from the touch up to the center of the intended key of the characters of a long word
2253        #[unsafe(method(longWordUpErrorDistance))]
2254        #[unsafe(method_family = none)]
2255        pub unsafe fn longWordUpErrorDistance(
2256            &self,
2257        ) -> Retained<NSArray<SRKeyboardProbabilityMetric<NSUnitLength>>>;
2258
2259        /// The distance from the touch down to the center of the intended key of the characters of a long word
2260        #[unsafe(method(longWordDownErrorDistance))]
2261        #[unsafe(method_family = none)]
2262        pub unsafe fn longWordDownErrorDistance(
2263            &self,
2264        ) -> Retained<NSArray<SRKeyboardProbabilityMetric<NSUnitLength>>>;
2265
2266        /// The duration between touch down and touchup of the character keys of all the long words in the session.
2267        #[unsafe(method(longWordTouchDownUp))]
2268        #[unsafe(method_family = none)]
2269        pub unsafe fn longWordTouchDownUp(
2270            &self,
2271        ) -> Retained<NSArray<SRKeyboardProbabilityMetric<NSUnitDuration>>>;
2272
2273        /// The duration between touch down and touch down of the character keys of all the long words in the session.
2274        #[unsafe(method(longWordTouchDownDown))]
2275        #[unsafe(method_family = none)]
2276        pub unsafe fn longWordTouchDownDown(
2277            &self,
2278        ) -> Retained<NSArray<SRKeyboardProbabilityMetric<NSUnitDuration>>>;
2279
2280        /// The duration between touch up and touch down of the character keys of all the long words in the session.
2281        #[unsafe(method(longWordTouchUpDown))]
2282        #[unsafe(method_family = none)]
2283        pub unsafe fn longWordTouchUpDown(
2284            &self,
2285        ) -> Retained<NSArray<SRKeyboardProbabilityMetric<NSUnitDuration>>>;
2286
2287        /// The duration between touchup of the delete key and touch down of a sequential delete key
2288        #[unsafe(method(deleteToDeletes))]
2289        #[unsafe(method_family = none)]
2290        pub unsafe fn deleteToDeletes(
2291            &self,
2292        ) -> Retained<NSArray<SRKeyboardProbabilityMetric<NSUnitDuration>>>;
2293    );
2294}
2295
2296/// SpeedMetrics.
2297impl SRKeyboardMetrics {
2298    extern_methods!(
2299        /// The total number of pauses during the session
2300        #[unsafe(method(totalPauses))]
2301        #[unsafe(method_family = none)]
2302        pub unsafe fn totalPauses(&self) -> NSInteger;
2303
2304        /// The total number of pauses made while entering the path for any words composed using continuous path during the session
2305        #[unsafe(method(totalPathPauses))]
2306        #[unsafe(method_family = none)]
2307        pub unsafe fn totalPathPauses(&self) -> NSInteger;
2308
2309        /// The words per minute typed during the session
2310        #[unsafe(method(typingSpeed))]
2311        #[unsafe(method_family = none)]
2312        pub unsafe fn typingSpeed(&self) -> c_double;
2313
2314        /// The words per minute typed using continuous path during the session
2315        #[unsafe(method(pathTypingSpeed))]
2316        #[unsafe(method_family = none)]
2317        pub unsafe fn pathTypingSpeed(&self) -> c_double;
2318
2319        /// Total number of continuous typing episodes during the session
2320        #[unsafe(method(totalTypingEpisodes))]
2321        #[unsafe(method_family = none)]
2322        pub unsafe fn totalTypingEpisodes(&self) -> NSInteger;
2323    );
2324}
2325
2326/// Categories of sentiment from words or emoji
2327///
2328/// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srkeyboardmetricssentimentcategory?language=objc)
2329// NS_ENUM
2330#[repr(transparent)]
2331#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2332pub struct SRKeyboardMetricsSentimentCategory(pub NSInteger);
2333impl SRKeyboardMetricsSentimentCategory {
2334    #[doc(alias = "SRKeyboardMetricsSentimentCategoryAbsolutist")]
2335    pub const Absolutist: Self = Self(0);
2336    #[doc(alias = "SRKeyboardMetricsSentimentCategoryDown")]
2337    pub const Down: Self = Self(1);
2338    #[doc(alias = "SRKeyboardMetricsSentimentCategoryDeath")]
2339    pub const Death: Self = Self(2);
2340    #[doc(alias = "SRKeyboardMetricsSentimentCategoryAnxiety")]
2341    pub const Anxiety: Self = Self(3);
2342    #[doc(alias = "SRKeyboardMetricsSentimentCategoryAnger")]
2343    pub const Anger: Self = Self(4);
2344    #[doc(alias = "SRKeyboardMetricsSentimentCategoryHealth")]
2345    pub const Health: Self = Self(5);
2346    #[doc(alias = "SRKeyboardMetricsSentimentCategoryPositive")]
2347    pub const Positive: Self = Self(6);
2348    #[doc(alias = "SRKeyboardMetricsSentimentCategorySad")]
2349    pub const Sad: Self = Self(7);
2350    #[doc(alias = "SRKeyboardMetricsSentimentCategoryLowEnergy")]
2351    pub const LowEnergy: Self = Self(8);
2352    #[doc(alias = "SRKeyboardMetricsSentimentCategoryConfused")]
2353    pub const Confused: Self = Self(9);
2354}
2355
2356unsafe impl Encode for SRKeyboardMetricsSentimentCategory {
2357    const ENCODING: Encoding = NSInteger::ENCODING;
2358}
2359
2360unsafe impl RefEncode for SRKeyboardMetricsSentimentCategory {
2361    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2362}
2363
2364/// SentimentCounts.
2365/// These metrics describe the number of words and emoji of a particular category typed during
2366/// a keyboard session. Words and emoji may be counted in multiple categories.
2367impl SRKeyboardMetrics {
2368    extern_methods!(
2369        /// The count of words typed per category in the session
2370        #[unsafe(method(wordCountForSentimentCategory:))]
2371        #[unsafe(method_family = none)]
2372        pub unsafe fn wordCountForSentimentCategory(
2373            &self,
2374            category: SRKeyboardMetricsSentimentCategory,
2375        ) -> NSInteger;
2376
2377        /// The count of emoji typed per category in the session
2378        #[unsafe(method(emojiCountForSentimentCategory:))]
2379        #[unsafe(method_family = none)]
2380        pub unsafe fn emojiCountForSentimentCategory(
2381            &self,
2382            category: SRKeyboardMetricsSentimentCategory,
2383        ) -> NSInteger;
2384    );
2385}
2386
2387/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeletionreason?language=objc)
2388// NS_ENUM
2389#[repr(transparent)]
2390#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2391pub struct SRDeletionReason(pub NSInteger);
2392impl SRDeletionReason {
2393    /// The user initiated deletion
2394    #[doc(alias = "SRDeletionReasonUserInitiated")]
2395    pub const UserInitiated: Self = Self(0);
2396    /// Samples were removed due to low disk conditions
2397    #[doc(alias = "SRDeletionReasonLowDiskSpace")]
2398    pub const LowDiskSpace: Self = Self(1);
2399    /// Samples were removed because they were recorded beyond our retention limit
2400    #[doc(alias = "SRDeletionReasonAgeLimit")]
2401    pub const AgeLimit: Self = Self(2);
2402    /// Samples were removed because there are no longer any interested clients
2403    #[doc(alias = "SRDeletionReasonNoInterestedClients")]
2404    pub const NoInterestedClients: Self = Self(3);
2405    /// Samples were removed because the system was in an invalid state
2406    #[doc(alias = "SRDeletionReasonSystemInitiated")]
2407    pub const SystemInitiated: Self = Self(4);
2408}
2409
2410unsafe impl Encode for SRDeletionReason {
2411    const ENCODING: Encoding = NSInteger::ENCODING;
2412}
2413
2414unsafe impl RefEncode for SRDeletionReason {
2415    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2416}
2417
2418extern_class!(
2419    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srdeletionrecord?language=objc)
2420    #[unsafe(super(NSObject))]
2421    #[derive(Debug, PartialEq, Eq, Hash)]
2422    pub struct SRDeletionRecord;
2423);
2424
2425extern_conformance!(
2426    unsafe impl NSCoding for SRDeletionRecord {}
2427);
2428
2429extern_conformance!(
2430    unsafe impl NSObjectProtocol for SRDeletionRecord {}
2431);
2432
2433extern_conformance!(
2434    unsafe impl NSSecureCoding for SRDeletionRecord {}
2435);
2436
2437impl SRDeletionRecord {
2438    extern_methods!(
2439        #[cfg(feature = "objc2-core-foundation")]
2440        #[unsafe(method(startTime))]
2441        #[unsafe(method_family = none)]
2442        pub unsafe fn startTime(&self) -> SRAbsoluteTime;
2443
2444        #[cfg(feature = "objc2-core-foundation")]
2445        #[unsafe(method(endTime))]
2446        #[unsafe(method_family = none)]
2447        pub unsafe fn endTime(&self) -> SRAbsoluteTime;
2448
2449        #[unsafe(method(reason))]
2450        #[unsafe(method_family = none)]
2451        pub unsafe fn reason(&self) -> SRDeletionReason;
2452    );
2453}
2454
2455/// Methods declared on superclass `NSObject`.
2456impl SRDeletionRecord {
2457    extern_methods!(
2458        #[unsafe(method(init))]
2459        #[unsafe(method_family = init)]
2460        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2461
2462        #[unsafe(method(new))]
2463        #[unsafe(method_family = new)]
2464        pub unsafe fn new() -> Retained<Self>;
2465    );
2466}
2467
2468mod private_NSStringSRDeletionRecord {
2469    pub trait Sealed {}
2470}
2471
2472/// Category "SRDeletionRecord" on [`NSString`].
2473#[doc(alias = "SRDeletionRecord")]
2474pub unsafe trait NSStringSRDeletionRecord:
2475    ClassType + Sized + private_NSStringSRDeletionRecord::Sealed
2476{
2477    extern_methods!(
2478        /// Returns a sensor stream that contains deletion records of the sensor
2479        ///
2480        ///
2481        /// This sensor stream should only be used for fetching. All other
2482        /// operations will be ignored. Deletion records share the recording and authorization
2483        /// state with their parent sensor.
2484        ///
2485        ///
2486        /// Returns: May return nil if there is no deletion record available for this sensor
2487        #[unsafe(method(sr_sensorForDeletionRecordsFromSensor))]
2488        #[unsafe(method_family = none)]
2489        unsafe fn sr_sensorForDeletionRecordsFromSensor(&self) -> Option<Retained<SRSensor>>;
2490    );
2491}
2492
2493impl private_NSStringSRDeletionRecord::Sealed for NSString {}
2494unsafe impl NSStringSRDeletionRecord for NSString {}
2495
2496/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srwristlocation?language=objc)
2497// NS_ENUM
2498#[repr(transparent)]
2499#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2500pub struct SRWristLocation(pub NSInteger);
2501impl SRWristLocation {
2502    #[doc(alias = "SRWristLocationLeft")]
2503    pub const Left: Self = Self(0);
2504    #[doc(alias = "SRWristLocationRight")]
2505    pub const Right: Self = Self(1);
2506}
2507
2508unsafe impl Encode for SRWristLocation {
2509    const ENCODING: Encoding = NSInteger::ENCODING;
2510}
2511
2512unsafe impl RefEncode for SRWristLocation {
2513    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2514}
2515
2516/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srcrownorientation?language=objc)
2517// NS_ENUM
2518#[repr(transparent)]
2519#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2520pub struct SRCrownOrientation(pub NSInteger);
2521impl SRCrownOrientation {
2522    #[doc(alias = "SRCrownOrientationLeft")]
2523    pub const Left: Self = Self(0);
2524    #[doc(alias = "SRCrownOrientationRight")]
2525    pub const Right: Self = Self(1);
2526}
2527
2528unsafe impl Encode for SRCrownOrientation {
2529    const ENCODING: Encoding = NSInteger::ENCODING;
2530}
2531
2532unsafe impl RefEncode for SRCrownOrientation {
2533    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2534}
2535
2536extern_class!(
2537    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srwristdetection?language=objc)
2538    #[unsafe(super(NSObject))]
2539    #[derive(Debug, PartialEq, Eq, Hash)]
2540    pub struct SRWristDetection;
2541);
2542
2543extern_conformance!(
2544    unsafe impl NSObjectProtocol for SRWristDetection {}
2545);
2546
2547impl SRWristDetection {
2548    extern_methods!(
2549        #[unsafe(method(onWrist))]
2550        #[unsafe(method_family = none)]
2551        pub unsafe fn onWrist(&self) -> bool;
2552
2553        #[unsafe(method(wristLocation))]
2554        #[unsafe(method_family = none)]
2555        pub unsafe fn wristLocation(&self) -> SRWristLocation;
2556
2557        #[unsafe(method(crownOrientation))]
2558        #[unsafe(method_family = none)]
2559        pub unsafe fn crownOrientation(&self) -> SRCrownOrientation;
2560
2561        /// Start date of the recent on-wrist state.
2562        ///
2563        ///
2564        /// - When the state changes from off-wrist to on-wrist, onWristDate would be updated to the current date, and offWristDate would remain the same.
2565        /// - When the state changes from on-wrist to off-wrist, offWristDate would be updated to the current date, and onWristDate would remain the same.
2566        #[unsafe(method(onWristDate))]
2567        #[unsafe(method_family = none)]
2568        pub unsafe fn onWristDate(&self) -> Option<Retained<NSDate>>;
2569
2570        /// Start date of the recent off-wrist state.
2571        ///
2572        ///
2573        /// - When the state changes from off-wrist to on-wrist, onWristDate would be updated to the current date, and offWristDate would remain the same.
2574        /// - When the state changes from on-wrist to off-wrist, offWristDate would be updated to the current date, and onWristDate would remain the same.
2575        #[unsafe(method(offWristDate))]
2576        #[unsafe(method_family = none)]
2577        pub unsafe fn offWristDate(&self) -> Option<Retained<NSDate>>;
2578    );
2579}
2580
2581/// Methods declared on superclass `NSObject`.
2582impl SRWristDetection {
2583    extern_methods!(
2584        #[unsafe(method(init))]
2585        #[unsafe(method_family = init)]
2586        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2587
2588        #[unsafe(method(new))]
2589        #[unsafe(method_family = new)]
2590        pub unsafe fn new() -> Retained<Self>;
2591    );
2592}
2593
2594/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srwristtemperaturecondition?language=objc)
2595// NS_OPTIONS
2596#[repr(transparent)]
2597#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2598pub struct SRWristTemperatureCondition(pub NSUInteger);
2599bitflags::bitflags! {
2600    impl SRWristTemperatureCondition: NSUInteger {
2601        #[doc(alias = "SRWristTemperatureConditionNone")]
2602        const None = 0;
2603        #[doc(alias = "SRWristTemperatureConditionOffWrist")]
2604        const OffWrist = 1<<0;
2605        #[doc(alias = "SRWristTemperatureConditionOnCharger")]
2606        const OnCharger = 1<<1;
2607        #[doc(alias = "SRWristTemperatureConditionInMotion")]
2608        const InMotion = 1<<2;
2609    }
2610}
2611
2612unsafe impl Encode for SRWristTemperatureCondition {
2613    const ENCODING: Encoding = NSUInteger::ENCODING;
2614}
2615
2616unsafe impl RefEncode for SRWristTemperatureCondition {
2617    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2618}
2619
2620extern_class!(
2621    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srwristtemperature?language=objc)
2622    #[unsafe(super(NSObject))]
2623    #[derive(Debug, PartialEq, Eq, Hash)]
2624    pub struct SRWristTemperature;
2625);
2626
2627unsafe impl Send for SRWristTemperature {}
2628
2629unsafe impl Sync for SRWristTemperature {}
2630
2631extern_conformance!(
2632    unsafe impl NSCoding for SRWristTemperature {}
2633);
2634
2635extern_conformance!(
2636    unsafe impl NSCopying for SRWristTemperature {}
2637);
2638
2639unsafe impl CopyingHelper for SRWristTemperature {
2640    type Result = Self;
2641}
2642
2643extern_conformance!(
2644    unsafe impl NSObjectProtocol for SRWristTemperature {}
2645);
2646
2647extern_conformance!(
2648    unsafe impl NSSecureCoding for SRWristTemperature {}
2649);
2650
2651impl SRWristTemperature {
2652    extern_methods!(
2653        #[unsafe(method(init))]
2654        #[unsafe(method_family = init)]
2655        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2656
2657        #[unsafe(method(new))]
2658        #[unsafe(method_family = new)]
2659        pub unsafe fn new() -> Retained<Self>;
2660
2661        /// Timestamp of when temperature measurement was taken.
2662        #[unsafe(method(timestamp))]
2663        #[unsafe(method_family = none)]
2664        pub unsafe fn timestamp(&self) -> Retained<NSDate>;
2665
2666        /// Temperature sensor value in celsius
2667        #[unsafe(method(value))]
2668        #[unsafe(method_family = none)]
2669        pub unsafe fn value(&self) -> Retained<NSMeasurement<NSUnitTemperature>>;
2670
2671        /// Indicate system conditions that may impact the temperature sample.
2672        #[unsafe(method(condition))]
2673        #[unsafe(method_family = none)]
2674        pub unsafe fn condition(&self) -> SRWristTemperatureCondition;
2675
2676        /// Estimated temperature error per sample.
2677        /// Error could be in either positive or negative direction.
2678        #[unsafe(method(errorEstimate))]
2679        #[unsafe(method_family = none)]
2680        pub unsafe fn errorEstimate(&self) -> Retained<NSMeasurement<NSUnitTemperature>>;
2681    );
2682}
2683
2684extern_class!(
2685    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srwristtemperaturesession?language=objc)
2686    #[unsafe(super(NSObject))]
2687    #[derive(Debug, PartialEq, Eq, Hash)]
2688    pub struct SRWristTemperatureSession;
2689);
2690
2691unsafe impl Send for SRWristTemperatureSession {}
2692
2693unsafe impl Sync for SRWristTemperatureSession {}
2694
2695extern_conformance!(
2696    unsafe impl NSCoding for SRWristTemperatureSession {}
2697);
2698
2699extern_conformance!(
2700    unsafe impl NSCopying for SRWristTemperatureSession {}
2701);
2702
2703unsafe impl CopyingHelper for SRWristTemperatureSession {
2704    type Result = Self;
2705}
2706
2707extern_conformance!(
2708    unsafe impl NSObjectProtocol for SRWristTemperatureSession {}
2709);
2710
2711extern_conformance!(
2712    unsafe impl NSSecureCoding for SRWristTemperatureSession {}
2713);
2714
2715impl SRWristTemperatureSession {
2716    extern_methods!(
2717        #[unsafe(method(init))]
2718        #[unsafe(method_family = init)]
2719        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2720
2721        #[unsafe(method(new))]
2722        #[unsafe(method_family = new)]
2723        pub unsafe fn new() -> Retained<Self>;
2724
2725        /// Indicates when temperatures were collected.
2726        #[unsafe(method(startDate))]
2727        #[unsafe(method_family = none)]
2728        pub unsafe fn startDate(&self) -> Retained<NSDate>;
2729
2730        /// Precise number of seconds temperatures were collected.
2731        #[unsafe(method(duration))]
2732        #[unsafe(method_family = none)]
2733        pub unsafe fn duration(&self) -> NSTimeInterval;
2734
2735        /// Algorithm version.
2736        #[unsafe(method(version))]
2737        #[unsafe(method_family = none)]
2738        pub unsafe fn version(&self) -> Retained<NSString>;
2739
2740        /// Enumerator which could be used to view calculated wrist temperatures, along with their reading accuracy.
2741        #[unsafe(method(temperatures))]
2742        #[unsafe(method_family = none)]
2743        pub unsafe fn temperatures(&self) -> Retained<NSEnumerator<SRWristTemperature>>;
2744    );
2745}
2746
2747/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srmediaeventtype?language=objc)
2748// NS_ENUM
2749#[repr(transparent)]
2750#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2751pub struct SRMediaEventType(pub NSInteger);
2752impl SRMediaEventType {
2753    #[doc(alias = "SRMediaEventOnScreen")]
2754    pub const OnScreen: Self = Self(1);
2755    #[doc(alias = "SRMediaEventOffScreen")]
2756    pub const OffScreen: Self = Self(2);
2757}
2758
2759unsafe impl Encode for SRMediaEventType {
2760    const ENCODING: Encoding = NSInteger::ENCODING;
2761}
2762
2763unsafe impl RefEncode for SRMediaEventType {
2764    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2765}
2766
2767extern_class!(
2768    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srmediaevent?language=objc)
2769    #[unsafe(super(NSObject))]
2770    #[derive(Debug, PartialEq, Eq, Hash)]
2771    pub struct SRMediaEvent;
2772);
2773
2774unsafe impl Send for SRMediaEvent {}
2775
2776unsafe impl Sync for SRMediaEvent {}
2777
2778extern_conformance!(
2779    unsafe impl NSCoding for SRMediaEvent {}
2780);
2781
2782extern_conformance!(
2783    unsafe impl NSCopying for SRMediaEvent {}
2784);
2785
2786unsafe impl CopyingHelper for SRMediaEvent {
2787    type Result = Self;
2788}
2789
2790extern_conformance!(
2791    unsafe impl NSObjectProtocol for SRMediaEvent {}
2792);
2793
2794extern_conformance!(
2795    unsafe impl NSSecureCoding for SRMediaEvent {}
2796);
2797
2798impl SRMediaEvent {
2799    extern_methods!(
2800        /// Unique media identifier
2801        ///
2802        ///
2803        /// Unique media identifier to track a specific media object.
2804        #[unsafe(method(mediaIdentifier))]
2805        #[unsafe(method_family = none)]
2806        pub unsafe fn mediaIdentifier(&self) -> Retained<NSString>;
2807
2808        /// Type of the event
2809        ///
2810        ///
2811        /// Type of media event (e.g., media has been displayed on a screen).
2812        #[unsafe(method(eventType))]
2813        #[unsafe(method_family = none)]
2814        pub unsafe fn eventType(&self) -> SRMediaEventType;
2815    );
2816}
2817
2818/// Methods declared on superclass `NSObject`.
2819impl SRMediaEvent {
2820    extern_methods!(
2821        #[unsafe(method(init))]
2822        #[unsafe(method_family = init)]
2823        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2824
2825        #[unsafe(method(new))]
2826        #[unsafe(method_family = new)]
2827        pub unsafe fn new() -> Retained<Self>;
2828    );
2829}
2830
2831extern_class!(
2832    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srspeechexpression?language=objc)
2833    #[unsafe(super(NSObject))]
2834    #[derive(Debug, PartialEq, Eq, Hash)]
2835    pub struct SRSpeechExpression;
2836);
2837
2838unsafe impl Send for SRSpeechExpression {}
2839
2840unsafe impl Sync for SRSpeechExpression {}
2841
2842extern_conformance!(
2843    unsafe impl NSCoding for SRSpeechExpression {}
2844);
2845
2846extern_conformance!(
2847    unsafe impl NSCopying for SRSpeechExpression {}
2848);
2849
2850unsafe impl CopyingHelper for SRSpeechExpression {
2851    type Result = Self;
2852}
2853
2854extern_conformance!(
2855    unsafe impl NSObjectProtocol for SRSpeechExpression {}
2856);
2857
2858extern_conformance!(
2859    unsafe impl NSSecureCoding for SRSpeechExpression {}
2860);
2861
2862impl SRSpeechExpression {
2863    extern_methods!(
2864        #[unsafe(method(init))]
2865        #[unsafe(method_family = init)]
2866        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2867
2868        #[unsafe(method(new))]
2869        #[unsafe(method_family = new)]
2870        pub unsafe fn new() -> Retained<Self>;
2871
2872        /// Version of the algorithm used to generate
2873        /// `SRSpeechExpression`
2874        #[unsafe(method(version))]
2875        #[unsafe(method_family = none)]
2876        pub unsafe fn version(&self) -> Retained<NSString>;
2877
2878        #[cfg(feature = "objc2-core-media")]
2879        /// The time range in the client-provided audio stream to which this classification
2880        /// result corresponds
2881        #[unsafe(method(timeRange))]
2882        #[unsafe(method_family = none)]
2883        pub unsafe fn timeRange(&self) -> CMTimeRange;
2884
2885        /// The level of confidence normalized to [0, 1], where 1 is most confident
2886        #[unsafe(method(confidence))]
2887        #[unsafe(method_family = none)]
2888        pub unsafe fn confidence(&self) -> c_double;
2889
2890        /// Indicator of how slurry/tired/exhausted the speaker sounds as opposed to normal.
2891        ///
2892        ///
2893        /// on a scale from -1 to 1, where negative scores indicate 'negative'
2894        /// sentiment, and positive scores indicate 'positive' sentiment.
2895        #[unsafe(method(mood))]
2896        #[unsafe(method_family = none)]
2897        pub unsafe fn mood(&self) -> c_double;
2898
2899        /// Degree of (perceived) positive or negative emotion/sentiment from voice
2900        ///
2901        ///
2902        /// on a scale from -1 to 1, where negative scores indicate 'negative'
2903        /// sentiment, and positive scores indicate 'positive' sentiment.
2904        #[unsafe(method(valence))]
2905        #[unsafe(method_family = none)]
2906        pub unsafe fn valence(&self) -> c_double;
2907
2908        /// Level of energy or activation (perceived) in voice
2909        ///
2910        ///
2911        /// on a scale from -1 to 1, where negative scores indicate 'negative'
2912        /// sentiment, and positive scores indicate 'positive' sentiment.
2913        #[unsafe(method(activation))]
2914        #[unsafe(method_family = none)]
2915        pub unsafe fn activation(&self) -> c_double;
2916
2917        /// Degree of how strong or meek a person sounds (perceptually)
2918        ///
2919        ///
2920        /// on a scale from -1 to 1, where negative scores indicate 'negative'
2921        /// sentiment, and positive scores indicate 'positive' sentiment.
2922        #[unsafe(method(dominance))]
2923        #[unsafe(method_family = none)]
2924        pub unsafe fn dominance(&self) -> c_double;
2925    );
2926}
2927
2928extern_class!(
2929    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/sraudiolevel?language=objc)
2930    #[unsafe(super(NSObject))]
2931    #[derive(Debug, PartialEq, Eq, Hash)]
2932    pub struct SRAudioLevel;
2933);
2934
2935unsafe impl Send for SRAudioLevel {}
2936
2937unsafe impl Sync for SRAudioLevel {}
2938
2939extern_conformance!(
2940    unsafe impl NSCoding for SRAudioLevel {}
2941);
2942
2943extern_conformance!(
2944    unsafe impl NSCopying for SRAudioLevel {}
2945);
2946
2947unsafe impl CopyingHelper for SRAudioLevel {
2948    type Result = Self;
2949}
2950
2951extern_conformance!(
2952    unsafe impl NSObjectProtocol for SRAudioLevel {}
2953);
2954
2955extern_conformance!(
2956    unsafe impl NSSecureCoding for SRAudioLevel {}
2957);
2958
2959impl SRAudioLevel {
2960    extern_methods!(
2961        #[unsafe(method(init))]
2962        #[unsafe(method_family = init)]
2963        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2964
2965        #[unsafe(method(new))]
2966        #[unsafe(method_family = new)]
2967        pub unsafe fn new() -> Retained<Self>;
2968
2969        #[cfg(feature = "objc2-core-media")]
2970        /// The time range in the client-provided audio stream to which this classification
2971        /// result corresponds
2972        #[unsafe(method(timeRange))]
2973        #[unsafe(method_family = none)]
2974        pub unsafe fn timeRange(&self) -> CMTimeRange;
2975
2976        /// Measure of the audio level in decibels
2977        #[unsafe(method(loudness))]
2978        #[unsafe(method_family = none)]
2979        pub unsafe fn loudness(&self) -> c_double;
2980    );
2981}
2982
2983/// Flags indicating more information about how audio processing was done
2984/// on the audio stream
2985///
2986///
2987///
2988/// Audio stream went through the system voice processor
2989///
2990///
2991///
2992/// Audio stream bypassed the system voice processor.
2993///
2994/// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srspeechmetricssessionflags?language=objc)
2995// NS_OPTIONS
2996#[repr(transparent)]
2997#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2998pub struct SRSpeechMetricsSessionFlags(pub NSUInteger);
2999bitflags::bitflags! {
3000    impl SRSpeechMetricsSessionFlags: NSUInteger {
3001        #[doc(alias = "SRSpeechMetricsSessionFlagsDefault")]
3002        const Default = 0;
3003        #[doc(alias = "SRSpeechMetricsSessionFlagsBypassVoiceProcessing")]
3004        const BypassVoiceProcessing = 1<<0;
3005    }
3006}
3007
3008unsafe impl Encode for SRSpeechMetricsSessionFlags {
3009    const ENCODING: Encoding = NSUInteger::ENCODING;
3010}
3011
3012unsafe impl RefEncode for SRSpeechMetricsSessionFlags {
3013    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3014}
3015
3016extern_class!(
3017    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srspeechmetrics?language=objc)
3018    #[unsafe(super(NSObject))]
3019    #[derive(Debug, PartialEq, Eq, Hash)]
3020    pub struct SRSpeechMetrics;
3021);
3022
3023unsafe impl Send for SRSpeechMetrics {}
3024
3025unsafe impl Sync for SRSpeechMetrics {}
3026
3027extern_conformance!(
3028    unsafe impl NSCoding for SRSpeechMetrics {}
3029);
3030
3031extern_conformance!(
3032    unsafe impl NSCopying for SRSpeechMetrics {}
3033);
3034
3035unsafe impl CopyingHelper for SRSpeechMetrics {
3036    type Result = Self;
3037}
3038
3039extern_conformance!(
3040    unsafe impl NSObjectProtocol for SRSpeechMetrics {}
3041);
3042
3043extern_conformance!(
3044    unsafe impl NSSecureCoding for SRSpeechMetrics {}
3045);
3046
3047impl SRSpeechMetrics {
3048    extern_methods!(
3049        #[unsafe(method(init))]
3050        #[unsafe(method_family = init)]
3051        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3052
3053        #[unsafe(method(new))]
3054        #[unsafe(method_family = new)]
3055        pub unsafe fn new() -> Retained<Self>;
3056
3057        /// Identifier of an audio session e.g., a Phone call or Siri utterance
3058        #[unsafe(method(sessionIdentifier))]
3059        #[unsafe(method_family = none)]
3060        pub unsafe fn sessionIdentifier(&self) -> Retained<NSString>;
3061
3062        #[unsafe(method(sessionFlags))]
3063        #[unsafe(method_family = none)]
3064        pub unsafe fn sessionFlags(&self) -> SRSpeechMetricsSessionFlags;
3065
3066        /// The wall time when this sample was generated
3067        #[unsafe(method(timestamp))]
3068        #[unsafe(method_family = none)]
3069        pub unsafe fn timestamp(&self) -> Retained<NSDate>;
3070
3071        /// The number of seconds since the start of the audio stream
3072        ///
3073        ///
3074        /// When an audio stream like a phone call starts,
3075        /// `SRSpeechMetrics`samples are collected
3076        /// periodically. This field can be used to determine where each sample falls in the audio stream
3077        #[unsafe(method(timeSinceAudioStart))]
3078        #[unsafe(method_family = none)]
3079        pub unsafe fn timeSinceAudioStart(&self) -> NSTimeInterval;
3080
3081        #[unsafe(method(audioLevel))]
3082        #[unsafe(method_family = none)]
3083        pub unsafe fn audioLevel(&self) -> Option<Retained<SRAudioLevel>>;
3084
3085        #[cfg(feature = "objc2-speech")]
3086        #[unsafe(method(speechRecognition))]
3087        #[unsafe(method_family = none)]
3088        pub unsafe fn speechRecognition(&self) -> Option<Retained<SFSpeechRecognitionResult>>;
3089
3090        #[cfg(feature = "objc2-sound-analysis")]
3091        #[unsafe(method(soundClassification))]
3092        #[unsafe(method_family = none)]
3093        pub unsafe fn soundClassification(&self) -> Option<Retained<SNClassificationResult>>;
3094
3095        #[unsafe(method(speechExpression))]
3096        #[unsafe(method_family = none)]
3097        pub unsafe fn speechExpression(&self) -> Option<Retained<SRSpeechExpression>>;
3098    );
3099}
3100
3101/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srfacemetricscontext?language=objc)
3102// NS_OPTIONS
3103#[repr(transparent)]
3104#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3105pub struct SRFaceMetricsContext(pub NSUInteger);
3106bitflags::bitflags! {
3107    impl SRFaceMetricsContext: NSUInteger {
3108        #[doc(alias = "SRFaceMetricsContextDeviceUnlock")]
3109        const DeviceUnlock = 1<<0;
3110        #[doc(alias = "SRFaceMetricsContextMessagingAppUsage")]
3111        const MessagingAppUsage = 1<<1;
3112    }
3113}
3114
3115unsafe impl Encode for SRFaceMetricsContext {
3116    const ENCODING: Encoding = NSUInteger::ENCODING;
3117}
3118
3119unsafe impl RefEncode for SRFaceMetricsContext {
3120    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3121}
3122
3123extern_class!(
3124    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srfacemetricsexpression?language=objc)
3125    #[unsafe(super(NSObject))]
3126    #[derive(Debug, PartialEq, Eq, Hash)]
3127    pub struct SRFaceMetricsExpression;
3128);
3129
3130unsafe impl Send for SRFaceMetricsExpression {}
3131
3132unsafe impl Sync for SRFaceMetricsExpression {}
3133
3134extern_conformance!(
3135    unsafe impl NSCoding for SRFaceMetricsExpression {}
3136);
3137
3138extern_conformance!(
3139    unsafe impl NSCopying for SRFaceMetricsExpression {}
3140);
3141
3142unsafe impl CopyingHelper for SRFaceMetricsExpression {
3143    type Result = Self;
3144}
3145
3146extern_conformance!(
3147    unsafe impl NSObjectProtocol for SRFaceMetricsExpression {}
3148);
3149
3150extern_conformance!(
3151    unsafe impl NSSecureCoding for SRFaceMetricsExpression {}
3152);
3153
3154impl SRFaceMetricsExpression {
3155    extern_methods!(
3156        #[unsafe(method(init))]
3157        #[unsafe(method_family = init)]
3158        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3159
3160        #[unsafe(method(new))]
3161        #[unsafe(method_family = new)]
3162        pub unsafe fn new() -> Retained<Self>;
3163
3164        /// An opaque identifier for the face expression
3165        ///
3166        /// More information about what this face expression represents can be found in Apple's developer documentation
3167        #[unsafe(method(identifier))]
3168        #[unsafe(method_family = none)]
3169        pub unsafe fn identifier(&self) -> Retained<NSString>;
3170
3171        /// double value indicating the current position of the expression
3172        #[unsafe(method(value))]
3173        #[unsafe(method_family = none)]
3174        pub unsafe fn value(&self) -> c_double;
3175    );
3176}
3177
3178extern_class!(
3179    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srfacemetrics?language=objc)
3180    #[unsafe(super(NSObject))]
3181    #[derive(Debug, PartialEq, Eq, Hash)]
3182    pub struct SRFaceMetrics;
3183);
3184
3185unsafe impl Send for SRFaceMetrics {}
3186
3187unsafe impl Sync for SRFaceMetrics {}
3188
3189extern_conformance!(
3190    unsafe impl NSCoding for SRFaceMetrics {}
3191);
3192
3193extern_conformance!(
3194    unsafe impl NSCopying for SRFaceMetrics {}
3195);
3196
3197unsafe impl CopyingHelper for SRFaceMetrics {
3198    type Result = Self;
3199}
3200
3201extern_conformance!(
3202    unsafe impl NSObjectProtocol for SRFaceMetrics {}
3203);
3204
3205extern_conformance!(
3206    unsafe impl NSSecureCoding for SRFaceMetrics {}
3207);
3208
3209impl SRFaceMetrics {
3210    extern_methods!(
3211        #[unsafe(method(init))]
3212        #[unsafe(method_family = init)]
3213        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3214
3215        #[unsafe(method(new))]
3216        #[unsafe(method_family = new)]
3217        pub unsafe fn new() -> Retained<Self>;
3218
3219        /// Algorithm version
3220        #[unsafe(method(version))]
3221        #[unsafe(method_family = none)]
3222        pub unsafe fn version(&self) -> Retained<NSString>;
3223
3224        /// Identifier of a camera session
3225        #[unsafe(method(sessionIdentifier))]
3226        #[unsafe(method_family = none)]
3227        pub unsafe fn sessionIdentifier(&self) -> Retained<NSString>;
3228
3229        /// Indicates system context during a camera session, e.g., if the device was unlocked or (and) a messaging app was used
3230        #[unsafe(method(context))]
3231        #[unsafe(method_family = none)]
3232        pub unsafe fn context(&self) -> SRFaceMetricsContext;
3233
3234        #[cfg(feature = "objc2-ar-kit")]
3235        #[unsafe(method(faceAnchor))]
3236        #[unsafe(method_family = none)]
3237        pub unsafe fn faceAnchor(&self) -> Retained<ARFaceAnchor>;
3238
3239        /// Detected whole face expressions
3240        #[unsafe(method(wholeFaceExpressions))]
3241        #[unsafe(method_family = none)]
3242        pub unsafe fn wholeFaceExpressions(&self) -> Retained<NSArray<SRFaceMetricsExpression>>;
3243
3244        /// Detected partial face expressions
3245        #[unsafe(method(partialFaceExpressions))]
3246        #[unsafe(method_family = none)]
3247        pub unsafe fn partialFaceExpressions(&self) -> Retained<NSArray<SRFaceMetricsExpression>>;
3248    );
3249}
3250
3251/// The state of the ECG session when this sample was taken
3252///
3253/// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srelectrocardiogramsessionstate?language=objc)
3254// NS_ENUM
3255#[repr(transparent)]
3256#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3257pub struct SRElectrocardiogramSessionState(pub NSInteger);
3258impl SRElectrocardiogramSessionState {
3259    #[doc(alias = "SRElectrocardiogramSessionStateBegin")]
3260    pub const Begin: Self = Self(1);
3261    #[doc(alias = "SRElectrocardiogramSessionStateActive")]
3262    pub const Active: Self = Self(2);
3263    #[doc(alias = "SRElectrocardiogramSessionStateEnd")]
3264    pub const End: Self = Self(3);
3265}
3266
3267unsafe impl Encode for SRElectrocardiogramSessionState {
3268    const ENCODING: Encoding = NSInteger::ENCODING;
3269}
3270
3271unsafe impl RefEncode for SRElectrocardiogramSessionState {
3272    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3273}
3274
3275/// The type of session used to record the ECG sample
3276///
3277///
3278///
3279/// A session, usually of fixed duration, where the user is provided coaching to guide the ECG readings
3280///
3281///
3282///
3283/// A session, usually of undefined duration, where the user is not provided coaching to guide the ECG readings
3284///
3285/// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srelectrocardiogramsessionguidance?language=objc)
3286// NS_ENUM
3287#[repr(transparent)]
3288#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3289pub struct SRElectrocardiogramSessionGuidance(pub NSInteger);
3290impl SRElectrocardiogramSessionGuidance {
3291    #[doc(alias = "SRElectrocardiogramSessionGuidanceGuided")]
3292    pub const Guided: Self = Self(1);
3293    #[doc(alias = "SRElectrocardiogramSessionGuidanceUnguided")]
3294    pub const Unguided: Self = Self(2);
3295}
3296
3297unsafe impl Encode for SRElectrocardiogramSessionGuidance {
3298    const ENCODING: Encoding = NSInteger::ENCODING;
3299}
3300
3301unsafe impl RefEncode for SRElectrocardiogramSessionGuidance {
3302    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3303}
3304
3305extern_class!(
3306    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srelectrocardiogramsession?language=objc)
3307    #[unsafe(super(NSObject))]
3308    #[derive(Debug, PartialEq, Eq, Hash)]
3309    pub struct SRElectrocardiogramSession;
3310);
3311
3312unsafe impl Send for SRElectrocardiogramSession {}
3313
3314unsafe impl Sync for SRElectrocardiogramSession {}
3315
3316extern_conformance!(
3317    unsafe impl NSCoding for SRElectrocardiogramSession {}
3318);
3319
3320extern_conformance!(
3321    unsafe impl NSCopying for SRElectrocardiogramSession {}
3322);
3323
3324unsafe impl CopyingHelper for SRElectrocardiogramSession {
3325    type Result = Self;
3326}
3327
3328extern_conformance!(
3329    unsafe impl NSObjectProtocol for SRElectrocardiogramSession {}
3330);
3331
3332extern_conformance!(
3333    unsafe impl NSSecureCoding for SRElectrocardiogramSession {}
3334);
3335
3336impl SRElectrocardiogramSession {
3337    extern_methods!(
3338        #[unsafe(method(init))]
3339        #[unsafe(method_family = init)]
3340        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3341
3342        #[unsafe(method(new))]
3343        #[unsafe(method_family = new)]
3344        pub unsafe fn new() -> Retained<Self>;
3345
3346        /// The state of the ECG session when the sample was recorded
3347        #[unsafe(method(state))]
3348        #[unsafe(method_family = none)]
3349        pub unsafe fn state(&self) -> SRElectrocardiogramSessionState;
3350
3351        /// The type of session guidance during the the ECG session
3352        #[unsafe(method(sessionGuidance))]
3353        #[unsafe(method_family = none)]
3354        pub unsafe fn sessionGuidance(&self) -> SRElectrocardiogramSessionGuidance;
3355
3356        /// Used to tie samples across multiple
3357        /// `SRFetchResult`s to the same session
3358        #[unsafe(method(identifier))]
3359        #[unsafe(method_family = none)]
3360        pub unsafe fn identifier(&self) -> Retained<NSString>;
3361    );
3362}
3363
3364/// Flags indicating sensor context or events that occurred during
3365/// the sample reading
3366///
3367///
3368/// These flags can provide some indication of data validity or other system conditions
3369/// that may influence how the recorded data should be treated.
3370///
3371/// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srelectrocardiogramdataflags?language=objc)
3372// NS_OPTIONS
3373#[repr(transparent)]
3374#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3375pub struct SRElectrocardiogramDataFlags(pub NSUInteger);
3376bitflags::bitflags! {
3377    impl SRElectrocardiogramDataFlags: NSUInteger {
3378        #[doc(alias = "SRElectrocardiogramDataFlagsNone")]
3379        const None = 0;
3380/// Indicates an invalid sensor signal in the ECG data
3381        #[doc(alias = "SRElectrocardiogramDataFlagsSignalInvalid")]
3382        const SignalInvalid = 1<<0;
3383/// Indicates ECG data was recorded when the crown was being touched
3384        #[doc(alias = "SRElectrocardiogramDataFlagsCrownTouched")]
3385        const CrownTouched = 1<<1;
3386    }
3387}
3388
3389unsafe impl Encode for SRElectrocardiogramDataFlags {
3390    const ENCODING: Encoding = NSUInteger::ENCODING;
3391}
3392
3393unsafe impl RefEncode for SRElectrocardiogramDataFlags {
3394    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3395}
3396
3397extern_class!(
3398    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srelectrocardiogramdata?language=objc)
3399    #[unsafe(super(NSObject))]
3400    #[derive(Debug, PartialEq, Eq, Hash)]
3401    pub struct SRElectrocardiogramData;
3402);
3403
3404unsafe impl Send for SRElectrocardiogramData {}
3405
3406unsafe impl Sync for SRElectrocardiogramData {}
3407
3408extern_conformance!(
3409    unsafe impl NSCoding for SRElectrocardiogramData {}
3410);
3411
3412extern_conformance!(
3413    unsafe impl NSCopying for SRElectrocardiogramData {}
3414);
3415
3416unsafe impl CopyingHelper for SRElectrocardiogramData {
3417    type Result = Self;
3418}
3419
3420extern_conformance!(
3421    unsafe impl NSObjectProtocol for SRElectrocardiogramData {}
3422);
3423
3424extern_conformance!(
3425    unsafe impl NSSecureCoding for SRElectrocardiogramData {}
3426);
3427
3428impl SRElectrocardiogramData {
3429    extern_methods!(
3430        #[unsafe(method(init))]
3431        #[unsafe(method_family = init)]
3432        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3433
3434        #[unsafe(method(new))]
3435        #[unsafe(method_family = new)]
3436        pub unsafe fn new() -> Retained<Self>;
3437
3438        #[unsafe(method(flags))]
3439        #[unsafe(method_family = none)]
3440        pub unsafe fn flags(&self) -> SRElectrocardiogramDataFlags;
3441
3442        /// Value of the ECG AC data in microvolts
3443        #[unsafe(method(value))]
3444        #[unsafe(method_family = none)]
3445        pub unsafe fn value(&self) -> Retained<NSMeasurement<NSUnitElectricPotentialDifference>>;
3446    );
3447}
3448
3449/// Which lead was used to record the ECG data
3450///
3451/// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srelectrocardiogramlead?language=objc)
3452// NS_ENUM
3453#[repr(transparent)]
3454#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3455pub struct SRElectrocardiogramLead(pub NSInteger);
3456impl SRElectrocardiogramLead {
3457    #[doc(alias = "SRElectrocardiogramLeadRightArmMinusLeftArm")]
3458    pub const RightArmMinusLeftArm: Self = Self(1);
3459    #[doc(alias = "SRElectrocardiogramLeadLeftArmMinusRightArm")]
3460    pub const LeftArmMinusRightArm: Self = Self(2);
3461}
3462
3463unsafe impl Encode for SRElectrocardiogramLead {
3464    const ENCODING: Encoding = NSInteger::ENCODING;
3465}
3466
3467unsafe impl RefEncode for SRElectrocardiogramLead {
3468    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3469}
3470
3471extern_class!(
3472    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srelectrocardiogramsample?language=objc)
3473    #[unsafe(super(NSObject))]
3474    #[derive(Debug, PartialEq, Eq, Hash)]
3475    pub struct SRElectrocardiogramSample;
3476);
3477
3478unsafe impl Send for SRElectrocardiogramSample {}
3479
3480unsafe impl Sync for SRElectrocardiogramSample {}
3481
3482extern_conformance!(
3483    unsafe impl NSCoding for SRElectrocardiogramSample {}
3484);
3485
3486extern_conformance!(
3487    unsafe impl NSCopying for SRElectrocardiogramSample {}
3488);
3489
3490unsafe impl CopyingHelper for SRElectrocardiogramSample {
3491    type Result = Self;
3492}
3493
3494extern_conformance!(
3495    unsafe impl NSObjectProtocol for SRElectrocardiogramSample {}
3496);
3497
3498extern_conformance!(
3499    unsafe impl NSSecureCoding for SRElectrocardiogramSample {}
3500);
3501
3502impl SRElectrocardiogramSample {
3503    extern_methods!(
3504        #[unsafe(method(init))]
3505        #[unsafe(method_family = init)]
3506        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3507
3508        #[unsafe(method(new))]
3509        #[unsafe(method_family = new)]
3510        pub unsafe fn new() -> Retained<Self>;
3511
3512        /// Date of the start of the batch of ECG data
3513        #[unsafe(method(date))]
3514        #[unsafe(method_family = none)]
3515        pub unsafe fn date(&self) -> Retained<NSDate>;
3516
3517        /// Frequency in hertz at which the ECG data was recorded
3518        #[unsafe(method(frequency))]
3519        #[unsafe(method_family = none)]
3520        pub unsafe fn frequency(&self) -> Retained<NSMeasurement<NSUnitFrequency>>;
3521
3522        /// The session to which this sample belongs
3523        #[unsafe(method(session))]
3524        #[unsafe(method_family = none)]
3525        pub unsafe fn session(&self) -> Retained<SRElectrocardiogramSession>;
3526
3527        #[unsafe(method(lead))]
3528        #[unsafe(method_family = none)]
3529        pub unsafe fn lead(&self) -> SRElectrocardiogramLead;
3530
3531        #[unsafe(method(data))]
3532        #[unsafe(method_family = none)]
3533        pub unsafe fn data(&self) -> Retained<NSArray<SRElectrocardiogramData>>;
3534    );
3535}
3536
3537/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramopticalsamplecondition?language=objc)
3538// NS_TYPED_ENUM
3539pub type SRPhotoplethysmogramOpticalSampleCondition = NSString;
3540
3541extern "C" {
3542    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramopticalsampleconditionsignalsaturation?language=objc)
3543    pub static SRPhotoplethysmogramOpticalSampleConditionSignalSaturation:
3544        &'static SRPhotoplethysmogramOpticalSampleCondition;
3545}
3546
3547extern "C" {
3548    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramopticalsampleconditionunreliablenoise?language=objc)
3549    pub static SRPhotoplethysmogramOpticalSampleConditionUnreliableNoise:
3550        &'static SRPhotoplethysmogramOpticalSampleCondition;
3551}
3552
3553extern_class!(
3554    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramopticalsample?language=objc)
3555    #[unsafe(super(NSObject))]
3556    #[derive(Debug, PartialEq, Eq, Hash)]
3557    pub struct SRPhotoplethysmogramOpticalSample;
3558);
3559
3560unsafe impl Send for SRPhotoplethysmogramOpticalSample {}
3561
3562unsafe impl Sync for SRPhotoplethysmogramOpticalSample {}
3563
3564extern_conformance!(
3565    unsafe impl NSCoding for SRPhotoplethysmogramOpticalSample {}
3566);
3567
3568extern_conformance!(
3569    unsafe impl NSCopying for SRPhotoplethysmogramOpticalSample {}
3570);
3571
3572unsafe impl CopyingHelper for SRPhotoplethysmogramOpticalSample {
3573    type Result = Self;
3574}
3575
3576extern_conformance!(
3577    unsafe impl NSObjectProtocol for SRPhotoplethysmogramOpticalSample {}
3578);
3579
3580extern_conformance!(
3581    unsafe impl NSSecureCoding for SRPhotoplethysmogramOpticalSample {}
3582);
3583
3584impl SRPhotoplethysmogramOpticalSample {
3585    extern_methods!(
3586        #[unsafe(method(init))]
3587        #[unsafe(method_family = init)]
3588        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3589
3590        #[unsafe(method(new))]
3591        #[unsafe(method_family = new)]
3592        pub unsafe fn new() -> Retained<Self>;
3593
3594        /// The index of the LED in use during the sample reading
3595        #[unsafe(method(emitter))]
3596        #[unsafe(method_family = none)]
3597        pub unsafe fn emitter(&self) -> NSInteger;
3598
3599        /// The set of photodiodes in use during the sample reading
3600        #[unsafe(method(activePhotodiodeIndexes))]
3601        #[unsafe(method_family = none)]
3602        pub unsafe fn activePhotodiodeIndexes(&self) -> Retained<NSIndexSet>;
3603
3604        /// identifier to distinguish between different signals produced
3605        /// using the same photodiodes and emitters
3606        ///
3607        ///
3608        /// To provide the same quality of service certain system conditions may require configuring the
3609        /// PPG sensor behavior differently while using the same photodiodes and emitters. This
3610        /// identifier can be used distinguish between the different signals generated by these
3611        /// different configurations.
3612        #[unsafe(method(signalIdentifier))]
3613        #[unsafe(method_family = none)]
3614        pub unsafe fn signalIdentifier(&self) -> NSInteger;
3615
3616        /// the wavelength in nanometers the emitter was designed to produce while
3617        /// operating at a specific temperature
3618        #[unsafe(method(nominalWavelength))]
3619        #[unsafe(method_family = none)]
3620        pub unsafe fn nominalWavelength(&self) -> Retained<NSMeasurement<NSUnitLength>>;
3621
3622        /// a temperature compensated wavelength in nanometers estimate that the emitter is producing
3623        #[unsafe(method(effectiveWavelength))]
3624        #[unsafe(method_family = none)]
3625        pub unsafe fn effectiveWavelength(&self) -> Retained<NSMeasurement<NSUnitLength>>;
3626
3627        /// Sampling frequency of PPG data in Hz
3628        #[unsafe(method(samplingFrequency))]
3629        #[unsafe(method_family = none)]
3630        pub unsafe fn samplingFrequency(&self) -> Retained<NSMeasurement<NSUnitFrequency>>;
3631
3632        /// nanoseconds since the
3633        /// `SRPhotoplethysmogramSample`start date of the
3634        /// specific optical sample
3635        #[unsafe(method(nanosecondsSinceStart))]
3636        #[unsafe(method_family = none)]
3637        pub unsafe fn nanosecondsSinceStart(&self) -> i64;
3638
3639        /// The PPG waveform
3640        ///
3641        ///
3642        /// This may be
3643        /// `nil`when the sensor data reading is invalid
3644        #[unsafe(method(normalizedReflectance))]
3645        #[unsafe(method_family = none)]
3646        pub unsafe fn normalizedReflectance(&self) -> Option<Retained<NSNumber>>;
3647
3648        /// White noise estimation
3649        ///
3650        ///
3651        /// This may be
3652        /// `nil`when the sensor data reading is invalid
3653        #[unsafe(method(whiteNoise))]
3654        #[unsafe(method_family = none)]
3655        pub unsafe fn whiteNoise(&self) -> Option<Retained<NSNumber>>;
3656
3657        /// Pink noise estimation
3658        ///
3659        ///
3660        /// This may be
3661        /// `nil`when the sensor data reading is invalid
3662        #[unsafe(method(pinkNoise))]
3663        #[unsafe(method_family = none)]
3664        pub unsafe fn pinkNoise(&self) -> Option<Retained<NSNumber>>;
3665
3666        /// Estimated ambient noise intrusion
3667        ///
3668        ///
3669        /// This may be
3670        /// `nil`when the sensor data reading is invalid
3671        #[unsafe(method(backgroundNoise))]
3672        #[unsafe(method_family = none)]
3673        pub unsafe fn backgroundNoise(&self) -> Option<Retained<NSNumber>>;
3674
3675        /// Estimated electronics noise floor level of the sensor
3676        ///
3677        ///
3678        /// To estimate the total ambient noise, subtract scaled background noise offset
3679        /// from the background noise. The scaling factor can be computed based on
3680        /// the researcher's digital filter setup.
3681        /// This may be
3682        /// `nil`when the sensor data reading is invalid
3683        #[unsafe(method(backgroundNoiseOffset))]
3684        #[unsafe(method_family = none)]
3685        pub unsafe fn backgroundNoiseOffset(&self) -> Option<Retained<NSNumber>>;
3686
3687        /// Flags indicating sensor context or conditions that may effect
3688        /// the sample reading
3689        ///
3690        ///
3691        /// These flags can provide some indication of data validity or other system conditions
3692        /// that may influence how the recorded data should be treated.
3693        #[unsafe(method(conditions))]
3694        #[unsafe(method_family = none)]
3695        pub unsafe fn conditions(
3696            &self,
3697        ) -> Retained<NSArray<SRPhotoplethysmogramOpticalSampleCondition>>;
3698    );
3699}
3700
3701extern_class!(
3702    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramaccelerometersample?language=objc)
3703    #[unsafe(super(NSObject))]
3704    #[derive(Debug, PartialEq, Eq, Hash)]
3705    pub struct SRPhotoplethysmogramAccelerometerSample;
3706);
3707
3708unsafe impl Send for SRPhotoplethysmogramAccelerometerSample {}
3709
3710unsafe impl Sync for SRPhotoplethysmogramAccelerometerSample {}
3711
3712extern_conformance!(
3713    unsafe impl NSCoding for SRPhotoplethysmogramAccelerometerSample {}
3714);
3715
3716extern_conformance!(
3717    unsafe impl NSCopying for SRPhotoplethysmogramAccelerometerSample {}
3718);
3719
3720unsafe impl CopyingHelper for SRPhotoplethysmogramAccelerometerSample {
3721    type Result = Self;
3722}
3723
3724extern_conformance!(
3725    unsafe impl NSObjectProtocol for SRPhotoplethysmogramAccelerometerSample {}
3726);
3727
3728extern_conformance!(
3729    unsafe impl NSSecureCoding for SRPhotoplethysmogramAccelerometerSample {}
3730);
3731
3732impl SRPhotoplethysmogramAccelerometerSample {
3733    extern_methods!(
3734        #[unsafe(method(init))]
3735        #[unsafe(method_family = init)]
3736        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3737
3738        #[unsafe(method(new))]
3739        #[unsafe(method_family = new)]
3740        pub unsafe fn new() -> Retained<Self>;
3741
3742        /// nanoseconds since the
3743        /// `SRPhotoplethysmogramSample`start date of the specific
3744        /// accelerometer sample
3745        #[unsafe(method(nanosecondsSinceStart))]
3746        #[unsafe(method_family = none)]
3747        pub unsafe fn nanosecondsSinceStart(&self) -> i64;
3748
3749        /// Sampling frequency of accelerometer data in Hz
3750        #[unsafe(method(samplingFrequency))]
3751        #[unsafe(method_family = none)]
3752        pub unsafe fn samplingFrequency(&self) -> Retained<NSMeasurement<NSUnitFrequency>>;
3753
3754        /// X-axis acceleration in G's
3755        #[unsafe(method(x))]
3756        #[unsafe(method_family = none)]
3757        pub unsafe fn x(&self) -> Retained<NSMeasurement<NSUnitAcceleration>>;
3758
3759        /// Y-axis acceleration in G's
3760        #[unsafe(method(y))]
3761        #[unsafe(method_family = none)]
3762        pub unsafe fn y(&self) -> Retained<NSMeasurement<NSUnitAcceleration>>;
3763
3764        /// Z-axis acceleration in G's
3765        #[unsafe(method(z))]
3766        #[unsafe(method_family = none)]
3767        pub unsafe fn z(&self) -> Retained<NSMeasurement<NSUnitAcceleration>>;
3768    );
3769}
3770
3771/// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramsampleusage?language=objc)
3772// NS_TYPED_ENUM
3773pub type SRPhotoplethysmogramSampleUsage = NSString;
3774
3775extern "C" {
3776    /// A heart rate reading actively taken by a user in an app context
3777    ///
3778    ///
3779    /// Typically driven by the user using the HeartRate app or a workout session.
3780    ///
3781    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramsampleusageforegroundheartrate?language=objc)
3782    pub static SRPhotoplethysmogramSampleUsageForegroundHeartRate:
3783        &'static SRPhotoplethysmogramSampleUsage;
3784}
3785
3786extern "C" {
3787    /// A sensor reading actively taken by a user in a deep breathing context
3788    ///
3789    ///
3790    /// Typically driven by the user performing a reflect or breathe session
3791    /// in the Mindfulness app.
3792    ///
3793    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramsampleusagedeepbreathing?language=objc)
3794    pub static SRPhotoplethysmogramSampleUsageDeepBreathing:
3795        &'static SRPhotoplethysmogramSampleUsage;
3796}
3797
3798extern "C" {
3799    /// A blood oxygen reading actively taken by a user in app context
3800    ///
3801    ///
3802    /// Typically driven by the user using the BloodOxygen app
3803    ///
3804    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramsampleusageforegroundbloodoxygen?language=objc)
3805    pub static SRPhotoplethysmogramSampleUsageForegroundBloodOxygen:
3806        &'static SRPhotoplethysmogramSampleUsage;
3807}
3808
3809extern "C" {
3810    /// A sample reading passively taken by the system
3811    ///
3812    ///
3813    /// These are driven by the system to perform the various heart features of watchOS
3814    /// (e.g., background blood oxygen, afib notifications, low cardio notifications, etc)
3815    ///
3816    /// See also [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramsampleusagebackgroundsystem?language=objc)
3817    pub static SRPhotoplethysmogramSampleUsageBackgroundSystem:
3818        &'static SRPhotoplethysmogramSampleUsage;
3819}
3820
3821extern_class!(
3822    /// [Apple's documentation](https://developer.apple.com/documentation/sensorkit/srphotoplethysmogramsample?language=objc)
3823    #[unsafe(super(NSObject))]
3824    #[derive(Debug, PartialEq, Eq, Hash)]
3825    pub struct SRPhotoplethysmogramSample;
3826);
3827
3828unsafe impl Send for SRPhotoplethysmogramSample {}
3829
3830unsafe impl Sync for SRPhotoplethysmogramSample {}
3831
3832extern_conformance!(
3833    unsafe impl NSCoding for SRPhotoplethysmogramSample {}
3834);
3835
3836extern_conformance!(
3837    unsafe impl NSCopying for SRPhotoplethysmogramSample {}
3838);
3839
3840unsafe impl CopyingHelper for SRPhotoplethysmogramSample {
3841    type Result = Self;
3842}
3843
3844extern_conformance!(
3845    unsafe impl NSObjectProtocol for SRPhotoplethysmogramSample {}
3846);
3847
3848extern_conformance!(
3849    unsafe impl NSSecureCoding for SRPhotoplethysmogramSample {}
3850);
3851
3852impl SRPhotoplethysmogramSample {
3853    extern_methods!(
3854        #[unsafe(method(init))]
3855        #[unsafe(method_family = init)]
3856        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3857
3858        #[unsafe(method(new))]
3859        #[unsafe(method_family = new)]
3860        pub unsafe fn new() -> Retained<Self>;
3861
3862        /// the start date of a data collection session
3863        #[unsafe(method(startDate))]
3864        #[unsafe(method_family = none)]
3865        pub unsafe fn startDate(&self) -> Retained<NSDate>;
3866
3867        /// nanoseconds since the start date of this specific sample
3868        #[unsafe(method(nanosecondsSinceStart))]
3869        #[unsafe(method_family = none)]
3870        pub unsafe fn nanosecondsSinceStart(&self) -> i64;
3871
3872        /// How the sensor was being used during the sample reading
3873        ///
3874        ///
3875        /// It is possible for these to occur in combination
3876        #[unsafe(method(usage))]
3877        #[unsafe(method_family = none)]
3878        pub unsafe fn usage(&self) -> Retained<NSArray<SRPhotoplethysmogramSampleUsage>>;
3879
3880        #[unsafe(method(opticalSamples))]
3881        #[unsafe(method_family = none)]
3882        pub unsafe fn opticalSamples(&self)
3883            -> Retained<NSArray<SRPhotoplethysmogramOpticalSample>>;
3884
3885        #[unsafe(method(accelerometerSamples))]
3886        #[unsafe(method_family = none)]
3887        pub unsafe fn accelerometerSamples(
3888            &self,
3889        ) -> Retained<NSArray<SRPhotoplethysmogramAccelerometerSample>>;
3890
3891        /// temperature of the PPG sensors in the watch, measured in celsius
3892        ///
3893        ///
3894        /// This may be
3895        /// `nil`when the sensor data reading is invalid or if is not supported by the hardware
3896        #[unsafe(method(temperature))]
3897        #[unsafe(method_family = none)]
3898        pub unsafe fn temperature(&self) -> Option<Retained<NSMeasurement<NSUnitTemperature>>>;
3899    );
3900}