PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Master control device for ObjDev. More...
#include <uORBDeviceMaster.hpp>
Classes | |
struct | DeviceNodeStatisticsData |
Public Member Functions | |
int | advertise (const struct orb_metadata *meta, bool is_advertiser, int *instance, int priority) |
uORB::DeviceNode * | getDeviceNode (const char *node_name) |
Public interface for getDeviceNodeLocked(). More... | |
uORB::DeviceNode * | getDeviceNode (const struct orb_metadata *meta, const uint8_t instance) |
void | printStatistics (bool reset) |
Print statistics for each existing topic. More... | |
void | showTop (char **topic_filter, int num_filters) |
Continuously print statistics, like the unix top command for processes. More... | |
Private Member Functions | |
DeviceMaster () | |
~DeviceMaster () | |
int | addNewDeviceNodes (DeviceNodeStatisticsData **first_node, int &num_topics, size_t &max_topic_name_length, char **topic_filter, int num_filters) |
uORB::DeviceNode * | getDeviceNodeLocked (const struct orb_metadata *meta, const uint8_t instance) |
Find a node give its name. More... | |
void | lock () |
void | unlock () |
Private Attributes | |
List< uORB::DeviceNode * > | _node_list |
hrt_abstime | _last_statistics_output |
px4_sem_t | _lock |
lock to protect access to all class members (also for derived classes) More... | |
Friends | |
class | uORB::Manager |
Master control device for ObjDev.
Used primarily to create new objects via the ORBIOCCREATE ioctl.
Definition at line 59 of file uORBDeviceMaster.hpp.
|
private |
Definition at line 46 of file uORBDeviceMaster.cpp.
References _last_statistics_output, _lock, and hrt_absolute_time().
|
private |
Definition at line 52 of file uORBDeviceMaster.cpp.
References _lock.
|
private |
Definition at line 215 of file uORBDeviceMaster.cpp.
References _node_list, uORB::DeviceNode::get_meta(), uORB::DeviceMaster::DeviceNodeStatisticsData::last_lost_msg_count, uORB::DeviceMaster::DeviceNodeStatisticsData::last_pub_msg_count, uORB::DeviceNode::lost_message_count(), uORB::DeviceMaster::DeviceNodeStatisticsData::next, uORB::DeviceMaster::DeviceNodeStatisticsData::node, orb_metadata::o_name, and uORB::DeviceNode::published_message_count().
Referenced by printStatistics(), and showTop().
int uORB::DeviceMaster::advertise | ( | const struct orb_metadata * | meta, |
bool | is_advertiser, | ||
int * | instance, | ||
int | priority | ||
) |
Definition at line 58 of file uORBDeviceMaster.cpp.
References _lock, _node_list, getDeviceNodeLocked(), cdev::CDev::init(), ll40ls::instance, uORB::DeviceNode::is_advertised(), uORB::DeviceNode::mark_as_advertised(), uORB::Utils::node_mkpath(), uORB::orb_maxpath, ORB_MULTI_MAX_INSTANCES, and uORB::DeviceNode::set_priority().
Referenced by uORB::Manager::node_advertise().
uORB::DeviceNode * uORB::DeviceMaster::getDeviceNode | ( | const char * | node_name | ) |
Public interface for getDeviceNodeLocked().
Takes care of synchronization.
Definition at line 435 of file uORBDeviceMaster.cpp.
References _node_list, lock(), and unlock().
Referenced by uORB::Manager::node_open(), uORB::Manager::orb_exists(), and uORB::Subscription::subscribe().
uORB::DeviceNode * uORB::DeviceMaster::getDeviceNode | ( | const struct orb_metadata * | meta, |
const uint8_t | instance | ||
) |
Definition at line 451 of file uORBDeviceMaster.cpp.
References getDeviceNodeLocked(), lock(), and unlock().
|
private |
Find a node give its name.
_lock must already be held when calling this.
Definition at line 466 of file uORBDeviceMaster.cpp.
References _node_list, ll40ls::instance, and orb_metadata::o_name.
Referenced by advertise(), and getDeviceNode().
|
inlineprivate |
Definition at line 119 of file uORBDeviceMaster.hpp.
Referenced by getDeviceNode(), printStatistics(), and showTop().
void uORB::DeviceMaster::printStatistics | ( | bool | reset | ) |
Print statistics for each existing topic.
reset | if true, reset statistics afterwards |
Definition at line 175 of file uORBDeviceMaster.cpp.
References _last_statistics_output, addNewDeviceNodes(), hrt_absolute_time(), hrt_abstime, lock(), uORB::DeviceMaster::DeviceNodeStatisticsData::next, uORB::DeviceMaster::DeviceNodeStatisticsData::node, uORB::DeviceNode::print_statistics(), and unlock().
Referenced by uorb_main().
void uORB::DeviceMaster::showTop | ( | char ** | topic_filter, |
int | num_filters | ||
) |
Continuously print statistics, like the unix top command for processes.
Exited when the user presses the enter key.
topic_filter | list of topic filters: if set, each string can be a substring for topics to match. Or it can be '-a', which means to print all topics instead of only currently publishing ones. |
num_filters |
Definition at line 286 of file uORBDeviceMaster.cpp.
References _node_list, addNewDeviceNodes(), CLEAR_LINE, dt, uORB::DeviceNode::get_instance(), uORB::DeviceNode::get_meta(), uORB::DeviceNode::get_queue_size(), hrt_absolute_time(), hrt_abstime, uORB::DeviceMaster::DeviceNodeStatisticsData::last_lost_msg_count, uORB::DeviceMaster::DeviceNodeStatisticsData::last_pub_msg_count, lock(), uORB::DeviceNode::lost_message_count(), uORB::DeviceMaster::DeviceNodeStatisticsData::lost_msg_delta, uORB::DeviceMaster::DeviceNodeStatisticsData::next, uORB::DeviceMaster::DeviceNodeStatisticsData::node, orb_metadata::o_name, uORB::DeviceMaster::DeviceNodeStatisticsData::pub_msg_delta, uORB::DeviceNode::published_message_count(), read(), uORB::DeviceNode::subscriber_count(), and unlock().
Referenced by uorb_main().
|
inlineprivate |
Definition at line 120 of file uORBDeviceMaster.hpp.
Referenced by getDeviceNode(), printStatistics(), and showTop().
|
friend |
Definition at line 104 of file uORBDeviceMaster.hpp.
|
private |
Definition at line 115 of file uORBDeviceMaster.hpp.
Referenced by DeviceMaster(), and printStatistics().
|
private |
lock to protect access to all class members (also for derived classes)
Definition at line 117 of file uORBDeviceMaster.hpp.
Referenced by advertise(), DeviceMaster(), and ~DeviceMaster().
|
private |
Definition at line 113 of file uORBDeviceMaster.hpp.
Referenced by addNewDeviceNodes(), advertise(), getDeviceNode(), getDeviceNodeLocked(), and showTop().