objc2_core_bluetooth/generated/
CBL2CAPChannel.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbl2cappsm?language=objc)
10pub type CBL2CAPPSM = u16;
11
12extern_class!(
13    /// A CBL2CAPChannel represents a live L2CAP connection to a remote device
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbl2capchannel?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct CBL2CAPChannel;
19);
20
21extern_conformance!(
22    unsafe impl NSObjectProtocol for CBL2CAPChannel {}
23);
24
25impl CBL2CAPChannel {
26    extern_methods!(
27        #[cfg(feature = "CBPeer")]
28        /// The peer connected to the channel
29        #[unsafe(method(peer))]
30        #[unsafe(method_family = none)]
31        pub unsafe fn peer(&self) -> Option<Retained<CBPeer>>;
32
33        /// An NSStream used for reading data from the remote peer
34        #[unsafe(method(inputStream))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn inputStream(&self) -> Option<Retained<NSInputStream>>;
37
38        /// An NSStream used for writing data to the peer
39        #[unsafe(method(outputStream))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn outputStream(&self) -> Option<Retained<NSOutputStream>>;
42
43        /// The PSM (Protocol/Service Multiplexer) of the channel
44        #[unsafe(method(PSM))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn PSM(&self) -> CBL2CAPPSM;
47    );
48}
49
50/// Methods declared on superclass `NSObject`.
51impl CBL2CAPChannel {
52    extern_methods!(
53        #[unsafe(method(init))]
54        #[unsafe(method_family = init)]
55        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
56
57        #[unsafe(method(new))]
58        #[unsafe(method_family = new)]
59        pub unsafe fn new() -> Retained<Self>;
60    );
61}