monitoring_frame_msg_builder.h
Go to the documentation of this file.
1 // Copyright (c) 2021 Pilz GmbH & Co. KG
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU Lesser General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public License
14 // along with this program. If not, see <https://www.gnu.org/licenses/>.
15 
16 #ifndef PSEN_SCAN_V2_STANDALONE_MONITORING_FRAME_MSG_BUILDER_H
17 #define PSEN_SCAN_V2_STANDALONE_MONITORING_FRAME_MSG_BUILDER_H
18 
19 #include <cstdint>
20 #include <vector>
21 
26 
28 {
29 namespace data_conversion_layer
30 {
31 namespace monitoring_frame
32 {
34 {
35 public:
36  Message build();
37  operator Message();
38 
39 public:
41  MessageBuilder& fromTheta(const util::TenthOfDegree& from_theta);
43  MessageBuilder& measurements(const std::vector<double>& measurements);
45  MessageBuilder& activeZoneset(uint8_t active_zoneset);
46  MessageBuilder& intensities(const std::vector<double>& intensities);
47  MessageBuilder& diagnosticMessages(const std::vector<diagnostic::Message>& diagnostic_messages);
49 
50 private:
52 };
53 
55 {
56  return msg_;
57 }
58 
59 inline MessageBuilder::operator Message()
60 {
61  return build();
62 }
63 
65 {
66  msg_.scanner_id_ = scanner_id;
67  return *this;
68 }
69 
71 {
72  msg_.from_theta_ = from_theta;
73  return *this;
74 }
75 
77 {
79  return *this;
80 }
81 
82 inline MessageBuilder& MessageBuilder::measurements(const std::vector<double>& measurements)
83 {
85  return *this;
86 }
87 
89 {
91  return *this;
92 }
93 
94 inline MessageBuilder& MessageBuilder::activeZoneset(uint8_t active_zoneset)
95 {
96  msg_.active_zoneset_ = active_zoneset;
97  return *this;
98 }
99 
100 inline MessageBuilder& MessageBuilder::intensities(const std::vector<double>& intensities)
101 {
103  return *this;
104 }
105 
106 inline MessageBuilder& MessageBuilder::diagnosticMessages(const std::vector<diagnostic::Message>& diagnostic_messages)
107 {
108  msg_.diagnostic_messages_ = diagnostic_messages;
109  return *this;
110 }
111 
113 {
115  return *this;
116 }
117 } // namespace monitoring_frame
118 } // namespace data_conversion_layer
119 } // namespace psen_scan_v2_standalone
120 
121 #endif // PSEN_SCAN_V2_STANDALONE_MONITORING_FRAME_MSG_BUILDER_H
Higher level data type representing a single monitoring frame.
MessageBuilder & diagnosticMessages(const std::vector< diagnostic::Message > &diagnostic_messages)
Represents the IO PIN field of a monitoring frame.
Definition: io_pin_data.h:72
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
boost::optional< std::vector< diagnostic::Message > > diagnostic_messages_
Helper class representing angles in tenth of degree.


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Nov 5 2022 02:13:36