-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathTopics.cpp
53 lines (47 loc) · 1.89 KB
/
Topics.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2021-2023 (c) Christian von Arnim, ISW University of Stuttgart (for umati and VDW e.V.)
* Copyright 2021 (c) Moritz Walker, ISW University of Stuttgart (for umati and VDW e.V.)
*/
#include "Topics.hpp"
#include <IdEncode.hpp>
namespace Umati {
namespace MachineObserver {
std::string Topics::Prefix = "umati/v2";
// Must be set before using the methods below
std::string Topics::ClientId;
std::string Topics::Machine(const std::shared_ptr<ModelOpcUa::StructureNode> &p_type, const std::string &machineId) {
std::string specification = p_type->SpecifiedBrowseName.Name;
std::stringstream topic;
topic << Topics::Prefix << "/" << Topics::ClientId << "/" << specification << "/" << Umati::Util::IdEncode(machineId);
return topic.str();
}
std::string Topics::List(const std::string &specType) {
std::stringstream topic;
topic << Topics::Prefix << "/" << Topics::ClientId << "/list/" << specType;
return topic.str();
}
std::string Topics::ErrorList(const std::string &specType) {
std::stringstream topic;
topic << Topics::Prefix << "/" << Topics::ClientId << "/bad_list/" << specType;
return topic.str();
}
std::string Topics::OnlineStatus(const std::string &machineId) {
std::stringstream topic;
topic << Topics::Prefix << "/" << Topics::ClientId << "/online/" << Umati::Util::IdEncode(machineId);
return topic.str();
}
std::string Topics::ClientOnline() {
std::stringstream topic;
topic << Topics::Prefix << "/" << Topics::ClientId << "/clientOnline";
return topic.str();
}
std::string Topics::GwVersion() {
std::stringstream topic;
topic << Topics::Prefix << "/" << Topics::ClientId << "/gw-version";
return topic.str();
}
} // namespace MachineObserver
} // namespace Umati