void BatteryProviderEfl::timerFired(Timer<BatteryProviderEfl>* timer) { ASSERT_UNUSED(timer, timer == &m_timer); E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM); if (edbusConnection) e_upower_get_all_devices(edbusConnection, getBatteryStatus, static_cast<void*>(this)); }
EAPI void * e_modapi_init (E_Module * m) { char buf[4096]; snprintf (buf, sizeof (buf), "%s/locale", e_module_dir_get (m)); bindtextdomain (PACKAGE, buf); bind_textdomain_codeset (PACKAGE, "UTF-8"); conf_item_edd = E_CONFIG_DD_NEW ("Empris_Config_Item", Config_Item); #undef T #undef D #define T Config_Item #define D conf_item_edd E_CONFIG_VAL (D, T, id, STR); E_CONFIG_VAL (D, T, player, STR); E_CONFIG_VAL (D, T, show_popup, UCHAR); conf_edd = E_CONFIG_DD_NEW ("Empris_Config", Config); #undef T #undef D #define T Config #define D conf_edd E_CONFIG_LIST (D, T, items, conf_item_edd); empris_config = e_config_domain_load ("module.empris", conf_edd); if (!empris_config) { Config_Item *ci; empris_config = E_NEW (Config, 1); ci = E_NEW (Config_Item, 1); ci->id = eina_stringshare_add ("0"); ci->player = eina_stringshare_add (""); ci->show_popup = 1; empris_config->items = eina_list_append (empris_config->items, ci); } empris_config->module = m; conn = e_dbus_bus_get(DBUS_BUS_SESSION); if (!conn) return NULL; cb_name_owner_changed = e_dbus_signal_handler_add (conn, fdo_bus_name, fdo_path, fdo_interface, "NameOwnerChanged", _dbus_cb_name_owner_changed, NULL); e_dbus_list_names(conn, _dbus_cb_list_names, NULL); e_gadcon_provider_register (&_gc_class); e_module_delayed_set(m, 1); return m; }
int _battery_fso_start(void) { conn = e_dbus_bus_get(DBUS_BUS_SYSTEM); if (!conn) return 0; /* Initiate the battery gadget */ Battery *bat; const char *udi = "FSO"; bat = _battery_battery_find( udi ); if (!bat) { bat = E_NEW(Battery, 1); if (!bat) return 0; bat->udi = eina_stringshare_add(udi); device_batteries = eina_list_append(device_batteries, bat); } battery = bat; /* Get initial status */ _battery_fso_get_capacity( bat ); _battery_fso_get_powerstatus( bat ); /* Add signal listeners for PowerSupply.Capacity and PowerSupply.PowerStatus */ if( conn ) { nameowner_handler = e_dbus_signal_handler_add(conn, "org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", _battery_fso_on_nameowner_change, bat); capacity_handler = e_dbus_signal_handler_add( conn, "org.freesmartphone.odeviced", "/org/freesmartphone/Device/PowerSupply", "org.freesmartphone.Device.PowerSupply", "Capacity", _battery_fso_on_capacity_change, bat ); powerstatus_handler = e_dbus_signal_handler_add( conn, "org.freesmartphone.odeviced", "/org/freesmartphone/Device/PowerSupply", "org.freesmartphone.Device.PowerSupply", "PowerStatus", _battery_fso_on_powerstatus_change, bat ); } init_time = ecore_time_get(); return 1; }
void BatteryProviderEfl::getBatteryStatus(void* data, void* replyData, DBusError* dBusError) { E_Ukit_Get_All_Devices_Return* eukitDeviceNames = static_cast<E_Ukit_Get_All_Devices_Return*>(replyData); if (!eukitDeviceNames || !eukitDeviceNames->strings || dbus_error_is_set(dBusError)) { dbus_error_free(dBusError); return; } E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM); Eina_List* list; void* deviceName; EINA_LIST_FOREACH(eukitDeviceNames->strings, list, deviceName) e_upower_get_all_properties(edbusConnection, static_cast<char*>(deviceName), setBatteryClient, data); }
EAPI int e_notification_init(void) { if (init_count) return ++init_count; if (!e_dbus_init()) return 0; client_conn = e_dbus_bus_get(DBUS_BUS_SESSION); if (!client_conn) { e_dbus_shutdown(); return 0; } return ++init_count; }
EAPI int elm_main(int argc, char **argv) { e_dbus_init(); if (!_args_init(argc, argv)) { fprintf(stderr, "Cannot parse arguments, exiting.\n"); return 1; } e->conn = e_dbus_bus_get(DBUS_BUS_SESSION); _message(e->conn,"Config_Get",NULL); ewallset_main(); elm_run(); elm_shutdown(); return 0; }
int main(__UNUSED__ int argc, __UNUSED__ char *argv[]) { E_DBus_Connection *c; int total; ecore_init(); e_dbus_init(); eina_init(); c = e_dbus_bus_get(DBUS_BUS_SYSTEM); if (!c) { printf("ERROR: can't connect to system session\n"); return -1; } e_connman_system_init(c); ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_ADD, _on_element_add, NULL); ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_DEL, _on_element_del, NULL); ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_UPDATED, _on_element_updated, NULL); _exiter_reschedule(); ecore_main_loop_begin(); e_dbus_connection_close(c); eina_stringshare_dump(); eina_shutdown(); e_dbus_shutdown(); ecore_shutdown(); total = success + failure; if (total == 0) fputs("DBG: clean exit, no tests executed.\n", stderr); else fprintf(stderr, "DBG: clean exit, success: %d, failure: %d, %d%%\n", success, failure, (success * 100) / total); return 0; }
int main(__UNUSED__ int argc,__UNUSED__ char *argv[]) { ecore_init(); e_dbus_init(); eina_init(); _msgbus_data = calloc(1, sizeof(E_Msgbus_Data)); _msgbus_data->conn = e_dbus_bus_get(DBUS_BUS_SYSTEM); if (!_msgbus_data->conn) { printf("ERROR: can't connect to system session\n"); return -1; } e_bluez_system_init(_msgbus_data->conn); ecore_event_handler_add(E_BLUEZ_EVENT_ELEMENT_ADD, _on_element_add, NULL); ecore_event_handler_add(E_BLUEZ_EVENT_ELEMENT_DEL, _on_element_del, NULL); ecore_event_handler_add(E_BLUEZ_EVENT_ELEMENT_UPDATED, _on_element_updated, NULL); ecore_event_handler_add(E_BLUEZ_EVENT_DEVICE_FOUND, _on_device_found, NULL); ecore_main_fd_handler_add (0, ECORE_FD_READ | ECORE_FD_ERROR, _on_input, NULL, NULL, NULL); ecore_main_loop_begin(); e_bluez_system_shutdown(); e_dbus_connection_close(_msgbus_data->conn); eina_shutdown(); e_dbus_shutdown(); ecore_shutdown(); fputs("DBG: clean exit.\n", stderr); return 0; }
int _battery_dbus_start(void) { e_dbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM); if (!e_dbus_conn) return 0; // FIXME: e_dbus doesn't allow us to track this pending call e_hal_manager_find_device_by_capability (e_dbus_conn, "battery", _battery_dbus_find_battery, NULL); e_hal_manager_find_device_by_capability (e_dbus_conn, "ac_adapter", _battery_dbus_find_ac, NULL); battery_config->dbus.dev_add = e_dbus_signal_handler_add(e_dbus_conn, E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, "DeviceAdded", _battery_dbus_dev_add, NULL); battery_config->dbus.dev_del = e_dbus_signal_handler_add(e_dbus_conn, E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, "DeviceRemoved", _battery_dbus_dev_del, NULL); init_time = ecore_time_get(); return 1; }
void e_mod_kbd_device_init(void) { /* load the 'ignored' keyboard file */ _e_mod_kbd_device_ignore_load(); #ifdef HAVE_EEZE eeze_init(); watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_KEYBOARD, EEZE_UDEV_EVENT_NONE, _e_mod_kbd_device_udev_event, NULL); #else e_dbus_init(); e_hal_init(); /* try to attach to the system dbus */ if (!(_dbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM))) return; /* ask HAL for any input keyboards */ e_hal_manager_find_device_by_capability(_dbus_conn, "input.keyboard", _e_mod_kbd_device_cb_input_kbd, NULL); /* setup dbus signal handlers for when a device gets added/removed/changed */ _dev_add = e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, "DeviceAdded", _e_mod_kbd_device_dbus_add, NULL); _dev_del = e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, "DeviceRemoved", _e_mod_kbd_device_dbus_del, NULL); _dev_chg = e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, E_HAL_MANAGER_PATH, E_HAL_MANAGER_INTERFACE, "NewCapability", _e_mod_kbd_device_dbus_chg, NULL); #endif }
/* externally accessible functions */ EINTERN int e_msgbus_init(void) { E_DBus_Interface *iface; _e_msgbus_data = E_NEW(E_Msgbus_Data, 1); e_dbus_init(); #ifdef HAVE_HAL e_hal_init(); #endif _e_msgbus_data->conn = e_dbus_bus_get(DBUS_BUS_SESSION); if (!_e_msgbus_data->conn) { WRN("Cannot get DBUS_BUS_SESSION"); return 0; } e_dbus_request_name(_e_msgbus_data->conn, "org.enform.wm.service", 0, _e_msgbus_request_name_cb, NULL); _e_msgbus_data->obj = e_dbus_object_add(_e_msgbus_data->conn, "/org/enform/wm/RemoteObject", NULL); iface = e_dbus_interface_new("org.enform.wm.Core"); if (!iface) { WRN("Cannot add org.enform.wm.Core interface"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Hardcore methods */ e_dbus_interface_method_add(iface, "Restart", "", "", _e_msgbus_core_restart_cb); e_dbus_interface_method_add(iface, "Shutdown", "", "", _e_msgbus_core_shutdown_cb); iface = e_dbus_interface_new("org.enform.wm.Module"); if (!iface) { WRN("Cannot add org.enform.wm.Module interface"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Module methods */ e_dbus_interface_method_add(iface, "Load", "s", "", _e_msgbus_module_load_cb); e_dbus_interface_method_add(iface, "Unload", "s", "", _e_msgbus_module_unload_cb); e_dbus_interface_method_add(iface, "Enable", "s", "", _e_msgbus_module_enable_cb); e_dbus_interface_method_add(iface, "Disable", "s", "", _e_msgbus_module_disable_cb); e_dbus_interface_method_add(iface, "List", "", "a(si)", _e_msgbus_module_list_cb); iface = e_dbus_interface_new("org.enform.wm.Profile"); if (!iface) { WRN("Cannot add org.enform.wm.Profile interface"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Profile methods */ e_dbus_interface_method_add(iface, "Set", "s", "", _e_msgbus_profile_set_cb); e_dbus_interface_method_add(iface, "Get", "", "s", _e_msgbus_profile_get_cb); e_dbus_interface_method_add(iface, "List", "", "as", _e_msgbus_profile_list_cb); e_dbus_interface_method_add(iface, "Add", "s", "", _e_msgbus_profile_add_cb); e_dbus_interface_method_add(iface, "Delete", "s", "", _e_msgbus_profile_delete_cb); iface = e_dbus_interface_new("org.enform.wm.Window"); if (!iface) { WRN("Cannot add org.enform.wm.Window interface"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Profile methods */ e_dbus_interface_method_add(iface, "List", "", "a(si)", _e_msgbus_window_list_cb); e_dbus_interface_method_add(iface, "Close", "i", "", _e_msgbus_window_close_cb); e_dbus_interface_method_add(iface, "Kill", "i", "", _e_msgbus_window_kill_cb); e_dbus_interface_method_add(iface, "Focus", "i", "", _e_msgbus_window_focus_cb); e_dbus_interface_method_add(iface, "Iconify", "i", "", _e_msgbus_window_iconify_cb); e_dbus_interface_method_add(iface, "Uniconify", "i", "", _e_msgbus_window_uniconify_cb); e_dbus_interface_method_add(iface, "Maximize", "i", "", _e_msgbus_window_maximize_cb); e_dbus_interface_method_add(iface, "Unmaximize", "i", "", _e_msgbus_window_unmaximize_cb); return 1; }
/* externally accessible functions */ EINTERN int e_msgbus_init(void) { E_DBus_Interface *iface; _e_msgbus_data = E_NEW(E_Msgbus_Data, 1); e_dbus_init(); #ifdef HAVE_HAL e_hal_init(); #endif _e_msgbus_data->conn = e_dbus_bus_get(DBUS_BUS_SESSION); if (!_e_msgbus_data->conn) { printf("WARNING: Cannot get DBUS_BUS_SESSION\n"); return 0; } e_dbus_request_name(_e_msgbus_data->conn, "org.enlightenment.wm.service", 0, _e_msgbus_request_name_cb, NULL); _e_msgbus_data->obj = e_dbus_object_add(_e_msgbus_data->conn, "/org/enlightenment/wm/RemoteObject", NULL); iface = e_dbus_interface_new("org.enlightenment.wm.Core"); if (!iface) { printf("WARNING: Cannot add org.enlightenment.wm.Core interface\n"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Hardcore methods */ e_dbus_interface_method_add(iface, "Restart", "", "", _e_msgbus_core_restart_cb); e_dbus_interface_method_add(iface, "Shutdown", "", "", _e_msgbus_core_shutdown_cb); iface = e_dbus_interface_new("org.enlightenment.wm.Module"); if (!iface) { printf("WARNING: Cannot add org.enlightenment.wm.Module interface\n"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Module methods */ e_dbus_interface_method_add(iface, "Load", "s", "", _e_msgbus_module_load_cb); e_dbus_interface_method_add(iface, "Unload", "s", "", _e_msgbus_module_unload_cb); e_dbus_interface_method_add(iface, "Enable", "s", "", _e_msgbus_module_enable_cb); e_dbus_interface_method_add(iface, "Disable", "s", "", _e_msgbus_module_disable_cb); e_dbus_interface_method_add(iface, "List", "", "a(si)", _e_msgbus_module_list_cb); iface = e_dbus_interface_new("org.enlightenment.wm.Profile"); if (!iface) { printf("WARNING: Cannot add org.enlightenment.wm.Profile interface\n"); return 0; } e_dbus_object_interface_attach(_e_msgbus_data->obj, iface); e_dbus_interface_unref(iface); /* Profile methods */ e_dbus_interface_method_add(iface, "Set", "s", "", _e_msgbus_profile_set_cb); e_dbus_interface_method_add(iface, "Get", "", "s", _e_msgbus_profile_get_cb); e_dbus_interface_method_add(iface, "List", "", "as", _e_msgbus_profile_list_cb); e_dbus_interface_method_add(iface, "Add", "s", "", _e_msgbus_profile_add_cb); e_dbus_interface_method_add(iface, "Delete", "s", "", _e_msgbus_profile_delete_cb); return 1; }
int _bt_ipc_send_obex_message(uint8_t *address, const uint8_t *files, uint32_t length) { int result = 0; uint32_t i, count = 1; E_DBus_Connection *conn = NULL; LOGD("[%s(): %d] BEGIN>>>>", __FUNCTION__, __LINE__); if (address == NULL || files == NULL) { LOGD("invalid param [%p] [%p]", address, files); return 0; } /* count files */ for (i = 0; i < length; i++) { if (files[i] == '?') { count++; } } if (e_dbus_init() > 0) { if ((conn = e_dbus_bus_get(DBUS_BUS_SYSTEM)) != NULL) { DBusMessage *msg = NULL; if (e_dbus_request_name(conn, "User.Bluetooth.UG", 0, NULL, NULL) != NULL) { if ((msg = dbus_message_new_signal("/org/projectx/connect_device", "User.Bluetooth.UG", "Send")) != NULL) { int reserved = 0; char *type = "nfc"; LOGD("msg [%p], reserved [%d], address [%02X:%02X:%02X:%02X:%02X:%02X], count [%d], files [%s]", msg, reserved, address[0], address[1], address[2], address[3], address[4], address[5], count, files); if (dbus_message_append_args(msg, DBUS_TYPE_INT32, &reserved, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &address, 6, DBUS_TYPE_INT32, &count, DBUS_TYPE_STRING, &files, DBUS_TYPE_STRING, &type, DBUS_TYPE_INVALID)) { e_dbus_message_send(conn, msg, NULL, -1, NULL); LOGD("Send success"); } else { LOGE("Connect sending failed"); result = -1; } dbus_message_unref(msg); } else { LOGE("dbus_message_new_signal failed"); result = -1; } } else { LOGE("e_dbus_request_name failed"); result = -1; } } else { LOGE("e_dbus_bus_get failed"); result = -1; } e_dbus_shutdown(); } else { LOGE("e_dbus_init failed"); result = -1; } LOGD("[%s(): %d] END>>>>", __FUNCTION__, __LINE__); return result; }