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

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

commit d1b15db361834428d473910f1cece5539b29fa58
Author: likun17 <[email protected]>
AuthorDate: Wed Sep 9 19:58:30 2026 +0800

    system/uorb: add resistance, conductivity, energy and charge topics.
    
    Declare and define the uORB metadata for the resistance, conductivity,
    energy and charge types, and register them in g_sensor_list[] so that
    orb_get_meta() and uorb_listener can resolve them by name.
    
    Signed-off-by: likun17 <[email protected]>
---
 system/uorb/sensor/charge.c       | 41 +++++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/charge.h       | 38 ++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/conductivity.c | 41 +++++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/conductivity.h | 38 ++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/energy.c       | 41 +++++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/energy.h       | 38 ++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/resistance.c   | 41 +++++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/resistance.h   | 38 ++++++++++++++++++++++++++++++++++++
 system/uorb/sensor/topics.c       |  9 +++++++++
 9 files changed, 325 insertions(+)

diff --git a/system/uorb/sensor/charge.c b/system/uorb/sensor/charge.c
new file mode 100644
index 000000000..3dfa7623b
--- /dev/null
+++ b/system/uorb/sensor/charge.c
@@ -0,0 +1,41 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/charge.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sensor/charge.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_UORB_FORMAT
+static const char sensor_charge_format[] =
+  "timestamp:%" PRIu64 ",charge:%" PRId64 "";
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+ORB_DEFINE(sensor_charge, struct sensor_charge,
+           sensor_charge_format);
diff --git a/system/uorb/sensor/charge.h b/system/uorb/sensor/charge.h
new file mode 100644
index 000000000..ab5121d21
--- /dev/null
+++ b/system/uorb/sensor/charge.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/charge.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __APPS_SYSTEM_UORB_SENSOR_CHARGE_H
+#define __APPS_SYSTEM_UORB_SENSOR_CHARGE_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <uORB/uORB.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* register this as object request broker structure */
+
+ORB_DECLARE(sensor_charge);
+
+#endif
diff --git a/system/uorb/sensor/conductivity.c 
b/system/uorb/sensor/conductivity.c
new file mode 100644
index 000000000..483e5271c
--- /dev/null
+++ b/system/uorb/sensor/conductivity.c
@@ -0,0 +1,41 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/conductivity.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sensor/conductivity.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_UORB_FORMAT
+static const char sensor_conductivity_format[] =
+  "timestamp:%" PRIu64 ",conductivity:%hf";
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+ORB_DEFINE(sensor_conductivity, struct sensor_conductivity,
+           sensor_conductivity_format);
diff --git a/system/uorb/sensor/conductivity.h 
b/system/uorb/sensor/conductivity.h
new file mode 100644
index 000000000..0026a8078
--- /dev/null
+++ b/system/uorb/sensor/conductivity.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/conductivity.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __APPS_SYSTEM_UORB_SENSOR_CONDUCTIVITY_H
+#define __APPS_SYSTEM_UORB_SENSOR_CONDUCTIVITY_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <uORB/uORB.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* register this as object request broker structure */
+
+ORB_DECLARE(sensor_conductivity);
+
+#endif
diff --git a/system/uorb/sensor/energy.c b/system/uorb/sensor/energy.c
new file mode 100644
index 000000000..d88e51e6e
--- /dev/null
+++ b/system/uorb/sensor/energy.c
@@ -0,0 +1,41 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/energy.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sensor/energy.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_UORB_FORMAT
+static const char sensor_energy_format[] =
+  "timestamp:%" PRIu64 ",energy:%" PRId64 "";
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+ORB_DEFINE(sensor_energy, struct sensor_energy,
+           sensor_energy_format);
diff --git a/system/uorb/sensor/energy.h b/system/uorb/sensor/energy.h
new file mode 100644
index 000000000..7aabf4b0d
--- /dev/null
+++ b/system/uorb/sensor/energy.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/energy.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __APPS_SYSTEM_UORB_SENSOR_ENERGY_H
+#define __APPS_SYSTEM_UORB_SENSOR_ENERGY_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <uORB/uORB.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* register this as object request broker structure */
+
+ORB_DECLARE(sensor_energy);
+
+#endif
diff --git a/system/uorb/sensor/resistance.c b/system/uorb/sensor/resistance.c
new file mode 100644
index 000000000..54636f7ad
--- /dev/null
+++ b/system/uorb/sensor/resistance.c
@@ -0,0 +1,41 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/resistance.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sensor/resistance.h>
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+#ifdef CONFIG_UORB_FORMAT
+static const char sensor_resistance_format[] =
+  "timestamp:%" PRIu64 ",resistance:%hf";
+#endif
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+ORB_DEFINE(sensor_resistance, struct sensor_resistance,
+           sensor_resistance_format);
diff --git a/system/uorb/sensor/resistance.h b/system/uorb/sensor/resistance.h
new file mode 100644
index 000000000..ca384010d
--- /dev/null
+++ b/system/uorb/sensor/resistance.h
@@ -0,0 +1,38 @@
+/****************************************************************************
+ * apps/system/uorb/sensor/resistance.h
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+#ifndef __APPS_SYSTEM_UORB_SENSOR_RESISTANCE_H
+#define __APPS_SYSTEM_UORB_SENSOR_RESISTANCE_H
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <uORB/uORB.h>
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/* register this as object request broker structure */
+
+ORB_DECLARE(sensor_resistance);
+
+#endif
diff --git a/system/uorb/sensor/topics.c b/system/uorb/sensor/topics.c
index e41268ada..e1941233c 100644
--- a/system/uorb/sensor/topics.c
+++ b/system/uorb/sensor/topics.c
@@ -35,10 +35,13 @@
 #include <sensor/angle.h>
 #include <sensor/baro.h>
 #include <sensor/cap.h>
+#include <sensor/charge.h>
 #include <sensor/co2.h>
+#include <sensor/conductivity.h>
 #include <sensor/current.h>
 #include <sensor/dust.h>
 #include <sensor/ecg.h>
+#include <sensor/energy.h>
 #include <sensor/eng.h>
 #include <sensor/force.h>
 #include <sensor/gas.h>
@@ -66,6 +69,7 @@
 #include <sensor/ppgd.h>
 #include <sensor/ppgq.h>
 #include <sensor/prox.h>
+#include <sensor/resistance.h>
 #include <sensor/rgb.h>
 #include <sensor/rotation.h>
 #include <sensor/step_counter.h>
@@ -89,11 +93,14 @@ static FAR const struct orb_metadata *g_sensor_list[] =
   ORB_ID(sensor_hinge_angle),
   ORB_ID(sensor_baro),
   ORB_ID(sensor_cap),
+  ORB_ID(sensor_charge),
   ORB_ID(sensor_co2),
+  ORB_ID(sensor_conductivity),
   ORB_ID(sensor_current),
   ORB_ID(sensor_device_orientation),
   ORB_ID(sensor_dust),
   ORB_ID(sensor_ecg),
+  ORB_ID(sensor_energy),
   ORB_ID(sensor_eng),
   ORB_ID(sensor_force),
   ORB_ID(sensor_gas),
@@ -136,6 +143,7 @@ static FAR const struct orb_metadata *g_sensor_list[] =
   ORB_ID(sensor_ppgd),
   ORB_ID(sensor_ppgq),
   ORB_ID(sensor_prox),
+  ORB_ID(sensor_resistance),
   ORB_ID(sensor_rgb),
   ORB_ID(sensor_rotation),
   ORB_ID(sensor_significant_motion),
@@ -173,6 +181,7 @@ FAR const struct orb_metadata *orb_get_meta(FAR const char 
*name)
   for (i = 0; g_sensor_list[i]; i++)
     {
       size_t len = strlen(g_sensor_list[i]->o_name);
+
       if ((!strncmp(g_sensor_list[i]->o_name, name, len))
           && (name[len] == '\0' || isdigit(name[len])))
         {

Reply via email to