From ea75960e8f61a2360ba2cd7e98a745418bb77988 Mon Sep 17 00:00:00 2001 From: likun17 Date: Wed, 9 Sep 2026 19:34:11 +0800 Subject: [PATCH 1/3] system/uorb: add missing metadata for velocity and ambient_temp SENSOR_TYPE_VELOCITY and SENSOR_TYPE_AMBIENT_TEMPERATURE have an entry in the kernel g_sensor_meta[] table but no ORB_DECLARE/ORB_DEFINE in user space, so ORB_ID() fails to link, callers must fall back to orb_open() by name and lose the o_size check, and uorb_listener cannot monitor them. Add the missing metadata and register both in g_sensor_list[]; ambient_temp reuses struct sensor_temp the same way sensor_light_uncal already reuses struct sensor_light. Signed-off-by: likun17 --- system/uorb/sensor/temp.c | 1 + system/uorb/sensor/temp.h | 1 + system/uorb/sensor/topics.c | 3 +++ system/uorb/sensor/velocity.c | 40 +++++++++++++++++++++++++++++++++++ system/uorb/sensor/velocity.h | 38 +++++++++++++++++++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 system/uorb/sensor/velocity.c create mode 100644 system/uorb/sensor/velocity.h diff --git a/system/uorb/sensor/temp.c b/system/uorb/sensor/temp.c index 63545b3126a..4a2e2fb93b6 100644 --- a/system/uorb/sensor/temp.c +++ b/system/uorb/sensor/temp.c @@ -40,3 +40,4 @@ static const char sensor_temp_format[] = ****************************************************************************/ ORB_DEFINE(sensor_temp, struct sensor_temp, sensor_temp_format); +ORB_DEFINE(sensor_ambient_temp, struct sensor_temp, sensor_temp_format); diff --git a/system/uorb/sensor/temp.h b/system/uorb/sensor/temp.h index 2ee401af3b6..18067559e29 100644 --- a/system/uorb/sensor/temp.h +++ b/system/uorb/sensor/temp.h @@ -36,5 +36,6 @@ /* register this as object request broker structure */ ORB_DECLARE(sensor_temp); +ORB_DECLARE(sensor_ambient_temp); #endif diff --git a/system/uorb/sensor/topics.c b/system/uorb/sensor/topics.c index 48619627f42..2eec67decc7 100644 --- a/system/uorb/sensor/topics.c +++ b/system/uorb/sensor/topics.c @@ -70,6 +70,7 @@ #include #include #include +#include #include @@ -81,6 +82,7 @@ static FAR const struct orb_metadata *g_sensor_list[] = { ORB_ID(sensor_accel), ORB_ID(sensor_accel_uncal), + ORB_ID(sensor_ambient_temp), ORB_ID(sensor_hinge_angle), ORB_ID(sensor_baro), ORB_ID(sensor_cap), @@ -139,6 +141,7 @@ static FAR const struct orb_metadata *g_sensor_list[] = ORB_ID(sensor_tilt_detector_uncal), ORB_ID(sensor_tvoc), ORB_ID(sensor_uv), + ORB_ID(sensor_velocity), ORB_ID(sensor_wake_gesture), ORB_ID(sensor_wake_gesture_uncal), ORB_ID(sensor_wrist_tilt), diff --git a/system/uorb/sensor/velocity.c b/system/uorb/sensor/velocity.c new file mode 100644 index 00000000000..0697173867c --- /dev/null +++ b/system/uorb/sensor/velocity.c @@ -0,0 +1,40 @@ +/**************************************************************************** + * apps/system/uorb/sensor/velocity.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 + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_UORB_FORMAT +static const char sensor_velocity_format[] = + "timestamp:%" PRIu64 ",velocity:%hf"; +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +ORB_DEFINE(sensor_velocity, struct sensor_velocity, sensor_velocity_format); diff --git a/system/uorb/sensor/velocity.h b/system/uorb/sensor/velocity.h new file mode 100644 index 00000000000..aff892c1fd9 --- /dev/null +++ b/system/uorb/sensor/velocity.h @@ -0,0 +1,38 @@ +/**************************************************************************** + * apps/system/uorb/sensor/velocity.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_VELOCITY_H +#define __APPS_SYSTEM_UORB_SENSOR_VELOCITY_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* register this as object request broker structure */ + +ORB_DECLARE(sensor_velocity); + +#endif From d83c1267a3143e8e795911109a944d987d9580c4 Mon Sep 17 00:00:00 2001 From: likun17 Date: Wed, 9 Sep 2026 19:58:03 +0800 Subject: [PATCH 2/3] system/uorb: add voltage, current and power topics Declare and define the uORB metadata for the voltage, current and power 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 --- system/uorb/sensor/current.c | 41 ++++++++++++++++++++++++++++++++++++ system/uorb/sensor/current.h | 38 +++++++++++++++++++++++++++++++++ system/uorb/sensor/power.c | 41 ++++++++++++++++++++++++++++++++++++ system/uorb/sensor/power.h | 38 +++++++++++++++++++++++++++++++++ system/uorb/sensor/topics.c | 6 ++++++ system/uorb/sensor/voltage.c | 41 ++++++++++++++++++++++++++++++++++++ system/uorb/sensor/voltage.h | 38 +++++++++++++++++++++++++++++++++ 7 files changed, 243 insertions(+) create mode 100644 system/uorb/sensor/current.c create mode 100644 system/uorb/sensor/current.h create mode 100644 system/uorb/sensor/power.c create mode 100644 system/uorb/sensor/power.h create mode 100644 system/uorb/sensor/voltage.c create mode 100644 system/uorb/sensor/voltage.h diff --git a/system/uorb/sensor/current.c b/system/uorb/sensor/current.c new file mode 100644 index 00000000000..0043f35518a --- /dev/null +++ b/system/uorb/sensor/current.c @@ -0,0 +1,41 @@ +/**************************************************************************** + * apps/system/uorb/sensor/current.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 + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_UORB_FORMAT +static const char sensor_current_format[] = + "timestamp:%" PRIu64 ",current:%hf"; +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +ORB_DEFINE(sensor_current, struct sensor_current, + sensor_current_format); diff --git a/system/uorb/sensor/current.h b/system/uorb/sensor/current.h new file mode 100644 index 00000000000..054e4a73fc3 --- /dev/null +++ b/system/uorb/sensor/current.h @@ -0,0 +1,38 @@ +/**************************************************************************** + * apps/system/uorb/sensor/current.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_CURRENT_H +#define __APPS_SYSTEM_UORB_SENSOR_CURRENT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* register this as object request broker structure */ + +ORB_DECLARE(sensor_current); + +#endif diff --git a/system/uorb/sensor/power.c b/system/uorb/sensor/power.c new file mode 100644 index 00000000000..02295697dfc --- /dev/null +++ b/system/uorb/sensor/power.c @@ -0,0 +1,41 @@ +/**************************************************************************** + * apps/system/uorb/sensor/power.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 + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_UORB_FORMAT +static const char sensor_power_format[] = + "timestamp:%" PRIu64 ",power:%hf"; +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +ORB_DEFINE(sensor_power, struct sensor_power, + sensor_power_format); diff --git a/system/uorb/sensor/power.h b/system/uorb/sensor/power.h new file mode 100644 index 00000000000..38490ec8f92 --- /dev/null +++ b/system/uorb/sensor/power.h @@ -0,0 +1,38 @@ +/**************************************************************************** + * apps/system/uorb/sensor/power.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_POWER_H +#define __APPS_SYSTEM_UORB_SENSOR_POWER_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* register this as object request broker structure */ + +ORB_DECLARE(sensor_power); + +#endif diff --git a/system/uorb/sensor/topics.c b/system/uorb/sensor/topics.c index 2eec67decc7..e41268adafa 100644 --- a/system/uorb/sensor/topics.c +++ b/system/uorb/sensor/topics.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -61,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -71,6 +73,7 @@ #include #include #include +#include #include @@ -87,6 +90,7 @@ static FAR const struct orb_metadata *g_sensor_list[] = ORB_ID(sensor_baro), ORB_ID(sensor_cap), ORB_ID(sensor_co2), + ORB_ID(sensor_current), ORB_ID(sensor_device_orientation), ORB_ID(sensor_dust), ORB_ID(sensor_ecg), @@ -128,6 +132,7 @@ static FAR const struct orb_metadata *g_sensor_list[] = ORB_ID(sensor_pm1p0), ORB_ID(sensor_pm25), ORB_ID(sensor_pose_6dof), + ORB_ID(sensor_power), ORB_ID(sensor_ppgd), ORB_ID(sensor_ppgq), ORB_ID(sensor_prox), @@ -142,6 +147,7 @@ static FAR const struct orb_metadata *g_sensor_list[] = ORB_ID(sensor_tvoc), ORB_ID(sensor_uv), ORB_ID(sensor_velocity), + ORB_ID(sensor_voltage), ORB_ID(sensor_wake_gesture), ORB_ID(sensor_wake_gesture_uncal), ORB_ID(sensor_wrist_tilt), diff --git a/system/uorb/sensor/voltage.c b/system/uorb/sensor/voltage.c new file mode 100644 index 00000000000..a76fafc110f --- /dev/null +++ b/system/uorb/sensor/voltage.c @@ -0,0 +1,41 @@ +/**************************************************************************** + * apps/system/uorb/sensor/voltage.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 + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifdef CONFIG_UORB_FORMAT +static const char sensor_voltage_format[] = + "timestamp:%" PRIu64 ",voltage:%hf"; +#endif + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +ORB_DEFINE(sensor_voltage, struct sensor_voltage, + sensor_voltage_format); diff --git a/system/uorb/sensor/voltage.h b/system/uorb/sensor/voltage.h new file mode 100644 index 00000000000..c75c760c556 --- /dev/null +++ b/system/uorb/sensor/voltage.h @@ -0,0 +1,38 @@ +/**************************************************************************** + * apps/system/uorb/sensor/voltage.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_VOLTAGE_H +#define __APPS_SYSTEM_UORB_SENSOR_VOLTAGE_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* register this as object request broker structure */ + +ORB_DECLARE(sensor_voltage); + +#endif From 324d865ee05f2d342544ec8b92303535e59584e6 Mon Sep 17 00:00:00 2001 From: likun17 Date: Wed, 9 Sep 2026 19:58:30 +0800 Subject: [PATCH 3/3] 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 --- 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(+) create mode 100644 system/uorb/sensor/charge.c create mode 100644 system/uorb/sensor/charge.h create mode 100644 system/uorb/sensor/conductivity.c create mode 100644 system/uorb/sensor/conductivity.h create mode 100644 system/uorb/sensor/energy.c create mode 100644 system/uorb/sensor/energy.h create mode 100644 system/uorb/sensor/resistance.c create mode 100644 system/uorb/sensor/resistance.h diff --git a/system/uorb/sensor/charge.c b/system/uorb/sensor/charge.c new file mode 100644 index 00000000000..3dfa7623b8d --- /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 + +/**************************************************************************** + * 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 00000000000..ab5121d2108 --- /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 + +/**************************************************************************** + * 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 00000000000..483e5271cd6 --- /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 + +/**************************************************************************** + * 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 00000000000..0026a80789c --- /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 + +/**************************************************************************** + * 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 00000000000..d88e51e6ed2 --- /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 + +/**************************************************************************** + * 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 00000000000..7aabf4b0dea --- /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 + +/**************************************************************************** + * 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 00000000000..54636f7ad9c --- /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 + +/**************************************************************************** + * 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 00000000000..ca384010d66 --- /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 + +/**************************************************************************** + * 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 e41268adafa..e1941233c41 100644 --- a/system/uorb/sensor/topics.c +++ b/system/uorb/sensor/topics.c @@ -35,10 +35,13 @@ #include #include #include +#include #include +#include #include #include #include +#include #include #include #include @@ -66,6 +69,7 @@ #include #include #include +#include #include #include #include @@ -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]))) {