objc2_io_bluetooth/generated/OBEXBluetooth.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5
6use crate::*;
7
8extern "C-unwind" {
9 /// Create an OBEX session with a service ref, usually obtained from the device browser.
10 ///
11 /// Parameter `inSDPServiceRecordRef`: A valid service reference.
12 ///
13 /// Parameter `outSessionRef`: A valid ptr to an IOBluetoothOBEXSessionRef; will contain the newly created session if
14 /// return value is kOBEXSuccess.
15 ///
16 /// Returns: An error code value. 0 if successful.
17 ///
18 /// You will use a session reference to do all OBEX interaction to a specific device. This method DOES NOT
19 /// create a connection to the device of any kind.
20 ///
21 /// ** DEPRECATED IN BLUETOOTH 2.2 (Mac OS X 10.6)
22 /// ** You should transition your code to Objective-C equivalents.
23 /// ** This API may be removed any time in the future.
24 ///
25 /// # Safety
26 ///
27 /// `out_session_ref` must be a valid pointer.
28 #[cfg(all(feature = "IOBluetoothUserLib", feature = "OBEX"))]
29 #[deprecated]
30 pub fn IOBluetoothOBEXSessionCreateWithIOBluetoothSDPServiceRecordRef(
31 in_sdp_service_ref: &IOBluetoothSDPServiceRecordRef,
32 out_session_ref: *mut OBEXSessionRef,
33 ) -> OBEXError;
34}
35
36extern "C-unwind" {
37 /// Create an OBEX session with a device ref and an RFCOMM channel ID. This allows you to bypass the browser
38 /// if you already know the SDP information.
39 ///
40 /// Parameter `inDeviceRef`: A valid IOBluetoothDeviceRef reference.
41 ///
42 /// Parameter `inChannelID`: A valid RFCOMM channel ID on the target device.
43 ///
44 /// Parameter `outSessionRef`: A valid ptr to an IOBluetoothOBEXSessionRef; will contain the newly created session
45 /// if return value is kOBEXSuccess.
46 ///
47 /// Returns: An error code value. 0 if successful.
48 ///
49 /// You will use a session reference to do all OBEX interaction to a specific device. This method DOES NOT
50 /// create a connection to the device of any kind.
51 ///
52 /// ** DEPRECATED IN BLUETOOTH 2.2 (Mac OS X 10.6)
53 /// ** You should transition your code to Objective-C equivalents.
54 /// ** This API may be removed any time in the future.
55 ///
56 /// # Safety
57 ///
58 /// `out_session_ref` must be a valid pointer.
59 #[cfg(all(
60 feature = "Bluetooth",
61 feature = "IOBluetoothUserLib",
62 feature = "OBEX"
63 ))]
64 #[deprecated]
65 pub fn IOBluetoothOBEXSessionCreateWithIOBluetoothDeviceRefAndChannelNumber(
66 in_device_ref: &IOBluetoothDeviceRef,
67 in_channel_id: BluetoothRFCOMMChannelID,
68 out_session_ref: *mut OBEXSessionRef,
69 ) -> OBEXError;
70}
71
72extern "C-unwind" {
73 /// Create an OBEX session with an IOBluetoothRFCOMMchannel. This implies you are creating a OBEX SERVER
74 /// session that will dole out info to remote Bluetooth clients.
75 ///
76 /// Parameter `inRFCOMMChannel`: A valid IOBluetoothRFCOMMChannel reference.
77 ///
78 /// Parameter `inGetResponseCallback`: A callback for Get requests sent to your session by a remote device. Must be a
79 /// valid function ptr, otherwise why even call this?
80 ///
81 /// Parameter `outSessionRef`: A valid ptr to an IOBluetoothOBEXSessionRef; will contain the newly created
82 /// session if return value is kOBEXSuccess.
83 ///
84 /// Returns: An error code value. 0 if successful.
85 ///
86 /// This assumes that the RFCOMM channel you have passed it is already open and ready to transmit data
87 /// to the session.
88 ///
89 /// ** DEPRECATED IN BLUETOOTH 2.2 (Mac OS X 10.6)
90 /// ** You should transition your code to Objective-C equivalents.
91 /// ** This API may be removed any time in the future.
92 ///
93 /// # Safety
94 ///
95 /// - `in_callback` must be implemented correctly.
96 /// - `in_user_ref_con` must be a valid pointer.
97 /// - `out_session_ref` must be a valid pointer.
98 #[cfg(all(feature = "IOBluetoothUserLib", feature = "OBEX"))]
99 #[deprecated]
100 pub fn IOBluetoothOBEXSessionCreateWithIncomingIOBluetoothRFCOMMChannel(
101 in_rfcomm_channel_ref: &IOBluetoothRFCOMMChannelRef,
102 in_callback: OBEXSessionEventCallback,
103 in_user_ref_con: *mut c_void,
104 out_session_ref: *mut OBEXSessionRef,
105 ) -> OBEXError;
106}
107
108/// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothobexsessionopenconnectioncallback?language=objc)
109#[cfg(feature = "OBEX")]
110pub type IOBluetoothOBEXSessionOpenConnectionCallback =
111 Option<unsafe extern "C-unwind" fn(OBEXSessionRef, OBEXError, *mut c_void)>;
112
113extern "C-unwind" {
114 /// Parameter `inSessionRef`: A valid session reference.
115 ///
116 /// Parameter `inCallback`: A valid callback.
117 ///
118 /// Parameter `inUserRefCon`: Optional parameter; can contain anything you wish. Will be returned in your
119 /// callback just as you passed it.
120 ///
121 /// Returns: An error code value. 0 if successful.
122 ///
123 /// Opens a transport-level connection to a remote target. For example, if you are using a Bluetooth transport,
124 /// this will establish the baseband/L2CAP/RFCOMM connection to a device. Once the callback is called, the
125 /// connection will either be opened or have failed with a status code. That status code will most likely have
126 /// originated from the transport layer being used, so you may receive a Bluetooth error, an IOKit error, etc,
127 /// but a 0 status should indicate success in all cases.
128 ///
129 /// ** DEPRECATED IN BLUETOOTH 2.2 (Mac OS X 10.6)
130 /// ** You should transition your code to Objective-C equivalents.
131 /// ** This API may be removed any time in the future.
132 ///
133 /// # Safety
134 ///
135 /// - `in_session_ref` must be a valid pointer.
136 /// - `in_callback` must be implemented correctly.
137 /// - `in_user_ref_con` must be a valid pointer.
138 #[cfg(feature = "OBEX")]
139 #[deprecated]
140 pub fn IOBluetoothOBEXSessionOpenTransportConnection(
141 in_session_ref: OBEXSessionRef,
142 in_callback: IOBluetoothOBEXSessionOpenConnectionCallback,
143 in_user_ref_con: *mut c_void,
144 ) -> OBEXError;
145}