efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Ecore.h"
|
|
|
|
#include "Ecore_Con.h"
|
|
|
|
#include "ecore_con_private.h"
|
|
|
|
#include "efl_net-connman.h"
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* Eldbus_Proxy/Eldbus_Object keeps a list of pending calls, but
|
|
|
|
* they are reference counted singletons and will only cancel
|
|
|
|
* pending calls when everything is gone. However we operate on
|
|
|
|
* our private data, that may be gone before other refs. So
|
|
|
|
* keep the pending list.
|
|
|
|
*/
|
|
|
|
Eina_List *pending;
|
|
|
|
Eina_List *signal_handlers;
|
|
|
|
Eldbus_Proxy *proxy;
|
|
|
|
Eina_Stringshare *path;
|
|
|
|
Eina_Stringshare *name;
|
|
|
|
struct {
|
|
|
|
Eina_Stringshare *identifier;
|
|
|
|
Eina_Stringshare *passphrase;
|
|
|
|
Eina_Bool enabled;
|
|
|
|
} tethering;
|
|
|
|
Efl_Net_Control_Technology_Type type;
|
|
|
|
Eina_Bool powered;
|
|
|
|
Eina_Bool connected;
|
|
|
|
} Efl_Net_Control_Technology_Data;
|
|
|
|
|
|
|
|
#define MY_CLASS EFL_NET_CONTROL_TECHNOLOGY_CLASS
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_powered_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
|
|
|
|
{
|
|
|
|
Eina_Bool powered;
|
|
|
|
|
|
|
|
if (!eldbus_message_iter_arguments_get(value, "b", &powered))
|
|
|
|
{
|
|
|
|
ERR("Expected boolean, got %s", eldbus_message_iter_signature_get(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pd->powered == powered) return;
|
|
|
|
pd->powered = powered;
|
|
|
|
DBG("powered=%hhu", powered);
|
|
|
|
efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_connected_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
|
|
|
|
{
|
|
|
|
Eina_Bool connected;
|
|
|
|
|
|
|
|
if (!eldbus_message_iter_arguments_get(value, "b", &connected))
|
|
|
|
{
|
|
|
|
ERR("Expected boolean, got %s", eldbus_message_iter_signature_get(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pd->connected == connected) return;
|
|
|
|
pd->connected = connected;
|
|
|
|
DBG("connected=%hhu", connected);
|
|
|
|
efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_name_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
if (!eldbus_message_iter_arguments_get(value, "s", &name))
|
|
|
|
{
|
|
|
|
ERR("Expected string, got %s", eldbus_message_iter_signature_get(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!eina_stringshare_replace(&pd->name, name)) return;
|
|
|
|
DBG("name=%s", name);
|
|
|
|
efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
Efl_Net_Control_Technology_Type
|
|
|
|
efl_net_connman_technology_type_from_str(const char *str)
|
|
|
|
{
|
|
|
|
const struct {
|
|
|
|
Efl_Net_Control_Technology_Type val;
|
|
|
|
const char *str;
|
|
|
|
} *itr, map[] = {
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_UNKNOWN, "unknown"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_SYSTEM, "system"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_ETHERNET, "ethernet"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_WIFI, "wifi"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_BLUETOOTH, "bluetooth"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_CELLULAR, "cellular"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_GPS, "gps"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_VPN, "vpn"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_GADGET, "gadget"},
|
|
|
|
{EFL_NET_CONTROL_TECHNOLOGY_TYPE_P2P, "p2p"},
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
for (itr = map; itr->str != NULL; itr++)
|
|
|
|
if (strcmp(itr->str, str) == 0) return itr->val;
|
|
|
|
|
|
|
|
ERR("Unknown type '%s'", str);
|
|
|
|
return EFL_NET_CONTROL_TECHNOLOGY_TYPE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_type_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
|
|
|
|
{
|
|
|
|
const char *str;
|
|
|
|
Efl_Net_Control_Technology_Type type;
|
|
|
|
|
|
|
|
if (!eldbus_message_iter_arguments_get(value, "s", &str))
|
|
|
|
{
|
|
|
|
ERR("Expected string, got %s", eldbus_message_iter_signature_get(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
type = efl_net_connman_technology_type_from_str(str);
|
|
|
|
if (pd->type == type) return;
|
|
|
|
pd->type = type;
|
|
|
|
DBG("type=%d (%s)", type, str);
|
|
|
|
efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_tethering_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
|
|
|
|
{
|
|
|
|
Eina_Bool tethering;
|
|
|
|
|
|
|
|
if (!eldbus_message_iter_arguments_get(value, "b", &tethering))
|
|
|
|
{
|
|
|
|
ERR("Expected boolean, got %s", eldbus_message_iter_signature_get(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pd->tethering.enabled == tethering) return;
|
|
|
|
pd->tethering.enabled = tethering;
|
|
|
|
DBG("tethering=%hhu", tethering);
|
|
|
|
efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_tethering_identifier_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
|
|
|
|
{
|
|
|
|
const char *tethering_identifier;
|
|
|
|
|
|
|
|
if (!eldbus_message_iter_arguments_get(value, "s", &tethering_identifier))
|
|
|
|
{
|
|
|
|
ERR("Expected string, got %s", eldbus_message_iter_signature_get(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!eina_stringshare_replace(&pd->tethering.identifier, tethering_identifier)) return;
|
|
|
|
DBG("tethering identifier=%s", tethering_identifier);
|
|
|
|
efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_tethering_passphrase_changed(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *value)
|
|
|
|
{
|
|
|
|
const char *tethering_passphrase;
|
|
|
|
|
|
|
|
if (!eldbus_message_iter_arguments_get(value, "s", &tethering_passphrase))
|
|
|
|
{
|
|
|
|
ERR("Expected string, got %s", eldbus_message_iter_signature_get(value));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!eina_stringshare_replace(&pd->tethering.passphrase, tethering_passphrase)) return;
|
|
|
|
DBG("tethering passphrase=%s", tethering_passphrase);
|
|
|
|
efl_event_callback_call(o, EFL_NET_CONTROL_TECHNOLOGY_EVENT_CHANGED, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_changed_internal(Eo *o, Efl_Net_Control_Technology_Data *pd, Eldbus_Message_Iter *itr)
|
|
|
|
{
|
|
|
|
Eldbus_Message_Iter *value;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
if (!eldbus_message_iter_arguments_get(itr, "sv", &name, &value))
|
|
|
|
{
|
|
|
|
ERR("Unexpected signature: %s", eldbus_message_iter_signature_get(itr));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(name, "Powered") == 0)
|
|
|
|
_efl_net_control_technology_property_powered_changed(o, pd, value);
|
|
|
|
else if (strcmp(name, "Connected") == 0)
|
|
|
|
_efl_net_control_technology_property_connected_changed(o, pd, value);
|
|
|
|
else if (strcmp(name, "Name") == 0)
|
|
|
|
_efl_net_control_technology_property_name_changed(o, pd, value);
|
|
|
|
else if (strcmp(name, "Type") == 0)
|
|
|
|
_efl_net_control_technology_property_type_changed(o, pd, value);
|
|
|
|
else if (strcmp(name, "Tethering") == 0)
|
|
|
|
_efl_net_control_technology_property_tethering_changed(o, pd, value);
|
|
|
|
else if (strcmp(name, "TetheringIdentifier") == 0)
|
|
|
|
_efl_net_control_technology_property_tethering_identifier_changed(o, pd, value);
|
|
|
|
else if (strcmp(name, "TetheringPassphrase") == 0)
|
|
|
|
_efl_net_control_technology_property_tethering_passphrase_changed(o, pd, value);
|
|
|
|
else
|
|
|
|
WRN("Unknown property name: %s", name);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_changed(void *data, const Eldbus_Message *msg)
|
|
|
|
{
|
|
|
|
Eo *o = data;
|
|
|
|
Efl_Net_Control_Technology_Data *pd = efl_data_scope_get(o, MY_CLASS);
|
|
|
|
Eldbus_Message_Iter *itr;
|
|
|
|
|
|
|
|
itr = eldbus_message_iter_get(msg);
|
|
|
|
_efl_net_control_technology_property_changed_internal(o, pd, itr);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_efl_net_control_technology_efl_object_destructor(Eo *o, Efl_Net_Control_Technology_Data *pd)
|
|
|
|
{
|
|
|
|
Eldbus_Pending *p;
|
|
|
|
Eldbus_Signal_Handler *sh;
|
|
|
|
|
|
|
|
EINA_LIST_FREE(pd->pending, p)
|
|
|
|
eldbus_pending_cancel(p);
|
|
|
|
|
|
|
|
EINA_LIST_FREE(pd->signal_handlers, sh)
|
|
|
|
eldbus_signal_handler_del(sh);
|
|
|
|
|
|
|
|
if (pd->proxy)
|
|
|
|
{
|
|
|
|
Eldbus_Object *obj = eldbus_proxy_object_get(pd->proxy);
|
|
|
|
eldbus_proxy_unref(pd->proxy);
|
|
|
|
pd->proxy = NULL;
|
|
|
|
eldbus_object_unref(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
efl_destructor(efl_super(o, MY_CLASS));
|
|
|
|
eina_stringshare_replace(&pd->path, NULL);
|
|
|
|
eina_stringshare_replace(&pd->name, NULL);
|
|
|
|
eina_stringshare_replace(&pd->tethering.identifier, NULL);
|
|
|
|
eina_stringshare_replace(&pd->tethering.passphrase, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_set_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
|
|
|
|
{
|
|
|
|
Eo *o = data;
|
|
|
|
Efl_Net_Control_Technology_Data *pd = efl_data_scope_get(o, MY_CLASS);
|
|
|
|
const char *err_name, *err_msg;
|
|
|
|
|
|
|
|
pd->pending = eina_list_remove(pd->pending, pending);
|
|
|
|
if (eldbus_message_error_get(msg, &err_name, &err_msg))
|
|
|
|
{
|
|
|
|
ERR("Could not set property %p: %s=%s", o, err_name, err_msg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_property_set(Eo *o, Efl_Net_Control_Technology_Data *pd, const char *name, const char *signature, ...)
|
|
|
|
{
|
|
|
|
Eldbus_Message *msg;
|
|
|
|
Eldbus_Message_Iter *msg_itr, *var;
|
|
|
|
Eldbus_Pending *p;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
msg = eldbus_proxy_method_call_new(pd->proxy, "SetProperty");
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(msg);
|
|
|
|
|
|
|
|
msg_itr = eldbus_message_iter_get(msg);
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(msg_itr, error_send);
|
|
|
|
|
|
|
|
eldbus_message_iter_basic_append(msg_itr, 's', name);
|
|
|
|
var = eldbus_message_iter_container_new(msg_itr, 'v', signature);
|
|
|
|
|
|
|
|
va_start(ap, signature);
|
|
|
|
eldbus_message_iter_arguments_vappend(var, signature, ap);
|
|
|
|
va_end(ap);
|
|
|
|
eldbus_message_iter_container_close(msg_itr, var);
|
|
|
|
|
|
|
|
p = eldbus_proxy_send(pd->proxy, msg, _efl_net_control_technology_property_set_cb, o, DEFAULT_TIMEOUT);
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(p, error_send);
|
|
|
|
|
|
|
|
pd->pending = eina_list_append(pd->pending, p);
|
|
|
|
DBG("Setting property %s", name);
|
|
|
|
return;
|
|
|
|
|
|
|
|
error_send:
|
|
|
|
eldbus_message_unref(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_efl_net_control_technology_powered_set(Eo *o, Efl_Net_Control_Technology_Data *pd, Eina_Bool powered)
|
|
|
|
{
|
|
|
|
_efl_net_control_technology_property_set(o, pd, "Powered", "b", powered);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_net_control_technology_powered_get(const Eo *o EINA_UNUSED, Efl_Net_Control_Technology_Data *pd)
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
{
|
|
|
|
return pd->powered;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
|
|
|
_efl_net_control_technology_tethering_set(Eo *o, Efl_Net_Control_Technology_Data *pd, Eina_Bool enabled, const char *identifier, const char *passphrase)
|
|
|
|
{
|
|
|
|
if (passphrase)
|
|
|
|
_efl_net_control_technology_property_set(o, pd, "TetheringPassphrase", "s", passphrase);
|
|
|
|
|
|
|
|
if (identifier)
|
|
|
|
_efl_net_control_technology_property_set(o, pd, "TetheringIdentifier", "s", identifier);
|
|
|
|
|
|
|
|
_efl_net_control_technology_property_set(o, pd, "Tethering", "b", enabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static void
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_net_control_technology_tethering_get(const Eo *o EINA_UNUSED, Efl_Net_Control_Technology_Data *pd, Eina_Bool *enabled, const char **identifier, const char **passphrase)
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
{
|
|
|
|
if (enabled) *enabled = pd->tethering.enabled;
|
|
|
|
if (identifier) *identifier = pd->tethering.identifier;
|
|
|
|
if (passphrase) *passphrase = pd->tethering.passphrase;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Eina_Bool
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_net_control_technology_connected_get(const Eo *o EINA_UNUSED, Efl_Net_Control_Technology_Data *pd)
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
{
|
|
|
|
return pd->connected;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static const char *
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_net_control_technology_efl_object_name_get(const Eo *o EINA_UNUSED, Efl_Net_Control_Technology_Data *pd)
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
{
|
|
|
|
return pd->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
EOLIAN static Efl_Net_Control_Technology_Type
|
2018-04-17 11:09:44 -07:00
|
|
|
_efl_net_control_technology_type_get(const Eo *o EINA_UNUSED, Efl_Net_Control_Technology_Data *pd)
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
{
|
|
|
|
return pd->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_efl_net_control_technology_scan_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
|
|
|
|
{
|
2017-12-11 15:03:11 -08:00
|
|
|
Eina_Promise *promise = data;
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
const char *err_name, *err_msg;
|
|
|
|
|
|
|
|
if (eldbus_message_error_get(msg, &err_name, &err_msg))
|
|
|
|
{
|
2019-01-04 16:01:13 -08:00
|
|
|
Eo *o = eldbus_pending_data_get(pending, ".object");
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
Eina_Error err = EINVAL;
|
|
|
|
|
|
|
|
if (strcmp(err_name, "net.connman.Error.NotSupported") == 0)
|
|
|
|
err = ENOTSUP;
|
|
|
|
|
|
|
|
WRN("Could not Scan %p: %s=%s", o, err_name, err_msg);
|
2017-12-11 15:03:11 -08:00
|
|
|
eina_promise_reject(promise, err);
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-12-11 15:08:48 -08:00
|
|
|
eina_promise_resolve(promise, EINA_VALUE_EMPTY);
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
}
|
|
|
|
|
2019-01-04 16:01:13 -08:00
|
|
|
static Eina_Value
|
|
|
|
_efl_net_control_technology_scan_promise_cancel(Eo *o EINA_UNUSED, void *data, Eina_Error error)
|
|
|
|
{
|
|
|
|
Eldbus_Pending *p = data;
|
|
|
|
|
|
|
|
if (error == ECANCELED)
|
|
|
|
{
|
|
|
|
DBG("cancel pending scan %p", p);
|
|
|
|
eldbus_pending_cancel(p);
|
|
|
|
}
|
|
|
|
|
|
|
|
return eina_value_error_init(error);
|
|
|
|
}
|
|
|
|
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
static void
|
2019-01-04 16:01:13 -08:00
|
|
|
_efl_net_control_technology_scan_promise_del(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
{
|
2019-01-04 16:01:13 -08:00
|
|
|
Eldbus_Pending *p = data;
|
2017-12-11 15:03:11 -08:00
|
|
|
Efl_Net_Control_Technology_Data *pd;
|
|
|
|
|
|
|
|
pd = efl_data_scope_get(o, MY_CLASS);
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
|
|
|
|
pd->pending = eina_list_remove(pd->pending, p);
|
|
|
|
}
|
|
|
|
|
2017-12-11 15:03:11 -08:00
|
|
|
EOLIAN static Eina_Future *
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
_efl_net_control_technology_scan(Eo *o, Efl_Net_Control_Technology_Data *pd)
|
|
|
|
{
|
|
|
|
Eldbus_Pending *p;
|
2017-12-11 15:03:11 -08:00
|
|
|
Eina_Promise *promise;
|
|
|
|
Eina_Future *f = NULL;
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
|
2019-01-04 17:42:26 -08:00
|
|
|
promise = efl_loop_promise_new(o);
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(promise, NULL);
|
|
|
|
|
2017-12-11 15:03:11 -08:00
|
|
|
f = eina_future_new(promise);
|
|
|
|
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
p = eldbus_proxy_call(pd->proxy, "Scan",
|
|
|
|
_efl_net_control_technology_scan_cb, promise, -1.0, "");
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(p, error_dbus);
|
|
|
|
|
|
|
|
pd->pending = eina_list_append(pd->pending, p);
|
2017-12-11 15:03:11 -08:00
|
|
|
eldbus_pending_data_set(p, ".object", o);
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
|
2019-01-04 16:01:13 -08:00
|
|
|
return efl_future_then(o, f,
|
|
|
|
.error = _efl_net_control_technology_scan_promise_cancel,
|
|
|
|
.free = _efl_net_control_technology_scan_promise_del,
|
|
|
|
.data = p);
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
|
|
|
|
error_dbus:
|
2017-12-11 15:03:11 -08:00
|
|
|
eina_promise_reject(promise, ENOSYS);
|
2018-11-21 17:33:10 -08:00
|
|
|
return efl_future_then(o, f);
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
efl_net_connman_technology_path_get(Efl_Net_Control_Technology *o)
|
|
|
|
{
|
|
|
|
Efl_Net_Control_Technology_Data *pd = efl_data_scope_get(o, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL);
|
|
|
|
return pd->path;
|
|
|
|
}
|
|
|
|
|
|
|
|
Efl_Net_Control_Technology *
|
2018-04-06 02:06:56 -07:00
|
|
|
efl_net_connman_technology_new(Efl_Net_Control_Manager *ctl, const char *path, Eldbus_Message_Iter *itr)
|
efl_net_session and efl_net_control for ConnMan
These are objects to allow control of networking devices
(efl_net_control) as well as an application to request for
connectivity (efl_net_session).
They are loosely based on ConnMan.org, which we already use in
Enlightenment Window Manager via DBus access with Eldbus. However they
do not map 1:1 as the goal was to expose a viable subset of controls
but in a simple and general way, thus nome strings were converted to
enums, some arrays of strings were converted to bitwise flags, some
names were made more general, such as "service" was turned into
"access point" so it doesn't generate confusion with other "network
services" (ie: http server), or "favorite" that was renamed to
"remembered". Some behavior are slightly different (yet able to be
implemented on top), such as "Service.MoveBefore" and "MoveAfter" were
converted to a numeric "priority", calculated from service's list
index, changing the priority will reoder the list and thus generate
the MoveBefore and MoveAfter DBus commands.
ConnMan was chosen not only because we already use it, but because its
DBus API is sane and simple, with the server doing almost all that we
need. This is visible in the efl_net_session, which is completely done
in the server and do not require any extra work on our side -- aside
from talking DBus and converting to Eo, which is a major work :-D
NOTE: ConnMan doesn't use FreeDesktop.Org DBus interfaces such as
Properties and ObjectManager, thus we cannot use
eldbus_model_object.
There are two examples added:
- efl_net_session_example: monitors the connection available for an
application and try to connect. You need a connman compiled with
session_policy_local and a configuration file explained in
https://github.com/aldebaran/connman/blob/master/doc/session-policy-format.txt
to get a connection if nothing is connected. Otherwise it will just
monitor the connectivity state.
- efl_net_control_example: monitors, plays the agent and configure
the network details. It can enable/disable technologies, connect to
access points (services) and configure them. It's quite extensive
as allows testing all of ConnMan's DBus API except P2P (Peers).
2016-09-15 17:43:19 -07:00
|
|
|
{
|
|
|
|
Eo *o;
|
|
|
|
Efl_Net_Control_Technology_Data *pd;
|
|
|
|
Eldbus_Message_Iter *entry;
|
|
|
|
Eldbus_Connection *conn;
|
|
|
|
Eldbus_Object *obj;
|
|
|
|
|
|
|
|
conn = efl_net_connman_connection_get();
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(conn, NULL);
|
|
|
|
|
|
|
|
o = efl_add(MY_CLASS, ctl);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(o, NULL);
|
|
|
|
|
|
|
|
pd = efl_data_scope_get(o, MY_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(pd, error);
|
|
|
|
|
|
|
|
pd->path = eina_stringshare_add(path);
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(pd->path, error);
|
|
|
|
|
|
|
|
obj = eldbus_object_get(conn, "net.connman", pd->path);
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(obj, error);
|
|
|
|
pd->proxy = eldbus_proxy_get(obj, "net.connman.Technology");
|
|
|
|
EINA_SAFETY_ON_NULL_GOTO(pd->proxy, error);
|
|
|
|
|
|
|
|
#define SH(sig, cb) \
|
|
|
|
do { \
|
|
|
|
Eldbus_Signal_Handler *sh = eldbus_proxy_signal_handler_add(pd->proxy, sig, cb, o); \
|
|
|
|
if (sh) pd->signal_handlers = eina_list_append(pd->signal_handlers, sh); \
|
|
|
|
else ERR("could not add DBus signal handler %s", sig); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
SH("PropertyChanged", _efl_net_control_technology_property_changed);
|
|
|
|
#undef SH
|
|
|
|
|
|
|
|
efl_event_freeze(o);
|
|
|
|
while (eldbus_message_iter_get_and_next(itr, 'e', &entry))
|
|
|
|
_efl_net_control_technology_property_changed_internal(o, pd, entry);
|
|
|
|
efl_event_thaw(o);
|
|
|
|
|
|
|
|
return o;
|
|
|
|
|
|
|
|
error:
|
|
|
|
efl_del(o);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "efl_net_control_technology.eo.c"
|