Display feature is necessary for all profiles such as headed and headless.
ex) http://tizen.org/feature/display
So, add it.
Change-Id: If0a9f9d0cda5e31784fc5b38df0e7544ad41138c
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
*
* @section CAPI_SYSTEM_DEVICE_DISPLAY_MODULE__FEATURE Related Features
* This API is related with the following features:\n
+ * - %http://tizen.org/feature/display\n
* - %http://tizen.org/feature/display.state\n
*
* It is recommended to design feature related codes in your application for reliability.\n
/**
* @brief Adds a callback to the observing device state.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks the following feature should be supported for #DEVICE_CALLBACK_DISPLAY_STATE: %http://tizen.org/feature/display. Otherwise #DEVICE_ERROR_NOT_SUPPORTED is returned.
* @param[in] type The device type to monitor
* @param[in] callback The callback function to add
* @param[in] user_data The user data to be passed to the callback function
* @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #DEVICE_ERROR_ALREADY_IN_PROGRESS Operation already
* @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
*/
int device_add_callback(device_callback_e type, device_changed_cb callback, void *user_data);
/**
* @brief Removes a device callback function.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks the following feature should be supported for #DEVICE_CALLBACK_DISPLAY_STATE: %http://tizen.org/feature/display. Otherwise #DEVICE_ERROR_NOT_SUPPORTED is returned.
* @param[in] type The device type to monitor
* @param[in] callback The callback function to remove
* @return @c 0 on success,
* @retval #DEVICE_ERROR_NONE Successful
* @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
*/
int device_remove_callback(device_callback_e type, device_changed_cb callback);
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/display
+ * @remarks #DEVICE_ERROR_NOT_SUPPORTED is returned, when the following feature is not supported: %http://tizen.org/feature/display
* @param[out] device_number The total number of displays
* @return @c 0 on success,
* otherwise a negative error value
* @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
* @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
* @see device_display_get_brightness()
* @see device_display_set_brightness()
* @see device_display_get_max_brightness()
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/display
+ * @remarks #DEVICE_ERROR_NOT_SUPPORTED is returned, when the following feature is not supported: %http://tizen.org/feature/display
* @param[in] display_index The index of the display \n
* It can be greater than or equal to @c 0 and less than the number of displays returned by device_display_get_numbers(). \n
* The index zero is always assigned to the main display
* @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
* @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
* @see device_display_get_numbers()
* @see device_display_set_brightness()
* @see device_display_get_brightness()
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/display
+ * @remarks #DEVICE_ERROR_NOT_SUPPORTED is returned, when the following feature is not supported: %http://tizen.org/feature/display
* @param[in] display_index The index of the display \n
* It can be greater than or equal to @c 0 and less than the number of displays returned by device_display_get_numbers(). \n
* The index zero is always assigned to the main display
* @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
* @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
* @see device_display_get_numbers()
* @see device_display_set_brightness()
* @see device_display_get_max_brightness()
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @privlevel public
* @privilege %http://tizen.org/privilege/display
+ * @remarks #DEVICE_ERROR_NOT_SUPPORTED is returned, when the following feature is not supported: %http://tizen.org/feature/display
* @param[in] display_index The index of the display \n
* It can be greater than or equal to @c 0 and less than the number of displays returned by device_display_get_numbers(). \n
* The index zero is always assigned to the main display
* @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #DEVICE_ERROR_PERMISSION_DENIED Permission denied
* @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
* @see device_display_get_numbers()
* @see device_display_get_max_brightness()
* @see device_display_get_brightness()
/**
* @brief Gets the current display state.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @remarks #DEVICE_ERROR_NOT_SUPPORTED is returned, when the following feature is not supported: %http://tizen.org/feature/display
* @param[out] state The display state
* @return @c 0 on success,
* otherwise a negative error value
* @retval #DEVICE_ERROR_NONE Successful
* @retval #DEVICE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #DEVICE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #DEVICE_ERROR_NOT_SUPPORTED Not supported device
* @see device_add_callback
* @see device_remove_callback
* @see #DEVICE_CALLBACK_DISPLAY_STATE
dd_list *elem, *elem_next;
int ret, n;
+ if (!is_display_supported() && type == DEVICE_CALLBACK_DISPLAY_STATE)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (type < 0 || type >= DEVICE_CALLBACK_MAX)
return DEVICE_ERROR_INVALID_PARAMETER;
dd_list *elem, *elem_next;
int ret, n;
+ if (!is_display_supported() && type == DEVICE_CALLBACK_DISPLAY_STATE)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (type < 0 || type >= DEVICE_CALLBACK_MAX)
return DEVICE_ERROR_INVALID_PARAMETER;
#define MODEL_NAME "http://tizen.org/system/model_name"
#define MODEL_EMULATOR "Emulator"
+#define DISPLAY_FEATURE "http://tizen.org/feature/display"
#define DISPLAY_STATE_FEATURE "http://tizen.org/feature/display.state"
static inline char *trim_str(char *s)
return emul;
}
+int is_display_supported(void)
+{
+ int ret;
+ bool display_avail;
+
+ ret = system_info_get_platform_bool(DISPLAY_FEATURE, &display_avail);
+ if (ret < 0) {
+ _E("Failed to get value of display feature");
+ return false;
+ } else if (ret == 0 && !display_avail) {
+ _D("Display feature is not supported");
+ return false;
+ } else
+ return true;
+}
+
int is_display_state_supported(void)
{
int ret;
bool is_emulator(void);
int is_display_state_supported(void);
+int is_display_supported(void);
#endif /* __COMMON_H__ */
{
int ret;
+ ret = is_display_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (!device_number)
return DEVICE_ERROR_INVALID_PARAMETER;
char str_val[32];
int ret;
+ ret = is_display_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (!max_brightness)
return DEVICE_ERROR_INVALID_PARAMETER;
char str_val[32];
int ret;
+ ret = is_display_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (!brightness)
return DEVICE_ERROR_INVALID_PARAMETER;
char str_val[32];
int ret, max;
+ ret = is_display_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (display_cnt < 0) {
ret = device_display_get_numbers(&display_cnt);
if (ret != DEVICE_ERROR_NONE) //LCOV_EXCL_LINE System Error
{
int ret, val;
+ ret = is_display_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (!state)
return DEVICE_ERROR_INVALID_PARAMETER;
char str_val[32];
int ret;
+ ret = is_display_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (!brightness)
return DEVICE_ERROR_INVALID_PARAMETER;
char str_val[32];
int ret;
+ ret = is_display_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (!brightness)
return DEVICE_ERROR_INVALID_PARAMETER;
char str_val[32];
int ret, max;
+ ret = is_display_supported();
+ if (!ret)
+ return DEVICE_ERROR_NOT_SUPPORTED;
+
if (display_cnt < 0) {
ret = device_display_get_numbers(&display_cnt);
if (ret != DEVICE_ERROR_NONE) //LCOV_EXCL_LINE System Error