enlightenment/src/modules/bluez5/e_mod_main.h

91 lines
2.6 KiB
C
Raw Normal View History

#ifndef E_MOD_MAIN_H
#define E_MOD_MAIN_H
#include <e.h>
#include "bz.h"
typedef struct _Instance Instance;
struct _Instance
{
// common info
Evas_Object *o_bluez5;
// e_gadcon info
E_Gadcon_Client *gcc;
E_Gadcon_Popup *popup;
// e_gadget info
Evas_Object *pop;
Evas_Object *popcontent;
int id;
E_Gadget_Site_Orient orient;
};
typedef struct _Config Config;
struct _Config
{
Eina_List *adapters;
bluez5 - add device specific options like unlock and force connect i added 2 more device specific options, so i had to move all of the device controls to an expandable button set. it's not brilliant actually. the icons are poor and these probably should become toggle like states rather than a button with an action. it's just not that intuitive. this i think needs more theme styles in elm core theme though, so for now keep what's there. but this was necessary due to the ever expanding set to keep space usage sane. now the 2 features are "force connect" for any device that is discovered and responds to pings - connect to it if not connected. this seems to not always work and maybe this should eventually be removed, but this leads to there needing to be config per device so we now have config storage for that like adapters. the other feature which is much more interesting is the unlock feature. this means if that bt device is around and responds to pings, e will unlock (and only explicit manual locking will lock it), but when that bt device stops responding to pings, e will lock. you could use your phone, or smartwatch or any other bt device you have on your all the time as some unlock device. this required the fixing of the l2ping support in e_sys and i've fixed it to properly work now and added an optional timeout value as input. the unlock feature uses this and it pings bt devices on a frequency that depends on e's powersave state which is dependent on if on ac, or battery and what battery level is if you have the battery module running. a handy feature to have just there at the click of a button. i've kept the printf logging in for now so people trying it out get some semblance of logging and state so they could figure out why things are doing what they do and maybe debug it more easily.
2018-12-15 08:03:41 -08:00
Eina_List *devices;
};
typedef struct _Config_Adapter Config_Adapter;
struct _Config_Adapter
{
const char *addr;
Eina_Bool powered;
Eina_Bool pairable;
};
bluez5 - add device specific options like unlock and force connect i added 2 more device specific options, so i had to move all of the device controls to an expandable button set. it's not brilliant actually. the icons are poor and these probably should become toggle like states rather than a button with an action. it's just not that intuitive. this i think needs more theme styles in elm core theme though, so for now keep what's there. but this was necessary due to the ever expanding set to keep space usage sane. now the 2 features are "force connect" for any device that is discovered and responds to pings - connect to it if not connected. this seems to not always work and maybe this should eventually be removed, but this leads to there needing to be config per device so we now have config storage for that like adapters. the other feature which is much more interesting is the unlock feature. this means if that bt device is around and responds to pings, e will unlock (and only explicit manual locking will lock it), but when that bt device stops responding to pings, e will lock. you could use your phone, or smartwatch or any other bt device you have on your all the time as some unlock device. this required the fixing of the l2ping support in e_sys and i've fixed it to properly work now and added an optional timeout value as input. the unlock feature uses this and it pings bt devices on a frequency that depends on e's powersave state which is dependent on if on ac, or battery and what battery level is if you have the battery module running. a handy feature to have just there at the click of a button. i've kept the printf logging in for now so people trying it out get some semblance of logging and state so they could figure out why things are doing what they do and maybe debug it more easily.
2018-12-15 08:03:41 -08:00
typedef struct _Config_Device Config_Device;
struct _Config_Device
{
const char *addr;
Eina_Bool force_connect;
Eina_Bool unlock;
};
extern Config *ebluez5_config;
E_API extern E_Module_Api e_modapi;
E_API void *e_modapi_init(E_Module *m);
E_API int e_modapi_shutdown(E_Module *m);
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);
bluez5 - add device specific options like unlock and force connect i added 2 more device specific options, so i had to move all of the device controls to an expandable button set. it's not brilliant actually. the icons are poor and these probably should become toggle like states rather than a button with an action. it's just not that intuitive. this i think needs more theme styles in elm core theme though, so for now keep what's there. but this was necessary due to the ever expanding set to keep space usage sane. now the 2 features are "force connect" for any device that is discovered and responds to pings - connect to it if not connected. this seems to not always work and maybe this should eventually be removed, but this leads to there needing to be config per device so we now have config storage for that like adapters. the other feature which is much more interesting is the unlock feature. this means if that bt device is around and responds to pings, e will unlock (and only explicit manual locking will lock it), but when that bt device stops responding to pings, e will lock. you could use your phone, or smartwatch or any other bt device you have on your all the time as some unlock device. this required the fixing of the l2ping support in e_sys and i've fixed it to properly work now and added an optional timeout value as input. the unlock feature uses this and it pings bt devices on a frequency that depends on e's powersave state which is dependent on if on ac, or battery and what battery level is if you have the battery module running. a handy feature to have just there at the click of a button. i've kept the printf logging in for now so people trying it out get some semblance of logging and state so they could figure out why things are doing what they do and maybe debug it more easily.
2018-12-15 08:03:41 -08:00
void ebluez5_device_prop_force_connect_set(const char *address, Eina_Bool enable);
void ebluez5_device_prop_unlock_set(const char *address, Eina_Bool enable);
Config_Device *ebluez5_device_prop_find(const char *address);
void ebluez5_popup_hide(Instance *inst);
Evas_Object *ebluez5_popup_content_add(Evas_Object *base, Instance *inst);
void ebluze5_popup_init(void);
void ebluze5_popup_shutdown(void);
void ebluze5_popup_clear(void);
void ebluez5_popup_adapter_add(Obj *o);
void ebluez5_popup_adapter_del(Obj *o);
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);
void ebluez5_agent_agent_req_pin(Eldbus_Message *msg);
void ebluez5_agent_agent_disp_pin(Eldbus_Message *msg);
void ebluez5_agent_req_pass(Eldbus_Message *msg);
void ebluez5_agent_disp_pass(Eldbus_Message *msg);
void ebluez5_agent_req_confirm(Eldbus_Message *msg);
void ebluez5_agent_req_auth(Eldbus_Message *msg);
void ebluez5_agent_auth_service(Eldbus_Message *msg);
Evas_Object *util_obj_icon_add(Evas_Object *base, Obj *o, int size);
Evas_Object *util_obj_icon_rssi_add(Evas_Object *base, Obj *o, int size);
Evas_Object *util_check_add(Evas_Object *base, const char *text, const char *tip, Eina_Bool state);
Evas_Object *util_button_icon_add(Evas_Object *base, const char *icon, const char *tip);
const char *util_obj_name_get(Obj *o);
#endif