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
Exception thrown if an additional field was missing during deserialization of a Message.
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