16class PortConnection :
public QObject
22 PortConnection (QObject * parent =
nullptr);
30 QObject * parent =
nullptr);
32 void update (
float multiplier,
bool locked,
bool enabled)
39 void set_bipolar (
bool bipolar) {
bipolar_ = bipolar; }
41 void set_channel_mapping (uint8_t source_channel, uint8_t destination_channel)
44 std::make_pair (source_channel, destination_channel);
46 void unset_channel_mapping ()
52 static constexpr std::string_view kSourceIdKey =
"srcId";
53 static constexpr std::string_view kDestIdKey =
"destId";
54 static constexpr std::string_view kMultiplierKey =
"multiplier";
55 static constexpr std::string_view kLockedKey =
"locked";
56 static constexpr std::string_view kEnabledKey =
"enabled";
57 static constexpr std::string_view kBipolarKey =
"bipolar";
58 static constexpr std::string_view kSourceDestMappingKey =
59 "sourceChannelToDestinationChannelMapping";
60 friend void to_json (nlohmann::json &j,
const PortConnection &port_connection)
62 j[kSourceIdKey] = port_connection.src_id_;
63 j[kDestIdKey] = port_connection.dest_id_;
65 j[kLockedKey] = port_connection.
locked_;
66 j[kEnabledKey] = port_connection.
enabled_;
67 j[kBipolarKey] = port_connection.
bipolar_;
68 j[kSourceDestMappingKey] =
72 from_json (
const nlohmann::json &j, PortConnection &port_connection)
74 j.at (kSourceIdKey).get_to (port_connection.src_id_);
75 j.at (kDestIdKey).get_to (port_connection.dest_id_);
76 j.at (kMultiplierKey).get_to (port_connection.
multiplier_);
77 j.at (kLockedKey).get_to (port_connection.
locked_);
78 j.at (kEnabledKey).get_to (port_connection.
enabled_);
79 j.at (kBipolarKey).get_to (port_connection.
bipolar_);
80 j.at (kSourceDestMappingKey)
84 friend void init_from (
86 const PortConnection &other,
89 friend bool operator== (
const PortConnection &lhs,
const PortConnection &rhs)
91 return lhs.src_id_ == rhs.src_id_ && lhs.dest_id_ == rhs.dest_id_;
142 BOOST_DESCRIBE_CLASS (