void BatteryProviderEfl::startUpdating()
{
    if (m_timer.isActive())
        return;

    if (!e_dbus_init())
        return;

    if (!e_ukit_init()) {
        e_dbus_shutdown();
        return;
    }

    m_timer.startRepeating(m_batteryStatusRefreshInterval);
}
Пример #2
0
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;
}
Пример #3
0
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;
}
Пример #4
0
static E_Gadcon_Client *
_gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
{
   Evas_Object *o;
   E_Gadcon_Client *gcc;
   Instance *inst;

   battery_config->full = -2;
   battery_config->time_left = -2;
   battery_config->time_full = -2;
   battery_config->have_battery = -2;
   battery_config->have_power = -2;

   inst = E_NEW(Instance, 1);

   o = edje_object_add(gc->evas);
   e_theme_edje_object_set(o, "base/theme/modules/battery",
			   "e/modules/battery/main");

   gcc = e_gadcon_client_new(gc, name, id, style, o);
   gcc->data = inst;

   inst->gcc = gcc;
   inst->o_battery = o;   
   inst->warning = NULL;
   inst->popup_battery = NULL;

#ifdef HAVE_EEZE
   eeze_init();
#elif !defined __OpenBSD__
   e_dbus_init();
   e_hal_init();
#endif

   evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN,
				  _button_cb_mouse_down, inst);
   battery_config->instances = 
     eina_list_append(battery_config->instances, inst);
   _battery_config_updated();

   return gcc;
}
Пример #5
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;
}
Пример #6
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;
}
Пример #7
0
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
}
Пример #8
0
/* 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;
}
Пример #9
0
/* 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;
}