forked from enlightenment/enlightenment
bluez5 - finally add signals to show global adapter state
this adds signals that go to the bz5 gadget object so you know if you have a bt adatper on at all, if any are powered on, scanning, visible etc.
This commit is contained in:
parent
38ae2285ec
commit
3cb7d8868f
|
@ -301,6 +301,37 @@ ebluez5_rfkill_unblock(const char *name)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
ebluez5_instances_update(void)
|
||||
{
|
||||
const Eina_List *l;
|
||||
Obj *o;
|
||||
Instance *inst;
|
||||
Eina_Bool exist = EINA_FALSE;
|
||||
Eina_Bool on = EINA_FALSE;
|
||||
Eina_Bool visible = EINA_FALSE;
|
||||
Eina_Bool scanning = EINA_FALSE;
|
||||
|
||||
EINA_LIST_FOREACH(ebluez5_popup_adapters_get(), l, o)
|
||||
{
|
||||
exist = EINA_TRUE;
|
||||
if (o->powered) on = EINA_TRUE;
|
||||
if (o->discoverable) visible = EINA_TRUE;
|
||||
if (o->discovering) scanning = EINA_TRUE;
|
||||
}
|
||||
EINA_LIST_FOREACH(instances, l, inst)
|
||||
{
|
||||
if (exist) edje_object_signal_emit(inst->o_bluez5, "e,state,exist", "e");
|
||||
else edje_object_signal_emit(inst->o_bluez5, "e,state,noexist", "e");
|
||||
if (on) edje_object_signal_emit(inst->o_bluez5, "e,state,on", "e");
|
||||
else edje_object_signal_emit(inst->o_bluez5, "e,state,off", "e");
|
||||
if (visible) edje_object_signal_emit(inst->o_bluez5, "e,state,visible", "e");
|
||||
else edje_object_signal_emit(inst->o_bluez5, "e,state,invisible", "e");
|
||||
if (scanning) edje_object_signal_emit(inst->o_bluez5, "e,state,scanning", "e");
|
||||
else edje_object_signal_emit(inst->o_bluez5, "e,state,unscanning", "e");
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Module Functions */
|
||||
|
|
|
@ -43,6 +43,7 @@ E_API int e_modapi_save(E_Module *m);
|
|||
void ebluez5_conf_adapter_add(const char *addr, Eina_Bool powered, Eina_Bool pairable);
|
||||
void ebluez5_popups_show(void);
|
||||
void ebluez5_rfkill_unblock(const char *name);
|
||||
void ebluez5_instances_update(void);
|
||||
|
||||
void ebluez5_popup_hide(Instance *inst);
|
||||
|
||||
|
@ -56,6 +57,7 @@ void ebluez5_popup_adapter_change(Obj *o);
|
|||
void ebluez5_popup_device_add(Obj *o);
|
||||
void ebluez5_popup_device_del(Obj *o);
|
||||
void ebluez5_popup_device_change(Obj *o);
|
||||
const Eina_List *ebluez5_popup_adapters_get(void);
|
||||
|
||||
void ebluez5_agent_agent_release(void);
|
||||
void ebluez5_agent_agent_cancel(void);
|
||||
|
|
|
@ -631,6 +631,7 @@ ebluez5_popup_adapter_add(Obj *o)
|
|||
{
|
||||
_adapter_add(gl, o);
|
||||
}
|
||||
ebluez5_instances_update();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -653,6 +654,7 @@ ebluez5_popup_adapter_del(Obj *o)
|
|||
}
|
||||
}
|
||||
adapters = eina_list_remove(adapters, o);
|
||||
ebluez5_instances_update();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -677,6 +679,7 @@ ebluez5_popup_adapter_change(Obj *o)
|
|||
}
|
||||
}
|
||||
}
|
||||
ebluez5_instances_update();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -753,3 +756,9 @@ ebluez5_popup_device_change(Obj *o)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Eina_List *
|
||||
ebluez5_popup_adapters_get(void)
|
||||
{
|
||||
return (const Eina_List *)adapters;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue