From 9957a7fc96db43dc2602fbd6202ee3bd809940dd Mon Sep 17 00:00:00 2001 From: Yang YongHyun Date: Thu, 23 Aug 2012 10:21:00 +0900 Subject: [PATCH] [Version] 0.0.1 [Project] Tizen 2.0 [Title] Commit runtime-info(0.0.1) pkg to tizen 2.0 (migration from private to RSA public) [BinType] PDA [Customer] Public/Open/... [Issue#] N/A [Problem] Open Tizen 2.0 [Cause] Open Tizen 2.0 [Solution] Commit runtime-info(0.0.1) pkg to tizen 2.0 (migration from private to RSA public) [Team] Kernel&SystemFW [Developer] alex.yang [Request] N/A [Horizontal expansion] N/A [SCMRequest] N/A --- debian/changelog | 60 +++++++- include/runtime_info.h | 17 +++ include/runtime_info_private.h | 29 +++- packaging/capi-system-runtime-info.spec | 2 +- src/runtime_info.c | 63 +++++++- src/runtime_info_connectivity.c | 40 ++--- src/runtime_info_locale.c | 16 +- src/runtime_info_location.c | 16 +- src/runtime_info_system.c | 257 ++++++++++++++++++++++++++++++-- src/runtime_info_vconf.c | 84 ++++++++++- 10 files changed, 523 insertions(+), 61 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4b947eb..7bbf9c8 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,47 @@ +capi-system-runtime-info (0.0.1-9) unstable; urgency=low + + * Applying vconf-key changes + * Git: slp/api/runtime-info + * Tag: capi-system-runtime-info_0.0.1-9 + + -- Junghyuk Park Wen, 13 Jun 2012 16:32:44 +0900 + +capi-system-runtime-info (0.0.1-8) unstable; urgency=low + + * Added charger connection feature + * Git: slp/api/runtime-info + * Tag: capi-system-runtime-info_0.0.1-8 + + -- Jinkun Jang Mon, 11 Jun 2012 13:32:44 +0900 + +capi-system-runtime-info (0.0.1-7) unstable; urgency=low + + * Added haptic vibration level + * Git: slp/api/runtime-info + * Tag: capi-system-runtime-info_0.0.1-7 + + -- Junghyuk Park Thu, 10 May 2012 21:27:44 +0900 + +capi-system-runtime-info (0.0.1-6) unstable; urgency=low + + * Added usb connection feature + * Git: slp/api/runtime-info + * Tag: capi-system-runtime-info_0.0.1-6 + + -- Jinkun Jang Tue, 08 May 2012 17:04:41 +0900 + +capi-system-runtime-info (0.0.1-5) unstable; urgency=low + + * Added tv-out, audio-jack and sliding keboard features + * Git: slp/api/runtime-info + * Tag: capi-system-runtime-info_0.0.1-5 + + -- Junghyuk Park Thu, 26 Apr 2012 20:51:41 +0900 + capi-system-runtime-info (0.0.1-4) unstable; urgency=low * Updated build configuration - * Git: api/runtime-info + * Git: slp/api/runtime-info * Tag: capi-system-runtime-info_0.0.1-4 -- Junghyuk Park Thu, 15 Mar 2012 11:43:57 +0900 @@ -9,13 +49,25 @@ capi-system-runtime-info (0.0.1-4) unstable; urgency=low capi-system-runtime-info (0.0.1-3) unstable; urgency=low * Added version numbering - * Git: api/runtime-info + * Git: slp/api/runtime-info * Tag: capi-system-runtime-info_0.0.1-3 -- Junghyuk Park Wed, 15 Feb 2012 10:51:38 +0900 capi-system-runtime-info (0.0.1-2) unstable; urgency=low - * Initial release. + * Code refactoring + * Git: slp/api/runtime-info + * Tag: capi-system-runtime-info_0.0.1-2 + + -- Junghyuk Park Sat, 10 Dec 2011 17:09:25 +0900 + +capi-system-runtime-info (0.0.1-1) unstable; urgency=low + + * Initial upload + * Git: slp-source.sec.samsung.net:slp/api/runtime-info + * Tag: capi-system-runtime-info_0.0.1-1 + + -- Junghyuk Park Tue, 06 Dec 2011 21:16:07 +0900 + - -- Junghyuk Park Thu, 08 Dec 2011 08:40:35 +0900 diff --git a/include/runtime_info.h b/include/runtime_info.h index 50c2f23..a1b43ad 100755 --- a/include/runtime_info.h +++ b/include/runtime_info.h @@ -67,6 +67,12 @@ typedef enum RUNTIME_INFO_KEY_AUDIO_JACK_CONNECTED, /**data_type, ¤t_value); if (runtime_info_item->event_subscription->most_recent_value != NULL) @@ -524,7 +585,7 @@ void runtime_info_updated(runtime_info_key_e key) } else { - runtime_info_item->event_subscription->most_recent_value = malloc(sizeof(runtime_info_value_u)); + runtime_info_item->event_subscription->most_recent_value = calloc(1, sizeof(runtime_info_value_u)); if (runtime_info_item->event_subscription->most_recent_value == NULL) { diff --git a/src/runtime_info_connectivity.c b/src/runtime_info_connectivity.c index 347c754..d474428 100755 --- a/src/runtime_info_connectivity.c +++ b/src/runtime_info_connectivity.c @@ -37,7 +37,7 @@ static const char *VCONF_BT_HOTSPOT_ENABLED = VCONFKEY_MOBILE_HOTSPOT_MODE; static const char *VCONF_USB_HOTSPOT_ENABLED = VCONFKEY_MOBILE_HOTSPOT_MODE; static const char *VCONF_PACKET_DATA_ENABLED = VCONFKEY_3G_ENABLE; static const char *VCONF_DATA_ROAMING_ENABLED = "db/setting/data_roaming"; -static const char *VCONF_GPS_STATUS = VCONFKEY_GPS_STATE; +static const char *VCONF_GPS_STATUS = VCONFKEY_LOCATION_GPS_STATE; int runtime_info_wifi_status_get_value(runtime_info_value_h value) { @@ -72,12 +72,12 @@ int runtime_info_wifi_status_get_value(runtime_info_value_h value) int runtime_info_wifi_status_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_WIFI_STATUS, RUNTIME_INFO_KEY_WIFI_STATUS); + return runtime_info_vconf_set_event_cb(VCONF_WIFI_STATUS, RUNTIME_INFO_KEY_WIFI_STATUS, 0); } void runtime_info_wifi_status_unset_event_cb () { - runtime_info_vconf_unset_event_cb(VCONF_WIFI_STATUS); + runtime_info_vconf_unset_event_cb(VCONF_WIFI_STATUS, 0); } int runtime_info_bt_enabled_get_value(runtime_info_value_h value) @@ -110,12 +110,12 @@ int runtime_info_bt_enabled_get_value(runtime_info_value_h value) int runtime_info_bt_enabled_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_BT_ENABLED, RUNTIME_INFO_KEY_BLUETOOTH_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_BT_ENABLED, RUNTIME_INFO_KEY_BLUETOOTH_ENABLED, 0); } void runtime_info_bt_enabled_unset_event_cb () { - runtime_info_vconf_unset_event_cb(VCONF_BT_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_BT_ENABLED, 0); } @@ -135,12 +135,12 @@ int runtime_info_wifi_hotspot_get_value(runtime_info_value_h value) int runtime_info_wifi_hotspot_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_WIFI_HOTSPOT_ENABLED, RUNTIME_INFO_KEY_WIFI_HOTSPOT_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_WIFI_HOTSPOT_ENABLED, RUNTIME_INFO_KEY_WIFI_HOTSPOT_ENABLED, 0); } void runtime_info_wifi_hotspot_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_WIFI_HOTSPOT_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_WIFI_HOTSPOT_ENABLED, 0); } int runtime_info_bt_hotspot_get_value(runtime_info_value_h value) @@ -159,12 +159,12 @@ int runtime_info_bt_hotspot_get_value(runtime_info_value_h value) int runtime_info_bt_hotspot_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_BT_HOTSPOT_ENABLED, RUNTIME_INFO_KEY_BLUETOOTH_TETHERING_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_BT_HOTSPOT_ENABLED, RUNTIME_INFO_KEY_BLUETOOTH_TETHERING_ENABLED, 0); } void runtime_info_bt_hotspot_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_BT_HOTSPOT_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_BT_HOTSPOT_ENABLED, 0); } int runtime_info_usb_hotspot_get_value(runtime_info_value_h value) @@ -183,12 +183,12 @@ int runtime_info_usb_hotspot_get_value(runtime_info_value_h value) int runtime_info_usb_hotspot_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_USB_HOTSPOT_ENABLED, RUNTIME_INFO_KEY_USB_TETHERING_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_USB_HOTSPOT_ENABLED, RUNTIME_INFO_KEY_USB_TETHERING_ENABLED, 0); } void runtime_info_usb_hotspot_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_USB_HOTSPOT_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_USB_HOTSPOT_ENABLED, 0); } int runtime_info_packet_data_get_value(runtime_info_value_h value) @@ -207,12 +207,12 @@ int runtime_info_packet_data_get_value(runtime_info_value_h value) int runtime_info_packet_data_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_PACKET_DATA_ENABLED, RUNTIME_INFO_KEY_PACKET_DATA_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_PACKET_DATA_ENABLED, RUNTIME_INFO_KEY_PACKET_DATA_ENABLED, 0); } void runtime_info_packet_data_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_PACKET_DATA_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_PACKET_DATA_ENABLED, 0); } int runtime_info_data_roaming_get_value(runtime_info_value_h value) @@ -231,12 +231,12 @@ int runtime_info_data_roaming_get_value(runtime_info_value_h value) int runtime_info_data_roaming_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_DATA_ROAMING_ENABLED, RUNTIME_INFO_KEY_DATA_ROAMING_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_DATA_ROAMING_ENABLED, RUNTIME_INFO_KEY_DATA_ROAMING_ENABLED, 0); } void runtime_info_data_roaming_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_DATA_ROAMING_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_DATA_ROAMING_ENABLED, 0); } int runtime_info_gps_status_get_value(runtime_info_value_h value) @@ -250,15 +250,15 @@ int runtime_info_gps_status_get_value(runtime_info_value_h value) switch (vconf_value) { - case VCONFKEY_GPS_OFF: + case VCONFKEY_LOCATION_GPS_OFF: value->i = RUNTIME_INFO_GPS_STATUS_DISABLED; break; - case VCONFKEY_GPS_SEARCHING: + case VCONFKEY_LOCATION_GPS_SEARCHING: value->i = RUNTIME_INFO_GPS_STATUS_SEARCHING; break; - case VCONFKEY_GPS_CONNECTED: + case VCONFKEY_LOCATION_GPS_CONNECTED: value->i = RUNTIME_INFO_GPS_STATUS_CONNECTED; break; @@ -271,11 +271,11 @@ int runtime_info_gps_status_get_value(runtime_info_value_h value) int runtime_info_gps_status_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_GPS_STATUS, RUNTIME_INFO_KEY_GPS_STATUS); + return runtime_info_vconf_set_event_cb(VCONF_GPS_STATUS, RUNTIME_INFO_KEY_GPS_STATUS, 0); } void runtime_info_gps_status_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_GPS_STATUS); + runtime_info_vconf_unset_event_cb(VCONF_GPS_STATUS, 0); } diff --git a/src/runtime_info_locale.c b/src/runtime_info_locale.c index 05332ea..e2bc74e 100755 --- a/src/runtime_info_locale.c +++ b/src/runtime_info_locale.c @@ -63,12 +63,12 @@ int runtime_info_24hour_format_get_value(runtime_info_value_h value) int runtime_info_24hour_format_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_24HOUR_FORMAT, RUNTIME_INFO_KEY_24HOUR_CLOCK_FORMAT_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_24HOUR_FORMAT, RUNTIME_INFO_KEY_24HOUR_CLOCK_FORMAT_ENABLED, 0); } void runtime_info_24hour_format_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_24HOUR_FORMAT); + runtime_info_vconf_unset_event_cb(VCONF_24HOUR_FORMAT, 0); } int runtime_info_first_day_of_week_get_value(runtime_info_value_h value) @@ -119,12 +119,12 @@ int runtime_info_first_day_of_week_get_value(runtime_info_value_h value) int runtime_info_first_day_of_week_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_FIRST_DAY_OF_WEEK, RUNTIME_INFO_KEY_FIRST_DAY_OF_WEEK); + return runtime_info_vconf_set_event_cb(VCONF_FIRST_DAY_OF_WEEK, RUNTIME_INFO_KEY_FIRST_DAY_OF_WEEK, 0); } void runtime_info_first_day_of_week_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_FIRST_DAY_OF_WEEK); + runtime_info_vconf_unset_event_cb(VCONF_FIRST_DAY_OF_WEEK, 0); } int runtime_info_language_get_value(runtime_info_value_h value) @@ -143,12 +143,12 @@ int runtime_info_language_get_value(runtime_info_value_h value) int runtime_info_language_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_LANGUAGE, RUNTIME_INFO_KEY_LANGUAGE); + return runtime_info_vconf_set_event_cb(VCONF_LANGUAGE, RUNTIME_INFO_KEY_LANGUAGE, 0); } void runtime_info_language_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_LANGUAGE); + runtime_info_vconf_unset_event_cb(VCONF_LANGUAGE, 0); } int runtime_info_region_get_value(runtime_info_value_h value) @@ -167,11 +167,11 @@ int runtime_info_region_get_value(runtime_info_value_h value) int runtime_info_region_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_REGION, RUNTIME_INFO_KEY_REGION); + return runtime_info_vconf_set_event_cb(VCONF_REGION, RUNTIME_INFO_KEY_REGION, 0); } void runtime_info_region_unset_event_cb () { - runtime_info_vconf_unset_event_cb(VCONF_REGION); + runtime_info_vconf_unset_event_cb(VCONF_REGION, 0); } diff --git a/src/runtime_info_location.c b/src/runtime_info_location.c index bde1b4d..458928f 100755 --- a/src/runtime_info_location.c +++ b/src/runtime_info_location.c @@ -51,12 +51,12 @@ int runtime_info_location_service_get_value(runtime_info_value_h value) int runtime_info_location_service_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_LOCATION_SERVICE_ENABLED, RUNTIME_INFO_KEY_LOCATION_SERVICE_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_LOCATION_SERVICE_ENABLED, RUNTIME_INFO_KEY_LOCATION_SERVICE_ENABLED, 0); } void runtime_info_location_service_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_LOCATION_SERVICE_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_LOCATION_SERVICE_ENABLED, 0); } int runtime_info_location_agps_get_value(runtime_info_value_h value) @@ -75,12 +75,12 @@ int runtime_info_location_agps_get_value(runtime_info_value_h value) int runtime_info_location_agps_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_LOCATION_AGPS_ENABLED, RUNTIME_INFO_KEY_LOCATION_ADVANCED_GPS_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_LOCATION_AGPS_ENABLED, RUNTIME_INFO_KEY_LOCATION_ADVANCED_GPS_ENABLED, 0); } void runtime_info_location_agps_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_LOCATION_AGPS_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_LOCATION_AGPS_ENABLED, 0); } int runtime_info_location_network_get_value(runtime_info_value_h value) @@ -99,12 +99,12 @@ int runtime_info_location_network_get_value(runtime_info_value_h value) int runtime_info_location_network_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_LOCATION_NETWORK_ENABLED, RUNTIME_INFO_KEY_LOCATION_NETWORK_POSITION_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_LOCATION_NETWORK_ENABLED, RUNTIME_INFO_KEY_LOCATION_NETWORK_POSITION_ENABLED, 0); } void runtime_info_location_network_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_LOCATION_NETWORK_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_LOCATION_NETWORK_ENABLED, 0); } int runtime_info_location_sensor_get_value(runtime_info_value_h value) @@ -123,11 +123,11 @@ int runtime_info_location_sensor_get_value(runtime_info_value_h value) int runtime_info_location_sensor_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_LOCATION_SENSOR_ENABLED, RUNTIME_INFO_KEY_LOCATION_SENSOR_AIDING_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_LOCATION_SENSOR_ENABLED, RUNTIME_INFO_KEY_LOCATION_SENSOR_AIDING_ENABLED, 0); } void runtime_info_location_sensor_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_LOCATION_SENSOR_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_LOCATION_SENSOR_ENABLED, 0); } diff --git a/src/runtime_info_system.c b/src/runtime_info_system.c index 463bdaa..1595e3f 100755 --- a/src/runtime_info_system.c +++ b/src/runtime_info_system.c @@ -36,6 +36,11 @@ static const char *VCONF_SILENT_MODE = "db/setting/sound/sound_on"; static const char *VCONF_VIBRATION_ENABLED = "db/setting/sound/vibration_on"; static const char *VCONF_ROTATION_LOCK_ENABLED = VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL; static const char *VCONF_BATTERY_CHARGING = VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW; +static const char *VCONF_TVOUT_CONNECTED = VCONFKEY_SYSMAN_EARJACK; +static const char *VCONF_AUDIO_JACK_STATUS = VCONFKEY_SYSMAN_EARJACK; +static const char *VCONF_SLIDING_KEYBOARD_STATUS = VCONFKEY_SYSMAN_SLIDING_KEYBOARD; +static const char *VCONF_USB_CONNECTED = VCONFKEY_SYSMAN_USB_STATUS; +static const char *VCONF_CHARGER_CONNECTED = VCONFKEY_SYSMAN_CHARGER_STATUS; int runtime_info_flightmode_get_value(runtime_info_value_h value) @@ -54,12 +59,12 @@ int runtime_info_flightmode_get_value(runtime_info_value_h value) int runtime_info_flightmode_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_FLIGHT_MODE, RUNTIME_INFO_KEY_FLIGHT_MODE_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_FLIGHT_MODE, RUNTIME_INFO_KEY_FLIGHT_MODE_ENABLED, 0); } void runtime_info_flightmode_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_FLIGHT_MODE); + runtime_info_vconf_unset_event_cb(VCONF_FLIGHT_MODE, 0); } int runtime_info_audiojack_get_value (runtime_info_value_h value) @@ -88,12 +93,12 @@ int runtime_info_audiojack_get_value (runtime_info_value_h value) int runtime_info_audiojack_set_event_cb () { - return runtime_info_vconf_set_event_cb(VCONF_AUDIO_JACK, RUNTIME_INFO_KEY_AUDIO_JACK_CONNECTED); + return runtime_info_vconf_set_event_cb(VCONF_AUDIO_JACK, RUNTIME_INFO_KEY_AUDIO_JACK_CONNECTED, 0); } void runtime_info_audiojack_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_AUDIO_JACK); + runtime_info_vconf_unset_event_cb(VCONF_AUDIO_JACK, 0); } int runtime_info_silent_mode_get_value(runtime_info_value_h value) @@ -112,12 +117,12 @@ int runtime_info_silent_mode_get_value(runtime_info_value_h value) int runtime_info_silent_mode_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_SILENT_MODE, RUNTIME_INFO_KEY_SILENT_MODE_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_SILENT_MODE, RUNTIME_INFO_KEY_SILENT_MODE_ENABLED, 0); } void runtime_info_silent_mode_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_SILENT_MODE); + runtime_info_vconf_unset_event_cb(VCONF_SILENT_MODE, 0); } int runtime_info_vibration_enabled_get_value(runtime_info_value_h value) @@ -136,12 +141,12 @@ int runtime_info_vibration_enabled_get_value(runtime_info_value_h value) int runtime_info_vibration_enabled_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_VIBRATION_ENABLED, RUNTIME_INFO_KEY_VIBRATION_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_VIBRATION_ENABLED, RUNTIME_INFO_KEY_VIBRATION_ENABLED, 0); } void runtime_info_vibration_enabled_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_VIBRATION_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_VIBRATION_ENABLED, 0); } int runtime_info_rotation_lock_enabled_get_value(runtime_info_value_h value) @@ -160,12 +165,12 @@ int runtime_info_rotation_lock_enabled_get_value(runtime_info_value_h value) int runtime_info_rotation_lock_enabled_set_event_cb() { - return runtime_info_vconf_set_event_cb(VCONF_ROTATION_LOCK_ENABLED, RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED); + return runtime_info_vconf_set_event_cb(VCONF_ROTATION_LOCK_ENABLED, RUNTIME_INFO_KEY_ROTATION_LOCK_ENABLED, 0); } void runtime_info_rotation_lock_enabled_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_ROTATION_LOCK_ENABLED); + runtime_info_vconf_unset_event_cb(VCONF_ROTATION_LOCK_ENABLED, 0); } int runtime_info_battery_charging_get_value (runtime_info_value_h value) @@ -184,11 +189,239 @@ int runtime_info_battery_charging_get_value (runtime_info_value_h value) int runtime_info_battery_charging_set_event_cb () { - return runtime_info_vconf_set_event_cb(VCONF_BATTERY_CHARGING, RUNTIME_INFO_KEY_BATTERY_IS_CHARGING); + return runtime_info_vconf_set_event_cb(VCONF_BATTERY_CHARGING, RUNTIME_INFO_KEY_BATTERY_IS_CHARGING, 0); } void runtime_info_battery_charging_unset_event_cb() { - runtime_info_vconf_unset_event_cb(VCONF_BATTERY_CHARGING); + runtime_info_vconf_unset_event_cb(VCONF_BATTERY_CHARGING, 0); } + +int runtime_info_tvout_connected_get_value (runtime_info_value_h value) +{ + int vconf_value; + + if (runtime_info_vconf_get_value_int(VCONF_TVOUT_CONNECTED, &vconf_value)) + { + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + switch (vconf_value) + { + case VCONFKEY_SYSMAN_EARJACK_TVOUT: + value->b = true; + break; + + default: + value->b = false; + break; + } + + return RUNTIME_INFO_ERROR_NONE; +} + +int runtime_info_tvout_connected_set_event_cb () +{ + return runtime_info_vconf_set_event_cb(VCONF_TVOUT_CONNECTED, RUNTIME_INFO_KEY_TV_OUT_CONNECTED, 1); +} + +void runtime_info_tvout_connected_unset_event_cb() +{ + runtime_info_vconf_unset_event_cb(VCONF_TVOUT_CONNECTED, 1); +} + + +int runtime_info_audio_jack_status_get_value (runtime_info_value_h value) +{ + int vconf_value; + + if (runtime_info_vconf_get_value_int(VCONF_AUDIO_JACK_STATUS, &vconf_value)) + { + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + switch (vconf_value) + { + case VCONFKEY_SYSMAN_EARJACK_3WIRE: + value->i = RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_3WIRE; + break; + + case VCONFKEY_SYSMAN_EARJACK_4WIRE: + value->i = RUNTIME_INFO_AUDIO_JACK_STATUS_CONNECTED_4WIRE; + break; + + default: + value->i = RUNTIME_INFO_AUDIO_JACK_STATUS_UNCONNECTED; + break; + } + + return RUNTIME_INFO_ERROR_NONE; +} + +int runtime_info_audio_jack_status_set_event_cb () +{ + return runtime_info_vconf_set_event_cb(VCONF_AUDIO_JACK_STATUS, RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, 2); +} + +void runtime_info_audio_jack_status_unset_event_cb() +{ + runtime_info_vconf_unset_event_cb(VCONF_AUDIO_JACK_STATUS, 2); +} + + +int runtime_info_sliding_keyboard_opened_get_value (runtime_info_value_h value) +{ + int vconf_value; + + if (runtime_info_vconf_get_value_int(VCONF_SLIDING_KEYBOARD_STATUS, &vconf_value)) + { + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + switch (vconf_value) + { + case VCONFKEY_SYSMAN_SLIDING_KEYBOARD_NOT_AVAILABE: + value->b = false; + break; + + case VCONFKEY_SYSMAN_SLIDING_KEYBOAED_AVAILABLE: + value->b = true; + break; + + case VCONFKEY_SYSMAN_SLIDING_KEYBOARD_NOT_SUPPORTED: + value->b = false; + break; + + default: + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + return RUNTIME_INFO_ERROR_NONE; +} + +int runtime_info_sliding_keyboard_opened_set_event_cb () +{ + return runtime_info_vconf_set_event_cb(VCONF_SLIDING_KEYBOARD_STATUS, RUNTIME_INFO_KEY_SLIDING_KEYBOARD_OPENED, 0); +} + +void runtime_info_sliding_keyboard_opened_unset_event_cb() +{ + runtime_info_vconf_unset_event_cb(VCONF_SLIDING_KEYBOARD_STATUS, 0); +} + + +int runtime_info_usb_connected_get_value(runtime_info_value_h value) +{ + int vconf_value; + + if (runtime_info_vconf_get_value_int(VCONF_USB_CONNECTED, &vconf_value)) + { + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + switch (vconf_value) + { + case VCONFKEY_SYSMAN_USB_DISCONNECTED: + value->b = false; + break; + + case VCONFKEY_SYSMAN_USB_CONNECTED: + value->b = false; + break; + + case VCONFKEY_SYSMAN_USB_AVAILABLE: + value->b = true; + break; + + default: + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + return RUNTIME_INFO_ERROR_NONE; +} + +int runtime_info_usb_connected_set_event_cb() +{ + return runtime_info_vconf_set_event_cb(VCONF_USB_CONNECTED, RUNTIME_INFO_KEY_USB_CONNECTED, 0); +} + +void runtime_info_usb_connected_unset_event_cb() +{ + runtime_info_vconf_unset_event_cb(VCONF_USB_CONNECTED, 0); +} + +int runtime_info_charger_connected_get_value(runtime_info_value_h value) +{ + int vconf_value; + + if (runtime_info_vconf_get_value_int(VCONF_CHARGER_CONNECTED, &vconf_value)) + { + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + switch (vconf_value) + { + case VCONFKEY_SYSMAN_CHARGER_DISCONNECTED: + value->b = false; + break; + + case VCONFKEY_SYSMAN_CHARGER_CONNECTED: + value->b = true; + break; + + default: + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + return RUNTIME_INFO_ERROR_NONE; +} + +int runtime_info_charger_connected_set_event_cb() +{ + return runtime_info_vconf_set_event_cb(VCONF_CHARGER_CONNECTED, RUNTIME_INFO_KEY_CHARGER_CONNECTED, 0); +} + +void runtime_info_charger_connected_unset_event_cb() +{ + runtime_info_vconf_unset_event_cb(VCONF_CHARGER_CONNECTED, 0); +} + + +int runtime_info_vibration_level_haptic_feedback_get_value (runtime_info_value_h value) +{ + int vconf_value; + + if (runtime_info_vconf_get_value_int(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, &vconf_value)) + { + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + switch (vconf_value) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + value->i = vconf_value; + break; + default: + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + return RUNTIME_INFO_ERROR_NONE; +} + +int runtime_info_vibration_level_haptic_feedback_set_event_cb () +{ + return runtime_info_vconf_set_event_cb(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, RUNTIME_INFO_KEY_VIBRATION_LEVEL_HAPTIC_FEEDBACK, 0); +} + +void runtime_info_vibration_level_haptic_feedback_unset_event_cb() +{ + runtime_info_vconf_unset_event_cb(VCONFKEY_SETAPPL_TOUCH_FEEDBACK_VIBRATION_LEVEL_INT, 0); +} + + diff --git a/src/runtime_info_vconf.c b/src/runtime_info_vconf.c index a1a72d5..6caea0b 100755 --- a/src/runtime_info_vconf.c +++ b/src/runtime_info_vconf.c @@ -62,7 +62,9 @@ int runtime_info_vconf_get_value_string(const char *vconf_key, char **value) } } -static void runtime_info_vconf_event_broker(keynode_t *node, void *event_data) +typedef void (*runtime_info_vconf_event_cb)(keynode_t *node, void *event_data); + +static void runtime_info_vconf_event_cb0(keynode_t *node, void *event_data) { if (node != NULL) { @@ -70,9 +72,74 @@ static void runtime_info_vconf_event_broker(keynode_t *node, void *event_data) } } -int runtime_info_vconf_set_event_cb (const char *vconf_key, runtime_info_key_e runtime_info_key) +static void runtime_info_vconf_event_cb1(keynode_t *node, void *event_data) { - if (vconf_notify_key_changed(vconf_key, runtime_info_vconf_event_broker, (void*)runtime_info_key)) + if (node != NULL) + { + runtime_info_updated((runtime_info_key_e)event_data); + } +} + +static void runtime_info_vconf_event_cb2(keynode_t *node, void *event_data) +{ + if (node != NULL) + { + runtime_info_updated((runtime_info_key_e)event_data); + } +} + +static void runtime_info_vconf_event_cb3(keynode_t *node, void *event_data) +{ + if (node != NULL) + { + runtime_info_updated((runtime_info_key_e)event_data); + } +} + +static void runtime_info_vconf_event_cb4(keynode_t *node, void *event_data) +{ + if (node != NULL) + { + runtime_info_updated((runtime_info_key_e)event_data); + } +} + +static runtime_info_vconf_event_cb runtime_info_vconf_get_event_cb_slot(int slot) +{ + switch (slot) + { + case 0: + return runtime_info_vconf_event_cb0; + + case 1: + return runtime_info_vconf_event_cb1; + + case 2: + return runtime_info_vconf_event_cb2; + + case 3: + return runtime_info_vconf_event_cb3; + + case 4: + return runtime_info_vconf_event_cb4; + + default: + return NULL; + } +} + +int runtime_info_vconf_set_event_cb (const char *vconf_key, runtime_info_key_e runtime_info_key, int slot) +{ + runtime_info_vconf_event_cb vconf_event_cb; + + vconf_event_cb = runtime_info_vconf_get_event_cb_slot(slot); + + if (vconf_event_cb == NULL) + { + return RUNTIME_INFO_ERROR_IO_ERROR; + } + + if (vconf_notify_key_changed(vconf_key, vconf_event_cb, (void*)runtime_info_key)) { return RUNTIME_INFO_ERROR_IO_ERROR; } @@ -80,8 +147,15 @@ int runtime_info_vconf_set_event_cb (const char *vconf_key, runtime_info_key_e r return RUNTIME_INFO_ERROR_NONE; } -void runtime_info_vconf_unset_event_cb (const char *vconf_key) +void runtime_info_vconf_unset_event_cb (const char *vconf_key, int slot) { - vconf_ignore_key_changed(vconf_key, runtime_info_vconf_event_broker); + runtime_info_vconf_event_cb vconf_event_cb; + + vconf_event_cb = runtime_info_vconf_get_event_cb_slot(slot); + + if (vconf_event_cb != NULL) + { + vconf_ignore_key_changed(vconf_key, vconf_event_cb); + } } -- 2.7.4