Ditto  3.0.4
PresenceGraph.hpp
1 #ifndef _DITTO_PRESENCE_GRAPH_
2 #define _DITTO_PRESENCE_GRAPH_
3 
4 #include "dittoffi.hpp"
5 
6 #include "json.hpp"
7 
8 #include <vector>
9 
10 typedef uint64_t SiteId;
11 typedef std::vector<uint8_t> Pubkey;
12 
13 namespace ditto {
14 using nlohmann::json;
18 class DittoAddress {
19 public:
20  explicit DittoAddress();
21  DittoAddress(Pubkey pubkey, SiteId site_id);
22  void update_from_json(json j);
23  bool operator==(const DittoAddress &b) const;
24 
25 private:
26  SiteId site_id;
27  Pubkey pubkey;
28 };
29 
33 class Connection {
34 public:
35  explicit Connection();
36  std::string id;
37  DittoAddress peer1;
38  DittoAddress peer2;
39  float approximate_distance_in_meters;
40  std::string connection_type;
41 };
42 
46 class Peer {
47 public:
48  explicit Peer();
49  DittoAddress address;
50  std::string device_name;
51  std::string os;
52  uint8_t query_overlap_group;
53  bool is_connected_to_ditto_cloud;
54  bool is_compatible;
55  std::string ditto_sdk_version;
56  std::vector<Connection> connections;
57 };
58 
63 public:
68  Peer local_peer;
69  std::vector<Peer> remote_peers;
70 };
71 
72 } // namespace ditto
73 #endif
Connection between two peers.
Definition: PresenceGraph.hpp:33
Information used to identify a peer.
Definition: PresenceGraph.hpp:18
Represent a known peer in the Ditto network.
Definition: PresenceGraph.hpp:46
Represents local peer and local peers.
Definition: PresenceGraph.hpp:62
PresenceGraph(nlohmann::json)
Construct a new Presence Graph object.
Definition: PresenceGraph.cpp:46
basic_json<> json
default JSON class
Definition: json.hpp:2933