objc2_core_bluetooth/generated/
CBATTRequest.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// Represents a read or write request from a central.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/corebluetooth/cbattrequest?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct CBATTRequest;
17);
18
19unsafe impl NSObjectProtocol for CBATTRequest {}
20
21impl CBATTRequest {
22    extern_methods!(
23        #[unsafe(method(init))]
24        #[unsafe(method_family = init)]
25        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
26
27        #[cfg(all(feature = "CBCentral", feature = "CBPeer"))]
28        /// The central that originated the request.
29        #[unsafe(method(central))]
30        #[unsafe(method_family = none)]
31        pub unsafe fn central(&self) -> Retained<CBCentral>;
32
33        #[cfg(all(feature = "CBAttribute", feature = "CBCharacteristic"))]
34        /// The characteristic whose value will be read or written.
35        #[unsafe(method(characteristic))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn characteristic(&self) -> Retained<CBCharacteristic>;
38
39        /// The zero-based index of the first byte for the read or write.
40        #[unsafe(method(offset))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn offset(&self) -> NSUInteger;
43
44        /// The data being read or written.
45        /// For read requests,
46        /// <i>
47        /// value
48        /// </i>
49        /// will be nil and should be set before responding via
50        ///
51        /// ```text
52        ///  respondToRequest:withResult:
53        /// ```
54        ///
55        /// .
56        /// For write requests,
57        /// <i>
58        /// value
59        /// </i>
60        /// will contain the data to be written.
61        #[unsafe(method(value))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn value(&self) -> Option<Retained<NSData>>;
64
65        /// Setter for [`value`][Self::value].
66        #[unsafe(method(setValue:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setValue(&self, value: Option<&NSData>);
69    );
70}
71
72/// Methods declared on superclass `NSObject`.
73impl CBATTRequest {
74    extern_methods!(
75        #[unsafe(method(new))]
76        #[unsafe(method_family = new)]
77        pub unsafe fn new() -> Retained<Self>;
78    );
79}