1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! `BACnetNameValue` (Clause 21): one tag of an object's Tags array (#1553).
use String;
use cratePropertyValue;
/// `BACnetNameValue` (Clause 21): a tag's name and, for a value tag, its
/// value. A semantic tag has a name alone (Annex Y.1.4).
///
/// On the wire it is a SEQUENCE with no frame of its own: the name as a
/// CharacterString under primitive context tag `[0]`, then the value, when
/// there is one, application-tagged as its own datatype. The `bacnet-encoding`
/// crate owns the codec. The 2024-04-29 errata, item 37, restricts the
/// optional value to one primitive; Date and Time are allowed separately.
///
/// ```
/// use bacnet_types::constructed::BACnetNameValue;
/// use bacnet_types::primitives::PropertyValue;
///
/// let semantic = BACnetNameValue::semantic("exhaust");
/// let valued = BACnetNameValue::valued("floor", PropertyValue::Unsigned(3));
/// assert!(semantic.value.is_none() && valued.value.is_some());
/// ```