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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
use crate::rcl;
use num_derive::{FromPrimitive, ToPrimitive};

/// QoS history enumerations describing how samples endure
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, FromPrimitive, ToPrimitive)]
pub enum HistoryPolicy {
    /// Implementation default for history policy
    SystemDefault = rcl::rmw_qos_history_policy_e_RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT,

    /// Only store up to a maximum number of samples, dropping oldest once max is exceeded
    KeepLast = rcl::rmw_qos_history_policy_e_RMW_QOS_POLICY_HISTORY_KEEP_LAST,

    /// Store all samples, subject to resource limits
    KeepAll = rcl::rmw_qos_history_policy_e_RMW_QOS_POLICY_HISTORY_KEEP_ALL,

    /// History policy has not yet been set
    Unknown = rcl::rmw_qos_history_policy_e_RMW_QOS_POLICY_HISTORY_UNKNOWN,
}

/// QoS Reliability enumerations describing how messages are delivered
#[repr(u32)]
#[derive(Debug, Clone, PartialEq, Eq, FromPrimitive, ToPrimitive)]
pub enum ReliabilityPolicy {
    /// Implementation specific default
    SystemDefault = rcl::rmw_qos_reliability_policy_e_RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT,

    /// Guarantee that samples are delivered, may retry multiple times.
    Reliable = rcl::rmw_qos_reliability_policy_e_RMW_QOS_POLICY_RELIABILITY_RELIABLE,

    /// Attempt to deliver samples, but some may be lost if the network is not robust
    BestEffort = rcl::rmw_qos_reliability_policy_e_RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,

    /// Reliability policy has not yet been set
    Unknown = rcl::rmw_qos_reliability_policy_e_RMW_QOS_POLICY_RELIABILITY_UNKNOWN,
}

/// QoS durability enumerations describing how samples persist
#[repr(u32)]
#[derive(Debug, Clone, PartialEq, Eq, FromPrimitive, ToPrimitive)]
pub enum DurabilityPolicy {
    /// Impplementation specific default
    SystemDefault = rcl::rmw_qos_durability_policy_e_RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT,

    /// The rmw publisher is responsible for persisting samples for “late-joining” subscribers
    TransientLocal = rcl::rmw_qos_durability_policy_e_RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,

    /// Samples are not persistent
    Volatile = rcl::rmw_qos_durability_policy_e_RMW_QOS_POLICY_DURABILITY_VOLATILE,

    /// Durability policy has not yet been set
    Unknown = rcl::rmw_qos_durability_policy_e_RMW_QOS_POLICY_DURABILITY_UNKNOWN,
}

/// QoS liveliness enumerations that describe a publisher's reporting policy for its alive status.
/// For a subscriber, these are its requirements for its topic's publishers.
#[repr(u32)]
#[derive(Debug, Clone, PartialEq, Eq, FromPrimitive, ToPrimitive)]
pub enum LivelinessPolicy {
    /// Implementation specific default
    SystemDefault = rcl::rmw_qos_liveliness_policy_e_RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,

    /// The signal that establishes a Topic is alive comes from the ROS rmw layer.
    Automatic = rcl::rmw_qos_liveliness_policy_e_RMW_QOS_POLICY_LIVELINESS_AUTOMATIC,

    /// Explicitly asserting node liveliness is required in this case.
    /// This option is deprecated, use RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC if your application
    /// requires to assert liveliness manually.
    // #[deprecated]
    // ManualByNode = rcl::rmw_qos_liveliness_policy_e_RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_NODE,

    /// The signal that establishes a Topic is alive is at the Topic level. Only publishing a message
    /// on the Topic or an explicit signal from the application to assert liveliness on the Topic
    /// will mark the Topic as being alive.
    ManualByTopic = rcl::rmw_qos_liveliness_policy_e_RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC,

    /// Liveliness policy has not yet been set
    Unknown = rcl::rmw_qos_liveliness_policy_e_RMW_QOS_POLICY_LIVELINESS_UNKNOWN,
}