NodeInfoRetriever::invalidateAll()

This commit is contained in:
Pavel Kirienko
2015-06-24 01:32:44 +03:00
parent 532d490fac
commit 1b698c4267
3 changed files with 47 additions and 0 deletions
@@ -365,6 +365,22 @@ public:
return 0;
}
/**
* This method forces the class to re-request uavcan.protocol.GetNodeInfo from all nodes as if they
* have just appeared in the network.
*/
void invalidateAll()
{
NodeStatusMonitor::forgetAllNodes();
get_node_info_client_.cancelAllCalls();
for (unsigned i = 0; i < (sizeof(entries_) / sizeof(entries_[0])); i++)
{
entries_[i] = Entry();
}
// It is not necessary to reset the last picked node index
}
/**
* Adds one listener. Does nothing if such listener already exists.
* May return -ErrMemory if there's no space to add the listener.
@@ -195,6 +195,17 @@ public:
}
}
/**
* Make all nodes unknown.
*/
void forgetAllNodes()
{
for (unsigned i = 0; i < (sizeof(entries_) / sizeof(entries_[0])); i++)
{
entries_[i] = Entry();
}
}
/**
* Returns status of a given node.
* Unknown nodes are considered offline.