objc2_core_location/generated/
CLLocation.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10pub type CLLocationDegrees = c_double;
12
13pub type CLLocationAccuracy = c_double;
15
16pub type CLLocationSpeed = c_double;
18
19pub type CLLocationSpeedAccuracy = c_double;
21
22pub type CLLocationDirection = c_double;
24
25pub type CLLocationDirectionAccuracy = c_double;
27
28#[repr(C)]
30#[derive(Clone, Copy, Debug, PartialEq)]
31pub struct CLLocationCoordinate2D {
32 pub latitude: CLLocationDegrees,
33 pub longitude: CLLocationDegrees,
34}
35
36unsafe impl Encode for CLLocationCoordinate2D {
37 const ENCODING: Encoding = Encoding::Struct(
38 "CLLocationCoordinate2D",
39 &[<CLLocationDegrees>::ENCODING, <CLLocationDegrees>::ENCODING],
40 );
41}
42
43unsafe impl RefEncode for CLLocationCoordinate2D {
44 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47pub type CLLocationDistance = c_double;
49
50extern "C" {
51 pub static kCLDistanceFilterNone: CLLocationDistance;
53}
54
55extern "C" {
56 pub static kCLLocationAccuracyBestForNavigation: CLLocationAccuracy;
58}
59
60extern "C" {
61 pub static kCLLocationAccuracyBest: CLLocationAccuracy;
63}
64
65extern "C" {
66 pub static kCLLocationAccuracyNearestTenMeters: CLLocationAccuracy;
68}
69
70extern "C" {
71 pub static kCLLocationAccuracyHundredMeters: CLLocationAccuracy;
73}
74
75extern "C" {
76 pub static kCLLocationAccuracyKilometer: CLLocationAccuracy;
78}
79
80extern "C" {
81 pub static kCLLocationAccuracyThreeKilometers: CLLocationAccuracy;
83}
84
85extern "C" {
86 pub static kCLLocationAccuracyReduced: CLLocationAccuracy;
88}
89
90extern "C" {
91 pub static CLLocationDistanceMax: CLLocationDistance;
93}
94
95extern "C" {
96 pub static CLTimeIntervalMax: NSTimeInterval;
98}
99
100extern "C" {
101 pub static kCLLocationCoordinate2DInvalid: CLLocationCoordinate2D;
103}
104
105#[inline]
106pub unsafe extern "C-unwind" fn CLLocationCoordinate2DIsValid(
107 coord: CLLocationCoordinate2D,
108) -> bool {
109 extern "C-unwind" {
110 fn CLLocationCoordinate2DIsValid(coord: CLLocationCoordinate2D) -> Bool;
111 }
112 unsafe { CLLocationCoordinate2DIsValid(coord) }.as_bool()
113}
114
115extern "C-unwind" {
116 pub fn CLLocationCoordinate2DMake(
117 latitude: CLLocationDegrees,
118 longitude: CLLocationDegrees,
119 ) -> CLLocationCoordinate2D;
120}
121
122extern_class!(
123 #[unsafe(super(NSObject))]
125 #[derive(Debug, PartialEq, Eq, Hash)]
126 pub struct CLFloor;
127);
128
129unsafe impl NSCoding for CLFloor {}
130
131unsafe impl NSCopying for CLFloor {}
132
133unsafe impl CopyingHelper for CLFloor {
134 type Result = Self;
135}
136
137unsafe impl NSObjectProtocol for CLFloor {}
138
139unsafe impl NSSecureCoding for CLFloor {}
140
141impl CLFloor {
142 extern_methods!(
143 #[unsafe(method(level))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn level(&self) -> NSInteger;
146 );
147}
148
149impl CLFloor {
151 extern_methods!(
152 #[unsafe(method(init))]
153 #[unsafe(method_family = init)]
154 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156 #[unsafe(method(new))]
157 #[unsafe(method_family = new)]
158 pub unsafe fn new() -> Retained<Self>;
159 );
160}
161
162extern_class!(
163 #[unsafe(super(NSObject))]
165 #[derive(Debug, PartialEq, Eq, Hash)]
166 pub struct CLLocationSourceInformation;
167);
168
169unsafe impl NSCoding for CLLocationSourceInformation {}
170
171unsafe impl NSCopying for CLLocationSourceInformation {}
172
173unsafe impl CopyingHelper for CLLocationSourceInformation {
174 type Result = Self;
175}
176
177unsafe impl NSObjectProtocol for CLLocationSourceInformation {}
178
179unsafe impl NSSecureCoding for CLLocationSourceInformation {}
180
181impl CLLocationSourceInformation {
182 extern_methods!(
183 #[unsafe(method(initWithSoftwareSimulationState:andExternalAccessoryState:))]
184 #[unsafe(method_family = init)]
185 pub unsafe fn initWithSoftwareSimulationState_andExternalAccessoryState(
186 this: Allocated<Self>,
187 is_software: bool,
188 is_accessory: bool,
189 ) -> Retained<Self>;
190
191 #[unsafe(method(isSimulatedBySoftware))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn isSimulatedBySoftware(&self) -> bool;
194
195 #[unsafe(method(isProducedByAccessory))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn isProducedByAccessory(&self) -> bool;
198 );
199}
200
201impl CLLocationSourceInformation {
203 extern_methods!(
204 #[unsafe(method(init))]
205 #[unsafe(method_family = init)]
206 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
207
208 #[unsafe(method(new))]
209 #[unsafe(method_family = new)]
210 pub unsafe fn new() -> Retained<Self>;
211 );
212}
213
214extern_class!(
215 #[unsafe(super(NSObject))]
217 #[derive(Debug, PartialEq, Eq, Hash)]
218 pub struct CLLocation;
219);
220
221unsafe impl Send for CLLocation {}
222
223unsafe impl Sync for CLLocation {}
224
225unsafe impl NSCoding for CLLocation {}
226
227unsafe impl NSCopying for CLLocation {}
228
229unsafe impl CopyingHelper for CLLocation {
230 type Result = Self;
231}
232
233unsafe impl NSObjectProtocol for CLLocation {}
234
235unsafe impl NSSecureCoding for CLLocation {}
236
237impl CLLocation {
238 extern_methods!(
239 #[unsafe(method(initWithLatitude:longitude:))]
240 #[unsafe(method_family = init)]
241 pub unsafe fn initWithLatitude_longitude(
242 this: Allocated<Self>,
243 latitude: CLLocationDegrees,
244 longitude: CLLocationDegrees,
245 ) -> Retained<Self>;
246
247 #[unsafe(method(initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:timestamp:))]
248 #[unsafe(method_family = init)]
249 pub unsafe fn initWithCoordinate_altitude_horizontalAccuracy_verticalAccuracy_timestamp(
250 this: Allocated<Self>,
251 coordinate: CLLocationCoordinate2D,
252 altitude: CLLocationDistance,
253 h_accuracy: CLLocationAccuracy,
254 v_accuracy: CLLocationAccuracy,
255 timestamp: &NSDate,
256 ) -> Retained<Self>;
257
258 #[unsafe(method(initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:course:speed:timestamp:))]
259 #[unsafe(method_family = init)]
260 pub unsafe fn initWithCoordinate_altitude_horizontalAccuracy_verticalAccuracy_course_speed_timestamp(
261 this: Allocated<Self>,
262 coordinate: CLLocationCoordinate2D,
263 altitude: CLLocationDistance,
264 h_accuracy: CLLocationAccuracy,
265 v_accuracy: CLLocationAccuracy,
266 course: CLLocationDirection,
267 speed: CLLocationSpeed,
268 timestamp: &NSDate,
269 ) -> Retained<Self>;
270
271 #[unsafe(method(initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:))]
272 #[unsafe(method_family = init)]
273 pub unsafe fn initWithCoordinate_altitude_horizontalAccuracy_verticalAccuracy_course_courseAccuracy_speed_speedAccuracy_timestamp(
274 this: Allocated<Self>,
275 coordinate: CLLocationCoordinate2D,
276 altitude: CLLocationDistance,
277 h_accuracy: CLLocationAccuracy,
278 v_accuracy: CLLocationAccuracy,
279 course: CLLocationDirection,
280 course_accuracy: CLLocationDirectionAccuracy,
281 speed: CLLocationSpeed,
282 speed_accuracy: CLLocationSpeedAccuracy,
283 timestamp: &NSDate,
284 ) -> Retained<Self>;
285
286 #[unsafe(method(initWithCoordinate:altitude:horizontalAccuracy:verticalAccuracy:course:courseAccuracy:speed:speedAccuracy:timestamp:sourceInfo:))]
287 #[unsafe(method_family = init)]
288 pub unsafe fn initWithCoordinate_altitude_horizontalAccuracy_verticalAccuracy_course_courseAccuracy_speed_speedAccuracy_timestamp_sourceInfo(
289 this: Allocated<Self>,
290 coordinate: CLLocationCoordinate2D,
291 altitude: CLLocationDistance,
292 h_accuracy: CLLocationAccuracy,
293 v_accuracy: CLLocationAccuracy,
294 course: CLLocationDirection,
295 course_accuracy: CLLocationDirectionAccuracy,
296 speed: CLLocationSpeed,
297 speed_accuracy: CLLocationSpeedAccuracy,
298 timestamp: &NSDate,
299 source_info: &CLLocationSourceInformation,
300 ) -> Retained<Self>;
301
302 #[unsafe(method(coordinate))]
303 #[unsafe(method_family = none)]
304 pub unsafe fn coordinate(&self) -> CLLocationCoordinate2D;
305
306 #[unsafe(method(altitude))]
307 #[unsafe(method_family = none)]
308 pub unsafe fn altitude(&self) -> CLLocationDistance;
309
310 #[unsafe(method(ellipsoidalAltitude))]
311 #[unsafe(method_family = none)]
312 pub unsafe fn ellipsoidalAltitude(&self) -> CLLocationDistance;
313
314 #[unsafe(method(horizontalAccuracy))]
315 #[unsafe(method_family = none)]
316 pub unsafe fn horizontalAccuracy(&self) -> CLLocationAccuracy;
317
318 #[unsafe(method(verticalAccuracy))]
319 #[unsafe(method_family = none)]
320 pub unsafe fn verticalAccuracy(&self) -> CLLocationAccuracy;
321
322 #[unsafe(method(course))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn course(&self) -> CLLocationDirection;
325
326 #[unsafe(method(courseAccuracy))]
327 #[unsafe(method_family = none)]
328 pub unsafe fn courseAccuracy(&self) -> CLLocationDirectionAccuracy;
329
330 #[unsafe(method(speed))]
331 #[unsafe(method_family = none)]
332 pub unsafe fn speed(&self) -> CLLocationSpeed;
333
334 #[unsafe(method(speedAccuracy))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn speedAccuracy(&self) -> CLLocationSpeedAccuracy;
337
338 #[unsafe(method(timestamp))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn timestamp(&self) -> Retained<NSDate>;
341
342 #[unsafe(method(floor))]
343 #[unsafe(method_family = none)]
344 pub unsafe fn floor(&self) -> Option<Retained<CLFloor>>;
345
346 #[unsafe(method(sourceInformation))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn sourceInformation(&self) -> Option<Retained<CLLocationSourceInformation>>;
349 );
350}
351
352impl CLLocation {
354 extern_methods!(
355 #[unsafe(method(init))]
356 #[unsafe(method_family = init)]
357 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
358
359 #[unsafe(method(new))]
360 #[unsafe(method_family = new)]
361 pub unsafe fn new() -> Retained<Self>;
362 );
363}