objc2_health_kit/generated/
HKDevice.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern "C" {
10    /// Used with predicateForObjectsWithDeviceProperty to specify a device name.
11    ///
12    /// The expected value type is an NSString.
13    ///
14    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevicepropertykeyname?language=objc)
15    pub static HKDevicePropertyKeyName: &'static NSString;
16}
17
18extern "C" {
19    /// Used with predicateForObjectsWithDeviceProperty to specify a device manufacturer.
20    ///
21    /// The expected value type is an NSString.
22    ///
23    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevicepropertykeymanufacturer?language=objc)
24    pub static HKDevicePropertyKeyManufacturer: &'static NSString;
25}
26
27extern "C" {
28    /// Used with predicateForObjectsWithDeviceProperty to specify a device model.
29    ///
30    /// The expected value type is an NSString.
31    ///
32    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevicepropertykeymodel?language=objc)
33    pub static HKDevicePropertyKeyModel: &'static NSString;
34}
35
36extern "C" {
37    /// Used with predicateForObjectsWithDeviceProperty to specify a hardware version.
38    ///
39    /// The expected value type is an NSString.
40    ///
41    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevicepropertykeyhardwareversion?language=objc)
42    pub static HKDevicePropertyKeyHardwareVersion: &'static NSString;
43}
44
45extern "C" {
46    /// Used with predicateForObjectsWithDeviceProperty to specify a firmware version.
47    ///
48    /// The expected value type is an NSString.
49    ///
50    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevicepropertykeyfirmwareversion?language=objc)
51    pub static HKDevicePropertyKeyFirmwareVersion: &'static NSString;
52}
53
54extern "C" {
55    /// Used with predicateForObjectsWithDeviceProperty to specify a software version.
56    ///
57    /// The expected value type is an NSString.
58    ///
59    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevicepropertykeysoftwareversion?language=objc)
60    pub static HKDevicePropertyKeySoftwareVersion: &'static NSString;
61}
62
63extern "C" {
64    /// Used with predicateForObjectsWithDeviceProperty to specify a local identifier.
65    ///
66    /// The expected value type is an NSString.
67    ///
68    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevicepropertykeylocalidentifier?language=objc)
69    pub static HKDevicePropertyKeyLocalIdentifier: &'static NSString;
70}
71
72extern "C" {
73    /// Used with predicateForObjectsWithDeviceProperty to specify a UDI device identifier.
74    ///
75    /// The expected value type is an NSString.
76    ///
77    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevicepropertykeyudideviceidentifier?language=objc)
78    pub static HKDevicePropertyKeyUDIDeviceIdentifier: &'static NSString;
79}
80
81extern_class!(
82    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkdevice?language=objc)
83    #[unsafe(super(NSObject))]
84    #[derive(Debug, PartialEq, Eq, Hash)]
85    pub struct HKDevice;
86);
87
88unsafe impl Send for HKDevice {}
89
90unsafe impl Sync for HKDevice {}
91
92extern_conformance!(
93    unsafe impl NSCoding for HKDevice {}
94);
95
96extern_conformance!(
97    unsafe impl NSCopying for HKDevice {}
98);
99
100unsafe impl CopyingHelper for HKDevice {
101    type Result = Self;
102}
103
104extern_conformance!(
105    unsafe impl NSObjectProtocol for HKDevice {}
106);
107
108extern_conformance!(
109    unsafe impl NSSecureCoding for HKDevice {}
110);
111
112impl HKDevice {
113    extern_methods!(
114        /// The name of the receiver.
115        ///
116        /// The user-facing name, such as the one displayed in the Bluetooth Settings for a BLE device.
117        #[unsafe(method(name))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn name(&self) -> Option<Retained<NSString>>;
120
121        /// The manufacturer of the receiver.
122        #[unsafe(method(manufacturer))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn manufacturer(&self) -> Option<Retained<NSString>>;
125
126        /// The model of the receiver.
127        #[unsafe(method(model))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn model(&self) -> Option<Retained<NSString>>;
130
131        /// The hardware revision of the receiver.
132        #[unsafe(method(hardwareVersion))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn hardwareVersion(&self) -> Option<Retained<NSString>>;
135
136        /// The firmware revision of the receiver.
137        #[unsafe(method(firmwareVersion))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn firmwareVersion(&self) -> Option<Retained<NSString>>;
140
141        /// The software revision of the receiver.
142        #[unsafe(method(softwareVersion))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn softwareVersion(&self) -> Option<Retained<NSString>>;
145
146        /// A unique identifier for the receiver.
147        ///
148        /// This property is available to clients for a local identifier.
149        /// For example, Bluetooth peripherals managed by HealthKit use this
150        /// for the CoreBluetooth UUID which is valid only on the local
151        /// device and thus distinguish the same Bluetooth peripheral used
152        /// between multiple devices.
153        #[unsafe(method(localIdentifier))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn localIdentifier(&self) -> Option<Retained<NSString>>;
156
157        /// Represents the device identifier portion of a device's FDA UDI (Unique Device Identifier).
158        ///
159        /// The device identifier can be used to reference the FDA's GUDID (Globally Unique Device
160        /// Identifier Database). Note that for user privacy concerns this field should not be used to
161        /// persist the production identifier portion of the device UDI. HealthKit clients should manage
162        /// the production identifier independently, if needed.
163        /// See http://www.fda.gov/MedicalDevices/DeviceRegulationandGuidance/UniqueDeviceIdentification/ for more information.
164        #[unsafe(method(UDIDeviceIdentifier))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn UDIDeviceIdentifier(&self) -> Option<Retained<NSString>>;
167
168        /// Initialize a new HKDevice with the specified values.
169        ///
170        /// This allows initialization of an HKDevice object based on the
171        /// information provided.
172        #[unsafe(method(initWithName:manufacturer:model:hardwareVersion:firmwareVersion:softwareVersion:localIdentifier:UDIDeviceIdentifier:))]
173        #[unsafe(method_family = init)]
174        pub unsafe fn initWithName_manufacturer_model_hardwareVersion_firmwareVersion_softwareVersion_localIdentifier_UDIDeviceIdentifier(
175            this: Allocated<Self>,
176            name: Option<&NSString>,
177            manufacturer: Option<&NSString>,
178            model: Option<&NSString>,
179            hardware_version: Option<&NSString>,
180            firmware_version: Option<&NSString>,
181            software_version: Option<&NSString>,
182            local_identifier: Option<&NSString>,
183            udi_device_identifier: Option<&NSString>,
184        ) -> Retained<Self>;
185
186        #[unsafe(method(init))]
187        #[unsafe(method_family = init)]
188        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
189
190        /// Returns a device representing the host.
191        ///
192        /// If an app chooses to save samples that were retrieved from the local device, e.g. an HKWorkout with a
193        /// totalDistance HKQuantity gathered from CoreLocation GPS distances, then this would be an appropriate
194        /// HKDevice to use.
195        #[unsafe(method(localDevice))]
196        #[unsafe(method_family = none)]
197        pub unsafe fn localDevice() -> Retained<HKDevice>;
198    );
199}
200
201/// Methods declared on superclass `NSObject`.
202impl HKDevice {
203    extern_methods!(
204        #[unsafe(method(new))]
205        #[unsafe(method_family = new)]
206        pub unsafe fn new() -> Retained<Self>;
207    );
208}