mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 23:33:34 +08:00
Using transfer priorities in protocol:: classes
This commit is contained in:
@@ -114,7 +114,8 @@ void DynamicNodeIDAllocationClient::handleAllocation(
|
||||
}
|
||||
|
||||
int DynamicNodeIDAllocationClient::start(const protocol::HardwareVersion& hardware_version,
|
||||
const NodeID preferred_node_id)
|
||||
const NodeID preferred_node_id,
|
||||
const TransferPriority transfer_priority)
|
||||
{
|
||||
terminate();
|
||||
|
||||
@@ -161,6 +162,11 @@ int DynamicNodeIDAllocationClient::start(const protocol::HardwareVersion& hardwa
|
||||
return res;
|
||||
}
|
||||
dnida_pub_.allowAnonymousTransfers();
|
||||
res = dnida_pub_.setPriority(transfer_priority);
|
||||
if (res < 0)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
res = dnida_sub_.start(AllocationCallback(this, &DynamicNodeIDAllocationClient::handleAllocation));
|
||||
if (res < 0)
|
||||
|
||||
@@ -24,6 +24,12 @@ int GlobalTimeSyncMaster::IfaceMaster::init()
|
||||
UAVCAN_ASSERT(ts != NULL);
|
||||
ts->setIfaceMask(uint8_t(1 << iface_index_));
|
||||
ts->setCanIOFlags(CanIOFlagLoopback);
|
||||
|
||||
const int prio_res = pub_.setPriority(TransferPriorityHigh); // Fixed priority
|
||||
if (prio_res < 0)
|
||||
{
|
||||
return prio_res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,12 @@ Logger::LogLevel Logger::getExternalSinkLevel() const
|
||||
|
||||
int Logger::init()
|
||||
{
|
||||
return logmsg_pub_.init();
|
||||
const int res = logmsg_pub_.init();
|
||||
if (res < 0)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
return logmsg_pub_.setPriority(TransferPriorityLow); // Fixed priority
|
||||
}
|
||||
|
||||
int Logger::log(const protocol::debug::LogMessage& message)
|
||||
|
||||
@@ -61,7 +61,7 @@ void NodeStatusProvider::handleGetNodeInfoRequest(const protocol::GetNodeInfo::R
|
||||
rsp = node_info_;
|
||||
}
|
||||
|
||||
int NodeStatusProvider::startAndPublish()
|
||||
int NodeStatusProvider::startAndPublish(TransferPriority priority)
|
||||
{
|
||||
if (!isNodeInfoInitialized())
|
||||
{
|
||||
@@ -71,6 +71,12 @@ int NodeStatusProvider::startAndPublish()
|
||||
|
||||
int res = -1;
|
||||
|
||||
res = node_status_pub_.setPriority(priority);
|
||||
if (res < 0)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!getNode().isPassiveMode())
|
||||
{
|
||||
res = publish();
|
||||
|
||||
Reference in New Issue
Block a user