Aktualizr
C++ SOTA Client
ecuversionmanifest.h
1 #ifndef OPCUABRIDGE_ECUVERSIONMANIFEST_H_
2 #define OPCUABRIDGE_ECUVERSIONMANIFEST_H_
3 
4 #include "ecuversionmanifestsigned.h"
5 #include "signature.h"
6 
7 #include "common.h"
8 
9 namespace opcuabridge {
11  public:
12  ECUVersionManifest() = default;
13  virtual ~ECUVersionManifest() = default;
14 
15  const std::vector<Signature>& getSignatures() const { return signatures_; }
16  void setSignatures(const std::vector<Signature>& signatures) { signatures_ = signatures; }
17  ECUVersionManifestSigned& getEcuVersionManifestSigned() { return ecuVersionManifestSigned_; }
18  const ECUVersionManifestSigned& getEcuVersionManifestSigned() const { return ecuVersionManifestSigned_; }
19  void setEcuVersionManifestSigned(const ECUVersionManifestSigned& ecuVersionManifestSigned) {
20  ecuVersionManifestSigned_ = ecuVersionManifestSigned;
21  }
22 
23  Json::Value wrapMessage() const {
24  Json::Value v;
25  v["signatures"] = convert_to::jsonArray(getSignatures());
26  v["signed"] = getEcuVersionManifestSigned().wrapMessage();
27  return v;
28  }
29  void unwrapMessage(Json::Value v) {
30  setSignatures(convert_to::stdVector<Signature>(v["signatures"]));
32  ms.unwrapMessage(v["signed"]);
33  setEcuVersionManifestSigned(ms);
34  }
35 
36  protected:
37  std::vector<Signature> signatures_;
38  ECUVersionManifestSigned ecuVersionManifestSigned_;
39 
40  private:
41 #ifdef OPCUABRIDGE_ENABLE_SERIALIZATION
42  SERIALIZE_FUNCTION_FRIEND_DECLARATION
43 
44  DEFINE_SERIALIZE_METHOD() {
45  SERIALIZE_FIELD(ar, "signatures_", signatures_);
46  SERIALIZE_FIELD(ar, "ecuVersionManifestSigned_", ecuVersionManifestSigned_);
47  }
48 #endif // OPCUABRIDGE_ENABLE_SERIALIZATION
49 };
50 } // namespace opcuabridge
51 
52 #endif // OPCUABRIDGE_ECUVERSIONMANIFEST_H_