Skip to content

Commit b28a4b4

Browse files
Otpvondoiatsxiaoxiang781216
authored andcommitted
uORB: Add topic information acquisition and setting interface.
Signed-off-by: likun17 <[email protected]>
1 parent bccb6c6 commit b28a4b4

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

system/uorb/uORB/uORB.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,16 @@ int orb_get_interval(int fd, FAR unsigned *interval)
257257
return ret;
258258
}
259259

260+
int orb_set_info(int fd, FAR const orb_info_t *info)
261+
{
262+
return ioctl(fd, SNIOC_SET_INFO, (unsigned long)(uintptr_t)info);
263+
}
264+
265+
int orb_get_info(int fd, FAR orb_info_t *info)
266+
{
267+
return ioctl(fd, SNIOC_GET_INFO, (unsigned long)(uintptr_t)info);
268+
}
269+
260270
int orb_set_batch_interval(int fd, unsigned batch_interval)
261271
{
262272
return ioctl(fd, SNIOC_BATCH, (unsigned long)batch_interval);
@@ -340,7 +350,7 @@ void orb_info(FAR const char *format, FAR const char *name,
340350

341351
vaf.fmt = format;
342352
vaf.va = (va_list *)data;
343-
uorbinfo_raw("%s(now:%" PRIu64 "):%pB", name, orb_absolute_time(), &vaf);
353+
uorbinfo_raw("%s(now:%" PRIu64 "):%pB\n", name, orb_absolute_time(), &vaf);
344354
}
345355

346356
int orb_fprintf(FAR FILE *stream, FAR const char *format,

system/uorb/uORB/uORB.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ struct orb_object
6969
};
7070

7171
typedef uint64_t orb_abstime;
72+
typedef struct sensor_device_info_s orb_info_t;
7273

7374
struct orb_handle_s;
7475

@@ -625,6 +626,38 @@ int orb_set_interval(int fd, unsigned interval);
625626

626627
int orb_get_interval(int fd, FAR unsigned *interval);
627628

629+
/****************************************************************************
630+
* Name: orb_set_info
631+
*
632+
* Description:
633+
* Set topic information.
634+
*
635+
* Input Parameters:
636+
* fd A fd returned from orb_subscribe.
637+
* info Data to be transmitted.
638+
*
639+
* Returned Value:
640+
* 0 on success, -1 otherwise with ERRNO set accordingly.
641+
****************************************************************************/
642+
643+
int orb_set_info(int fd, FAR const orb_info_t *info);
644+
645+
/****************************************************************************
646+
* Name: orb_get_info
647+
*
648+
* Description:
649+
* Get topic information.
650+
*
651+
* Input Parameters:
652+
* fd A fd returned from orb_subscribe.
653+
* info The returned topic info.
654+
*
655+
* Returned Value:
656+
* 0 on success, -1 otherwise with ERRNO set accordingly.
657+
****************************************************************************/
658+
659+
int orb_get_info(int fd, FAR orb_info_t *info);
660+
628661
/****************************************************************************
629662
* Name:
630663
* orb_set_frequency

0 commit comments

Comments
 (0)