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 event_channel_capacity(mut self, capacity: usize) -> Self {
117 self.options.event_channel_capacity = capacity;
118 self
119 }
120
121 pub fn apdu_retries(mut self, retries: u8) -> Self {
123 self.config.apdu_retries = retries;
124 self
125 }
126
127 pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
132 self.config.min_request_interval_ms = ms;
133 self
134 }
135
136 pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
141 self.config.max_segments = max_segments;
142 self
143 }
144
145 pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
147 self.config.segmented_response_accepted = accepted;
148 self
149 }
150
151 pub fn proposed_window_size(mut self, window_size: u8) -> Self {
153 self.config.proposed_window_size = window_size;
154 self
155 }
156
157 pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
159 where
160 F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
161 {
162 self.options = self
163 .options
164 .with_confirmed_cov_notification_ack_policy(policy);
165 self
166 }
167}
168
169#[cfg(feature = "sc-tls")]
170impl ScClientBuilder {
171 pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
173 self.options.event_channel_capacity = capacity;
174 self
175 }
176
177 pub fn apdu_retries(mut self, retries: u8) -> Self {
179 self.config.apdu_retries = retries;
180 self
181 }
182
183 pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
188 self.config.min_request_interval_ms = ms;
189 self
190 }
191
192 pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
197 self.config.max_segments = max_segments;
198 self
199 }
200
201 pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
203 self.config.segmented_response_accepted = accepted;
204 self
205 }
206
207 pub fn proposed_window_size(mut self, window_size: u8) -> Self {
209 self.config.proposed_window_size = window_size;
210 self
211 }
212
213 pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
215 where
216 F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
217 {
218 self.options = self
219 .options
220 .with_confirmed_cov_notification_ack_policy(policy);
221 self
222 }
223}