4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
23 #include <libsyscommon/dbus-system.h>
28 #define METHOD_GET_BRIGHTNESS "GetBrightness"
29 #define METHOD_GET_MAX_BRIGHTNESS "GetMaxBrightness"
30 #define METHOD_SET_BRIGHTNESS "SetBrightness"
31 #define METHOD_SET_IR_COMMAND "SetIrCommand"
33 API int led_get_brightness(void)
35 GVariant *reply = NULL;
39 ret_dbus = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME,
41 DEVICED_INTERFACE_LED,
42 METHOD_GET_BRIGHTNESS,
48 if (!g_variant_get_safe(reply, "(i)", &reply_val)) {
49 _E("Failed to get signature(%s): no message", g_variant_get_type_string(reply));
53 g_variant_unref(reply);
58 API int led_get_max_brightness(void)
60 GVariant *reply = NULL;
61 int reply_val, ret_dbus;
63 ret_dbus = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME,
65 DEVICED_INTERFACE_LED,
66 METHOD_GET_MAX_BRIGHTNESS,
72 if (!g_variant_get_safe(reply, "(i)", &reply_val)) {
73 _E("Failed to get signature(%s): no message", g_variant_get_type_string(reply));
77 g_variant_unref(reply);
82 API int led_set_brightness_with_noti(int val, bool enable)
84 GVariant *reply = NULL;
85 int reply_val, ret_dbus;
87 ret_dbus = dbus_handle_method_sync_with_reply_var(DEVICED_BUS_NAME,
89 DEVICED_INTERFACE_LED,
90 METHOD_SET_BRIGHTNESS,
91 g_variant_new("(ii)", val, enable),
96 if (!g_variant_get_safe(reply, "(i)", &reply_val)) {
97 _E("Failed to get signature(%s): no message", g_variant_get_type_string(reply));
101 g_variant_unref(reply);