Firmware
|
Per-object device instance. More...
#include <uORBDeviceNode.hpp>
Public Member Functions | |
DeviceNode (const struct orb_metadata *meta, const uint8_t instance, const char *path, uint8_t priority, uint8_t queue_size=1) | |
DeviceNode (const DeviceNode &)=delete | |
DeviceNode & | operator= (const DeviceNode &)=delete |
DeviceNode (DeviceNode &&)=delete | |
DeviceNode & | operator= (DeviceNode &&)=delete |
int | open (cdev::file_t *filp) override |
Method to create a subscriber instance and return the struct pointing to the subscriber as a file pointer. | |
int | close (cdev::file_t *filp) override |
Method to close a subscriber for this topic. | |
ssize_t | read (cdev::file_t *filp, char *buffer, size_t buflen) override |
reads data from a subscriber node to the buffer provided. More... | |
ssize_t | write (cdev::file_t *filp, const char *buffer, size_t buflen) override |
writes the published data to the internal buffer to be read by subscribers later. More... | |
int | ioctl (cdev::file_t *filp, int cmd, unsigned long arg) override |
IOCTL control for the subscriber. | |
void | add_internal_subscriber () |
Add the subscriber to the node's list of subscriber. More... | |
void | remove_internal_subscriber () |
Removes the subscriber from the list. More... | |
bool | is_published () const |
Return true if this topic has been published. More... | |
int | update_queue_size (unsigned int queue_size) |
Try to change the size of the queue. More... | |
bool | print_statistics (bool reset) |
Print statistics (nr of lost messages) More... | |
uint8_t | get_queue_size () const |
int8_t | subscriber_count () const |
uint32_t | lost_message_count () const |
unsigned | published_message_count () const |
const orb_metadata * | get_meta () const |
const char * | get_name () const |
uint8_t | get_instance () const |
int | get_priority () const |
void | set_priority (uint8_t priority) |
![]() | |
CDev (const char *devname) | |
Constructor. More... | |
virtual int | init () |
virtual off_t | seek (file_t *filep, off_t offset, int whence) |
Perform a logical seek operation on the device. More... | |
virtual int | poll (file_t *filep, px4_pollfd_struct_t *fds, bool setup) |
Perform a poll setup/teardown operation. More... | |
const char * | get_devname () const |
Get the device name. More... | |
![]() | |
void | setSibling (uORB::DeviceNode * sibling) |
const uORB::DeviceNode * | getSibling () const |
Static Public Member Functions | |
static ssize_t | publish (const orb_metadata *meta, orb_advert_t handle, const void *data) |
Method to publish a data to this node. | |
static int | unadvertise (orb_advert_t handle) |
Protected Member Functions | |
pollevent_t | poll_state (cdev::file_t *filp) override |
Check the current state of the device for poll events from the perspective of the file. More... | |
void | poll_notify_one (px4_pollfd_struct_t *fds, pollevent_t events) override |
Internal implementation of poll_notify. More... | |
![]() | |
virtual void | poll_notify (pollevent_t events) |
Report new poll events. More... | |
virtual int | open_first (file_t *filep) |
Notification of the first open. More... | |
virtual int | close_last (file_t *filep) |
Notification of the last close. More... | |
virtual int | register_class_devname (const char *class_devname) |
Register a class device name, automatically adding device class instance suffix if need be. More... | |
virtual int | unregister_class_devname (const char *class_devname, unsigned class_instance) |
Register a class device name, automatically adding device class instance suffix if need be. More... | |
void | lock () |
Take the driver lock. More... | |
void | unlock () |
Release the driver lock. | |
Additional Inherited Members | |
![]() | |
px4_sem_t | _lock |
lock to protect access to all class members (also for derived classes) | |
![]() | |
uORB::DeviceNode * | _sibling |
![]() | |
static const px4_file_operations_t | fops = {} |
Pointer to the default cdev file operations table; useful for registering clone devices etc. | |
Per-object device instance.
void uORB::DeviceNode::add_internal_subscriber | ( | ) |
Add the subscriber to the node's list of subscriber.
If there is remote proxy to which this subscription needs to be sent, it will done via uORBCommunicator::IChannel interface.
sd | the subscriber to be added. |
|
inline |
Return true if this topic has been published.
This is used in the case of multi_pub/sub to check if it's valid to advertise and publish to this node or if another node should be tried.
|
overrideprotectedvirtual |
Internal implementation of poll_notify.
fds | A poll waiter to notify. |
events | The event(s) to send to the waiter. |
Reimplemented from cdev::CDev.
|
overrideprotectedvirtual |
Check the current state of the device for poll events from the perspective of the file.
This function is called by the default poll() implementation when a poll is set up to determine whether the poll should return immediately.
The default implementation returns no events.
filep | The file that's interested. |
Reimplemented from cdev::CDev.
bool uORB::DeviceNode::print_statistics | ( | bool | reset | ) |
Print statistics (nr of lost messages)
reset | if true, reset statistics afterwards |
|
overridevirtual |
reads data from a subscriber node to the buffer provided.
filp | The subscriber from which the data needs to be read from. |
buffer | The buffer into which the data is read into. |
buflen | the length of the buffer |
Reimplemented from cdev::CDev.
void uORB::DeviceNode::remove_internal_subscriber | ( | ) |
Removes the subscriber from the list.
Also notifies the remote if there a uORBCommunicator::IChannel instance.
sd | the Subscriber to be removed. |
int uORB::DeviceNode::update_queue_size | ( | unsigned int | queue_size | ) |
Try to change the size of the queue.
This can only be done as long as nobody published yet. This is the case, for example when orb_subscribe was called before an orb_advertise. The queue size can only be increased.
queue_size | new size of the queue |
|
overridevirtual |
writes the published data to the internal buffer to be read by subscribers later.
filp | the subscriber; this is not used. |
buffer | The buffer for the input data |
buflen | the length of the buffer. |
Reimplemented from cdev::CDev.