uORB: Add topic information acquisition and setting interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
This commit is contained in:
parent
f86baa76fc
commit
9ca75e2977
@ -257,6 +257,16 @@ int orb_get_interval(int fd, FAR unsigned *interval)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int orb_set_info(int fd, FAR const orb_info_t *info)
|
||||
{
|
||||
return ioctl(fd, SNIOC_SET_INFO, (unsigned long)(uintptr_t)info);
|
||||
}
|
||||
|
||||
int orb_get_info(int fd, FAR orb_info_t *info)
|
||||
{
|
||||
return ioctl(fd, SNIOC_GET_INFO, (unsigned long)(uintptr_t)info);
|
||||
}
|
||||
|
||||
int orb_set_batch_interval(int fd, unsigned batch_interval)
|
||||
{
|
||||
return ioctl(fd, SNIOC_BATCH, (unsigned long)batch_interval);
|
||||
@ -340,7 +350,7 @@ void orb_info(FAR const char *format, FAR const char *name,
|
||||
|
||||
vaf.fmt = format;
|
||||
vaf.va = (va_list *)data;
|
||||
uorbinfo_raw("%s(now:%" PRIu64 "):%pB", name, orb_absolute_time(), &vaf);
|
||||
uorbinfo_raw("%s(now:%" PRIu64 "):%pB\n", name, orb_absolute_time(), &vaf);
|
||||
}
|
||||
|
||||
int orb_fprintf(FAR FILE *stream, FAR const char *format,
|
||||
|
@ -69,6 +69,7 @@ struct orb_object
|
||||
};
|
||||
|
||||
typedef uint64_t orb_abstime;
|
||||
typedef struct sensor_device_info_s orb_info_t;
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -590,6 +591,38 @@ int orb_set_interval(int fd, unsigned interval);
|
||||
|
||||
int orb_get_interval(int fd, FAR unsigned *interval);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: orb_set_info
|
||||
*
|
||||
* Description:
|
||||
* Set topic information.
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd A fd returned from orb_subscribe.
|
||||
* info Data to be transmitted.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 on success, -1 otherwise with ERRNO set accordingly.
|
||||
****************************************************************************/
|
||||
|
||||
int orb_set_info(int fd, FAR const orb_info_t *info);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: orb_get_info
|
||||
*
|
||||
* Description:
|
||||
* Get topic information.
|
||||
*
|
||||
* Input Parameters:
|
||||
* fd A fd returned from orb_subscribe.
|
||||
* info The returned topic info.
|
||||
*
|
||||
* Returned Value:
|
||||
* 0 on success, -1 otherwise with ERRNO set accordingly.
|
||||
****************************************************************************/
|
||||
|
||||
int orb_get_info(int fd, FAR orb_info_t *info);
|
||||
|
||||
/****************************************************************************
|
||||
* Name:
|
||||
* orb_set_frequency
|
||||
|
Loading…
x
Reference in New Issue
Block a user