objc2_io_bluetooth/generated/objc2/
IOBluetoothHandsFreeDevice.rs

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