e/connman: Add stub functions to implement the agent

SVN revision: 76049
This commit is contained in:
Lucas De Marchi 2012-09-03 21:59:45 +00:00
parent e3a8e242bd
commit 5da9539335
4 changed files with 107 additions and 0 deletions

View File

@ -25,6 +25,8 @@ module_la_SOURCES = e_mod_main.h \
e_mod_main.c \
e_mod_config.c \
e_connman.c \
agent.c \
agent.h \
log.h \
E_Connman.h

View File

@ -0,0 +1,92 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "agent.h"
#include "E_Connman.h"
static unsigned int init_count;
static E_DBus_Connection *conn;
static E_DBus_Object *agent_obj;
#define AGENT_PATH "/org/enlightenment/connman/agent"
#define AGENT_IFACE "net.connman.Agent"
static DBusMessage *_agent_release(E_DBus_Object *obj, DBusMessage *msg)
{
return NULL;
}
static DBusMessage *_agent_report_error(E_DBus_Object *obj, DBusMessage *msg)
{
return NULL;
}
static DBusMessage *_agent_request_browser(E_DBus_Object *obj, DBusMessage *msg)
{
return NULL;
}
static DBusMessage *_agent_request_input(E_DBus_Object *obj, DBusMessage *msg)
{
return NULL;
}
static DBusMessage *_agent_cancel(E_DBus_Object *obj, DBusMessage *msg)
{
return NULL;
}
static void _econnman_agent_object_create(void)
{
E_DBus_Interface *iface = e_dbus_interface_new(AGENT_IFACE);
e_dbus_interface_method_add(iface, "Release", "", "", _agent_release);
e_dbus_interface_method_add(iface, "ReportError", "os", "",
_agent_report_error);
e_dbus_interface_method_add(iface, "RequestBrowser", "os", "",
_agent_request_browser);
e_dbus_interface_method_add(iface, "RequestInput", "oa{sv}", "a{sv}",
_agent_request_input);
e_dbus_interface_method_add(iface, "Cancel", "", "", _agent_cancel);
agent_obj = e_dbus_object_add(conn, AGENT_PATH, NULL);
e_dbus_object_interface_attach(agent_obj, iface);
e_dbus_interface_unref(iface);
}
unsigned int econnman_agent_init(E_DBus_Connection *edbus_conn)
{
init_count++;
if (init_count > 1)
return init_count;
conn = edbus_conn;
_econnman_agent_object_create();
return init_count;
}
unsigned int econnman_agent_shutdown(void)
{
if (init_count == 0)
{
ERR("connman agent already shut down.");
return 0;
}
init_count--;
if (init_count > 0)
return init_count;
e_dbus_object_free(agent_obj);
conn = NULL;
return 0;
}

View File

@ -0,0 +1,9 @@
#ifndef E_CONNMAN_AGENT_H
#define E_CONNMAN_AGENT_H
#include "E_Connman.h"
unsigned int econnman_agent_init(E_DBus_Connection *edbus_conn) EINA_ARG_NONNULL(1);
unsigned int econnman_agent_shutdown(void);
#endif /* E_CONNMAN_H */

View File

@ -7,6 +7,7 @@
#include <string.h>
#include "E_Connman.h"
#include "agent.h"
#define CONNMAN_BUS_NAME "net.connman"
#define CONNMAN_MANAGER_IFACE CONNMAN_BUS_NAME ".Manager"
@ -716,6 +717,8 @@ e_connman_system_init(E_DBus_Connection *edbus_conn)
CONNMAN_BUS_NAME, _e_connman_get_name_owner,
NULL);
econnman_agent_init(edbus_conn);
return init_count;
}
@ -742,6 +745,7 @@ e_connman_system_shutdown(void)
if (pending_get_name_owner)
dbus_pending_call_cancel(pending_get_name_owner);
econnman_agent_shutdown();
conn = NULL;
E_CONNMAN_EVENT_MANAGER_OUT = 0;