objc2_io_bluetooth/generated/objc2/IOBluetoothL2CAPChannel.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
11/// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchanneleventtype?language=objc)
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct IOBluetoothL2CAPChannelEventType(pub c_uint);
15impl IOBluetoothL2CAPChannelEventType {
16 #[doc(alias = "kIOBluetoothL2CAPChannelEventTypeData")]
17 pub const Data: Self = Self(0x0001);
18 #[doc(alias = "kIOBluetoothL2CAPChannelEventTypeOpenComplete")]
19 pub const OpenComplete: Self = Self(0x0002);
20 #[doc(alias = "kIOBluetoothL2CAPChannelEventTypeClosed")]
21 pub const Closed: Self = Self(0x0003);
22 #[doc(alias = "kIOBluetoothL2CAPChannelEventTypeReconfigured")]
23 pub const Reconfigured: Self = Self(0x0004);
24 #[doc(alias = "kIOBluetoothL2CAPChannelEventTypeWriteComplete")]
25 pub const WriteComplete: Self = Self(0x0005);
26 #[doc(alias = "kIOBluetoothL2CAPChannelEventTypeQueueSpaceAvailable")]
27 pub const QueueSpaceAvailable: Self = Self(0x0006);
28}
29
30unsafe impl Encode for IOBluetoothL2CAPChannelEventType {
31 const ENCODING: Encoding = c_uint::ENCODING;
32}
33
34unsafe impl RefEncode for IOBluetoothL2CAPChannelEventType {
35 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38/// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchanneldatablock?language=objc)
39#[repr(C)]
40#[derive(Clone, Copy, Debug, PartialEq)]
41pub struct IOBluetoothL2CAPChannelDataBlock {
42 pub dataPtr: *mut c_void,
43 pub dataSize: usize,
44}
45
46unsafe impl Encode for IOBluetoothL2CAPChannelDataBlock {
47 const ENCODING: Encoding = Encoding::Struct(
48 "IOBluetoothL2CAPChannelDataBlock",
49 &[<*mut c_void>::ENCODING, <usize>::ENCODING],
50 );
51}
52
53unsafe impl RefEncode for IOBluetoothL2CAPChannelDataBlock {
54 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
55}
56
57/// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchannelevent_u?language=objc)
58#[repr(C)]
59#[derive(Clone, Copy)]
60pub union IOBluetoothL2CAPChannelEvent_u {
61 pub data: IOBluetoothL2CAPChannelDataBlock,
62 pub writeRefCon: *mut c_void,
63 pub padding: [u8; 32],
64}
65
66unsafe impl Encode for IOBluetoothL2CAPChannelEvent_u {
67 const ENCODING: Encoding = Encoding::Union(
68 "?",
69 &[
70 <IOBluetoothL2CAPChannelDataBlock>::ENCODING,
71 <*mut c_void>::ENCODING,
72 <[u8; 32]>::ENCODING,
73 ],
74 );
75}
76
77unsafe impl RefEncode for IOBluetoothL2CAPChannelEvent_u {
78 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
79}
80
81/// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchannelevent?language=objc)
82#[repr(C)]
83#[derive(Clone, Copy)]
84pub struct IOBluetoothL2CAPChannelEvent {
85 pub eventType: IOBluetoothL2CAPChannelEventType,
86 pub u: IOBluetoothL2CAPChannelEvent_u,
87 pub status: IOReturn,
88}
89
90unsafe impl Encode for IOBluetoothL2CAPChannelEvent {
91 const ENCODING: Encoding = Encoding::Struct(
92 "IOBluetoothL2CAPChannelEvent",
93 &[
94 <IOBluetoothL2CAPChannelEventType>::ENCODING,
95 <IOBluetoothL2CAPChannelEvent_u>::ENCODING,
96 <IOReturn>::ENCODING,
97 ],
98 );
99}
100
101unsafe impl RefEncode for IOBluetoothL2CAPChannelEvent {
102 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
103}
104
105/// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchannelincomingdatalistener?language=objc)
106#[cfg(feature = "IOBluetoothUserLib")]
107pub type IOBluetoothL2CAPChannelIncomingDataListener = Option<
108 unsafe extern "C-unwind" fn(*mut IOBluetoothL2CAPChannelRef, *mut c_void, u16, *mut c_void),
109>;
110
111/// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchannelincomingeventlistener?language=objc)
112#[cfg(feature = "IOBluetoothUserLib")]
113pub type IOBluetoothL2CAPChannelIncomingEventListener = Option<
114 unsafe extern "C-unwind" fn(
115 *mut IOBluetoothL2CAPChannelRef,
116 *mut c_void,
117 *mut IOBluetoothL2CAPChannelEvent,
118 ),
119>;
120
121extern_class!(
122 /// An instance of IOBluetoothL2CAPChannel represents a single open L2CAP channel.
123 ///
124 /// A client won't create IOBluetoothL2CAPChannel objects directly. Instead, the IOBluetoothDevice's
125 /// L2CAP channel open API is responsible for opening a new L2CAP channel and returning an
126 /// IOBluetoothL2CAPChannel instance representing that newly opened channel. Additionally, the IOBluetooth
127 /// notification system will send notifications when new L2CAP channels are open (if requested).
128 ///
129 /// After a new L2CAP channel is opened, the L2CAP configuration process will not be completed until an
130 /// incoming data listener is registered with the IOBluetoothL2CAPChannel object. The reason for this is
131 /// to due to the limited buffering done of incoming L2CAP data. This way, we avoid the situation where
132 /// incoming data is received before the client is ready for it. Once a client is done with an
133 /// IOBluetoothL2CAPChannel that it opened, it should call -closeChannel. Additionally, if the client
134 /// does not intend to use the connection to the remote device any further, it should call -closeConnection
135 /// on the IOBluetoothDevice object.
136 ///
137 /// See also [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchannel?language=objc)
138 #[unsafe(super(IOBluetoothObject, NSObject))]
139 #[derive(Debug, PartialEq, Eq, Hash)]
140 #[cfg(feature = "IOBluetoothObject")]
141 pub struct IOBluetoothL2CAPChannel;
142);
143
144#[cfg(all(feature = "IOBluetoothObject", feature = "objc2-foundation"))]
145extern_conformance!(
146 unsafe impl NSCopying for IOBluetoothL2CAPChannel {}
147);
148
149#[cfg(all(feature = "IOBluetoothObject", feature = "objc2-foundation"))]
150unsafe impl CopyingHelper for IOBluetoothL2CAPChannel {
151 type Result = Self;
152}
153
154#[cfg(feature = "IOBluetoothObject")]
155extern_conformance!(
156 unsafe impl NSObjectProtocol for IOBluetoothL2CAPChannel {}
157);
158
159#[cfg(all(feature = "IOBluetoothObject", feature = "objc2-foundation"))]
160extern_conformance!(
161 unsafe impl NSPortDelegate for IOBluetoothL2CAPChannel {}
162);
163
164#[cfg(feature = "IOBluetoothObject")]
165impl IOBluetoothL2CAPChannel {
166 extern_methods!(
167 #[cfg(feature = "IOBluetoothUserNotification")]
168 /// Allows a client to register for L2CAP channel open notifications for any L2CAP channel.
169 ///
170 /// The given selector will be called on the target object whenever any L2CAP channel is opened.
171 /// The selector should accept two arguments. The first is the user notification object. The second
172 /// is the IOBluetoothL2CAPChannel that was opened.
173 ///
174 /// Parameter `object`: Target object
175 ///
176 /// Parameter `selector`: Selector to be called on the target object when a new L2CAP channel is opened.
177 ///
178 /// Returns: Returns an IOBluetoothUserNotification representing the outstanding L2CAP channel notification.
179 /// To unregister the notification, call -unregister on the resulting IOBluetoothUserNotification
180 /// object. If an error is encountered creating the notification, nil is returned. The returned
181 /// IOBluetoothUserNotification will be valid for as long as the notification is registered. It is
182 /// not necessary to retain the result. Once -unregister is called on it, it will no longer be valid.
183 #[unsafe(method(registerForChannelOpenNotifications:selector:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn registerForChannelOpenNotifications_selector(
186 object: Option<&AnyObject>,
187 selector: Option<Sel>,
188 ) -> Option<Retained<IOBluetoothUserNotification>>;
189
190 #[cfg(all(
191 feature = "Bluetooth",
192 feature = "IOBluetoothUserLib",
193 feature = "IOBluetoothUserNotification"
194 ))]
195 /// Allows a client to register for L2CAP channel open notifications for certain types of
196 /// L2CAP channels.
197 ///
198 /// The given selector will be called on the target object whenever an L2CAP channel with the given
199 /// attributes is opened. The selector should accept two arguments. The first is the user
200 /// notification object. The second is the IOBluetoothL2CAPChannel that was opened.
201 ///
202 /// Parameter `object`: Target object
203 ///
204 /// Parameter `selector`: Selector to be called on the target object when a new L2CAP channel is opened.
205 ///
206 /// Parameter `psm`: PSM to match a new L2CAP channel. If the PSM doesn't matter, 0 may be passed in.
207 ///
208 /// Parameter `inDirection`: The desired direction of the L2CAP channel - kIOBluetoothUserNotificationChannelDirectionAny
209 /// if the direction doesn't matter.
210 ///
211 /// Returns: Returns an IOBluetoothUserNotification representing the outstanding L2CAP channel notification.
212 /// To unregister the notification, call -unregister on the resulting IOBluetoothUserNotification
213 /// object. If an error is encountered creating the notification, nil is returned. The returned
214 /// IOBluetoothUserNotification will be valid for as long as the notification is registered. It is
215 /// not necessary to retain the result. Once -unregister is called on it, it will no longer be valid.
216 #[unsafe(method(registerForChannelOpenNotifications:selector:withPSM:direction:))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn registerForChannelOpenNotifications_selector_withPSM_direction(
219 object: Option<&AnyObject>,
220 selector: Option<Sel>,
221 psm: BluetoothL2CAPPSM,
222 in_direction: IOBluetoothUserNotificationChannelDirection,
223 ) -> Option<Retained<IOBluetoothUserNotification>>;
224
225 #[cfg(feature = "IOBluetoothUserLib")]
226 /// Returns the IObluetoothL2CAPChannel with the given IOBluetoothObjectID.
227 ///
228 /// The IOBluetoothObjectID can be used as a global reference for a given IOBluetoothL2CAPChannel. It allows
229 /// two separate applications to refer to the same IOBluetoothL2CAPChannel object.
230 ///
231 /// Parameter `objectID`: IOBluetoothObjectID of the desired IOBluetoothL2CAPChannel.
232 ///
233 /// Returns: Returns the IOBluetoothL2CAPChannel that matches the given IOBluetoothObjectID if one exists.
234 /// If no matching L2CAP channel exists, nil is returned.
235 #[unsafe(method(withObjectID:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn withObjectID(object_id: IOBluetoothObjectID) -> Option<Retained<Self>>;
238
239 /// Initiates the close process on an open L2CAP channel.
240 ///
241 /// This method may only be called by the client that opened the channel in the first place. In the future
242 /// asynchronous and synchronous versions will be provided that let the client know when the close process
243 /// has been finished.
244 ///
245 /// Returns: Returns kIOReturnSuccess on success.
246 #[unsafe(method(closeChannel))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn closeChannel(&self) -> IOReturn;
249
250 #[cfg(feature = "Bluetooth")]
251 /// Returns the current outgoing MTU for the L2CAP channel.
252 ///
253 /// The outgoing MTU represents the maximum L2CAP packet size for packets being sent to the remote device.
254 ///
255 /// Returns: Returns the current outgoing MTU for the L2CAP channel.
256 #[unsafe(method(outgoingMTU))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn outgoingMTU(&self) -> BluetoothL2CAPMTU;
259
260 #[cfg(feature = "Bluetooth")]
261 #[deprecated]
262 #[unsafe(method(getOutgoingMTU))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn getOutgoingMTU(&self) -> BluetoothL2CAPMTU;
265
266 #[cfg(feature = "Bluetooth")]
267 /// Returns the current incoming MTU for the L2CAP channel.
268 ///
269 /// The incoming MTU represents the maximum L2CAP packet size for packets being sent by the remote device.
270 ///
271 /// Returns: Returns the current incoming MTU for the L2CAP channel.
272 #[unsafe(method(incomingMTU))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn incomingMTU(&self) -> BluetoothL2CAPMTU;
275
276 #[cfg(feature = "Bluetooth")]
277 #[deprecated]
278 #[unsafe(method(getIncomingMTU))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn getIncomingMTU(&self) -> BluetoothL2CAPMTU;
281
282 #[cfg(feature = "Bluetooth")]
283 /// Initiates the process to reconfigure the L2CAP channel with a new outgoing MTU.
284 ///
285 /// Currently, this API does not give an indication that the re-config process has completed. In
286 /// the future additional API will be available to provide that information both synchronously and
287 /// asynchronously.
288 ///
289 /// Parameter `remoteMTU`: The desired outgoing MTU.
290 ///
291 /// Returns: Returns kIOReturnSuccess if the channel re-configure process was successfully initiated.
292 #[unsafe(method(requestRemoteMTU:))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn requestRemoteMTU(&self, remote_mtu: BluetoothL2CAPMTU) -> IOReturn;
295
296 /// Writes the given data over the target L2CAP channel asynchronously to the remote device using
297 /// IOConnectTrap4() call.
298 ///
299 /// The length of the data may not exceed the L2CAP channel's ougoing MTU. When the data has
300 /// been successfully passed to the hardware to be transmitted, the delegate method
301 /// -l2capChannelWriteComplete:refcon:status: will be called with the refcon passed
302 /// into this method.
303 ///
304 /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
305 ///
306 /// Parameter `data`: Pointer to the buffer containing the data to send.
307 ///
308 /// Parameter `length`: The length of the given data buffer.
309 ///
310 /// Parameter `refcon`: User supplied value that gets passed to the write callback.
311 ///
312 /// Returns: Returns kIOReturnSuccess if the data was buffered successfully.
313 #[unsafe(method(writeAsyncTrap:length:refcon:))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn writeAsyncTrap_length_refcon(
316 &self,
317 data: *mut c_void,
318 length: u16,
319 refcon: *mut c_void,
320 ) -> IOReturn;
321
322 /// Writes the given data over the target L2CAP channel asynchronously to the remote device.
323 ///
324 /// The length of the data may not exceed the L2CAP channel's ougoing MTU. When the data has
325 /// been successfully passed to the hardware to be transmitted, the delegate method
326 /// -l2capChannelWriteComplete:refcon:status: will be called with the refcon passed
327 /// into this method.
328 ///
329 /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
330 ///
331 /// Parameter `data`: Pointer to the buffer containing the data to send.
332 ///
333 /// Parameter `length`: The length of the given data buffer.
334 ///
335 /// Parameter `refcon`: User supplied value that gets passed to the write callback.
336 ///
337 /// Returns: Returns kIOReturnSuccess if the data was buffered successfully.
338 #[unsafe(method(writeAsync:length:refcon:))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn writeAsync_length_refcon(
341 &self,
342 data: *mut c_void,
343 length: u16,
344 refcon: *mut c_void,
345 ) -> IOReturn;
346
347 /// Writes the given data synchronously over the target L2CAP channel to the remote device.
348 ///
349 /// The length of the data may not exceed the L2CAP channel's ougoing MTU. This method will
350 /// block until the data has been successfully sent to the hardware for transmission (or an error
351 /// occurs).
352 ///
353 /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
354 ///
355 /// Parameter `data`: Pointer to the buffer containing the data to send.
356 ///
357 /// Parameter `length`: The length of the given data buffer.
358 ///
359 /// Returns: Returns kIOReturnSuccess if the data was written successfully.
360 #[unsafe(method(writeSync:length:))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn writeSync_length(&self, data: *mut c_void, length: u16) -> IOReturn;
363
364 /// Allows an object to register itself as client of the L2CAP channel.
365 ///
366 /// A channel delegate is the object the L2CAP channel uses as target for data and events. The
367 /// developer will implement only the the methods he/she is interested in. A list of the
368 /// possible methods is at the end of this file in the definition of the informal protocol
369 /// IOBluetoothL2CAPChannelDelegate.
370 /// A newly opened L2CAP channel will not complete its configuration process until the client
371 /// that opened it registers a connectionHandler. This prevents that case where incoming
372 /// data is received before the client is ready.
373 ///
374 /// NOTE: This method is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later.
375 ///
376 /// Parameter `channelDelegate`: the object that will play the role of channel delegate [NOTE the l2cap channel will retain the delegate].
377 ///
378 /// Returns: Returns kIOReturnSuccess if the delegate is successfully registered.
379 #[unsafe(method(setDelegate:))]
380 #[unsafe(method_family = none)]
381 pub unsafe fn setDelegate(&self, channel_delegate: Option<&AnyObject>) -> IOReturn;
382
383 #[cfg(feature = "objc2-foundation")]
384 /// Allows an object to register itself as client of the L2CAP channel.
385 ///
386 /// A channel delegate is the object the L2CAP channel uses as target for data and events. The
387 /// developer will implement only the the methods he/she is interested in. A list of the
388 /// possible methods is at the end of this file in the definition of the informal protocol
389 /// IOBluetoothL2CAPChannelDelegate.
390 /// A newly opened L2CAP channel will not complete its configuration process until the client
391 /// that opened it registers a connectionHandler. This prevents that case where incoming
392 /// data is received before the client is ready.
393 ///
394 /// NOTE: This method is only available in Mac OS X 10.5 (Bluetooth v2.0) or later.
395 ///
396 /// Parameter `channelDelegate`: the object that will play the role of channel delegate.
397 ///
398 /// Parameter `channelConfiguration`: the dictionary that describes the initial configuration for
399 /// the channel.
400 ///
401 /// Returns: Returns kIOReturnSuccess if the delegate is successfully registered.
402 #[unsafe(method(setDelegate:withConfiguration:))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn setDelegate_withConfiguration(
405 &self,
406 channel_delegate: Option<&AnyObject>,
407 channel_configuration: Option<&NSDictionary>,
408 ) -> IOReturn;
409
410 /// Returns the currently assigned delegate
411 ///
412 /// An incoming channel is one that was initiated by a remote device.
413 ///
414 /// Returns: Returns the current delegate, or nil if one is not set.
415 #[unsafe(method(delegate))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
418
419 #[cfg(feature = "IOBluetoothDevice")]
420 /// Returns the IOBluetoothDevice to which the target L2CAP channel is open.
421 ///
422 /// Returns: Returns the IOBluetoothDevice to which the target L2CAP channel is open.
423 #[unsafe(method(device))]
424 #[unsafe(method_family = none)]
425 pub unsafe fn device(&self) -> Option<Retained<IOBluetoothDevice>>;
426
427 #[cfg(feature = "IOBluetoothDevice")]
428 #[deprecated]
429 #[unsafe(method(getDevice))]
430 #[unsafe(method_family = none)]
431 pub unsafe fn getDevice(&self) -> Option<Retained<IOBluetoothDevice>>;
432
433 #[cfg(feature = "IOBluetoothUserLib")]
434 /// Returns the IOBluetoothObjectID of the given IOBluetoothL2CAPChannel.
435 ///
436 /// The IOBluetoothObjectID can be used as a global reference for a given IOBluetoothL2CAPChannel. It allows
437 /// two separate applications to refer to the same IOBluetoothL2CAPChannel.
438 ///
439 /// Returns: Returns the IOBluetoothObjectID of the given IOBluetoothL2CAPChannel.
440 #[unsafe(method(objectID))]
441 #[unsafe(method_family = none)]
442 pub unsafe fn objectID(&self) -> IOBluetoothObjectID;
443
444 #[cfg(feature = "IOBluetoothUserLib")]
445 #[deprecated]
446 #[unsafe(method(getObjectID))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn getObjectID(&self) -> IOBluetoothObjectID;
449
450 #[cfg(feature = "Bluetooth")]
451 /// Returns the PSM for the target L2CAP channel.
452 ///
453 /// Returns: Returns the PSM for the target L2CAP channel.
454 #[unsafe(method(PSM))]
455 #[unsafe(method_family = none)]
456 pub unsafe fn PSM(&self) -> BluetoothL2CAPPSM;
457
458 #[cfg(feature = "Bluetooth")]
459 #[deprecated]
460 #[unsafe(method(getPSM))]
461 #[unsafe(method_family = none)]
462 pub unsafe fn getPSM(&self) -> BluetoothL2CAPPSM;
463
464 #[cfg(feature = "Bluetooth")]
465 /// Returns the local L2CAP channel ID for the target L2CAP channel.
466 ///
467 /// Returns: Returns the local L2CAP channel ID for the target L2CAP channel.
468 #[unsafe(method(localChannelID))]
469 #[unsafe(method_family = none)]
470 pub unsafe fn localChannelID(&self) -> BluetoothL2CAPChannelID;
471
472 #[cfg(feature = "Bluetooth")]
473 #[deprecated]
474 #[unsafe(method(getLocalChannelID))]
475 #[unsafe(method_family = none)]
476 pub unsafe fn getLocalChannelID(&self) -> BluetoothL2CAPChannelID;
477
478 #[cfg(feature = "Bluetooth")]
479 /// Returns the remote L2CAP channel ID for the target L2CAP channel.
480 ///
481 /// Returns: Returns the remote L2CAP channel ID for the target L2CAP channel.
482 #[unsafe(method(remoteChannelID))]
483 #[unsafe(method_family = none)]
484 pub unsafe fn remoteChannelID(&self) -> BluetoothL2CAPChannelID;
485
486 #[cfg(feature = "Bluetooth")]
487 #[deprecated]
488 #[unsafe(method(getRemoteChannelID))]
489 #[unsafe(method_family = none)]
490 pub unsafe fn getRemoteChannelID(&self) -> BluetoothL2CAPChannelID;
491
492 /// Returns TRUE if the channel is an incoming channel.
493 ///
494 /// An incoming channel is one that was initiated by a remote device.
495 ///
496 /// Returns: Returns TRUE if the channel is an incoming channel.
497 #[unsafe(method(isIncoming))]
498 #[unsafe(method_family = none)]
499 pub unsafe fn isIncoming(&self) -> bool;
500
501 #[cfg(feature = "IOBluetoothUserNotification")]
502 /// Allows a client to register for a channel close notification.
503 ///
504 /// The given selector will be called on the target observer when the L2CAP channel is closed.
505 /// The selector should contain two arguments. The first is the user notification object. The second
506 /// is the IOBluetoothL2CAPChannel that was closed.
507 ///
508 /// Parameter `observer`: Target observer object
509 ///
510 /// Parameter `inSelector`: Selector to be sent to the observer when the L2CAP channel is closed.
511 ///
512 /// Returns: Returns an IOBluetoothUserNotification representing the outstanding L2CAP channel close notification.
513 /// To unregister the notification, call -unregister of the returned IOBluetoothUserNotification
514 /// object. If an error is encountered creating the notification, nil is returned.
515 #[unsafe(method(registerForChannelCloseNotification:selector:))]
516 #[unsafe(method_family = none)]
517 pub unsafe fn registerForChannelCloseNotification_selector(
518 &self,
519 observer: Option<&AnyObject>,
520 in_selector: Option<Sel>,
521 ) -> Option<Retained<IOBluetoothUserNotification>>;
522 );
523}
524
525/// Methods declared on superclass `NSObject`.
526#[cfg(feature = "IOBluetoothObject")]
527impl IOBluetoothL2CAPChannel {
528 extern_methods!(
529 #[unsafe(method(init))]
530 #[unsafe(method_family = init)]
531 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
532
533 #[unsafe(method(new))]
534 #[unsafe(method_family = new)]
535 pub unsafe fn new() -> Retained<Self>;
536 );
537}
538
539extern_protocol!(
540 /// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchanneldelegate?language=objc)
541 pub unsafe trait IOBluetoothL2CAPChannelDelegate {
542 #[cfg(feature = "IOBluetoothObject")]
543 #[optional]
544 #[unsafe(method(l2capChannelData:data:length:))]
545 #[unsafe(method_family = none)]
546 unsafe fn l2capChannelData_data_length(
547 &self,
548 l2cap_channel: Option<&IOBluetoothL2CAPChannel>,
549 data_pointer: *mut c_void,
550 data_length: usize,
551 );
552
553 #[cfg(feature = "IOBluetoothObject")]
554 #[optional]
555 #[unsafe(method(l2capChannelOpenComplete:status:))]
556 #[unsafe(method_family = none)]
557 unsafe fn l2capChannelOpenComplete_status(
558 &self,
559 l2cap_channel: Option<&IOBluetoothL2CAPChannel>,
560 error: IOReturn,
561 );
562
563 #[cfg(feature = "IOBluetoothObject")]
564 #[optional]
565 #[unsafe(method(l2capChannelClosed:))]
566 #[unsafe(method_family = none)]
567 unsafe fn l2capChannelClosed(&self, l2cap_channel: Option<&IOBluetoothL2CAPChannel>);
568
569 #[cfg(feature = "IOBluetoothObject")]
570 #[optional]
571 #[unsafe(method(l2capChannelReconfigured:))]
572 #[unsafe(method_family = none)]
573 unsafe fn l2capChannelReconfigured(&self, l2cap_channel: Option<&IOBluetoothL2CAPChannel>);
574
575 #[cfg(feature = "IOBluetoothObject")]
576 #[optional]
577 #[unsafe(method(l2capChannelWriteComplete:refcon:status:))]
578 #[unsafe(method_family = none)]
579 unsafe fn l2capChannelWriteComplete_refcon_status(
580 &self,
581 l2cap_channel: Option<&IOBluetoothL2CAPChannel>,
582 refcon: *mut c_void,
583 error: IOReturn,
584 );
585
586 #[cfg(feature = "IOBluetoothObject")]
587 #[optional]
588 #[unsafe(method(l2capChannelQueueSpaceAvailable:))]
589 #[unsafe(method_family = none)]
590 unsafe fn l2capChannelQueueSpaceAvailable(
591 &self,
592 l2cap_channel: Option<&IOBluetoothL2CAPChannel>,
593 );
594 }
595);
596
597extern "C" {
598 /// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchannelpublishednotification?language=objc)
599 #[cfg(feature = "objc2-foundation")]
600 pub static IOBluetoothL2CAPChannelPublishedNotification: Option<&'static NSString>;
601}
602
603extern "C" {
604 /// [Apple's documentation](https://developer.apple.com/documentation/iobluetooth/iobluetoothl2capchannelterminatednotification?language=objc)
605 #[cfg(feature = "objc2-foundation")]
606 pub static IOBluetoothL2CAPChannelTerminatedNotification: Option<&'static NSString>;
607}