DSDL catchup

This commit is contained in:
Pavel Kirienko
2015-07-05 09:17:44 +03:00
parent a25a9252a7
commit 27ec2419ff
10 changed files with 32 additions and 32 deletions
+1 -1
Submodule dsdl updated: cf1cdf6f0d...325d51e2b1
@@ -78,7 +78,7 @@ class UAVCAN_EXPORT DataTypeInfoProvider : Noncopyable
response.signature = desc->getSignature().get();
response.id = desc->getID().get();
response.kind.value = desc->getKind();
response.mask = protocol::GetDataTypeInfo::Response::MASK_KNOWN;
response.flags = protocol::GetDataTypeInfo::Response::FLAG_KNOWN;
response.name = desc->getFullName();
const Dispatcher& dispatcher = getNode().getDispatcher();
@@ -87,18 +87,18 @@ class UAVCAN_EXPORT DataTypeInfoProvider : Noncopyable
{
if (dispatcher.hasServer(desc->getID().get()))
{
response.mask |= protocol::GetDataTypeInfo::Response::MASK_SERVING;
response.flags |= protocol::GetDataTypeInfo::Response::FLAG_SERVING;
}
}
else if (desc->getKind() == DataTypeKindMessage)
{
if (dispatcher.hasSubscriber(desc->getID().get()))
{
response.mask |= protocol::GetDataTypeInfo::Response::MASK_SUBSCRIBED;
response.flags |= protocol::GetDataTypeInfo::Response::FLAG_SUBSCRIBED;
}
if (dispatcher.hasPublisher(desc->getID().get()))
{
response.mask |= protocol::GetDataTypeInfo::Response::MASK_PUBLISHING;
response.flags |= protocol::GetDataTypeInfo::Response::FLAG_PUBLISHING;
}
}
else
@@ -179,7 +179,7 @@ private:
{
if (!isRunning())
{
startPeriodic(MonotonicDuration::fromMSec(Discovery::BROADCASTING_INTERVAL_MS));
startPeriodic(MonotonicDuration::fromMSec(Discovery::BROADCASTING_PERIOD_MS));
}
}
@@ -83,7 +83,7 @@ class UAVCAN_EXPORT GlobalTimeSyncMaster : protected LoopbackFrameListenerBase
const MonotonicDuration since_prev_pub = current_time - iface_prev_pub_mono_;
iface_prev_pub_mono_ = current_time;
UAVCAN_ASSERT(since_prev_pub.isPositive());
const bool long_period = since_prev_pub.toMSec() >= protocol::GlobalTimeSync::MAX_PUBLICATION_PERIOD_MS;
const bool long_period = since_prev_pub.toMSec() >= protocol::GlobalTimeSync::MAX_BROADCASTING_PERIOD_MS;
protocol::GlobalTimeSync msg;
msg.previous_transmission_timestamp_usec = long_period ? 0 : prev_tx_utc_.toUSec();
@@ -124,7 +124,7 @@ class UAVCAN_EXPORT GlobalTimeSyncMaster : protected LoopbackFrameListenerBase
int getNextTransferID(TransferID& tid)
{
const MonotonicDuration max_transfer_interval =
MonotonicDuration::fromMSec(protocol::GlobalTimeSync::MAX_PUBLICATION_PERIOD_MS);
MonotonicDuration::fromMSec(protocol::GlobalTimeSync::MAX_BROADCASTING_PERIOD_MS);
const OutgoingTransferRegistryKey otr_key(dtid_, TransferTypeMessageBroadcast, NodeID::Broadcast);
const MonotonicTime otr_deadline = node_.getMonotonicTime() + max_transfer_interval;
@@ -226,7 +226,7 @@ public:
{
const MonotonicDuration since_prev_pub = current_time - prev_pub_mono_;
UAVCAN_ASSERT(since_prev_pub.isPositive());
if (since_prev_pub.toMSec() < protocol::GlobalTimeSync::MIN_PUBLICATION_PERIOD_MS)
if (since_prev_pub.toMSec() < protocol::GlobalTimeSync::MIN_BROADCASTING_PERIOD_MS)
{
UAVCAN_TRACE("GlobalTimeSyncMaster", "Publication skipped");
return 0;
@@ -83,7 +83,7 @@ class UAVCAN_EXPORT GlobalTimeSyncSlave : Noncopyable
const bool needs_init = !master_nid_.isValid() || prev_ts_mono_.isZero();
const bool switch_master = msg.getSrcNodeID() < master_nid_;
// TODO: Make configurable
const bool pub_timeout = since_prev_msg.toMSec() > protocol::GlobalTimeSync::RECOMMENDED_PUBLISHER_TIMEOUT_MS;
const bool pub_timeout = since_prev_msg.toMSec() > protocol::GlobalTimeSync::RECOMMENDED_BROADCASTER_TIMEOUT_MS;
if (switch_master || pub_timeout || needs_init)
{
@@ -97,7 +97,7 @@ class UAVCAN_EXPORT GlobalTimeSyncSlave : Noncopyable
{
const bool msg_invalid = msg.previous_transmission_timestamp_usec == 0;
const bool wrong_tid = prev_tid_.computeForwardDistance(msg.getTransferID()) != 1;
const bool wrong_timing = since_prev_msg.toMSec() > protocol::GlobalTimeSync::MAX_PUBLICATION_PERIOD_MS;
const bool wrong_timing = since_prev_msg.toMSec() > protocol::GlobalTimeSync::MAX_BROADCASTING_PERIOD_MS;
if (msg_invalid || wrong_tid || wrong_timing)
{
UAVCAN_TRACE("GlobalTimeSyncSlave",
@@ -179,7 +179,7 @@ public:
{
const MonotonicDuration since_prev_adj = getSystemClock().getMonotonic() - last_adjustment_ts_;
return !last_adjustment_ts_.isZero() &&
(since_prev_adj.toMSec() <= protocol::GlobalTimeSync::RECOMMENDED_PUBLISHER_TIMEOUT_MS);
(since_prev_adj.toMSec() <= protocol::GlobalTimeSync::RECOMMENDED_BROADCASTER_TIMEOUT_MS);
}
/**
@@ -39,11 +39,11 @@ public:
: TimerBase(node)
, pub_(node)
{
pub_.setTxTimeout(MonotonicDuration::fromMSec(protocol::Panic::BROADCASTING_INTERVAL_MS - 10));
pub_.setTxTimeout(MonotonicDuration::fromMSec(protocol::Panic::BROADCASTING_PERIOD_MS - 10));
}
/**
* Begin broadcasting at the standard interval (see BROADCASTING_INTERVAL_MS).
* Begin broadcasting at the standard interval (see BROADCASTING_PERIOD_MS).
* This method does not block and can't fail.
* @param short_reason Short ASCII string that describes the reason of the panic, 7 characters max.
* If the string exceeds 7 characters, it will be truncated.
@@ -65,7 +65,7 @@ public:
UAVCAN_TRACE("PanicBroadcaster", "Panicking with reason '%s'", getReason().c_str());
publishOnce();
startPeriodic(MonotonicDuration::fromMSec(protocol::Panic::BROADCASTING_INTERVAL_MS));
startPeriodic(MonotonicDuration::fromMSec(protocol::Panic::BROADCASTING_PERIOD_MS));
}
/**
@@ -77,7 +77,7 @@ int NodeStatusProvider::startAndPublish(TransferPriority priority)
goto fail;
}
setStatusPublicationPeriod(MonotonicDuration::fromMSec(protocol::NodeStatus::MAX_PUBLICATION_PERIOD_MS));
setStatusPublicationPeriod(MonotonicDuration::fromMSec(protocol::NodeStatus::MAX_BROADCASTING_PERIOD_MS));
return res;
@@ -90,8 +90,8 @@ fail:
void NodeStatusProvider::setStatusPublicationPeriod(uavcan::MonotonicDuration period)
{
const MonotonicDuration maximum = MonotonicDuration::fromMSec(protocol::NodeStatus::MAX_PUBLICATION_PERIOD_MS);
const MonotonicDuration minimum = MonotonicDuration::fromMSec(protocol::NodeStatus::MIN_PUBLICATION_PERIOD_MS);
const MonotonicDuration maximum = MonotonicDuration::fromMSec(protocol::NodeStatus::MAX_BROADCASTING_PERIOD_MS);
const MonotonicDuration minimum = MonotonicDuration::fromMSec(protocol::NodeStatus::MIN_BROADCASTING_PERIOD_MS);
period = min(period, maximum);
period = max(period, minimum);
@@ -40,7 +40,7 @@ TEST(Dsdl, Streaming)
"software_version: \n"
" major: 0\n"
" minor: 0\n"
" optional_field_mask: 0\n"
" optional_field_flags: 0\n"
" vcs_commit: 0\n"
" image_crc: 0\n"
"hardware_version: \n"
@@ -19,7 +19,7 @@ using uavcan::MonotonicDuration;
template <typename DataType>
static bool validateDataTypeInfoResponse(const std::auto_ptr<ServiceCallResultCollector<GetDataTypeInfo>::Result>& resp,
unsigned mask)
unsigned flags)
{
if (!resp.get())
{
@@ -43,7 +43,7 @@ static bool validateDataTypeInfoResponse(const std::auto_ptr<ServiceCallResultCo
std::cout << "Signature mismatch" << std::endl;
return false;
}
if (resp->getResponse().mask != mask)
if (resp->getResponse().flags != flags)
{
std::cout << "Mask mismatch" << std::endl;
return false;
@@ -90,8 +90,8 @@ TEST(DataTypeInfoProvider, Basic)
nodes.spinBoth(MonotonicDuration::fromMSec(10));
ASSERT_TRUE(validateDataTypeInfoResponse<GetDataTypeInfo>(gdti_cln.collector.result,
GetDataTypeInfo::Response::MASK_KNOWN |
GetDataTypeInfo::Response::MASK_SERVING));
GetDataTypeInfo::Response::FLAG_KNOWN |
GetDataTypeInfo::Response::FLAG_SERVING));
ASSERT_EQ(1, gdti_cln.collector.result->getCallID().server_node_id.get());
/*
@@ -105,8 +105,8 @@ TEST(DataTypeInfoProvider, Basic)
nodes.spinBoth(MonotonicDuration::fromMSec(10));
ASSERT_TRUE(validateDataTypeInfoResponse<GetDataTypeInfo>(gdti_cln.collector.result,
GetDataTypeInfo::Response::MASK_KNOWN |
GetDataTypeInfo::Response::MASK_SERVING));
GetDataTypeInfo::Response::FLAG_KNOWN |
GetDataTypeInfo::Response::FLAG_SERVING));
ASSERT_EQ(1, gdti_cln.collector.result->getCallID().server_node_id.get());
/*
@@ -119,7 +119,7 @@ TEST(DataTypeInfoProvider, Basic)
nodes.spinBoth(MonotonicDuration::fromMSec(10));
ASSERT_TRUE(validateDataTypeInfoResponse<NodeStatus>(gdti_cln.collector.result,
GetDataTypeInfo::Response::MASK_KNOWN));
GetDataTypeInfo::Response::FLAG_KNOWN));
/*
* Starting publisher and subscriber for NodeStatus, requesting info again
@@ -135,9 +135,9 @@ TEST(DataTypeInfoProvider, Basic)
nodes.spinBoth(MonotonicDuration::fromMSec(10));
ASSERT_TRUE(validateDataTypeInfoResponse<NodeStatus>(gdti_cln.collector.result,
GetDataTypeInfo::Response::MASK_KNOWN |
GetDataTypeInfo::Response::MASK_PUBLISHING |
GetDataTypeInfo::Response::MASK_SUBSCRIBED));
GetDataTypeInfo::Response::FLAG_KNOWN |
GetDataTypeInfo::Response::FLAG_PUBLISHING |
GetDataTypeInfo::Response::FLAG_SUBSCRIBED));
/*
* Requesting a non-existent type
@@ -46,15 +46,15 @@ TEST(NodeStatusProvider, Basic)
ASSERT_LE(0, nsp.startAndPublish());
// Checking the publishing rate settings
ASSERT_EQ(uavcan::MonotonicDuration::fromMSec(uavcan::protocol::NodeStatus::MAX_PUBLICATION_PERIOD_MS),
ASSERT_EQ(uavcan::MonotonicDuration::fromMSec(uavcan::protocol::NodeStatus::MAX_BROADCASTING_PERIOD_MS),
nsp.getStatusPublicationPeriod());
nsp.setStatusPublicationPeriod(uavcan::MonotonicDuration());
ASSERT_EQ(uavcan::MonotonicDuration::fromMSec(uavcan::protocol::NodeStatus::MIN_PUBLICATION_PERIOD_MS),
ASSERT_EQ(uavcan::MonotonicDuration::fromMSec(uavcan::protocol::NodeStatus::MIN_BROADCASTING_PERIOD_MS),
nsp.getStatusPublicationPeriod());
nsp.setStatusPublicationPeriod(uavcan::MonotonicDuration::fromMSec(3600 * 1000 * 24));
ASSERT_EQ(uavcan::MonotonicDuration::fromMSec(uavcan::protocol::NodeStatus::MAX_PUBLICATION_PERIOD_MS),
ASSERT_EQ(uavcan::MonotonicDuration::fromMSec(uavcan::protocol::NodeStatus::MAX_BROADCASTING_PERIOD_MS),
nsp.getStatusPublicationPeriod());
/*