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 
88 inline MessageBuilder& MessageBuilder::scanCounter(uint32_t scan_counter)
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
psen_scan_v2_standalone::configuration::ScannerId
ScannerId
Definition: scanner_ids.h:27
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::resolution
MessageBuilder & resolution(const util::TenthOfDegree &resolution)
Definition: monitoring_frame_msg_builder.h:76
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::AdditionalFieldHeaderID::scan_counter
@ scan_counter
monitoring_frame_msg.h
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::measurements
MessageBuilder & measurements(const std::vector< double > &measurements)
Definition: monitoring_frame_msg_builder.h:82
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::scanner_id_
configuration::ScannerId scanner_id_
Definition: monitoring_frame_msg.h:90
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::diagnostic_messages_
boost::optional< std::vector< diagnostic::Message > > diagnostic_messages_
Definition: monitoring_frame_msg.h:99
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::io::PinData
Represents the IO PIN field of a monitoring frame.
Definition: io_pin_data.h:72
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::intensities_
boost::optional< std::vector< double > > intensities_
Definition: monitoring_frame_msg.h:98
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder
Definition: monitoring_frame_msg_builder.h:33
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::scan_counter_
boost::optional< uint32_t > scan_counter_
Definition: monitoring_frame_msg.h:94
tenth_of_degree.h
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::intensities
MessageBuilder & intensities(const std::vector< double > &intensities)
Definition: monitoring_frame_msg_builder.h:100
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::activeZoneset
MessageBuilder & activeZoneset(uint8_t active_zoneset)
Definition: monitoring_frame_msg_builder.h:94
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::scannerId
MessageBuilder & scannerId(configuration::ScannerId scanner_id)
Definition: monitoring_frame_msg_builder.h:64
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::scanCounter
MessageBuilder & scanCounter(uint32_t scan_counter)
Definition: monitoring_frame_msg_builder.h:88
diagnostics.h
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::build
Message build()
Definition: monitoring_frame_msg_builder.h:54
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::active_zoneset_
boost::optional< uint8_t > active_zoneset_
Definition: monitoring_frame_msg.h:95
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::measurements_
boost::optional< std::vector< double > > measurements_
Definition: monitoring_frame_msg.h:97
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::from_theta_
util::TenthOfDegree from_theta_
Definition: monitoring_frame_msg.h:91
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::iOPinData
MessageBuilder & iOPinData(const io::PinData &io_pin_data)
Definition: monitoring_frame_msg_builder.h:112
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::io_pin_data_
boost::optional< io::PinData > io_pin_data_
Definition: monitoring_frame_msg.h:96
psen_scan_v2_standalone
Root namespace in which the software components to communicate with the scanner (firmware-version: 2)...
Definition: udp_client.h:41
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::AdditionalFieldHeaderID::io_pin_data
@ io_pin_data
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::diagnosticMessages
MessageBuilder & diagnosticMessages(const std::vector< diagnostic::Message > &diagnostic_messages)
Definition: monitoring_frame_msg_builder.h:106
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message
Higher level data type representing a single monitoring frame.
Definition: monitoring_frame_msg.h:62
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::msg_
Message msg_
Definition: monitoring_frame_msg_builder.h:51
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::MessageBuilder::fromTheta
MessageBuilder & fromTheta(const util::TenthOfDegree &from_theta)
Definition: monitoring_frame_msg_builder.h:70
psen_scan_v2_standalone::util::TenthOfDegree
Helper class representing angles in tenth of degree.
Definition: tenth_of_degree.h:34
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::resolution_
util::TenthOfDegree resolution_
Definition: monitoring_frame_msg.h:92
io_pin_data.h


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Jun 22 2024 02:46:11