scanner_ids.h
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 #ifndef PSEN_SCAN_V2_STANDALONE_SCANNER_IDS_H
17 #define PSEN_SCAN_V2_STANDALONE_SCANNER_IDS_H
18 
19 #include <array>
20 #include <map>
21 #include <string>
22 
24 {
25 namespace configuration
26 {
27 enum class ScannerId : uint8_t
28 {
29  master = 0,
30  subscriber0 = 1, // Note: This refers to the scanner type subscriber, *not* a ros subscriber
31  subscriber1 = 2,
32  subscriber2 = 3
33 };
34 
35 static constexpr std::array<ScannerId, 4> VALID_SCANNER_IDS{ ScannerId::master,
39 
40 static const int MAX_NR_SUBSCRIBERS = VALID_SCANNER_IDS.size() - 1; // all but the master
41 
42 static inline ScannerId subscriber_number_to_scanner_id(uint8_t nr)
43 {
44  return VALID_SCANNER_IDS.at(nr + 1);
45 }
46 
47 static const std::map<ScannerId, std::string> SCANNER_ID_TO_STRING{ { ScannerId::master, "Master" },
48  { ScannerId::subscriber0, "Subscriber0" },
49  { ScannerId::subscriber1, "Subscriber1" },
50  { ScannerId::subscriber2, "Subscriber2" } };
51 
52 } // namespace configuration
53 } // namespace psen_scan_v2_standalone
54 
55 #endif // PSEN_SCAN_V2_STANDALONE_SCANNER_IDS_H
psen_scan_v2_standalone::configuration::ScannerId
ScannerId
Definition: scanner_ids.h:27
psen_scan_v2_standalone::configuration::SCANNER_ID_TO_STRING
static const std::map< ScannerId, std::string > SCANNER_ID_TO_STRING
Definition: scanner_ids.h:47
psen_scan_v2_standalone::configuration::MAX_NR_SUBSCRIBERS
static const int MAX_NR_SUBSCRIBERS
Definition: scanner_ids.h:40
psen_scan_v2_standalone::configuration::VALID_SCANNER_IDS
static constexpr std::array< ScannerId, 4 > VALID_SCANNER_IDS
Definition: scanner_ids.h:35
psen_scan_v2_standalone::configuration::subscriber_number_to_scanner_id
static ScannerId subscriber_number_to_scanner_id(uint8_t nr)
Definition: scanner_ids.h:42
psen_scan_v2_standalone::configuration::ScannerId::subscriber0
@ subscriber0
psen_scan_v2_standalone::configuration::ScannerId::master
@ master
psen_scan_v2_standalone::configuration::ScannerId::subscriber2
@ subscriber2
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::configuration::ScannerId::subscriber1
@ subscriber1


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