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
19extern_conformance!(
20    unsafe impl NSObjectProtocol for CBATTRequest {}
21);
22
23impl CBATTRequest {
24    extern_methods!(
25        #[unsafe(method(init))]
26        #[unsafe(method_family = init)]
27        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
28
29        #[cfg(all(feature = "CBCentral", feature = "CBPeer"))]
30        /// The central that originated the request.
31        #[unsafe(method(central))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn central(&self) -> Retained<CBCentral>;
34
35        #[cfg(all(feature = "CBAttribute", feature = "CBCharacteristic"))]
36        /// The characteristic whose value will be read or written.
37        #[unsafe(method(characteristic))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn characteristic(&self) -> Retained<CBCharacteristic>;
40
41        /// The zero-based index of the first byte for the read or write.
42        #[unsafe(method(offset))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn offset(&self) -> NSUInteger;
45
46        /// The data being read or written.
47        /// For read requests,
48        /// <i>
49        /// value
50        /// </i>
51        /// will be nil and should be set before responding via
52        ///
53        /// ```text
54        ///  respondToRequest:withResult:
55        /// ```
56        ///
57        /// .
58        /// For write requests,
59        /// <i>
60        /// value
61        /// </i>
62        /// will contain the data to be written.
63        #[unsafe(method(value))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn value(&self) -> Option<Retained<NSData>>;
66
67        /// Setter for [`value`][Self::value].
68        ///
69        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
70        #[unsafe(method(setValue:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn setValue(&self, value: Option<&NSData>);
73    );
74}
75
76/// Methods declared on superclass `NSObject`.
77impl CBATTRequest {
78    extern_methods!(
79        #[unsafe(method(new))]
80        #[unsafe(method_family = new)]
81        pub unsafe fn new() -> Retained<Self>;
82    );
83}