Example #1
0
 bool operator==(const Transfer& rhs) const
 {
     return
         (ts_monotonic  == rhs.ts_monotonic) &&
         ((!ts_utc.isZero() && !rhs.ts_utc.isZero()) ? (ts_utc == rhs.ts_utc) : true) &&
         (transfer_type == rhs.transfer_type) &&
         (transfer_id   == rhs.transfer_id) &&
         (src_node_id   == rhs.src_node_id) &&
         ((dst_node_id.isValid() && rhs.dst_node_id.isValid()) ? (dst_node_id == rhs.dst_node_id) : true) &&
         (data_type     == rhs.data_type) &&
         (payload       == rhs.payload);
 }
 Transfer makeTransfer(uavcan::TransferPriority priority, uavcan::TransferType transfer_type,
                       uint8_t source_node_id, const std::string& payload, const uavcan::DataTypeDescriptor& type,
                       uavcan::NodeID dst_node_id_override = uavcan::NodeID())
 {
     ts_ += uavcan::MonotonicDuration::fromUSec(100);
     const uavcan::UtcTime utc = uavcan::UtcTime::fromUSec(ts_.toUSec() + 1000000000ul);
     const uavcan::NodeID dst_node_id = (transfer_type == uavcan::TransferTypeMessageBroadcast) ?
                                        uavcan::NodeID::Broadcast :
                                        (dst_node_id_override.isValid() ? dst_node_id_override : dst_node_id_);
     const Transfer tr(ts_, utc, priority, transfer_type, tid_, source_node_id, dst_node_id, payload, type);
     tid_.increment();
     return tr;
 }