diff --git a/light/v1_0/ILightInterface.idl b/light/v1_0/ILightInterface.idl index fe124dd5ac04c90966bb36efdb6fe1d35344c639..cd6cd891b00fdc3932d80d9d7aaec0470755c4cd 100755 --- a/light/v1_0/ILightInterface.idl +++ b/light/v1_0/ILightInterface.idl @@ -13,11 +13,74 @@ * limitations under the License. */ +/** + * @addtogroup HdfLight + * @{ + * + * @brief Provides APIs for the light service. + * + * The light module provides a unified interface for the light service to access the light driver. + * After obtaining the driver object or proxy, the light service distinguishes light devices by id + * and call related APIs to obtain light information, turn on or off a light, or set the blinking mode. + * @since 3.1 + */ + +/** + * @file ILightInterface.idl + * + * @brief Declares common APIs of the light module. These APIs can be used to obtain the light id, + * turn on or off a light, and set the light brightness and blinking mode. + * @since 3.1 + */ + +/** + * @brief Defines the basic operations that can be performed on lights. + * + * The operations include obtaining light information, turning on or off a light, + * and setting the light brightness or blinking mode. + */ + package ohos.hdi.light.v1_0; import ohos.hdi.light.v1_0.LightTypes; interface ILightInterface { + /** + * @brief Obtains information about all the lights in the system. + * + * @param info Indicates the vector of the light information. For details, see {@link HdfLightInfo}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.1 + */ GetLightInfo([out] struct HdfLightInfo[] info); + + /** + * @brief Turns on available lights in the list based on the specified light id. + * + * @param lightId Indicates the light id. For details, see {@link HdfLightId}. + * + * @param effect Indicates the pointer to the lighting effect. For details, see {@link HdfLightEffect}. + * + * @return Returns 0 if the operation is successful. + * @return Returns -1 if the light id is not supported. + * @return Returns -2 if the blinking setting is not supported. + * @return Returns -3 if the brightness setting is not supported. + * + * @since 3.1 + */ TurnOnLight([in] int lightId, [in] struct HdfLightEffect effect); - TurnOffLight([in] int LightId); + + /** + * @brief Turns off available lights in the list based on the specified light id. + * + * @param lightId Indicates the light id. For details, see {@link HdfLightId}. + * + * @return Returns 0 if the operation is successful. + * @return Returns a negative value if the operation fails. + * + * @since 3.1 + */ + TurnOffLight([in] int lightId); } \ No newline at end of file diff --git a/light/v1_0/LightTypes.idl b/light/v1_0/LightTypes.idl index 8ff6b5221f0778a9721fba9448a58fb89afa57cc..58829dde0a47eda4fe1bfd885f6c3f9eb3ddcdf5 100755 --- a/light/v1_0/LightTypes.idl +++ b/light/v1_0/LightTypes.idl @@ -13,33 +13,85 @@ * limitations under the License. */ +/** + * @addtogroup HdfLight + * @{ + * + * @brief Provides APIs for the light service. + * + * The light module provides a unified interface for the light service to access the light driver. + * After obtaining the light driver object or proxy, the service can call related APIs to obtain light information, + * turn on or off a light, and set the light blinking mode based on the light id. + * @since 3.1 + */ + +/** + * @file LightTypes.idl + * + * @brief Defines the light data structure, including the light id, lighting mode, + * blinking mode and duration, return values, and lighting effect. + * @since 3.1 + */ + package ohos.hdi.light.v1_0; -enum HdfLighType { - HDF_LIGHT_TYPE_BATTERY = 1, - HDF_LIGHT_TYPE_NOTIFICATIONS = 2, - HDF_LIGHT_TYPE_ATTENTION = 3, +/** + * @brief Enumerates the light ids. + * + * @since 3.1 + */ +enum HdfLightId { + HDF_LIGHT_ID_BATTERY = 1, + HDF_LIGHT_ID_NOTIFICATIONS = 2, + HDF_LIGHT_ID_ATTENTION = 3, HDF_LIGHT_ID_BUTT = 4, }; +/** + * @brief Defines the basic light information. + * + * Basic light information includes the light id and custom extended information. + * + * @since 3.1 + */ struct HdfLightInfo { - int lightId; - int reserved; + int lightId; /** Light id. For details, see {@link HdfLightId}. */ + int reserved; /** Custom extended information. */ }; +/** + * @brief Enumerates the lighting modes. + * + * @since 3.1 + */ enum HdfLightFlashMode { HDF_LIGHT_FLASH_NONE = 0, HDF_LIGHT_FLASH_TIMED = 1, HDF_LIGHT_FLASH_BUTT = 2, }; +/** + * @brief Defines the blinking parameters. + * + * The parameters include the blinking mode and the on and off time for the light in a blinking period. + * + * @since 3.1 + */ struct HdfLightFlashEffect { - int flashMode; - int onTime; - int offTime; + int flashMode; /** Blinking mode. For details, see {@link HdfLightFlashMode}. */ + int onTime; /** Duration (in ms) for which the light is on in a blinking period. */ + int offTime; /** Duration (in ms) for which the light is off in a blinking period. */ }; +/** + * @brief Defines the lighting effect parameters. + * + * The parameters include the brightness and blinking mode. + * + * @since 3.1 + */ struct HdfLightEffect { - int lightBrightness; - struct HdfLightFlashEffect flashEffect; + int lightBrightness; /** Brightness value. The value 1 of the most significant bit indicates a color. + Bits 16–31 for red, bits 8–15 for green, and bits 0–7 for blue. */ + struct HdfLightFlashEffect flashEffect; /** Blinking mode. For details, see {@link LightFlashEffect}. */ }; \ No newline at end of file diff --git a/sensor/v1_0/ISensorInterface.idl b/sensor/v1_0/ISensorInterface.idl index 0524106c66f87106c32e18ad93b89eb2d03f95a2..31e9f51376e58b1242c401e50250a40fdf9906fe 100644 --- a/sensor/v1_0/ISensorInterface.idl +++ b/sensor/v1_0/ISensorInterface.idl @@ -129,22 +129,22 @@ interface ISensorInterface { /** * @brief Registers the callback for reporting sensor data to the subscriber. * - * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}. + * @param groupId Indicates the sensor group ID. * @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 sensorId, [in] ISensorCallback callbackObj); + Register([in] int groupId, [in] ISensorCallback callbackObj); /** * @brief Deregisters the callback for reporting sensor data. - * @param sensorId Indicates the sensor ID. For details, see {@link SensorTypeTag}. + * @param groupId Indicates the sensor group ID. * @return Returns 0 if the callback is successfully deregistered; returns a negative value otherwise. * * @since 2.2 * @version 1.0 */ - Unregister([in] int sensorId, [in] ISensorCallback callbackObj); + Unregister([in] int groupId, [in] ISensorCallback callbackObj); } diff --git a/sensor/v1_0/SensorTypes.idl b/sensor/v1_0/SensorTypes.idl index 2d44d9a2f2eb1b12bcecb894c50514a55f5d49bd..96b72968c79d6d0ec56c1fc243672c641f48df37 100644 --- a/sensor/v1_0/SensorTypes.idl +++ b/sensor/v1_0/SensorTypes.idl @@ -76,3 +76,56 @@ struct HdfSensorEvents { unsigned char[] data; /**< Sensor data vector */ unsigned int dataLen; /**< Sensor data length */ }; + +/** + * @brief Enumerates sensor types. + * + * @since 2.2 + */ +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_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_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_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*/ +};