monitoring_frame_msg.cpp
Go to the documentation of this file.
1 // Copyright (c) 2020-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 #include <cstdint>
17 #include <string>
18 #include <vector>
19 
24 
26 {
27 namespace data_conversion_layer
28 {
29 namespace monitoring_frame
30 {
32 {
33  return scanner_id_;
34 }
35 
37 {
38  return from_theta_;
39 }
40 
42 {
43  return resolution_;
44 }
45 
46 uint32_t Message::scanCounter() const
47 {
48  if (scan_counter_.is_initialized())
49  {
50  return scan_counter_.get();
51  }
52  else
53  {
54  throw AdditionalFieldMissing("Scan counter");
55  }
56 }
57 
58 uint8_t Message::activeZoneset() const
59 {
60  if (active_zoneset_.is_initialized())
61  {
62  return active_zoneset_.get();
63  }
64  else
65  {
66  throw AdditionalFieldMissing("Active zoneset");
67  }
68 }
69 
71 {
72  if (io_pin_data_.is_initialized())
73  {
74  return io_pin_data_.get();
75  }
76  else
77  {
78  throw AdditionalFieldMissing("IO pin data");
79  }
80 }
81 
82 const std::vector<double>& Message::measurements() const
83 {
84  if (measurements_.is_initialized())
85  {
86  return measurements_.get();
87  }
88  else
89  {
90  throw AdditionalFieldMissing("Measurements");
91  }
92 }
93 
94 const std::vector<double>& Message::intensities() const
95 {
96  if (intensities_.is_initialized())
97  {
98  return intensities_.get();
99  }
100  else
101  {
102  throw AdditionalFieldMissing("Intensities");
103  }
104 }
105 
106 std::vector<diagnostic::Message> Message::diagnosticMessages() const
107 {
108  if (diagnostic_messages_.is_initialized())
109  {
110  return diagnostic_messages_.get();
111  }
112  else
113  {
114  throw AdditionalFieldMissing("Diagnostic messages");
115  }
116 }
117 
119 {
120  return scan_counter_.is_initialized();
121 }
122 
124 {
125  return active_zoneset_.is_initialized();
126 }
127 
129 {
130  return io_pin_data_.is_initialized();
131 }
132 
134 {
135  return measurements_.is_initialized();
136 }
137 
139 {
140  return intensities_.is_initialized();
141 }
142 
144 {
145  return diagnostic_messages_.is_initialized();
146 }
147 } // namespace monitoring_frame
148 } // namespace data_conversion_layer
149 } // namespace psen_scan_v2_standalone
psen_scan_v2_standalone::configuration::ScannerId
ScannerId
Definition: scanner_ids.h:27
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::hasIOPinField
bool hasIOPinField() const
Definition: monitoring_frame_msg.cpp:128
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::scannerId
configuration::ScannerId scannerId() const
Definition: monitoring_frame_msg.cpp:31
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::hasActiveZonesetField
bool hasActiveZonesetField() const
Definition: monitoring_frame_msg.cpp:123
monitoring_frame_msg.h
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::AdditionalFieldMissing
Exception thrown if an additional field was missing during deserialization of a Message.
Definition: monitoring_frame_msg.h:49
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::fromTheta
util::TenthOfDegree fromTheta() const
Definition: monitoring_frame_msg.cpp:36
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::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::Message::hasScanCounterField
bool hasScanCounterField() const
Definition: monitoring_frame_msg.cpp:118
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::hasDiagnosticMessagesField
bool hasDiagnosticMessagesField() const
Definition: monitoring_frame_msg.cpp:143
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::hasMeasurementsField
bool hasMeasurementsField() const
Definition: monitoring_frame_msg.cpp:133
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::iOPinData
const io::PinData & iOPinData() const
Definition: monitoring_frame_msg.cpp:70
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::scanCounter
uint32_t scanCounter() const
Definition: monitoring_frame_msg.cpp:46
diagnostics.h
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::diagnosticMessages
std::vector< diagnostic::Message > diagnosticMessages() const
Definition: monitoring_frame_msg.cpp:106
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::intensities
const std::vector< double > & intensities() const
Definition: monitoring_frame_msg.cpp:94
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::Message::measurements
const std::vector< double > & measurements() const
Definition: monitoring_frame_msg.cpp:82
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::activeZoneset
uint8_t activeZoneset() const
Definition: monitoring_frame_msg.cpp:58
scanner_ids.h
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::Message::resolution
util::TenthOfDegree resolution() const
Definition: monitoring_frame_msg.cpp:41
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
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::Message::hasIntensitiesField
bool hasIntensitiesField() const
Definition: monitoring_frame_msg.cpp:138


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