protected:
static void SetUpHalTestSuite() {
int ret_val, val;
- enum display_state state;
- enum display_image_effect effect;
- enum display_panel_mode pmode;
+ hal_device_display_state_e state;
+ hal_device_display_image_effect_e effect;
+ hal_device_display_panel_mode_e pmode;
ret_val = system_info_get_platform_bool(FEATURE_DISPLAY, &DISPLAY::supported);
ASSERT_EQ(SYSTEM_INFO_ERROR_NONE, ret_val) << "system_info_get_platform_bool failed";
if (DISPLAY::orig_brightness != -1)
hal_device_display_set_brightness(DISPLAY::orig_brightness);
if (DISPLAY::orig_state != -1)
- hal_device_display_set_state((enum display_state)DISPLAY::orig_state);
+ hal_device_display_set_state((hal_device_display_state_e)DISPLAY::orig_state);
if (DISPLAY::orig_image_effect != -1)
- hal_device_display_set_image_effect((enum display_image_effect)DISPLAY::orig_image_effect);
+ hal_device_display_set_image_effect((hal_device_display_image_effect_e)DISPLAY::orig_image_effect);
if (DISPLAY::orig_panel_mode != -1)
- hal_device_display_set_panel_mode((enum display_panel_mode)DISPLAY::orig_panel_mode);
+ hal_device_display_set_panel_mode((hal_device_display_panel_mode_e)DISPLAY::orig_panel_mode);
if (DISPLAY::orig_frame_rate != -1)
hal_device_display_set_frame_rate(DISPLAY::orig_frame_rate);
}
static int image_effect_raw_to_enum(int effect)
{
if (effect == 0)
- return DISPLAY_IMAGE_EFFECT_STANDARD;
+ return HAL_DEVICE_DISPLAY_IMAGE_EFFECT_STANDARD;
if (effect == 6)
- return DISPLAY_IMAGE_EFFECT_NEGATIVE;
+ return HAL_DEVICE_DISPLAY_IMAGE_EFFECT_NEGATIVE;
if (effect == 9)
- return DISPLAY_IMAGE_EFFECT_GREY;
+ return HAL_DEVICE_DISPLAY_IMAGE_EFFECT_GREY;
if (effect == 11)
- return DISPLAY_IMAGE_EFFECT_GREY_NEGATIVE;
+ return HAL_DEVICE_DISPLAY_IMAGE_EFFECT_GREY_NEGATIVE;
EXPECT_TRUE(false) << "Invalid image effect=" << effect;
- return DISPLAY_IMAGE_EFFECT_MAX;
+ return HAL_DEVICE_DISPLAY_IMAGE_EFFECT_MAX;
}
/*
* Testcase for Display
TEST_F(DISPLAY, GetStateP)
{
int ret_val;
- enum display_state state;
+ hal_device_display_state_e state;
if (!DISPLAY::supported) {
SKIP_MESSAGE("Display not supported");
TEST_F(DISPLAY, SetStateP)
{
int ret_val;
- enum display_state state;
+ hal_device_display_state_e state;
if (!DISPLAY::supported) {
SKIP_MESSAGE("Display not supported");
return;
}
- ret_val = hal_device_display_set_state(DISPLAY_ON);
+ ret_val = hal_device_display_set_state(HAL_DEVICE_DISPLAY_ON);
if (ret_val == -ENODEV) {
SKIP_MESSAGE("Not supported HAL");
return;
ASSERT_EQ(ret_val, 0) << "Failed to set state (" << ret_val << ")";
ret_val = hal_device_display_get_state(&state);
- ASSERT_EQ(state, DISPLAY_ON) << "Failed to set DISPLAY_ON (" << ret_val << ")";
+ ASSERT_EQ(state, HAL_DEVICE_DISPLAY_ON) << "Failed to set HAL_DEVICE_DISPLAY_ON (" << ret_val << ")";
- ret_val = hal_device_display_set_state(DISPLAY_OFF);
+ ret_val = hal_device_display_set_state(HAL_DEVICE_DISPLAY_OFF);
ASSERT_EQ(ret_val, 0) << "Failed to set state (" << ret_val << ")";
ret_val = hal_device_display_get_state(&state);
- ASSERT_EQ(state, DISPLAY_OFF) << "Failed to set DISPLAY_ON (" << ret_val << ")";
+ ASSERT_EQ(state, HAL_DEVICE_DISPLAY_OFF) << "Failed to set HAL_DEVICE_DISPLAY_ON (" << ret_val << ")";
// restore
if (DISPLAY::orig_state != -1)
- hal_device_display_set_state((enum display_state)DISPLAY::orig_state);
+ hal_device_display_set_state((hal_device_display_state_e)DISPLAY::orig_state);
}
TEST_F(DISPLAY, GetImageEffectP)
{
- enum display_image_effect effect;
+ hal_device_display_image_effect_e effect;
int ret_val;
if (!DISPLAY::supported) {
{
int ret_val;
int set_image_effect, get_image_effect;
- enum display_image_effect get_image_effect_raw = DISPLAY_IMAGE_EFFECT_STANDARD;
+ hal_device_display_image_effect_e get_image_effect_raw = HAL_DEVICE_DISPLAY_IMAGE_EFFECT_STANDARD;
if (!DISPLAY::supported) {
SKIP_MESSAGE("Display not supported");
return;
}
- for (set_image_effect = DISPLAY_IMAGE_EFFECT_STANDARD;
- set_image_effect <= DISPLAY_IMAGE_EFFECT_GREY_NEGATIVE; ++set_image_effect) {
- ret_val = hal_device_display_set_image_effect((enum display_image_effect)set_image_effect);
+ for (set_image_effect = HAL_DEVICE_DISPLAY_IMAGE_EFFECT_STANDARD;
+ set_image_effect <= HAL_DEVICE_DISPLAY_IMAGE_EFFECT_GREY_NEGATIVE; ++set_image_effect) {
+ ret_val = hal_device_display_set_image_effect((hal_device_display_image_effect_e)set_image_effect);
if (ret_val == -ENODEV) {
SKIP_MESSAGE("Not supported HAL");
return;
// restore
if (DISPLAY::orig_image_effect != -1)
- hal_device_display_set_image_effect((enum display_image_effect)DISPLAY::orig_image_effect);
+ hal_device_display_set_image_effect((hal_device_display_image_effect_e)DISPLAY::orig_image_effect);
}
TEST_F(DISPLAY, GetPanelModeP)
{
- enum display_panel_mode mode;
+ hal_device_display_panel_mode_e mode;
int ret_val;
if (!DISPLAY::supported) {
{
int ret_val;
int panel_mode;
- enum display_panel_mode panel_mode_raw = DISPLAY_PANEL_MODE_STANDARD;
+ hal_device_display_panel_mode_e panel_mode_raw = HAL_DEVICE_DISPLAY_PANEL_MODE_STANDARD;
if (!DISPLAY::supported) {
SKIP_MESSAGE("Display not supported");
return;
}
- for (panel_mode = DISPLAY_PANEL_MODE_STANDARD;
- panel_mode <= DISPLAY_PANEL_MODE_LOWPOWER; ++panel_mode) {
- ret_val = hal_device_display_set_panel_mode((enum display_panel_mode)panel_mode);
+ for (panel_mode = HAL_DEVICE_DISPLAY_PANEL_MODE_STANDARD;
+ panel_mode <= HAL_DEVICE_DISPLAY_PANEL_MODE_LOWPOWER; ++panel_mode) {
+ ret_val = hal_device_display_set_panel_mode((hal_device_display_panel_mode_e)panel_mode);
if (ret_val == -ENODEV) {
SKIP_MESSAGE("Not supported HAL");
return;
// restore
if (DISPLAY::orig_panel_mode != -1)
- hal_device_display_set_panel_mode((enum display_panel_mode)DISPLAY::orig_panel_mode);
+ hal_device_display_set_panel_mode((hal_device_display_panel_mode_e)DISPLAY::orig_panel_mode);
}
TEST_F(DISPLAY, GetAodModeP)
{
- enum display_aod_mode mode;
+ hal_device_display_aod_mode_e mode;
int ret_val;
if (!DISPLAY::supported) {
int (*get_auto_brightness)(float lmax, float lmin, float light, int *brightness);
/* Control display state */
- int (*get_state)(enum display_state *state);
- int (*set_state)(enum display_state state);
+ int (*get_state)(hal_device_display_state_e *state);
+ int (*set_state)(hal_device_display_state_e state);
/* Control image effect */
- int (*get_image_effect)(enum display_image_effect *effect);
- int (*set_image_effect)(enum display_image_effect effect);
+ int (*get_image_effect)(hal_device_display_image_effect_e *effect);
+ int (*set_image_effect)(hal_device_display_image_effect_e effect);
/* Control panel mode */
- int (*get_panel_mode)(enum display_panel_mode *mode);
- int (*set_panel_mode)(enum display_panel_mode mode);
+ int (*get_panel_mode)(hal_device_display_panel_mode_e *mode);
+ int (*set_panel_mode)(hal_device_display_panel_mode_e mode);
/* Control AOD mode */
- int (*get_aod_mode)(enum display_aod_mode *mode);
+ int (*get_aod_mode)(hal_device_display_aod_mode_e *mode);
/* Control AOD brightness */
int (*get_aod_brightness)(int *max, int *normal, int *min, int *charging);
int (*set_frame_rate)(int rate);
/* Control display white balance */
- int (*set_white_balance)(enum hal_display_white_balance, int value);
- int (*get_white_balance)(enum hal_display_white_balance, int *value);
+ int (*set_white_balance)(hal_device_display_white_balance_e white_balance_type, int value);
+ int (*get_white_balance)(hal_device_display_white_balance_e white_balance_type, int *value);
/* Control display rotation angle */
- int (*get_rotation_angle)(int display_index, enum hal_device_display_rotation_angle *angle);
- int (*set_rotation_angle)(int display_index, enum hal_device_display_rotation_angle angle,
- enum hal_device_display_rotation_direction direction);
+ int (*get_rotation_angle)(int display_index, hal_device_display_rotation_angle_e *angle);
+ int (*set_rotation_angle)(int display_index, hal_device_display_rotation_angle_e angle,
+ hal_device_display_rotation_direction_e direction);
} hal_backend_device_display_funcs;
#ifdef __cplusplus
extern "C" {
#endif
-enum display_state {
- DISPLAY_ON, /* In use */
- DISPLAY_STANDBY, /* Blanked, low power */
- DISPLAY_SUSPEND, /* Blanked, lower power */
- DISPLAY_OFF, /* Shut off, awaiting activity */
- DISPLAY_DETACH, /* Detached display at runtime */
-};
+/**
+ * @brief Enumeration for display state.
+ * @since HAL_MODULE_DEVICE_DISPLAY 1.0
+ */
+typedef enum {
+ HAL_DEVICE_DISPLAY_ON, /**< In use (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_STANDBY, /**< Blanked, low power (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_SUSPEND, /**< Blanked, lower power (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_OFF, /**< Shut off, awaiting activity (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_DETACH, /**< Detached display at runtime (Since HAL_DEVICE_DISPLAY 1.0) */
+} hal_device_display_state_e;
-enum display_image_effect {
- DISPLAY_IMAGE_EFFECT_STANDARD, /* No effect */
- DISPLAY_IMAGE_EFFECT_NEGATIVE, /* Negative effect */
- DISPLAY_IMAGE_EFFECT_GREY, /* Grey effect */
- DISPLAY_IMAGE_EFFECT_GREY_NEGATIVE, /* Grey Negative effect */
- DISPLAY_IMAGE_EFFECT_MAX,
-};
+/**
+ * @brief Enumeration for display image effect.
+ * @since HAL_MODULE_DEVICE_DISPLAY 1.0
+ */
+typedef enum {
+ HAL_DEVICE_DISPLAY_IMAGE_EFFECT_STANDARD, /**< No effect (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_IMAGE_EFFECT_NEGATIVE, /**< Negative effect (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_IMAGE_EFFECT_GREY, /**< Grey effect (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_IMAGE_EFFECT_GREY_NEGATIVE, /**< Grey Negative effect (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_IMAGE_EFFECT_MAX,
+} hal_device_display_image_effect_e;
-enum display_panel_mode {
- DISPLAY_PANEL_MODE_STANDARD, /* Standard mode */
- DISPLAY_PANEL_MODE_OUTDOOR, /* Outdoor mode */
- DISPLAY_PANEL_MODE_CONTENTS, /* Contents adaptive brightness control mode */
- DISPLAY_PANEL_MODE_LOWPOWER, /* Low power mode */
-};
+/**
+ * @brief Enumeration for display panel mode.
+ * @since HAL_MODULE_DEVICE_DISPLAY 1.0
+ */
+typedef enum {
+ HAL_DEVICE_DISPLAY_PANEL_MODE_STANDARD, /**< Standard mode (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_PANEL_MODE_OUTDOOR, /**< Outdoor mode (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_PANEL_MODE_CONTENTS, /**< Contents adaptive brightness control mode (Since HAL_DEVICE_DISPLAY 1.0) */
+ HAL_DEVICE_DISPLAY_PANEL_MODE_LOWPOWER, /**< Low power mode (Since HAL_DEVICE_DISPLAY 1.0) */
+} hal_device_display_panel_mode_e;
-enum display_aod_mode {
- DISPLAY_AOD_MODE_OFF,
- DISPLAY_AOD_MODE_ON,
-};
+/**
+ * @brief Enumeration for display aod mode.
+ * @since HAL_MODULE_DEVICE_DISPLAY 1.0
+ */
+typedef enum {
+ HAL_DEVICE_DISPLAY_AOD_MODE_OFF,
+ HAL_DEVICE_DISPLAY_AOD_MODE_ON,
+} hal_device_display_aod_mode_e;
-enum hal_display_white_balance {
- HAL_DISPLAY_WHITE_BALANCE_R_GAIN,
- HAL_DISPLAY_WHITE_BALANCE_G_GAIN,
- HAL_DISPLAY_WHITE_BALANCE_B_GAIN,
- HAL_DISPLAY_WHITE_BALANCE_R_OFFSET,
- HAL_DISPLAY_WHITE_BALANCE_G_OFFSET,
- HAL_DISPLAY_WHITE_BALANCE_B_OFFSET,
-};
+/**
+ * @brief Enumeration for display white balance value.
+ * @since HAL_MODULE_DEVICE_DISPLAY 1.0
+ */
+typedef enum {
+ HAL_DEVICE_DISPLAY_WHITE_BALANCE_R_GAIN,
+ HAL_DEVICE_DISPLAY_WHITE_BALANCE_G_GAIN,
+ HAL_DEVICE_DISPLAY_WHITE_BALANCE_B_GAIN,
+ HAL_DEVICE_DISPLAY_WHITE_BALANCE_R_OFFSET,
+ HAL_DEVICE_DISPLAY_WHITE_BALANCE_G_OFFSET,
+ HAL_DEVICE_DISPLAY_WHITE_BALANCE_B_OFFSET,
+} hal_device_display_white_balance_e;
-enum hal_device_display_rotation_angle {
+/**
+ * @brief Enumeration for display rotation angle.
+ * @since HAL_MODULE_DEVICE_DISPLAY 1.0
+ */
+typedef enum {
HAL_DEVICE_DISPLAY_ROTATION_ANGLE_UNKNOWN = -1,
HAL_DEVICE_DISPLAY_ROTATION_ANGLE_DEGREE_0 = 0,
HAL_DEVICE_DISPLAY_ROTATION_ANGLE_DEGREE_90 = 90,
HAL_DEVICE_DISPLAY_ROTATION_ANGLE_DEGREE_180 = 180,
HAL_DEVICE_DISPLAY_ROTATION_ANGLE_DEGREE_270 = 270,
-};
+} hal_device_display_rotation_angle_e;
-enum hal_device_display_rotation_direction {
+/**
+ * @brief Enumeration for display rotation direction.
+ * @since HAL_MODULE_DEVICE_DISPLAY 1.0
+ */
+typedef enum {
HAL_DEVICE_DISPLAY_ROTATION_DIRECTION_CLOCKWISE,
HAL_DEVICE_DISPLAY_ROTATION_DIRECTION_COUNTER_CLOCKWISE,
-};
+} hal_device_display_rotation_direction_e;
#ifdef __cplusplus
}
int hal_device_display_set_brightness(int brightness);
int hal_device_display_set_multi_brightness(int brightness, int step, int delay);
int hal_device_display_get_auto_brightness(float lmax, float lmin, float light, int *brightness);
-int hal_device_display_get_state(enum display_state *state);
-int hal_device_display_set_state(enum display_state state);
-int hal_device_display_get_image_effect(enum display_image_effect *effect);
-int hal_device_display_set_image_effect(enum display_image_effect effect);
-int hal_device_display_get_panel_mode(enum display_panel_mode *mode);
-int hal_device_display_set_panel_mode(enum display_panel_mode mode);
-int hal_device_display_get_aod_mode(enum display_aod_mode *mode);
+int hal_device_display_get_state(hal_device_display_state_e *state);
+int hal_device_display_set_state(hal_device_display_state_e state);
+int hal_device_display_get_image_effect(hal_device_display_image_effect_e *effect);
+int hal_device_display_set_image_effect(hal_device_display_image_effect_e effect);
+int hal_device_display_get_panel_mode(hal_device_display_panel_mode_e *mode);
+int hal_device_display_set_panel_mode(hal_device_display_panel_mode_e mode);
+int hal_device_display_get_aod_mode(hal_device_display_aod_mode_e *mode);
int hal_device_display_get_aod_brightness(int *max, int *normal, int *min, int *charging);
int hal_device_display_get_max_frame_rate(int *rate);
int hal_device_display_get_min_frame_rate(int *rate);
int hal_device_display_get_frame_rate(int *rate);
int hal_device_display_set_frame_rate(int rate);
-int hal_device_display_set_white_balance(enum hal_display_white_balance, int value);
-int hal_device_display_get_white_balance(enum hal_display_white_balance, int* value);
-int hal_device_display_get_rotation_angle(int display_index, enum hal_device_display_rotation_angle *angle);
-int hal_device_display_set_rotation_angle(int display_index, enum hal_device_display_rotation_angle angle,
- enum hal_device_display_rotation_direction direction);
+int hal_device_display_set_white_balance(hal_device_display_white_balance_e white_balance_type, int value);
+int hal_device_display_get_white_balance(hal_device_display_white_balance_e white_balance_type, int* value);
+int hal_device_display_get_rotation_angle(int display_index, hal_device_display_rotation_angle_e *angle);
+int hal_device_display_set_rotation_angle(int display_index, hal_device_display_rotation_angle_e angle,
+ hal_device_display_rotation_direction_e direction);
#ifdef __cplusplus
}
return hal_device_display_funcs->get_auto_brightness(lmax, lmin, light, brightness);
}
-int hal_device_display_get_state(enum display_state *state)
+int hal_device_display_get_state(hal_device_display_state_e *state)
{
int ret;
return hal_device_display_funcs->get_state(state);
}
-int hal_device_display_set_state(enum display_state state)
+int hal_device_display_set_state(hal_device_display_state_e state)
{
int ret;
return hal_device_display_funcs->set_state(state);
}
-int hal_device_display_get_image_effect(enum display_image_effect *effect)
+int hal_device_display_get_image_effect(hal_device_display_image_effect_e *effect)
{
int ret;
return hal_device_display_funcs->get_image_effect(effect);
}
-int hal_device_display_set_image_effect(enum display_image_effect effect)
+int hal_device_display_set_image_effect(hal_device_display_image_effect_e effect)
{
int ret;
return hal_device_display_funcs->set_image_effect(effect);
}
-int hal_device_display_get_panel_mode(enum display_panel_mode *mode)
+int hal_device_display_get_panel_mode(hal_device_display_panel_mode_e *mode)
{
int ret;
return hal_device_display_funcs->get_panel_mode(mode);
}
-int hal_device_display_set_panel_mode(enum display_panel_mode mode)
+int hal_device_display_set_panel_mode(hal_device_display_panel_mode_e mode)
{
int ret;
return hal_device_display_funcs->set_panel_mode(mode);
}
-int hal_device_display_get_aod_mode(enum display_aod_mode *mode)
+int hal_device_display_get_aod_mode(hal_device_display_aod_mode_e *mode)
{
int ret;
return hal_device_display_funcs->set_frame_rate(rate);
}
-int hal_device_display_set_white_balance(enum hal_display_white_balance white_balance_type, int value)
+int hal_device_display_set_white_balance(hal_device_display_white_balance_e white_balance_type, int value)
{
int ret;
return hal_device_display_funcs->set_white_balance(white_balance_type, value);
}
-int hal_device_display_get_white_balance(enum hal_display_white_balance white_balance_type, int* value)
+int hal_device_display_get_white_balance(hal_device_display_white_balance_e white_balance_type, int* value)
{
int ret;
return hal_device_display_funcs->get_white_balance(white_balance_type, value);
}
-int hal_device_display_get_rotation_angle(int display_index, enum hal_device_display_rotation_angle *angle)
+int hal_device_display_get_rotation_angle(int display_index, hal_device_display_rotation_angle_e *angle)
{
int ret;
}
int hal_device_display_set_rotation_angle(int display_index,
- enum hal_device_display_rotation_angle angle,
- enum hal_device_display_rotation_direction direction)
+ hal_device_display_rotation_angle_e angle,
+ hal_device_display_rotation_direction_e direction)
{
int ret;