1 #ifndef OPCUABRIDGE_CONFIGURATION_H_ 2 #define OPCUABRIDGE_CONFIGURATION_H_ 6 #include "uptane/tuf.h" 21 const KeyType& getPublicKeyType()
const {
return public_key_type_; }
22 void setPublicKeyType(
const KeyType& public_key_type) { public_key_type_ = public_key_type; }
23 const std::string& getPublicKey()
const {
return public_key_; }
24 void setPublicKey(
const std::string& public_key) { public_key_ = public_key; }
27 CLIENTREAD_FUNCTION_DEFINITION()
28 CLIENTWRITE_FUNCTION_DEFINITION()
30 void setOnBeforeReadCallback(MessageOnBeforeReadCallback<Configuration>::type cb) {
31 on_before_read_cb_ = std::move(cb);
33 void setOnAfterWriteCallback(MessageOnAfterWriteCallback<Configuration>::type cb) {
34 on_after_write_cb_ = std::move(cb);
38 KeyType public_key_type_{};
40 std::string public_key_;
43 MessageOnBeforeReadCallback<Configuration>::type on_before_read_cb_;
44 MessageOnAfterWriteCallback<Configuration>::type on_after_write_cb_;
47 static const char* node_id_;
49 Json::Value wrapMessage()
const {
51 v[
"hwid"] = getHwId().ToString();
52 v[
"public_key_type"] =
static_cast<int>(getPublicKeyType());
53 v[
"public_key"] = getPublicKey();
54 v[
"serial"] = getSerial().ToString();
57 void unwrapMessage(Json::Value v) {
59 setPublicKeyType(static_cast<KeyType>(v[
"public_key_type"].asInt()));
60 setPublicKey(v[
"public_key"].asString());
70 #ifdef OPCUABRIDGE_ENABLE_SERIALIZATION 71 SERIALIZE_FUNCTION_FRIEND_DECLARATION
73 DEFINE_SERIALIZE_METHOD() {
74 SERIALIZE_FIELD(ar,
"hwid_", hwid_);
75 SERIALIZE_FIELD(ar,
"serial_", serial_);
76 SERIALIZE_FIELD(ar,
"public_key_", public_key_);
78 #endif // OPCUABRIDGE_ENABLE_SERIALIZATION 82 #endif // OPCUABRIDGE_CONFIGURATION_H_