uORB: Add topic information acquisition and setting interface.
Signed-off-by: likun17 <likun17@xiaomi.com>
diff --git a/system/uorb/uORB/uORB.c b/system/uorb/uORB/uORB.c
index 20d6e11..cf3f70c 100644
--- a/system/uorb/uORB/uORB.c
+++ b/system/uorb/uORB/uORB.c
@@ -257,6 +257,16 @@
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 @@
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,
diff --git a/system/uorb/uORB/uORB.h b/system/uorb/uORB/uORB.h
index 0c99e6b..448324f 100644
--- a/system/uorb/uORB/uORB.h
+++ b/system/uorb/uORB/uORB.h
@@ -69,6 +69,7 @@
};
typedef uint64_t orb_abstime;
+typedef struct sensor_device_info_s orb_info_t;
struct orb_handle_s;
@@ -626,6 +627,38 @@
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
*