orb: add orb_get_interval to API

This commit is contained in:
Beat Küng
2016-06-06 23:27:16 +02:00
committed by Lorenz Meier
parent 0fb0f17ccb
commit e709048fb8
7 changed files with 41 additions and 1 deletions
+3
View File
@@ -90,4 +90,7 @@
/** Set the queue size of the topic */
#define ORBIOCSETQUEUESIZE _ORBIOC(15)
/** Get the minimum interval at which the topic can be seen to be updated for this subscription */
#define ORBIOCGETINTERVAL _ORBIOC(16)
#endif /* _DRV_UORB_H */
+5 -1
View File
@@ -140,8 +140,12 @@ int orb_priority(int handle, int32_t *priority)
return uORB::Manager::get_instance()->orb_priority(handle, priority);
}
int orb_set_interval(int handle, unsigned interval)
int orb_set_interval(int handle, unsigned interval)
{
return uORB::Manager::get_instance()->orb_set_interval(handle, interval);
}
int orb_get_interval(int handle, unsigned *interval)
{
return uORB::Manager::get_instance()->orb_get_interval(handle, interval);
}
+5
View File
@@ -232,6 +232,11 @@ extern int orb_priority(int handle, int32_t *priority) __EXPORT;
*/
extern int orb_set_interval(int handle, unsigned interval) __EXPORT;
/**
* @see uORB::Manager::orb_get_interval()
*/
extern int orb_get_interval(int handle, unsigned *interval) __EXPORT;
__END_DECLS
/* Diverse uORB header defines */ //XXX: move to better location
+4
View File
@@ -311,6 +311,10 @@ uORB::DeviceNode::ioctl(struct file *filp, int cmd, unsigned long arg)
//and only one advertiser is allowed to open the DeviceNode at the same time.
return update_queue_size(arg);
case ORBIOCGETINTERVAL:
*(unsigned *)arg = sd->update_interval;
return OK;
default:
/* give it to the superclass */
return CDev::ioctl(filp, cmd, arg);
+4
View File
@@ -326,6 +326,10 @@ uORB::DeviceNode::ioctl(device::file_t *filp, int cmd, unsigned long arg)
//and only one advertiser is allowed to open the DeviceNode at the same time.
return update_queue_size(arg);
case ORBIOCGETINTERVAL:
*(unsigned *)arg = sd->update_interval;
return OK;
default:
/* give it to the superclass */
return VDev::ioctl(filp, cmd, arg);
+8
View File
@@ -204,6 +204,14 @@ int uORB::Manager::orb_set_interval(int handle, unsigned interval)
return px4_ioctl(handle, ORBIOCSETINTERVAL, interval * 1000);
}
int uORB::Manager::orb_get_interval(int handle, unsigned *interval)
{
ASSERT(interval);
int ret = px4_ioctl(handle, ORBIOCGETINTERVAL, (unsigned long)interval);
*interval /= 1000;
return ret;
}
int uORB::Manager::node_advertise
(
+12
View File
@@ -327,6 +327,18 @@ public:
*/
int orb_set_interval(int handle, unsigned interval) ;
/**
* Get the minimum interval between which updates are seen for a subscription.
*
* @see orb_set_interval()
*
* @param handle A handle returned from orb_subscribe.
* @param interval The returned interval period in milliseconds.
* @return OK on success, ERROR otherwise with ERRNO set accordingly.
*/
int orb_get_interval(int handle, unsigned *interval);
/**
* Method to set the uORBCommunicator::IChannel instance.
* @param comm_channel