This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch releases/12.7
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit 9ca75e29776d74756ddbd668556aa92c74194604
Author: likun17 <[email protected]>
AuthorDate: Mon Apr 1 19:21:58 2024 +0800

    uORB: Add topic information acquisition and setting interface.
    
    Signed-off-by: likun17 <[email protected]>
---
 system/uorb/uORB/uORB.c | 12 +++++++++++-
 system/uorb/uORB/uORB.h | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/system/uorb/uORB/uORB.c b/system/uorb/uORB/uORB.c
index 20d6e1157..cf3f70cb8 100644
--- a/system/uorb/uORB/uORB.c
+++ b/system/uorb/uORB/uORB.c
@@ -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,
diff --git a/system/uorb/uORB/uORB.h b/system/uorb/uORB/uORB.h
index 0655a1a86..84774d2af 100644
--- a/system/uorb/uORB/uORB.h
+++ b/system/uorb/uORB/uORB.h
@@ -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

Reply via email to