diagnostics.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 <ostream>
17 
18 #include <fmt/format.h>
19 #include <fmt/ostream.h>
20 
22 
24 {
25 namespace data_conversion_layer
26 {
27 namespace monitoring_frame
28 {
29 namespace diagnostic
30 {
31 std::ostream& operator<<(std::ostream& os, const Message& msg)
32 {
33  os << fmt::format("Device: {} - {}",
36 
37  if (isAmbiguous(msg.diagnosticCode()))
38  {
39  os << fmt::format(" (Byte:{} Bit:{})", msg.errorLocation().byte(), msg.errorLocation().bit());
40  }
41 
42  return os;
43 }
44 
45 } // namespace diagnostic
46 } // namespace monitoring_frame
47 } // namespace data_conversion_layer
48 } // namespace psen_scan_v2_standalone
psen_scan_v2_standalone::configuration::SCANNER_ID_TO_STRING
static const std::map< ScannerId, std::string > SCANNER_ID_TO_STRING
Definition: scanner_ids.h:40
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::diagnostic::Message::scannerId
constexpr configuration::ScannerId scannerId() const
Definition: diagnostics.h:189
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::diagnostic::Message::errorLocation
constexpr ErrorLocation errorLocation() const
Definition: diagnostics.h:194
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::diagnostic::operator<<
std::ostream & operator<<(std::ostream &os, const diagnostic::Message &msg)
Definition: diagnostics.cpp:31
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::diagnostic::Message::diagnosticCode
constexpr ErrorType diagnosticCode() const
Definition: diagnostics.h:199
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::diagnostic::isAmbiguous
bool isAmbiguous(const ErrorType &code)
Definition: diagnostics.h:223
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::diagnostic::ErrorLocation::byte
constexpr ByteLocation byte() const
Definition: diagnostics.h:155
diagnostics.h
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::diagnostic::Message
Defines an Diagnostic message by defining the ErrorLocation and a scanner ID.
Definition: diagnostics.h:181
psen_scan_v2_standalone::data_conversion_layer::monitoring_frame::diagnostic::ErrorLocation::bit
constexpr BitLocation bit() const
Definition: diagnostics.h:160
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::diagnostic::ERROR_CODE_TO_STRING
static const std::map< ErrorType, ErrorMessage > ERROR_CODE_TO_STRING
Definition: diagnostics.h:89


psen_scan_v2
Author(s): Pilz GmbH + Co. KG
autogenerated on Sat Nov 25 2023 03:46:26