forked from enlightenment/enlightenment
e/connman: support more service types and states
Also fix manager_update_inst function. SVN revision: 76058
This commit is contained in:
parent
3e4cc4ca2e
commit
35007e200a
|
@ -7890,8 +7890,8 @@ collections {
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
CONNMAN_ICON(3g)
|
|
||||||
CONNMAN_ICON(bluetooth)
|
CONNMAN_ICON(bluetooth)
|
||||||
|
CONNMAN_ICON(cellular)
|
||||||
CONNMAN_ICON(ethernet)
|
CONNMAN_ICON(ethernet)
|
||||||
|
|
||||||
#undef CONNMAN_ICON
|
#undef CONNMAN_ICON
|
||||||
|
|
|
@ -74,9 +74,9 @@ ch-m2-3.png \
|
||||||
ch-s1-3.png \
|
ch-s1-3.png \
|
||||||
ch-s2-3.png \
|
ch-s2-3.png \
|
||||||
clock_base.png \
|
clock_base.png \
|
||||||
connman_3g.png \
|
|
||||||
connman_almost_secure.png \
|
connman_almost_secure.png \
|
||||||
connman_bluetooth.png \
|
connman_bluetooth.png \
|
||||||
|
connman_cellular.png \
|
||||||
connman_ethernet.png \
|
connman_ethernet.png \
|
||||||
connman_online.png \
|
connman_online.png \
|
||||||
connman_ready.png \
|
connman_ready.png \
|
||||||
|
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
@ -16,8 +16,12 @@ enum Connman_State
|
||||||
CONNMAN_STATE_NONE = -1, /* All unknown states */
|
CONNMAN_STATE_NONE = -1, /* All unknown states */
|
||||||
CONNMAN_STATE_OFFLINE,
|
CONNMAN_STATE_OFFLINE,
|
||||||
CONNMAN_STATE_IDLE,
|
CONNMAN_STATE_IDLE,
|
||||||
|
CONNMAN_STATE_ASSOCIATION,
|
||||||
|
CONNMAN_STATE_CONFIGURATION,
|
||||||
CONNMAN_STATE_READY,
|
CONNMAN_STATE_READY,
|
||||||
CONNMAN_STATE_ONLINE,
|
CONNMAN_STATE_ONLINE,
|
||||||
|
CONNMAN_STATE_DISCONNECT,
|
||||||
|
CONNMAN_STATE_FAILURE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Connman_Service_Type
|
enum Connman_Service_Type
|
||||||
|
@ -25,6 +29,8 @@ enum Connman_Service_Type
|
||||||
CONNMAN_SERVICE_TYPE_NONE = -1, /* All non-supported types */
|
CONNMAN_SERVICE_TYPE_NONE = -1, /* All non-supported types */
|
||||||
CONNMAN_SERVICE_TYPE_ETHERNET,
|
CONNMAN_SERVICE_TYPE_ETHERNET,
|
||||||
CONNMAN_SERVICE_TYPE_WIFI,
|
CONNMAN_SERVICE_TYPE_WIFI,
|
||||||
|
CONNMAN_SERVICE_TYPE_BLUETOOTH,
|
||||||
|
CONNMAN_SERVICE_TYPE_CELLULAR,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Connman_Object
|
struct Connman_Object
|
||||||
|
|
|
@ -91,14 +91,22 @@ static void _dbus_str_array_to_eina(DBusMessageIter *value, Eina_Array **old,
|
||||||
|
|
||||||
static enum Connman_State str_to_state(const char *s)
|
static enum Connman_State str_to_state(const char *s)
|
||||||
{
|
{
|
||||||
if (strcmp(s, "offline") == 0)
|
if (!strcmp(s, "offline"))
|
||||||
return CONNMAN_STATE_OFFLINE;
|
return CONNMAN_STATE_OFFLINE;
|
||||||
if (strcmp(s, "idle") == 0)
|
if (!strcmp(s, "idle"))
|
||||||
return CONNMAN_STATE_IDLE;
|
return CONNMAN_STATE_IDLE;
|
||||||
if (strcmp(s, "ready") == 0)
|
if (!strcmp(s, "association"))
|
||||||
|
return CONNMAN_STATE_ASSOCIATION;
|
||||||
|
if (!strcmp(s, "configuration"))
|
||||||
|
return CONNMAN_STATE_CONFIGURATION;
|
||||||
|
if (!strcmp(s, "ready"))
|
||||||
return CONNMAN_STATE_READY;
|
return CONNMAN_STATE_READY;
|
||||||
if (strcmp(s, "online") == 0)
|
if (!strcmp(s, "online"))
|
||||||
return CONNMAN_STATE_ONLINE;
|
return CONNMAN_STATE_ONLINE;
|
||||||
|
if (!strcmp(s, "disconnect"))
|
||||||
|
return CONNMAN_STATE_DISCONNECT;
|
||||||
|
if (!strcmp(s, "failure"))
|
||||||
|
return CONNMAN_STATE_FAILURE;
|
||||||
|
|
||||||
ERR("Unknown state %s", s);
|
ERR("Unknown state %s", s);
|
||||||
return CONNMAN_STATE_NONE;
|
return CONNMAN_STATE_NONE;
|
||||||
|
@ -112,10 +120,18 @@ const char *econnman_state_to_str(enum Connman_State state)
|
||||||
return "offline";
|
return "offline";
|
||||||
case CONNMAN_STATE_IDLE:
|
case CONNMAN_STATE_IDLE:
|
||||||
return "idle";
|
return "idle";
|
||||||
|
case CONNMAN_STATE_ASSOCIATION:
|
||||||
|
return "association";
|
||||||
|
case CONNMAN_STATE_CONFIGURATION:
|
||||||
|
return "configuration";
|
||||||
case CONNMAN_STATE_READY:
|
case CONNMAN_STATE_READY:
|
||||||
return "ready";
|
return "ready";
|
||||||
case CONNMAN_STATE_ONLINE:
|
case CONNMAN_STATE_ONLINE:
|
||||||
return "online";
|
return "online";
|
||||||
|
case CONNMAN_STATE_DISCONNECT:
|
||||||
|
return "disconnect";
|
||||||
|
case CONNMAN_STATE_FAILURE:
|
||||||
|
return "failure";
|
||||||
case CONNMAN_STATE_NONE:
|
case CONNMAN_STATE_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -125,10 +141,14 @@ const char *econnman_state_to_str(enum Connman_State state)
|
||||||
|
|
||||||
static enum Connman_Service_Type str_to_type(const char *s)
|
static enum Connman_Service_Type str_to_type(const char *s)
|
||||||
{
|
{
|
||||||
if (strcmp(s, "ethernet") == 0)
|
if (!strcmp(s, "ethernet"))
|
||||||
return CONNMAN_SERVICE_TYPE_ETHERNET;
|
return CONNMAN_SERVICE_TYPE_ETHERNET;
|
||||||
else if (strcmp(s, "wifi") == 0)
|
else if (!strcmp(s, "wifi"))
|
||||||
return CONNMAN_SERVICE_TYPE_WIFI;
|
return CONNMAN_SERVICE_TYPE_WIFI;
|
||||||
|
else if (!strcmp(s, "bluetooth"))
|
||||||
|
return CONNMAN_SERVICE_TYPE_BLUETOOTH;
|
||||||
|
else if (!strcmp(s, "cellular"))
|
||||||
|
return CONNMAN_SERVICE_TYPE_CELLULAR;
|
||||||
|
|
||||||
DBG("Unknown type %s", s);
|
DBG("Unknown type %s", s);
|
||||||
return CONNMAN_SERVICE_TYPE_NONE;
|
return CONNMAN_SERVICE_TYPE_NONE;
|
||||||
|
@ -142,6 +162,10 @@ const char *econnman_service_type_to_str(enum Connman_Service_Type type)
|
||||||
return "ethernet";
|
return "ethernet";
|
||||||
case CONNMAN_SERVICE_TYPE_WIFI:
|
case CONNMAN_SERVICE_TYPE_WIFI:
|
||||||
return "wifi";
|
return "wifi";
|
||||||
|
case CONNMAN_SERVICE_TYPE_BLUETOOTH:
|
||||||
|
return "bluetooth";
|
||||||
|
case CONNMAN_SERVICE_TYPE_CELLULAR:
|
||||||
|
return "cellular";
|
||||||
case CONNMAN_SERVICE_TYPE_NONE:
|
case CONNMAN_SERVICE_TYPE_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,41 +268,22 @@ static void _econnman_mod_manager_update_inst(E_Connman_Module_Context *ctxt,
|
||||||
enum Connman_State state,
|
enum Connman_State state,
|
||||||
enum Connman_Service_Type type)
|
enum Connman_Service_Type type)
|
||||||
{
|
{
|
||||||
char buf[128];
|
|
||||||
Evas_Object *o = inst->ui.gadget;
|
Evas_Object *o = inst->ui.gadget;
|
||||||
const char *statestr;
|
const char *statestr, *typestr;
|
||||||
|
char buf[128];
|
||||||
|
|
||||||
switch (state)
|
if ((state == CONNMAN_STATE_ONLINE) || (state == CONNMAN_STATE_READY))
|
||||||
{
|
edje_object_signal_emit(o, "e,changed,connected,yes", "e");
|
||||||
case CONNMAN_STATE_ONLINE:
|
else
|
||||||
edje_object_signal_emit(o, "e,changed,connected,yes", "e");
|
edje_object_signal_emit(o, "e,changed,connected,no", "e");
|
||||||
break;
|
|
||||||
case CONNMAN_STATE_READY:
|
|
||||||
edje_object_signal_emit(o, "e,changed,connected,yes", "e");
|
|
||||||
break;
|
|
||||||
case CONNMAN_STATE_IDLE:
|
|
||||||
case CONNMAN_STATE_OFFLINE:
|
|
||||||
case CONNMAN_STATE_NONE:
|
|
||||||
edje_object_signal_emit(o, "e,changed,connected,no", "e");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
statestr = econnman_state_to_str(state);
|
statestr = econnman_state_to_str(state);
|
||||||
snprintf(buf, sizeof(buf), "e,changed,state,%s", statestr);
|
snprintf(buf, sizeof(buf), "e,changed,state,%s", statestr);
|
||||||
edje_object_signal_emit(o, statestr, "e");
|
edje_object_signal_emit(o, buf, "e");
|
||||||
|
|
||||||
switch (type)
|
typestr = econnman_service_type_to_str(type);
|
||||||
{
|
snprintf(buf, sizeof(buf), "e,changed,technology,%s", typestr);
|
||||||
case CONNMAN_SERVICE_TYPE_ETHERNET:
|
edje_object_signal_emit(o, buf, "e");
|
||||||
edje_object_signal_emit(o, "e,changed,technology,ethernet", "e");
|
|
||||||
break;
|
|
||||||
case CONNMAN_SERVICE_TYPE_WIFI:
|
|
||||||
edje_object_signal_emit(o, "e,changed,technology,wifi", "e");
|
|
||||||
break;
|
|
||||||
case CONNMAN_SERVICE_TYPE_NONE:
|
|
||||||
edje_object_signal_emit(o, "e,changed,technology,none", "e");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DBG("state=%d type=%d", state, type);
|
DBG("state=%d type=%d", state, type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue