mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 23:33:38 +08:00
OTR deinterfaced
This commit is contained in:
@@ -20,8 +20,36 @@ std::string OutgoingTransferRegistryKey::toString() const
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IOutgoingTransferRegistry
|
||||
* OutgoingTransferRegistry
|
||||
*/
|
||||
const MonotonicDuration IOutgoingTransferRegistry::MinEntryLifetime = MonotonicDuration::fromMSec(2000);
|
||||
const MonotonicDuration OutgoingTransferRegistry::MinEntryLifetime = MonotonicDuration::fromMSec(2000);
|
||||
|
||||
TransferID* OutgoingTransferRegistry::accessOrCreate(const OutgoingTransferRegistryKey& key,
|
||||
MonotonicTime new_deadline)
|
||||
{
|
||||
UAVCAN_ASSERT(!new_deadline.isZero());
|
||||
Value* p = map_.access(key);
|
||||
if (p == NULL)
|
||||
{
|
||||
p = map_.insert(key, Value());
|
||||
if (p == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
UAVCAN_TRACE("OutgoingTransferRegistry", "Created %s", key.toString().c_str());
|
||||
}
|
||||
p->deadline = new_deadline;
|
||||
return &p->tid;
|
||||
}
|
||||
|
||||
bool OutgoingTransferRegistry::exists(DataTypeID dtid, TransferType tt) const
|
||||
{
|
||||
return NULL != map_.find(ExistenceCheckingPredicate(dtid, tt));
|
||||
}
|
||||
|
||||
void OutgoingTransferRegistry::cleanup(MonotonicTime ts)
|
||||
{
|
||||
map_.removeAllWhere(DeadlineExpiredPredicate(ts));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ int TransferSender::send(const uint8_t* payload, unsigned payload_len, Monotonic
|
||||
|
||||
UAVCAN_ASSERT(!tx_deadline.isZero());
|
||||
const MonotonicTime otr_deadline = tx_deadline + max(max_transfer_interval_ * 2,
|
||||
IOutgoingTransferRegistry::MinEntryLifetime);
|
||||
OutgoingTransferRegistry::MinEntryLifetime);
|
||||
|
||||
TransferID* const tid = dispatcher_.getOutgoingTransferRegistry().accessOrCreate(otr_key, otr_deadline);
|
||||
if (tid == NULL)
|
||||
|
||||
Reference in New Issue
Block a user