bacnet_client/client/
builder_options.rs1use super::*;
2
3impl<T: TransportPort + 'static> ClientBuilder<T> {
4 pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
6 self.options.event_channel_capacity = capacity;
7 self
8 }
9
10 pub fn apdu_retries(mut self, retries: u8) -> Self {
12 self.config.apdu_retries = retries;
13 self
14 }
15
16 pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
21 self.config.min_request_interval_ms = ms;
22 self
23 }
24
25 pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
30 self.config.max_segments = max_segments;
31 self
32 }
33
34 pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
36 self.config.segmented_response_accepted = accepted;
37 self
38 }
39
40 pub fn proposed_window_size(mut self, window_size: u8) -> Self {
42 self.config.proposed_window_size = window_size;
43 self
44 }
45
46 pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
48 where
49 F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
50 {
51 self.options = self
52 .options
53 .with_confirmed_cov_notification_ack_policy(policy);
54 self
55 }
56}
57
58impl BipClientBuilder {
59 pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
61 self.options.event_channel_capacity = capacity;
62 self
63 }
64
65 pub fn apdu_retries(mut self, retries: u8) -> Self {
67 self.config.apdu_retries = retries;
68 self
69 }
70
71 pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
76 self.config.min_request_interval_ms = ms;
77 self
78 }
79
80 pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
85 self.config.max_segments = max_segments;
86 self
87 }
88
89 pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
91 self.config.segmented_response_accepted = accepted;
92 self
93 }
94
95 pub fn proposed_window_size(mut self, window_size: u8) -> Self {
97 self.config.proposed_window_size = window_size;
98 self
99 }
100
101 pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
103 where
104 F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
105 {
106 self.options = self
107 .options
108 .with_confirmed_cov_notification_ack_policy(policy);
109 self
110 }
111}
112
113#[cfg(feature = "ipv6")]
114impl Bip6ClientBuilder {
115 pub fn foreign_device(mut self, config: Bip6ForeignDeviceConfig) -> Self {
120 self.foreign_device = Some(config);
121 self
122 }
123
124 pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
126 self.options.event_channel_capacity = capacity;
127 self
128 }
129
130 pub fn apdu_retries(mut self, retries: u8) -> Self {
132 self.config.apdu_retries = retries;
133 self
134 }
135
136 pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
141 self.config.min_request_interval_ms = ms;
142 self
143 }
144
145 pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
150 self.config.max_segments = max_segments;
151 self
152 }
153
154 pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
156 self.config.segmented_response_accepted = accepted;
157 self
158 }
159
160 pub fn proposed_window_size(mut self, window_size: u8) -> Self {
162 self.config.proposed_window_size = window_size;
163 self
164 }
165
166 pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
168 where
169 F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
170 {
171 self.options = self
172 .options
173 .with_confirmed_cov_notification_ack_policy(policy);
174 self
175 }
176}
177
178#[cfg(feature = "sc-tls")]
179impl ScClientBuilder {
180 pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
182 self.options.event_channel_capacity = capacity;
183 self
184 }
185
186 pub fn apdu_retries(mut self, retries: u8) -> Self {
188 self.config.apdu_retries = retries;
189 self
190 }
191
192 pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
197 self.config.min_request_interval_ms = ms;
198 self
199 }
200
201 pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
206 self.config.max_segments = max_segments;
207 self
208 }
209
210 pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
212 self.config.segmented_response_accepted = accepted;
213 self
214 }
215
216 pub fn proposed_window_size(mut self, window_size: u8) -> Self {
218 self.config.proposed_window_size = window_size;
219 self
220 }
221
222 pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
224 where
225 F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
226 {
227 self.options = self
228 .options
229 .with_confirmed_cov_notification_ack_policy(policy);
230 self
231 }
232}