rust_rcs_client/provisioning/
rcs_application.rs1use super::characteristic::Characteristic;
16use super::wap_provisioning_doc::WapProvisioningDoc;
17
18pub struct RcsApplication<'a> {
19 root: &'a Characteristic,
20}
21
22impl<'a> RcsApplication<'a> {
23 pub fn new(e: &Characteristic) -> RcsApplication {
24 RcsApplication { root: e }
25 }
26
27 pub fn clone_characteristic(&self) -> Characteristic {
28 self.root.clone()
29 }
30
31 pub fn get_to_app_ref(&self) -> &'a str {
32 if let Some(to_app_ref) = self.root.get_parameter("To-AppRef") {
33 return to_app_ref;
34 }
35
36 "DEFAULT"
37 }
38
39 pub fn get_services_config(&self) -> Option<Services> {
40 if let Some(c) = self.root.get_child_characteristic("SERVICES") {
41 return Some(Services { root: c });
42 }
43
44 None
45 }
46
47 pub fn get_messaging_config(&self) -> Option<Messaging> {
48 if let Some(c) = self.root.get_child_characteristic("MESSAGING") {
49 return Some(Messaging { root: c });
50 }
51
52 None
53 }
54}
55
56pub trait GetRcsApplication {
57 fn get_rcs_application(&self) -> Option<RcsApplication>;
58}
59
60impl<'a> GetRcsApplication for &WapProvisioningDoc {
61 fn get_rcs_application(&self) -> Option<RcsApplication> {
62 if let Some(rcs_application) = self.get_application_characteristic("ap2002") {
63 return Some(RcsApplication {
64 root: rcs_application,
65 });
66 }
67
68 None
69 }
70}
71
72pub struct Services<'a> {
73 root: &'a Characteristic,
74}
75
76impl Services<'_> {
77 pub fn get_chat_auth(&self) -> i32 {
78 if let Some(p) = self.root.get_parameter("ChatAuth") {
79 if let Ok(i) = p.parse::<i32>() {
80 return i;
81 }
82 }
83
84 0
85 }
86
87 pub fn get_group_chat_auth(&self) -> i32 {
88 if let Some(p) = self.root.get_parameter("GroupChatAuth") {
89 if let Ok(i) = p.parse::<i32>() {
90 return i;
91 }
92 }
93
94 0
95 }
96
97 pub fn get_standalone_msg_auth(&self) -> i32 {
98 if let Some(p) = self.root.get_parameter("standaloneMsgAuth") {
99 if let Ok(i) = p.parse::<i32>() {
100 return i;
101 }
102 }
103
104 0
105 }
106
107 pub fn get_ft_auth(&self) -> u32 {
108 if let Some(p) = self.root.get_parameter("ftAuth") {
109 if let Ok(i) = p.parse::<u32>() {
110 return i;
111 }
112 }
113
114 0
115 }
116}
117
118pub struct Messaging<'a> {
119 root: &'a Characteristic,
120}
121
122impl Messaging<'_> {
123 pub fn get_max_one_to_many_recipients(&self) -> i32 {
124 if let Some(p) = self.root.get_parameter("max1ToManyRecipients") {
125 if let Ok(i) = p.parse::<i32>() {
126 return i;
127 }
128 }
129
130 0
131 }
132
133 pub fn get_one_to_many_selected_technology(&self) -> i32 {
134 if let Some(p) = self.root.get_parameter("1toManySelectedTech") {
135 if let Ok(i) = p.parse::<i32>() {
136 return i;
137 }
138 }
139
140 0
141 }
142
143 pub fn get_chat_config(&self) -> Option<Chat> {
144 if let Some(c) = self.root.get_child_characteristic("Chat") {
145 return Some(Chat { root: c });
146 }
147
148 None
149 }
150
151 pub fn get_standalone_config(&self) -> Option<StandaloneMsg> {
152 if let Some(c) = self.root.get_child_characteristic("StandaloneMsg") {
153 return Some(StandaloneMsg { root: c });
154 }
155
156 None
157 }
158
159 pub fn get_file_transfer_config(&self) -> Option<FileTransfer> {
160 if let Some(c) = self.root.get_child_characteristic("FileTransfer") {
161 return Some(FileTransfer { root: c });
162 }
163
164 None
165 }
166
167 pub fn get_chat_bot_config(&self) -> Option<Chatbot> {
168 if let Some(c) = self.root.get_child_characteristic("Chatbot") {
169 return Some(Chatbot { root: c });
170 }
171
172 None
173 }
174}
175
176pub struct Chat<'a> {
177 root: &'a Characteristic,
178}
179
180impl Chat<'_> {
181 pub fn get_max_ad_hoc_group_size(&self) -> usize {
182 if let Some(p) = self.root.get_parameter("max_adhoc_group_size") {
183 if let Ok(i) = p.parse::<usize>() {
184 return i;
185 }
186 }
187
188 0
189 }
190
191 pub fn get_conf_fcty_uri(&self) -> Option<String> {
192 if let Some(p) = self.root.get_parameter("conf-fcty-uri") {
193 return Some(String::from(p));
194 }
195
196 None
197 }
198
199 pub fn get_im_session_auto_accept(&self) -> i32 {
200 if let Some(p) = self.root.get_parameter("AutAccept") {
201 if let Ok(i) = p.parse::<i32>() {
202 return i;
203 }
204 }
205
206 1
207 }
208
209 pub fn get_im_session_auto_accept_group_chat(&self) -> i32 {
210 if let Some(p) = self.root.get_parameter("AutAcceptGroupChat") {
211 if let Ok(i) = p.parse::<i32>() {
212 return i;
213 }
214 }
215
216 1
217 }
218
219 pub fn get_im_session_timer(&self) -> i32 {
220 if let Some(p) = self.root.get_parameter("TimerIdle") {
221 if let Ok(i) = p.parse::<i32>() {
222 return i;
223 }
224 }
225
226 0
227 }
228
229 pub fn get_max_size_im(&self) -> usize {
230 if let Some(p) = self.root.get_parameter("MaxSize") {
231 if let Ok(i) = p.parse::<usize>() {
232 return i;
233 }
234 }
235
236 usize::max_value()
237 }
238}
239
240pub struct StandaloneMsg<'a> {
241 root: &'a Characteristic,
242}
243
244impl StandaloneMsg<'_> {
245 pub fn get_max_size(&self) -> usize {
246 if let Some(p) = self.root.get_parameter("MaxSize") {
247 if let Ok(i) = p.parse::<usize>() {
248 return i;
249 }
250 }
251
252 usize::max_value()
253 }
254
255 pub fn get_switch_over_size(&self) -> usize {
256 if let Some(p) = self.root.get_parameter("SwitchoverSize") {
257 if let Ok(i) = p.parse::<usize>() {
258 return i;
259 }
260 }
261
262 1300
263 }
264
265 pub fn get_exploder_uri(&self) -> Option<String> {
266 if let Some(p) = self.root.get_parameter("exploder-uri") {
267 return Some(String::from(p));
268 }
269
270 None
271 }
272}
273
274pub struct FileTransfer<'a> {
275 root: &'a Characteristic,
276}
277
278impl FileTransfer<'_> {
279 pub fn get_ft_warn_size(&self) -> u32 {
280 if let Some(p) = self.root.get_parameter("ftWarnSize") {
281 if let Ok(i) = p.parse::<u32>() {
282 return i;
283 }
284 }
285
286 0
287 }
288
289 pub fn get_max_size_file_tr(&self) -> u32 {
290 if let Some(p) = self.root.get_parameter("MaxSizeFileTr") {
291 if let Ok(i) = p.parse::<u32>() {
292 return i;
293 }
294 }
295
296 0
297 }
298
299 pub fn get_ft_aut_accept(&self) -> u32 {
300 if let Some(p) = self.root.get_parameter("ftAutAccept") {
301 if let Ok(i) = p.parse::<u32>() {
302 return i;
303 }
304 }
305
306 0
307 }
308
309 pub fn get_ft_http_cs_uri(&self) -> Option<String> {
310 if let Some(p) = self.root.get_parameter("ftHTTPCSURI") {
311 return Some(String::from(p));
312 }
313
314 None
315 }
316
317 pub fn get_ft_http_dl_uri(&self) -> Option<String> {
318 if let Some(p) = self.root.get_parameter("ftHTTPDLURI") {
319 return Some(String::from(p));
320 }
321
322 None
323 }
324
325 pub fn get_ft_http_cs_user(&self) -> Option<String> {
326 if let Some(p) = self.root.get_parameter("ftHTTPCSUser") {
327 return Some(String::from(p));
328 }
329
330 None
331 }
332
333 pub fn get_ft_http_cs_pwd(&self) -> Option<String> {
334 if let Some(p) = self.root.get_parameter("ftHTTPCSPwd") {
335 return Some(String::from(p));
336 }
337
338 None
339 }
340
341 pub fn get_ft_http_fallback(&self) -> Option<String> {
342 if let Some(p) = self.root.get_parameter("ftHTTPFallback") {
343 return Some(String::from(p));
344 }
345
346 None
347 }
348
349 pub fn get_ft_max_1_to_many_recipients(&self) -> u32 {
350 if let Some(p) = self.root.get_parameter("ftMax1ToManyRecipients") {
351 if let Ok(i) = p.parse::<u32>() {
352 return i;
353 }
354 }
355
356 0
357 }
358}
359
360pub struct Chatbot<'a> {
361 root: &'a Characteristic,
362}
363
364impl Chatbot<'_> {
365 pub fn get_chatbot_msg_tech(&self) -> i32 {
366 if let Some(p) = self.root.get_parameter("ChatbotMsgTech") {
367 if let Ok(i) = p.parse::<i32>() {
368 return i;
369 }
370 }
371
372 0
373 }
374
375 pub fn get_chatbot_directory(&self) -> Option<String> {
376 if let Some(p) = self.root.get_parameter("ChatbotDirectory") {
377 return Some(String::from(p));
378 }
379
380 None
381 }
382
383 pub fn get_bot_info_fqdn(&self) -> Option<String> {
384 if let Some(p) = self.root.get_parameter("BotinfoFQDNRoot") {
385 return Some(String::from(p));
386 }
387
388 None
389 }
390
391 pub fn get_specific_chatbots_lists(&self) -> Option<String> {
392 if let Some(p) = self.root.get_parameter("SpecificChatbotsList") {
393 return Some(String::from(p));
394 }
395
396 None
397 }
398}