script/dom/bluetooth/
bluetoothcharacteristicproperties.rs1use dom_struct::dom_struct;
6
7use crate::dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::BluetoothCharacteristicPropertiesMethods;
8use crate::dom::bindings::reflector::{Reflector, reflect_dom_object_with_cx};
9use crate::dom::bindings::root::DomRoot;
10use crate::dom::globalscope::GlobalScope;
11
12#[dom_struct]
14pub(crate) struct BluetoothCharacteristicProperties {
15 reflector_: Reflector,
16 broadcast: bool,
17 read: bool,
18 write_without_response: bool,
19 write: bool,
20 notify: bool,
21 indicate: bool,
22 authenticated_signed_writes: bool,
23 reliable_write: bool,
24 writable_auxiliaries: bool,
25}
26
27#[expect(non_snake_case)]
28impl BluetoothCharacteristicProperties {
29 #[expect(clippy::too_many_arguments)]
30 pub(crate) fn new_inherited(
31 broadcast: bool,
32 read: bool,
33 write_without_response: bool,
34 write: bool,
35 notify: bool,
36 indicate: bool,
37 authenticated_signed_writes: bool,
38 reliable_write: bool,
39 writable_auxiliaries: bool,
40 ) -> BluetoothCharacteristicProperties {
41 BluetoothCharacteristicProperties {
42 reflector_: Reflector::new(),
43 broadcast,
44 read,
45 write_without_response,
46 write,
47 notify,
48 indicate,
49 authenticated_signed_writes,
50 reliable_write,
51 writable_auxiliaries,
52 }
53 }
54
55 #[expect(clippy::too_many_arguments)]
56 pub(crate) fn new(
57 cx: &mut js::context::JSContext,
58 global: &GlobalScope,
59 broadcast: bool,
60 read: bool,
61 writeWithoutResponse: bool,
62 write: bool,
63 notify: bool,
64 indicate: bool,
65 authenticatedSignedWrites: bool,
66 reliableWrite: bool,
67 writableAuxiliaries: bool,
68 ) -> DomRoot<BluetoothCharacteristicProperties> {
69 reflect_dom_object_with_cx(
70 Box::new(BluetoothCharacteristicProperties::new_inherited(
71 broadcast,
72 read,
73 writeWithoutResponse,
74 write,
75 notify,
76 indicate,
77 authenticatedSignedWrites,
78 reliableWrite,
79 writableAuxiliaries,
80 )),
81 global,
82 cx,
83 )
84 }
85}
86
87impl BluetoothCharacteristicPropertiesMethods<crate::DomTypeHolder>
88 for BluetoothCharacteristicProperties
89{
90 fn Broadcast(&self) -> bool {
92 self.broadcast
93 }
94
95 fn Read(&self) -> bool {
97 self.read
98 }
99
100 fn WriteWithoutResponse(&self) -> bool {
102 self.write_without_response
103 }
104
105 fn Write(&self) -> bool {
107 self.write
108 }
109
110 fn Notify(&self) -> bool {
112 self.notify
113 }
114
115 fn Indicate(&self) -> bool {
117 self.indicate
118 }
119
120 fn AuthenticatedSignedWrites(&self) -> bool {
122 self.authenticated_signed_writes
123 }
124
125 fn ReliableWrite(&self) -> bool {
127 self.reliable_write
128 }
129
130 fn WritableAuxiliaries(&self) -> bool {
132 self.writable_auxiliaries
133 }
134}