1 // Copyright (C) 2017 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
2 // This Source Code Form is subject to the terms of the Mozilla Public
3 // License, v. 2.0. If a copy of the MPL was not distributed with this
4 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 
6 #ifndef VSOMEIP_V3_CFG_DEBOUNCE_HPP
7 #define VSOMEIP_V3_CFG_DEBOUNCE_HPP
8 
9 #include <map>
10 
11 namespace vsomeip_v3 {
12 namespace cfg {
13 
14 // Messages are forwarded either because their value differs from the
15 // last received message (on_change=true) or because the specified time
16 // (interval_) between two messages has elapsed. A message that is forwarded
17 // because of a changed value may reset the time until the next unchanged
18 // message is forwarded or not (on_change_resets_interval). By specifiying
19 // indexes and bit masks, the comparison that is carried out to decide whether
20 // or not two message values differ is configurable (ignore_).
21 struct debounce {
debouncevsomeip_v3::cfg::debounce22     debounce() : on_change_(false),
23             on_change_resets_interval_(false),
24             interval_(0),
25             last_forwarded_((std::chrono::steady_clock::time_point::max)()) {
26     }
27 
28     bool on_change_;
29     bool on_change_resets_interval_;
30     std::map<std::size_t, byte_t> ignore_;
31 
32     long interval_;
33     std::chrono::steady_clock::time_point last_forwarded_;
34 };
35 
36 } // namespace cfg
37 } // namespace vsomeip_v3
38 
39 #endif // VSOMEIP_V3_CFG_DEBOUNCE_HPP
40