diff --git a/sensor/bundle.json b/sensor/bundle.json
index 34857b186c3c8be643732cd891f50d51a1c2407f..26882b2bf82f32d49c8d05ca0726db6cfa280a11 100644
--- a/sensor/bundle.json
+++ b/sensor/bundle.json
@@ -28,7 +28,8 @@
"build": {
"sub_component": [
"//drivers/interface/sensor/v2_0:sensor_idl_target",
- "//drivers/interface/sensor/v2_1:sensor_idl_target"
+ "//drivers/interface/sensor/v2_1:sensor_idl_target",
+ "//drivers/interface/sensor/v3_0:sensor_idl_target"
],
"test": [
],
@@ -72,6 +73,30 @@
],
"header_base": "//drivers/interface/sensor"
}
+ },
+ {
+ "name": "//drivers/interface/sensor/v3_0:libsensor_proxy_3.0",
+ "header": {
+ "header_files": [
+ ],
+ "header_base": "//drivers/interface/sensor"
+ }
+ },
+ {
+ "name": "//drivers/interface/sensor/v3_0:libsensor_stub_3.0",
+ "header": {
+ "header_files": [
+ ],
+ "header_base": "//drivers/interface/sensor"
+ }
+ },
+ {
+ "name": "//drivers/interface/sensor/v3_0:sensor_idl_headers",
+ "header": {
+ "header_files": [
+ ],
+ "header_base": "//drivers/interface/sensor"
+ }
}
]
}
diff --git a/sensor/v3_0/BUILD.gn b/sensor/v3_0/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..f60d0fde96fa972fa06d0998fac0b400e6898f2a
--- /dev/null
+++ b/sensor/v3_0/BUILD.gn
@@ -0,0 +1,35 @@
+# Copyright (c) 2025 Huawei Device Co., Ltd.
+# Licensed 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.
+
+import("//build/config/components/hdi/hdi.gni")
+if (defined(ohos_lite)) {
+ group("libsensor_proxy_3.0") {
+ deps = []
+ public_configs = []
+ }
+} else {
+ hdi("sensor") {
+ module_name = "sensor_service"
+
+ sources = [
+ "ISensorCallback.idl",
+ "ISensorInterface.idl",
+ "SensorTypes.idl",
+ "ISensorPlugCallback.idl",
+ ]
+
+ language = "cpp"
+ subsystem_name = "hdf"
+ part_name = "drivers_interface_sensor"
+ }
+}
diff --git a/sensor/v3_0/ISensorCallback.idl b/sensor/v3_0/ISensorCallback.idl
new file mode 100644
index 0000000000000000000000000000000000000000..b307c84cff7b3279f2afd9af40c9441fe9c02c1e
--- /dev/null
+++ b/sensor/v3_0/ISensorCallback.idl
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed 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.
+ */
+
+/**
+ * @addtogroup HdiSensor
+ * @{
+ *
+ * @brief Provides unified APIs for sensor services to access sensor drivers.
+ *
+ * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to
+ * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information,
+ * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor,
+ * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+
+package ohos.hdi.sensor.v3_0;
+
+import ohos.hdi.sensor.v3_0.SensorTypes;
+
+/**
+ * @brief Defines the callback for reporting sensor data. This callback needs to be registered when
+ * a sensor user subscribes to sensor data. Only after the sensor is enabled, the sensor data subscriber can receive
+ * sensor data. For details, see {@link ISensorInterface}.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+[callback] interface ISensorCallback {
+ /**
+ * @brief Defines the function for reporting sensor data.
+ * @param event Indicates the information about sensor event in the system.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+ OnDataEvent([in] struct HdfSensorEvents event);
+ /**
+ * @brief Defines the function for reporting sensor data.
+ * @param event Indicates the information about sensor event in the system.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+ [oneway] OnDataEventAsync([in] struct HdfSensorEvents[] events);
+}
diff --git a/sensor/v3_0/ISensorInterface.idl b/sensor/v3_0/ISensorInterface.idl
new file mode 100644
index 0000000000000000000000000000000000000000..ff1bce93a9bc4e2439d9d4d89588a2a4f655c754
--- /dev/null
+++ b/sensor/v3_0/ISensorInterface.idl
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed 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.
+ */
+
+/**
+ * @addtogroup HdiSensor
+ * @{
+ *
+ * @brief Provides unified APIs for sensor services to access sensor drivers.
+ *
+ * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to
+ * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information,
+ * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor,
+ * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range.
+ *
+ * @since 5.1
+ */
+
+/**
+ * @file ISensorInterface.idl
+ *
+ * @brief Declares the APIs provided by the sensor module for obtaining sensor information, subscribing to or
+ * unsubscribing from sensor data, enabling or disabling a sensor, setting the sensor data reporting mode,
+ * and setting sensor options such as the accuracy and measurement range.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+
+package ohos.hdi.sensor.v3_0;
+
+import ohos.hdi.sensor.v3_0.SensorTypes;
+import ohos.hdi.sensor.v3_0.ISensorCallback;
+import ohos.hdi.sensor.v3_0.ISensorPlugCallback;
+
+/**
+ * @brief Defines the functions for performing basic operations on sensors.
+ *
+ * The operations include obtaining sensor information, subscribing to or unsubscribing from sensor data,
+ * enabling or disabling a sensor, setting the sensor data reporting mode, and setting sensor options such as
+ * the accuracy and measurement range.
+ */
+
+interface ISensorInterface {
+ /**
+ * @brief Obtains information about all sensors in the system.
+ *
+ * @param info Indicates the vector of the information about all sensors in the system.
+ * The information about a sensor generally includes the sensor name, sensor vendor, firmware version,
+ * hardware version, sensor type ID, sensor ID, maximum measurement range, accuracy, and power. For details,
+ * see {@link HdfSensorInformation}.
+ * @return Returns 0 if the information is obtained; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ GetAllSensorInfo([out] struct HdfSensorInformation[] info);
+
+ /**
+ * @brief Obtains information about this device contains sensors in the system.
+ *
+ * @param info Indicates the vector of the information about all sensors in the system.
+ * The information about a sensor generally includes the sensor name, sensor vendor, firmware version,
+ * hardware version, sensor type ID, sensor ID, maximum measurement range, accuracy, and power. For details,
+ * see {@link HdfSensorInformation}.
+ * @return Returns 0 if the information is obtained; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ GetDeviceSensorInfo([in] int deviceId, [out] struct HdfSensorInformation[] info);
+
+ /**
+ * @brief Enables the sensor available in the sensor list based on the specified sensor ID.
+ * The subscriber can obtain the sensor data only after the sensor is enabled.
+ *
+ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}.
+ * @param deviceId Indicates the device ID. For details, see {@link SensorTypeTag}.
+ * @return Returns 0 if the sensor is successfully enabled; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ Enable([in] struct DeviceSensorInfo deviceSensorInfo);
+
+ /**
+ * @brief Disables an enabled sensor.
+ *
+ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}.
+ * @param deviceId Indicates the device ID. For details, see {@link SensorTypeTag}.
+ * @return Returns 0 if the sensor is successfully disabled; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ Disable([in] struct DeviceSensorInfo deviceSensorInfo);
+
+ /**
+ * @brief Sets the data sampling interval and data reporting interval for the specified sensor.
+ *
+ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}.
+ * @param deviceId Indicates the device ID. For details, see {@link SensorTypeTag}.
+ * @param samplingInterval Indicates the sensor data sampling interval to set, in nanoseconds.
+ * @param reportInterval Indicates the sensor data reporting interval, in nanoseconds.
+ * @return Returns 0 if the setting is successful; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ SetBatch([in] struct DeviceSensorInfo deviceSensorInfo, [in] long samplingInterval, [in] long reportInterval);
+
+ /**
+ * @brief Sets the data reporting mode for the specified sensor.
+ *
+ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}.
+ * @param deviceId Indicates the device ID. For details, see {@link SensorTypeTag}.
+ * @param mode Indicates the data reporting mode to set. For details, see {@link SensorModeType}.
+ * @return Returns 0 if the sensor data reporting mode is successfully set;
+ * returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ SetMode([in] struct DeviceSensorInfo deviceSensorInfo, [in] int mode);
+
+ /**
+ * @brief Sets options for the specified sensor, including its measurement range and accuracy.
+ *
+ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}.
+ * @param deviceId Indicates the device ID. For details, see {@link SensorTypeTag}.
+ * @param option Indicates the options to set, such as the measurement range and accuracy.
+ * @return Returns 0 if the options are successfully set; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ SetOption([in] struct DeviceSensorInfo deviceSensorInfo, [in] unsigned int option);
+
+ /**
+ * @brief Registers the callback for reporting sensor data to the subscriber.
+ *
+ * The sensorId enumeration value range is 128-160, which means that the medical sensor service is subscribed.
+ * It only needs to be subscribed once successfully, and there is no need to subscribe repeatedly.
+ * The sensorId enumeration value range is not within 128-160, which means that the traditional sensor
+ * is subscribed, and the subscription is successful once.
+ * @param callbackObj Indicates the callback to register. For details, see {@link ISensorCallback}.
+ * @return Returns 0 if the callback is successfully registered; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ Register([in] int groupId, [in] ISensorCallback callbackObj);
+
+ /**
+ * @brief Deregisters the callback for reporting sensor data.
+ *
+ * The sensorId enumeration value range is 128-160, which means that the medical sensor service is subscribed.
+ * It only needs to cancel the subscription once successfully, and there is no need to
+ * cancel the subscription repeatedly. The sensorId enumeration value range is not within 128-160,
+ * which means that the traditional sensor is subscribed. You can cancel the subscription once successfully.
+ * @param callbackObj Indicates the callback to deregister. For details, see {@link ISensorCallback}.
+ * @return Returns 0 if the callback is successfully deregistered; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ Unregister([in] int groupId, [in] ISensorCallback callbackObj);
+
+ /**
+ * @brief Obtain the sensor event data in the small system.
+ *
+ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}.
+ * @param event Indicates the vector of the sensor event data in the system.
+ * The sensor event data includes the sensor ID, sensor algorithm version, data generation time,
+ * data options (such as the measurement range and accuracy), data reporting mode, data address, and data length.
+ * For details, see {@link HdfSensorEvents}.
+ * @return Returns 0 if the event data is obtained; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ ReadData([in] struct DeviceSensorInfo deviceSensorInfo, [out] struct HdfSensorEvents[] event);
+
+ /**
+ * @brief Obtain the sensor event data in the small system.
+ *
+ * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}.
+ * @param enabled Indicates if the value is enabled.
+ * @param rateLevel Indicates rateClass.
+ * @return Returns 0 if the event data is obtained; returns a negative value otherwise.
+ *
+ * @since 4.1
+ * @version 2.0
+ */
+ SetSdcSensor([in] struct DeviceSensorInfo deviceSensorInfo, [in] boolean enabled, [in] int rateLevel);
+ /**
+ * @brief Obtain sensor information for SDC
+ *
+ * @param sdcSensorInfos Indicates the data of the SDC type.
+ * @return Returns 0 if the event data is obtained; returns a negative value otherwise.
+ *
+ * @since 4.1
+ * @version 2.0
+ */
+ GetSdcSensorInfo([out] struct SdcSensorInfo[] sdcSensorInfo);
+
+ /**
+ * @brief Registers the callback for reporting sensor data to the subscriber.
+ *
+ * The sensorId enumeration value range is 128-160, which means that the medical sensor service is subscribed.
+ * It only needs to be subscribed once successfully, and there is no need to subscribe repeatedly.
+ * The sensorId enumeration value range is not within 128-160, which means that the traditional sensor
+ * is subscribed, and the subscription is successful once.
+ * @param callbackObj Indicates the callback to register. For details, see {@link ISensorCallback}.
+ * @return Returns 0 if the callback is successfully registered; returns a negative value otherwise.
+ *
+ * @since 5.1
+ * @version 1.0
+ */
+ RegisterAsync([in] int groupId, [in] ISensorCallback callbackObj);
+
+ /**
+ * @brief Deregisters the callback for reporting sensor data.
+ *
+ * The sensorId enumeration value range is 128-160, which means that the medical sensor service is subscribed.
+ * It only needs to cancel the subscription once successfully, and there is no need to
+ * cancel the subscription repeatedly. The sensorId enumeration value range is not within 128-160,
+ * which means that the traditional sensor is subscribed. You can cancel the subscription once successfully.
+ * @param callbackObj Indicates the callback to deregister. For details, see {@link ISensorCallback}.
+ * @return Returns 0 if the callback is successfully deregistered; returns a negative value otherwise.
+ *
+ * @since 5.1
+ * @version 1.0
+ */
+ UnregisterAsync([in] int groupId, [in] ISensorCallback callbackObj);
+
+ /**
+ * @brief Deregisters the callback for reporting sensor plug in/out state.
+ *
+ * The sensorId enumeration value range is 128-160, which means that the medical sensor service is subscribed.
+ * It only needs to cancel the subscription once successfully, and there is no need to
+ * cancel the subscription repeatedly. The sensorId enumeration value range is not within 128-160,
+ * which means that the traditional sensor is subscribed. You can cancel the subscription once successfully.
+ * @param callbackObj Indicates the callback to deregister. For details, see {@link ISensorCallback}.
+ * @return Returns 0 if the callback is successfully deregistered; returns a negative value otherwise.
+ *
+ * @since 5.1
+ * @version 1.0
+ */
+ RegSensorPlugCallBack([in] ISensorPlugCallback callbackObj);
+
+ /**
+ * @brief Unregisters the callback for reporting sensor plug in/out state.
+ *
+ * The sensorId enumeration value range is 128-160, which means that the medical sensor service is subscribed.
+ * It only needs to cancel the subscription once successfully, and there is no need to
+ * cancel the subscription repeatedly. The sensorId enumeration value range is not within 128-160,
+ * which means that the traditional sensor is subscribed. You can cancel the subscription once successfully.
+ * @param callbackObj Indicates the callback to deregister. For details, see {@link ISensorCallback}.
+ * @return Returns 0 if the callback is successfully deregistered; returns a negative value otherwise.
+ *
+ * @since 5.1
+ * @version 1.0
+ */
+ UnRegSensorPlugCallBack([in] ISensorPlugCallback callbackObj);
+}
diff --git a/sensor/v3_0/ISensorPlugCallback.idl b/sensor/v3_0/ISensorPlugCallback.idl
new file mode 100644
index 0000000000000000000000000000000000000000..0c2fffbd85b1dbca7f034d58e68ed30fb7762162
--- /dev/null
+++ b/sensor/v3_0/ISensorPlugCallback.idl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed 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.
+ */
+
+/**
+ * @addtogroup HdiSensor
+ * @{
+ *
+ * @brief Provides unified APIs for sensor services to access sensor drivers.
+ *
+ * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to
+ * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information,
+ * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor,
+ * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+
+package ohos.hdi.sensor.v3_0;
+
+import ohos.hdi.sensor.v3_0.SensorTypes;
+
+/**
+ * @brief Defines the callback for reporting sensor data. This callback needs to be registered when
+ * a sensor user subscribes to sensor data. Only after the sensor is enabled, the sensor data subscriber can receive
+ * sensor data. For details, see {@link ISensorInterface}.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+[callback] interface ISensorPlugCallback {
+ /**
+ * @brief Defines the function for sensor plug in/out state.
+ * @param event Indicates the information about sensor event in the system.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+ OnSensorPlugEvent([in] struct SensorPlugInfo sensorPlugInfo);
+}
diff --git a/sensor/v3_0/SensorTypes.idl b/sensor/v3_0/SensorTypes.idl
new file mode 100644
index 0000000000000000000000000000000000000000..c5127b3c999dc87a93e442bd66d37bff9b53d1a1
--- /dev/null
+++ b/sensor/v3_0/SensorTypes.idl
@@ -0,0 +1,191 @@
+/*
+ * SPDX-License-Identifier: Apache-2.0
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 1.1 (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.
+ */
+
+/**
+ * @addtogroup HdiSensor
+ * @{
+ *
+ * @brief Provides unified APIs for sensor services to access sensor drivers.
+ *
+ * A sensor service can obtain a sensor driver object or agent and then call APIs provided by this object or agent to
+ * access different types of sensor devices based on the sensor IDs, thereby obtaining sensor information,
+ * subscribing to or unsubscribing from sensor data, enabling or disabling a sensor,
+ * setting the sensor data reporting mode, and setting sensor options such as the accuracy and measurement range.
+ *
+ * @version 3.0
+ */
+
+/**
+ * @file SensorTypes.idl
+ *
+ * @brief Defines the data used by the sensor module, including the sensor information,
+ * and reported sensor data.
+ *
+ * @since 5.1
+ * @version 3.0
+ */
+
+package ohos.hdi.sensor.v3_0;
+
+/**
+ * @brief Defines basic sensor of the device information.
+ *
+ * Information about a sensor includes the deive ID, sensor type ID, sensor ID,
+ *
+ * @since 5.1
+ */
+struct DeviceSensorInfo {
+ int deviceId; /**< Device ID */
+ int sensorType; /**< Sensor type ID (described in {@link SensorTypeTag}) */
+ int sensorId; /**< Sensor ID, defined by the sensor driver developer */
+ int location; /**< Is the device a local device or an external device */
+};
+
+/**
+ * @brief Defines basic sensor information.
+ *
+ * Information about a sensor includes the sensor name, vendor, firmware version, hardware version, sensor type ID,
+ * sensor ID, maximum measurement range, accuracy, and power.
+ *
+ * @since 2.2
+ */
+struct HdfSensorInformation {
+ String sensorName; /**< Sensor name */
+ String vendorName; /**< Sensor vendor */
+ String firmwareVersion; /**< Sensor firmware version */
+ String hardwareVersion; /**< Sensor hardware version */
+ float maxRange; /**< Maximum measurement range of the sensor */
+ float accuracy; /**< Sensor accuracy */
+ float power; /**< Sensor power */
+ long minDelay; /**< Minimum sample period allowed in microseconds */
+ long maxDelay; /**< Maxmum sample period allowed in microseconds */
+ unsigned int fifoMaxEventCount; /**< Maxmum number of events of this sensor that could be batched */
+ struct DeviceSensorInfo deviceSensorInfo; /**< sensor ID info of the device */
+ unsigned int reserved; /**< Reserved fields */
+};
+
+/**
+ * @brief Defines the data reported by the sensor.
+ *
+ * The reported sensor data includes the sensor ID, sensor algorithm version, data generation time,
+ * data options (such as the measurement range and accuracy), data reporting mode, data address, and data length.
+ *
+ * @since 2.2
+ */
+struct HdfSensorEvents {
+ int sensorId; /**< Sensor ID */
+ int version; /**< Sensor algorithm version */
+ long timestamp; /**< Time when sensor data was generated */
+ unsigned int option; /**< Sensor data options, including the measurement range and accuracy */
+ int mode; /**< Sensor data reporting mode */
+ unsigned char[] data; /**< Sensor data vector */
+ unsigned int dataLen; /**< Sensor data length */
+ struct DeviceSensorInfo deviceSensorInfo; /**< sensor ID info of the device */
+};
+
+/**
+ * @brief Enumerates sensor types.
+ *
+ * @since 4.0
+ */
+enum HdfSensorTypeTag {
+ HDF_SENSOR_TYPE_NONE = 0, /**< None, for testing only */
+ HDF_SENSOR_TYPE_ACCELEROMETER = 1, /**< Acceleration sensor */
+ HDF_SENSOR_TYPE_GYROSCOPE = 2, /**< Gyroscope sensor */
+ HDF_SENSOR_TYPE_PHOTOPLETHYSMOGRAPH = 3, /**< Photoplethysmography sensor */
+ HDF_SENSOR_TYPE_ELECTROCARDIOGRAPH = 4, /**< Electrocardiogram (ECG) sensor */
+ HDF_SENSOR_TYPE_AMBIENT_LIGHT = 5, /**< Ambient light sensor */
+ HDF_SENSOR_TYPE_MAGNETIC_FIELD = 6, /**< Magnetic field sensor */
+ HDF_SENSOR_TYPE_CAPACITIVE = 7, /**< Capacitive sensor */
+ HDF_SENSOR_TYPE_BAROMETER = 8, /**< Barometric pressure sensor */
+ HDF_SENSOR_TYPE_TEMPERATURE = 9, /**< Temperature sensor */
+ HDF_SENSOR_TYPE_HALL = 10, /**< Hall effect sensor */
+ HDF_SENSOR_TYPE_GESTURE = 11, /**< Gesture sensor */
+ HDF_SENSOR_TYPE_PROXIMITY = 12, /**< Proximity sensor */
+ HDF_SENSOR_TYPE_HUMIDITY = 13, /**< Humidity sensor */
+ HDF_SENSOR_TYPE_COLOR = 14, /**< Color sensor */
+ HDF_SENSOR_TYPE_SAR = 15, /**< SAR sensor */
+ HDF_SENSOR_TYPE_AMBIENT_LIGHT1 = 16, /**< Secondary ambient light sensor */
+ HDF_SENSOR_TYPE_HALL1 = 17, /**< Secondary hall effect sensor */
+ HDF_SENSOR_TYPE_PROXIMITY1 = 18, /**< Secondary proximity sensor */
+ HDF_SENSOR_TYPE_MEDICAL_BEGIN = 128, /**< The begin of medical sensorId enumeration value range */
+ HDF_SENSOR_TYPE_MEDICAL_END = 160, /**< The end of medical sensorId enumeration value range */
+ HDF_SENSOR_TYPE_PHYSICAL_MAX = 255, /**< Maximum type of a physical sensor */
+ HDF_SENSOR_TYPE_ORIENTATION = 256, /**< Orientation sensor */
+ HDF_SENSOR_TYPE_GRAVITY = 257, /**< Gravity sensor */
+ HDF_SENSOR_TYPE_LINEAR_ACCELERATION = 258, /**< Linear acceleration sensor */
+ HDF_SENSOR_TYPE_ROTATION_VECTOR = 259, /**< Rotation vector sensor */
+ HDF_SENSOR_TYPE_AMBIENT_TEMPERATURE = 260, /**< Ambient temperature sensor */
+ HDF_SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED = 261, /**< Uncalibrated magnetic field sensor */
+ HDF_SENSOR_TYPE_GAME_ROTATION_VECTOR = 262, /**< Game rotation vector sensor */
+ HDF_SENSOR_TYPE_GYROSCOPE_UNCALIBRATED = 263, /**< Uncalibrated gyroscope sensor */
+ HDF_SENSOR_TYPE_SIGNIFICANT_MOTION = 264, /**< Significant motion sensor */
+ HDF_SENSOR_TYPE_PEDOMETER_DETECTION = 265, /**< Pedometer detection sensor */
+ HDF_SENSOR_TYPE_PEDOMETER = 266, /**< Pedometer sensor */
+ HDF_SENSOR_TYPE_POSTURE = 267, /**< Posture sensor */
+ HDF_SENSOR_TYPE_HEADPOSTURE = 268, /**< Headposture sensor */
+ HDF_SENSOR_TYPE_DROP_DETECT = 269, /**< Drop detection sensor */
+ HDF_SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR = 277, /**< Geomagnetic rotation vector sensor */
+ HDF_SENSOR_TYPE_HEART_RATE = 278, /**< Heart rate sensor */
+ HDF_SENSOR_TYPE_DEVICE_ORIENTATION = 279, /**< Device orientation sensor */
+ HDF_SENSOR_TYPE_WEAR_DETECTION = 280, /**< Wear detection sensor */
+ HDF_SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED = 281, /**< Uncalibrated acceleration sensor */
+ HDF_SENSOR_TYPE_RPC = 282, /**< Radio Power Control */
+ HDF_SENSOR_TYPE_FUSION_PRESSURE = 283, /**< fusion pressure sensor */
+ HDF_SENSOR_TYPE_MAX, /**< Maximum number of sensor types */
+};
+
+/**
+ * @brief Enumerates hardware service group for sensors
+ *
+ * @since 2.2
+ */
+enum HdfSensorGroupType {
+ HDF_TRADITIONAL_SENSOR_TYPE = 0, /**< traditional sensor type, the sensorId enumeration value range is 128-160 */
+ HDF_MEDICAL_SENSOR_TYPE = 1, /**< medical sensor type, the sensorId enumeration value range is not within 128-160 */
+ HDF_SENSOR_GROUP_TYPE_MAX, /**< Maximum sensor group type*/
+};
+
+/**
+ * @brief Defines SDC reports data object operations to the node.
+ *
+ * The reported sensor data includes the offset, type, ddrSize, minRateLevel, maxRateLevel, reserved.
+ *
+ * @since 4.1
+ */
+struct SdcSensorInfo {
+ unsigned long offset; /**< Used for mmap */
+ int ddrSize; /**< Shared memory Size */
+ int minRateLevel; /**< Supported min rate level */
+ int maxRateLevel; /**< Supported max rate level */
+ unsigned long memAddr; /**< Shared memory address */
+ struct DeviceSensorInfo deviceSensorInfo; /**< sensor ID info of the device */
+ int reserved; /**< Reserved */
+};
+
+/**
+ * @brief Defines info reports device pluged.
+ *
+ * The reported info contains deviceId, deviceName, plug state.
+ *
+ * @since 5.1
+ */
+struct SensorPlugInfo {
+ struct DeviceSensorInfo deviceSensorInfo; /**< sensor ID info of the device */
+ String deviceName; /**< Device Name */
+ int status; /**< Device Plug In/Out state */
+ int reserved; /**< Reserved */
+};
\ No newline at end of file
diff --git a/vibrator/bundle.json b/vibrator/bundle.json
index 248f7407420f30b04960e47709128dc0cd89d7b4..ead498f24ba101ab880d859be954ad486d2dff8b 100644
--- a/vibrator/bundle.json
+++ b/vibrator/bundle.json
@@ -33,7 +33,8 @@
"sub_component": [
"//drivers/interface/vibrator/v1_1:vibrator_idl_target",
"//drivers/interface/vibrator/v1_2:vibrator_idl_target",
- "//drivers/interface/vibrator/v1_3:vibrator_idl_target"
+ "//drivers/interface/vibrator/v1_3:vibrator_idl_target",
+ "//drivers/interface/vibrator/v2_0:vibrator_idl_target"
],
"test": [
],
@@ -109,6 +110,30 @@
],
"header_base": "//drivers/interface/vibrator"
}
+ },
+ {
+ "name": "//drivers/interface/vibrator/v2_0:libvibrator_proxy_2.0",
+ "header": {
+ "header_files": [
+ ],
+ "header_base": "//drivers/interface/vibrator"
+ }
+ },
+ {
+ "name": "//drivers/interface/vibrator/v2_0:libvibrator_stub_2.0",
+ "header": {
+ "header_files": [
+ ],
+ "header_base": "//drivers/interface/vibrator"
+ }
+ },
+ {
+ "name": "//drivers/interface/vibrator/v2_0:vibrator_idl_headers",
+ "header": {
+ "header_files": [
+ ],
+ "header_base": "//drivers/interface/vibrator"
+ }
}
]
}
diff --git a/vibrator/v2_0/BUILD.gn b/vibrator/v2_0/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..2bc5448bd6758009a754713fbf239bdc9e4dcbad
--- /dev/null
+++ b/vibrator/v2_0/BUILD.gn
@@ -0,0 +1,34 @@
+# Copyright (c) 2025 Huawei Device Co., Ltd.
+# Licensed 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.
+
+import("//build/config/components/hdi/hdi.gni")
+if (defined(ohos_lite)) {
+ group("libvibrator_proxy_2.0") {
+ deps = []
+ public_configs = []
+ }
+} else {
+ hdi("vibrator") {
+ module_name = "vibrator_service"
+
+ sources = [
+ "IVibratorInterface.idl",
+ "VibratorTypes.idl",
+ "IVibratorPlugCallback.idl",
+ ]
+
+ language = "cpp"
+ subsystem_name = "hdf"
+ part_name = "drivers_interface_vibrator"
+ }
+}
diff --git a/vibrator/v2_0/IVibratorInterface.idl b/vibrator/v2_0/IVibratorInterface.idl
new file mode 100644
index 0000000000000000000000000000000000000000..d84fffe492d913ad1ce9b80ae8c15b55af81874a
--- /dev/null
+++ b/vibrator/v2_0/IVibratorInterface.idl
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed 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.
+ */
+
+/**
+ * @addtogroup Vibrator
+ * @{
+ *
+ * @brief Provides a driver for upper-layer vibrator services.
+ *
+ * After obtaining a driver object or agent, a vibrator service get vibrator ability or
+ * set the vibrator effect using the functions provided by the driver object or agent.
+ *
+ * @since 5.1
+ * @version 2.0
+ */
+
+/**
+ * @file IVibratorInterface.idl
+ *
+ * @brief Declares common APIs in the vibrator module. The APIs canObtains information about all the vibrator
+ * that support setting intensity and Start the vibrator according to the incoming vibration effect.
+ *
+ * @since 5.1
+ * @version 2.0
+ */
+
+package ohos.hdi.vibrator.v2_0;
+
+import ohos.hdi.vibrator.v2_0.VibratorTypes;
+import ohos.hdi.vibrator.v2_0.IVibratorPlugCallback;
+
+interface IVibratorInterface {
+ /**
+ * @brief Controls the vibrator to perform a one-shot vibration that lasts for a given duration.
+ *
+ * One-shot vibration is mutually exclusive with periodic vibration. Before using one-shot vibration,
+ * exit periodic vibration.
+ *
+ * @param duration Indicates the duration that the one-shot vibration lasts, in milliseconds.
+ * @return Returns 0 if the operation is successful; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ StartOnce([in] int deviceId, [in] int vibratorId, [in] unsigned int duration);
+
+ /**
+ * @brief Controls the vibrator to perform a periodic vibration with the preset effect.
+ *
+ * One-shot vibration is mutually exclusive with periodic vibration. Before using periodic vibration,
+ * exit one-shot vibration.
+ *
+ * @param effectType Indicates the pointer to the preset effect type. It is recommended that the
+ * maximum length be 64 bytes.
+ * @return Returns 0 if the operation is successful; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ Start([in] int deviceId, [in] int vibratorId, [in] String effectType);
+
+ /**
+ * @brief Stops the vibration.
+ *
+ * Before the vibrator starts, it must stop vibrating in any mode. This function can be used during
+ * and after the vibrating process.
+ *
+ * @param mode Indicates the vibration mode, which can be one-shot or periodic. For details,
+ * see {@link HdfVibratorMode}.
+ * @return Returns 0 if the operation is successful; returns a negative value otherwise.
+ *
+ * @since 2.2
+ * @version 1.0
+ */
+ Stop([in] int deviceId, [in] int vibratorId, [in] enum HdfVibratorMode mode);
+
+ /**
+ * @brief Obtains information about all the vibrator that support setting intensity and frequency in the system.
+ *
+ * @param vibratorInfo Indicates the pointer to the vibration effect, For details, see {@link HdfVibratorInfo}.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns negative value if the get failed.
+ *
+ * @since 3.2
+ * @version 1.1
+ */
+ GetVibratorInfo([out] struct HdfVibratorInfo[] vibratorInfo);
+
+ /**
+ * @brief Obtains information about this device contains vibrator that support setting intensity and frequency in the system.
+ *
+ * @param vibratorInfo Indicates the pointer to the vibration effect, For details, see {@link HdfVibratorInfo}.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns negative value if the get failed.
+ *
+ * @since 3.2
+ * @version 1.1
+ */
+ GetVibratorIdSingle([in] int deviceId, [out] struct HdfVibratorInfo[] vibratorInfo);
+
+ /**
+ * @brief Start the vibrator according to the incoming vibration effect.
+ *
+ * @param duration Indicates the duration that the vibration lasts, in milliseconds.
+ *
+ * @param intensity Indicates vibrator intensity in a vibration period.
+ *
+ * @param frequency Indicates vibrator frequency in a vibration period.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns -1 if the vibrationPeriod setting is not supported.
+ * @return Returns -2 if the intensity setting is not supported.
+ * @return Returns -3 if the frequency setting is not supported.
+ *
+ * @since 3.2
+ * @version 1.1
+ */
+ EnableVibratorModulation([in] unsigned int duration, [in] unsigned short intensity, [in] short frequency);
+
+ /**
+ * @brief Controls the vibrator to perform a periodic vibration with the custom composite effect.
+ *
+ * @param effect Indicates the pointer to the custom composite effect type. For details,
+ * see {@link HdfCompositeEffect}.
+ *
+ * @return Returns 0 if the operation is successful; returns a negative value otherwise.
+ *
+ * @since 3.2
+ * @version 1.1
+ */
+ EnableCompositeEffect([in] int deviceId, [in] int vibratorId, [in] struct HdfCompositeEffect effect);
+
+ /**
+ * @brief Obtains the vibration effect information with the specified effect type.
+ *
+ * @param effectType Indicates the pointer to the preset effect type. It is recommended that the
+ * maximum length be 64 bytes.
+ *
+ * @param effectInfo Indicates the pointer to the vibration effect information. For details,
+ * see {@link HdfEffectInfo}.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns negative value if the get failed.
+ *
+ * @since 3.2
+ * @version 1.1
+ */
+ GetEffectInfo([in] int deviceId, [in] int vibratorId, [in] String effectType, [out] struct HdfEffectInfo effectInfo);
+
+ /**
+ * @brief Obtains whether the vibrator is currently vibrating.
+ *
+ * @param state Indicates current vibration state of the vibrator.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns negative value if the get failed.
+ *
+ * @since 3.2
+ * @version 1.1
+ */
+ IsVibratorRunning([in] int deviceId, [out] boolean state);
+
+ /**
+ * @brief HD vibration data packet delivery.
+ *
+ * @param Indecates the Hd vibration data packet.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns negative value if the get failed.
+ *
+ * @since 4.1
+ * @version 1.2
+ */
+ PlayHapticPattern([in] int deviceId, [in] struct HapticPaket pkg);
+
+ /**
+ * @brief Obtains the vibration capability of the motor.
+ *
+ * @param Indecates the vibration capability of the motor.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns negative value if the get failed.
+ *
+ * @since 4.1
+ * @version 1.2
+ */
+ GetHapticCapacity([in] int deviceId, [out] struct HapticCapacity HapticCapacity);
+
+ /**
+ * @brief Obtains the start_up time of the motor.
+ *
+ * @param Indicates the time from command is issued to the time the motor starts.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns negative value if the get failed.
+ *
+ * @since 4.1
+ * @version 1.2
+ */
+ GetHapticStartUpTime([in] int deviceId, [in] int mode, [out] int startUpTime);
+
+ /**
+ * @brief Controls the vibrator to perform a periodic vibration with the preset effect.
+ *
+ * One-shot vibration is mutually exclusive with periodic vibration. Before using periodic vibration,
+ * exit one-shot vibration.
+ *
+ * @param effectType Indicates the pointer to the preset effect type. It is recommended that the
+ * maximum length be 64 bytes.
+ * @param intensity Indicates amplitude intensity, ranging from 1 to 100.
+ * @return Returns 0 if the operation is successful; returns a negative value otherwise.
+ *
+ * @since 5.0
+ * @version 1.3
+ */
+ StartByIntensity([in] int deviceId, [in] int vibratorId, [in] String effectType, [in] unsigned short intensity);
+
+ /**
+ * @brief Obtains the vibration wave information.
+ *
+ * @param vibratorId Indicates the vibration index.
+ * @param info Indicates the information.
+ *
+ * @return Returns 0 if the operation is successful.
+ * @return Returns negative value if the get failed.
+ *
+ * @since 5.0
+ * @version 1.3
+ */
+ GetAllWaveInfo([in] int deviceId, [in] int vibratorId, [out] struct HdfWaveInformation[] info);
+
+ /**
+ * @brief Registers the callback for reporting vibrator plug state.
+ *
+ * The deviceId means which pluged in this device.
+ * the vibratorCnt means device contains vibrator count.
+ * The HapticCapacity means vibrator ability.
+ * is subscribed, and the subscription is successful once.
+ * @param callbackObj Indicates the callback to register. For details, see {@link IVibratorPlugCallback}.
+ * @return Returns 0 if the callback is successfully registered; returns a negative value otherwise.
+ *
+ * @since 5.1
+ * @version 2.0
+ */
+ RegVibratorPlugCallback([in] IVibratorPlugCallback callbackObj);
+
+ /**
+ * @brief UnRegisters the callback for reporting vibrator plug state.
+ *
+ * The deviceId means which pluged in this device.
+ * the vibratorCnt means device contains vibrator count.
+ * The HapticCapacity means vibrator ability.
+ * is subscribed, and the subscription is successful once.
+ * @param callbackObj Indicates the callback to register. For details, see {@link IVibratorPlugCallback}.
+ * @return Returns 0 if the callback is successfully registered; returns a negative value otherwise.
+ *
+ * @since 5.1
+ * @version 2.0
+ */
+ UnRegVibratorPlugCallback([in] IVibratorPlugCallback callbackObj);
+}
\ No newline at end of file
diff --git a/vibrator/v2_0/IVibratorPlugCallback.idl b/vibrator/v2_0/IVibratorPlugCallback.idl
new file mode 100644
index 0000000000000000000000000000000000000000..69e004ddec2ef67dd7330a1b584144aa272fdf34
--- /dev/null
+++ b/vibrator/v2_0/IVibratorPlugCallback.idl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed 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.
+ */
+
+package ohos.hdi.vibrator.v2_0;
+
+import ohos.hdi.vibrator.v2_0.VibratorTypes;
+
+/**
+ * @brief Defines the callback for reporting vibrator plug state. This callback needs to be registered when
+ * a Vibrator user subscribes to vibrator data.
+ * Vibrator state. For details, see {@link IVibratorInterface}.
+ *
+ * @since 5.1
+ * @version 2.0
+ */
+[callback] interface IVibratorPlugCallback {
+ /**
+ * @brief Defines the function for reporting vibrator data.
+ * @param event Indicates the information about vibrator event in the system.
+ *
+ * @since 5.1
+ * @version 2.0
+ */
+ OnVibratorPlugEvent([in] struct HdfVibratorPlugInfo vibratorPlugInfo);
+}
\ No newline at end of file
diff --git a/vibrator/v2_0/VibratorTypes.idl b/vibrator/v2_0/VibratorTypes.idl
new file mode 100644
index 0000000000000000000000000000000000000000..3a914a177633373faa74187ceb11a07c4d9150b0
--- /dev/null
+++ b/vibrator/v2_0/VibratorTypes.idl
@@ -0,0 +1,263 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed 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.
+ */
+
+package ohos.hdi.vibrator.v2_0;
+
+/**
+ * @brief Enumerates the vibration modes of this vibrator.
+ *
+ * @since 2.2
+ */
+enum HdfVibratorMode {
+ /**< Indicates the one-shot vibration with the given duration. */
+ HDF_VIBRATOR_MODE_ONCE,
+ /**< Indicates the periodic vibration with the preset effect. */
+ HDF_VIBRATOR_MODE_PRESET,
+ /**< Indicates the vibration is high-definition. */
+ HDF_VIBRATOR_MODE_HDHAPTIC,
+ /**< Indicates invalid the effect mode. */
+ HDF_VIBRATOR_MODE_BUTT,
+};
+
+/**
+ * @brief Enumerates the effect types of the composite effects.
+ *
+ * @since 3.2
+ */
+enum HdfEffectType {
+ /**< Indicates the time effect type of the given time series. */
+ HDF_EFFECT_TYPE_TIME,
+ /**< Indicates primitive vibration effect type for a given primitive vibration sequence. */
+ HDF_EFFECT_TYPE_PRIMITIVE,
+ /**< Indicates invalid the effect type. */
+ HDF_EFFECT_TYPE_BUTT,
+};
+
+/**
+ * @brief Defines the vibration parameters.
+ *
+ * The parameters include the setting intensity and frequency capability the on and intensity and frequency range.
+ *
+ * @since 3.2
+ */
+struct HdfVibratorInfo {
+ /**< setting intensity capability. 1 indicates support, 0 indicates not support. */
+ boolean isSupportIntensity;
+ /**< setting frequency capability. 1 indicates support, 0 indicates not support. */
+ boolean isSupportFrequency;
+ /**< Max intensity. */
+ unsigned short intensityMaxValue;
+ /**< Min intensity. */
+ unsigned short intensityMinValue;
+ /**< Max frequency(Hz). */
+ short frequencyMaxValue;
+ /**< Min frequency(Hz). */
+ short frequencyMinValue;
+ /**< Device id. */
+ int deviceId;
+};
+
+/**
+ * @brief Defines the time effect parameters.
+ *
+ * The parameters include delay, time, intensity and frequency of vibration.
+ *
+ * @since 3.2
+ */
+struct TimeEffect {
+ int delay; /** Waiting time. */
+ int time; /** Vibration time. */
+ unsigned short intensity; /** Vibration intensity. */
+ short frequency; /** Vibration frequency(Hz). */
+};
+
+/**
+ * @brief Defines the primitive effect parameters.
+ *
+ * The parameters include delay, effect id and vibration intensity.
+ *
+ * @since 3.2
+ */
+struct PrimitiveEffect {
+ int delay; /** Waiting time. */
+ int effectId; /** Effect id. */
+ unsigned short intensity; /** Vibration intensity. */
+};
+
+/**
+ * @brief Defines two effects for custom composite effects.
+ *
+ * The parameters include time effect and primitive effect.
+ *
+ * @since 3.2
+ */
+union CompositeEffect {
+ struct TimeEffect timeEffect; /** Time effect, see {@link TimeEffect}. */
+ struct PrimitiveEffect primitiveEffect; /** Primitive effect, see {@link PrimitiveEffect}. */
+};
+
+/**
+ * @brief Defines the composite vibration effect parameters.
+ *
+ * The parameters include type and sequences of composite effects.
+ *
+ * @since 3.2
+ */
+struct HdfCompositeEffect {
+ /** Type of the composite effect, see {@link union HdfEffectType}. */
+ int type;
+ /** The sequences of composite effects, see {@link union CompositeEffect}. */
+ union CompositeEffect[] compositeEffects;
+};
+
+/**
+ * @brief Defines the vibration effect information.
+ *
+ * The information include the capability to set the effect and the vibration duration of the effect.
+ *
+ * @since 3.2
+ */
+struct HdfEffectInfo {
+ /** Vibration duration of the effect, in milliseconds. */
+ int duration;
+ /**< setting effect capability. 1 indicates support, 0 indicates not support. */
+ boolean isSupportEffect;
+};
+
+/**
+ * @brief Enumerates the event types.
+ *
+ * @since 4.1
+ */
+enum EVENT_TYPE {
+ /**< Indicates that the vibration is continuous. */
+ CONTINUOUS = 0,
+ /**< Indicates that the vibration is instantaneous. */
+ TRANSIENT = 1,
+};
+
+/**
+ * @brief Defines the vibration point parameters.
+ *
+ * The information include the time, intensity, and frequency.
+ *
+ * @since 4.1
+ */
+struct CurvePoint {
+ /** Time of the vibration point. */
+ int time;
+ /** Intensity of the vibration point. */
+ int intensity;
+ /** Frequency of the vibration point. */
+ int frequency;
+};
+
+/**
+ * @brief Defines the HD vibration event.
+ *
+ * The information include the HD vibration event.
+ *
+ * @since 4.1
+ */
+struct HapticEvent {
+ /** Indicates the vibration type. */
+ enum EVENT_TYPE type;
+ /** Indicates the vibration time. */
+ int time;
+ /** Indicates the vibration duration. */
+ int duration;
+ /** Indicates the vibration intensity. */
+ int intensity;
+ /** Indicates the vibration frequency. */
+ int frequency;
+ /** ID of the vibration motor. */
+ int index;
+ /** Indicates the number of vibration points. */
+ int pointNum;
+ /** Indicates the vibration point array. */
+ struct CurvePoint[] points;
+};
+
+/**
+ * @brief Defines the vibration data delivery packet.
+ *
+ * The information include the different trypes of vibrationsr;
+ *
+ * @since 4.1
+ */
+struct HapticPaket {
+ /** Indicates the vibration data delivery time. */
+ int time;
+ /** Indicates the vibration number of data to be delivered. */
+ int eventNum;
+ /** Indicates the vibration data delivery event array. */
+ struct HapticEvent[] events;
+};
+
+/**
+ * @brief Defines the vibration capability data package.
+ *
+ * The information include the different types of vibrations.
+ *
+ * @since 4.1
+ */
+struct HapticCapacity {
+ /** Indicates the vibration support HD vibration. */
+ boolean isSupportHdHaptic;
+ /** Indicates the vibration support predefined waveforms. */
+ boolean isSupportPresetMapping;
+ /** Indicates the vibration support dalay vibration. */
+ boolean isSupportTimeDelay;
+ /** Indicates the vibration Standby parameter. */
+ boolean reserved0;
+ /** Indicates the vibration Standby parameter. */
+ int reserved1;
+};
+
+/**
+ * @brief Wave Information.
+ *
+ * @since 5.0
+ * @version 1.3
+ */
+struct HdfWaveInformation {
+ /** Indicates the wave number. */
+ int waveId;
+ /** Indicates the vibration intensity. */
+ float intensity;
+ /** Indicates the vibration frequency. */
+ float frequency;
+ /** Indicates the vibration duration. */
+ int duration;
+ /** reserved. */
+ int reserved;
+};
+
+/**
+ * @brief Defines the device pluged contains vibrator info.
+ *
+ * @since 5.1
+ * @version 2.0
+ */
+struct HdfVibratorPlugInfo {
+ /**< Device id. */
+ int deviceId;
+ /**< Device Name. */
+ String deviceName;
+ /**< Vibrator Count. */
+ int vibratorCnt;
+ /**< The vibration plug state. */
+ int status;
+};
\ No newline at end of file