1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;
use crate::*;
extern_class!(
/// APIs for managing a hands free device
///
/// (c) 2010 by Apple Inc. All rights reserved.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothhandsfreedevice?language=objc)
#[unsafe(super(IOBluetoothHandsFree, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "IOBluetoothHandsFree")]
pub struct IOBluetoothHandsFreeDevice;
);
#[cfg(feature = "IOBluetoothHandsFree")]
extern_conformance!(
unsafe impl NSObjectProtocol for IOBluetoothHandsFreeDevice {}
);
#[cfg(feature = "IOBluetoothHandsFree")]
impl IOBluetoothHandsFreeDevice {
extern_methods!(
#[cfg(all(feature = "IOBluetoothDevice", feature = "IOBluetoothObject"))]
/// Create a new IOBluetoothHandsFreeDevice to act as a hands free device
///
/// This will register a listener for incoming connections.
///
/// Parameter `device`: An IOBluetoothDevice
///
/// Parameter `inDelegate`: An object to act as delegate
///
/// Returns: A newly created IOBluetoothHandsFreeDevice object on success, nil on failure
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `delegate` should be of the correct type.
/// - `delegate` might not allow `None`.
#[unsafe(method(initWithDevice:delegate:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDevice_delegate(
this: Allocated<Self>,
device: Option<&IOBluetoothDevice>,
delegate: Option<&AnyObject>,
) -> Option<Retained<Self>>;
#[cfg(feature = "objc2-foundation")]
/// Dial a number
///
/// Calls aNumber
///
/// Parameter `aNumber`: The number to call - the gateway determines acceptable formats.
///
/// # Safety
///
/// `a_number` might not allow `None`.
#[unsafe(method(dialNumber:))]
#[unsafe(method_family = none)]
pub unsafe fn dialNumber(&self, a_number: Option<&NSString>);
/// Dial a number from memory
///
/// Calls a number from a memory (or speed dial) location.
///
/// Parameter `memoryLocation`: The location in memory
#[unsafe(method(memoryDial:))]
#[unsafe(method_family = none)]
pub unsafe fn memoryDial(&self, memory_location: c_int);
/// Redial a number
///
/// Redials the previous number stored by the hands free gateway.
#[unsafe(method(redial))]
#[unsafe(method_family = none)]
pub unsafe fn redial(&self);
/// Hang up a call or reject an incoming call
///
/// Hangs up the current call, or rejects an incoming call.
#[unsafe(method(endCall))]
#[unsafe(method_family = none)]
pub unsafe fn endCall(&self);
/// Accept an incoming call
///
/// Accepts an incoming call.
#[unsafe(method(acceptCall))]
#[unsafe(method_family = none)]
pub unsafe fn acceptCall(&self);
/// Accept an incoming call on the phone
///
/// Accepts an incoming call and then quickly transfer audio to the phone.
#[unsafe(method(acceptCallOnPhone))]
#[unsafe(method_family = none)]
pub unsafe fn acceptCallOnPhone(&self);
#[cfg(feature = "objc2-foundation")]
/// Send a key press
///
/// Sends a DTMF tone.
///
/// Parameter `character`: A single character in the set 0-9, #,*,A-D
///
/// # Safety
///
/// `character` might not allow `None`.
#[unsafe(method(sendDTMF:))]
#[unsafe(method_family = none)]
pub unsafe fn sendDTMF(&self, character: Option<&NSString>);
/// Get the subscriber number(s)
///
/// Gets the subscriber number(s) stored on the gateway. Each subscriber number is returned on the delegate method handsFree:subscriberNumber.
/// There is no guarantee that the gateway will have a subscriber number.
#[unsafe(method(subscriberNumber))]
#[unsafe(method_family = none)]
pub unsafe fn subscriberNumber(&self);
/// Get the current call list
///
/// Gets the current call list (active, held, and setup in process). Each call is returned on the delegate method handsFree:currentCall.
#[unsafe(method(currentCallList))]
#[unsafe(method_family = none)]
pub unsafe fn currentCallList(&self);
/// Release all held calls
///
/// Releases all held calls or sets User Determined User Busy for a waiting call.
#[unsafe(method(releaseHeldCalls))]
#[unsafe(method_family = none)]
pub unsafe fn releaseHeldCalls(&self);
/// Release all active calls
///
/// Releases all active calls (if any exist) and accepts the other (held or waiting) call.
#[unsafe(method(releaseActiveCalls))]
#[unsafe(method_family = none)]
pub unsafe fn releaseActiveCalls(&self);
/// Release an active call.
///
/// Releases the active call with index.
///
/// Parameter `index`: Index of the call to release
#[unsafe(method(releaseCall:))]
#[unsafe(method_family = none)]
pub unsafe fn releaseCall(&self, index: c_int);
/// Place all active calls on hold
///
/// Places all active calls (if any exist) on hold and accepts the other (held or waiting) call.
#[unsafe(method(holdCall))]
#[unsafe(method_family = none)]
pub unsafe fn holdCall(&self);
/// Place all other calls on hold.
///
/// Places all calls on hold except call with index.
///
/// Parameter `index`: Index of the call to not place on hold
#[unsafe(method(placeAllOthersOnHold:))]
#[unsafe(method_family = none)]
pub unsafe fn placeAllOthersOnHold(&self, index: c_int);
/// Add a held call to the current conversation
///
/// Adds a held call to the current conversation.
#[unsafe(method(addHeldCall))]
#[unsafe(method_family = none)]
pub unsafe fn addHeldCall(&self);
/// Release all active calls
///
/// Releases all active calls (if any exist) and accepts the other (held or waiting) call.
#[unsafe(method(callTransfer))]
#[unsafe(method_family = none)]
pub unsafe fn callTransfer(&self);
/// Transfer audio source to the computer.
///
/// Transfers audio to the computer.
#[unsafe(method(transferAudioToComputer))]
#[unsafe(method_family = none)]
pub unsafe fn transferAudioToComputer(&self);
/// Transfer audio source to the phone.
///
/// Transfers audio to the phone.
#[unsafe(method(transferAudioToPhone))]
#[unsafe(method_family = none)]
pub unsafe fn transferAudioToPhone(&self);
#[cfg(feature = "objc2-foundation")]
/// Send an SMS to a number.
///
/// Sends an SMS to aNumber with content aMessage. Currently this does not handle long SMS (>160 characters) or unicode messages.
///
/// # Safety
///
/// - `a_number` might not allow `None`.
/// - `a_message` might not allow `None`.
#[unsafe(method(sendSMS:message:))]
#[unsafe(method_family = none)]
pub unsafe fn sendSMS_message(
&self,
a_number: Option<&NSString>,
a_message: Option<&NSString>,
);
#[cfg(feature = "objc2-foundation")]
/// Send an AT command to the hands free gateway.
///
/// Sends an AT command to the hands free gateway with a timeout of 10 seconds and handled by the built-in response handling.
/// See sendAtCommand:timeout:selector:target for more details.
///
/// Parameter `atCommand`: AT command to send
///
/// # Safety
///
/// `at_command` might not allow `None`.
#[unsafe(method(sendATCommand:))]
#[unsafe(method_family = none)]
pub unsafe fn sendATCommand(&self, at_command: Option<&NSString>);
#[cfg(feature = "objc2-foundation")]
/// Send an AT command to the hands free gateway.
///
/// Sends an AT command to the hands free gateway with timeout.
/// On command complete (OK, ERROR, TIMEOUT response or after timeout seconds) will perform selector on target.
///
/// Parameter `atCommand`: AT command to send
///
/// # Safety
///
/// - `at_command` might not allow `None`.
/// - `selector` must be a valid selector.
/// - `target` should be of the correct type.
/// - `target` might not allow `None`.
#[unsafe(method(sendATCommand:timeout:selector:target:))]
#[unsafe(method_family = none)]
pub unsafe fn sendATCommand_timeout_selector_target(
&self,
at_command: Option<&NSString>,
timeout: c_float,
selector: Option<Sel>,
target: Option<&AnyObject>,
);
);
}
/// Methods declared on superclass `NSObject`.
#[cfg(feature = "IOBluetoothHandsFree")]
impl IOBluetoothHandsFreeDevice {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothhandsfreedevicedelegate?language=objc)
#[cfg(feature = "IOBluetoothHandsFree")]
pub unsafe trait IOBluetoothHandsFreeDeviceDelegate:
IOBluetoothHandsFreeDelegate
{
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate the service indicator has changed.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `isServiceAvailable`: 0 if no service available; 1 otherwise.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `is_service_available` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:isServiceAvailable:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_isServiceAvailable(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
is_service_available: Option<&NSNumber>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate the call indicator has changed.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `isCallActive`: 0 if no call is active; 1 otherwise.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `is_call_active` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:isCallActive:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_isCallActive(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
is_call_active: Option<&NSNumber>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate the call setup indicator has changed.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `callSetupMode`: 0 if not currently in call setup.
/// 1 if an incoming call is in call setup.
/// 2 if an outgoing call is in call setup.
/// 3 if the remote party is being alerted for an outgoing call.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `call_setup_mode` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:callSetupMode:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_callSetupMode(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
call_setup_mode: Option<&NSNumber>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate the call held indicator has changed.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `callHoldState`: 0 if no calls are held.
/// 1 if a call is on hold and an active call exists.
/// 2 if a call is on hold, but no active call exists.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `call_hold_state` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:callHoldState:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_callHoldState(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
call_hold_state: Option<&NSNumber>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate the signal indicator has changed.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `signalStrength`: 0-5 where 0 represents a weak signal.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `signal_strength` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:signalStrength:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_signalStrength(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
signal_strength: Option<&NSNumber>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate the roam indicator has changed.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `isRoaming`: 0 if not roaming; 1 otherwise.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `is_roaming` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:isRoaming:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_isRoaming(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
is_roaming: Option<&NSNumber>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate the battery charge indicator has changed.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `batteryCharge`: 0-5 where 0 represents a low battery charge.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `battery_charge` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:batteryCharge:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_batteryCharge(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
battery_charge: Option<&NSNumber>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate of an incoming call
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `number`: The remote caller's phone number
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `number` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:incomingCallFrom:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_incomingCallFrom(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
number: Option<&NSString>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate of a ring alert
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `ringAttempt`: The number or ring alerts received
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `ring_attempt` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:ringAttempt:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_ringAttempt(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
ring_attempt: Option<&NSNumber>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate of a current call.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `currentCall`: A dictionary representing a call. See "Hands free current call dictionary keys" for the keys and their values.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `current_call` generic should be of the correct type.
/// - `current_call` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:currentCall:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_currentCall(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
current_call: Option<&NSDictionary>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate a subscriber number.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `subscriberNumber`: A subscriber number. Note that a gateway may have multiple subscriber numbers in which case this will be called for each number.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `subscriber_number` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:subscriberNumber:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_subscriberNumber(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
subscriber_number: Option<&NSString>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate an incoming SMS has arrived.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `incomingSMS`: A dictionary representing an SMS. See "Hands free SMS dictionary keys" for the keys and their values.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `sms` generic should be of the correct type.
/// - `sms` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:incomingSMS:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_incomingSMS(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
sms: Option<&NSDictionary>,
);
#[cfg(feature = "objc2-foundation")]
/// Tells the delegate an unknown result code was received. Use this to add support additional response codes.
/// If a developer needs to change the handling of an implemented result code, they must use a subclass and override processResultCode:(NSString *)resultCode.
///
/// Parameter `device`: The IOBluetoothHandsFreeDevice object
///
/// Parameter `unhandledResultCode`: The result code. "/r/n" are stripped from the begining and end of the result code.
///
/// # Safety
///
/// - `device` might not allow `None`.
/// - `result_code` might not allow `None`.
#[optional]
#[unsafe(method(handsFree:unhandledResultCode:))]
#[unsafe(method_family = none)]
unsafe fn handsFree_unhandledResultCode(
&self,
device: Option<&IOBluetoothHandsFreeDevice>,
result_code: Option<&NSString>,
);
}
);