e_bluez_element_print(stderr, element);
return 1;
}
-/* Adapter Commands */
static int
_on_cmd_adapter_register_agent(char *cmd, char *args)
return 1;
}
-
-static int
-_on_cmd_adapter_get_address(char *cmd, char *args)
-{
- const char *address;
- char *next_args;
- E_Bluez_Element *element = _element_from_args(args, &next_args);
-
- if (!element)
- return 1;
-
- if (e_bluez_adapter_address_get(element, &address))
- printf(":::Adapter address = \"%s\"\n", address);
- else
- fputs("ERROR: can't get adapter address\n", stderr);
- return 1;
-}
-
-static int
-_on_cmd_adapter_set_powered(char *cmd, char *args)
-{
- char *next_args;
- bool powered;
- E_Bluez_Element *element = _element_from_args(args, &next_args);
-
- if (!element)
- return 1;
-
- if (!args)
- {
- fputs("ERROR: missing the powered value\n", stderr);
- return 1;
- }
-
- powered = !!atol(next_args);
-
- if (e_bluez_adapter_powered_set
- (element, powered, _method_success_check, "adapter_set_powered"))
- printf(":::Adapter %s Powered set to %hhu\n", element->path, powered);
- else
- fputs("ERROR: can't set device powered\n", stderr);
- return 1;
-}
-
-/* Devices Commands */
-
-static int
-_on_cmd_device_get_name(char *cmd, char *args)
-{
- const char *name;
- char *next_args;
- E_Bluez_Element *element = _element_from_args(args, &next_args);
-
- if (!element)
- return 1;
-
- if (e_bluez_device_name_get(element, &name))
- printf(":::Device name = \"%s\"\n", name);
- else
- fputs("ERROR: can't get device name\n", stderr);
- return 1;
-}
-
static int
_on_input(void *data, Ecore_Fd_Handler *fd_handler)
{
{"manager_get", _on_cmd_manager_get},
{"adapter_register_agent", _on_cmd_adapter_register_agent},
{"adapter_unregister_agent", _on_cmd_adapter_unregister_agent},
- {"adapter_get_address", _on_cmd_adapter_get_address},
- {"adapter_set_powered", _on_cmd_adapter_set_powered},
- {"device_get_name", _on_cmd_device_get_name},
{NULL, NULL}
};
/* Adapter Methods */
EAPI bool e_bluez_adapter_agent_register(E_Bluez_Element *element, const char *object_path, const char *capability, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
EAPI bool e_bluez_adapter_agent_unregister(E_Bluez_Element *element, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
- EAPI bool e_bluez_adapter_address_get(E_Bluez_Element *element, const char **address) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
-
- EAPI bool e_bluez_adapter_powered_set(E_Bluez_Element *profile, bool powered, E_DBus_Method_Return_Cb cb, const void *data) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
-
-
- /* Devices Methods */
- EAPI bool e_bluez_device_name_get(E_Bluez_Element *element, const char **name) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT;
/* Low-Level API:
*
e_bluez.c \
e_bluez_element.c \
e_bluez_manager.c \
-e_bluez_adapter.c \
-e_bluez_device.c
+e_bluez_adapter.c
libebluez_la_LIBADD = \
@EDBUS_LIBS@ @EVAS_LIBS@ \
const char *e_bluez_iface_manager = NULL;
const char *e_bluez_iface_adapter = NULL;
const char *e_bluez_iface_device = NULL;
-const char *e_bluez_prop_address = NULL;
-const char *e_bluez_prop_name = NULL;
-const char *e_bluez_prop_alias = NULL;
-const char *e_bluez_prop_class = NULL;
-const char *e_bluez_prop_icon = NULL;
-const char *e_bluez_prop_paired = NULL;
-const char *e_bluez_prop_trusted = NULL;
-const char *e_bluez_prop_connected = NULL;
-const char *e_bluez_prop_uuids = NULL;
-const char *e_bluez_prop_powered = NULL;
-const char *e_bluez_prop_discoverable = NULL;
-const char *e_bluez_prop_pairable = NULL;
-const char *e_bluez_prop_discoverabletimeout = NULL;
-const char *e_bluez_prop_pairabletimeout = NULL;
-const char *e_bluez_prop_discovering = NULL;
-const char *e_bluez_prop_devices = NULL;
int _e_dbus_bluez_log_dom = -1;
e_bluez_iface_adapter = eina_stringshare_add("org.bluez.Adapter");
if (e_bluez_iface_device == NULL)
e_bluez_iface_device = eina_stringshare_add("org.bluez.Device");
- if (e_bluez_prop_address == NULL)
- e_bluez_prop_address = eina_stringshare_add("Address");
- if (e_bluez_prop_name == NULL)
- e_bluez_prop_name = eina_stringshare_add("Name");
- if (e_bluez_prop_alias == NULL)
- e_bluez_prop_alias = eina_stringshare_add("Alias");
- if (e_bluez_prop_class == NULL)
- e_bluez_prop_class = eina_stringshare_add("Class");
- if (e_bluez_prop_icon == NULL)
- e_bluez_prop_icon = eina_stringshare_add("Icon");
- if (e_bluez_prop_paired == NULL)
- e_bluez_prop_paired = eina_stringshare_add("Paired");
- if (e_bluez_prop_trusted == NULL)
- e_bluez_prop_trusted = eina_stringshare_add("Trusted");
- if (e_bluez_prop_connected == NULL)
- e_bluez_prop_connected = eina_stringshare_add("Connected");
- if (e_bluez_prop_uuids == NULL)
- e_bluez_prop_uuids = eina_stringshare_add("UUIDs");
- if (e_bluez_prop_powered == NULL)
- e_bluez_prop_powered = eina_stringshare_add("Powered");
- if (e_bluez_prop_discoverable == NULL)
- e_bluez_prop_discoverable = eina_stringshare_add("Discoverable");
- if (e_bluez_prop_pairable == NULL)
- e_bluez_prop_pairable = eina_stringshare_add("Pairable");
- if (e_bluez_prop_discoverabletimeout == NULL)
- e_bluez_prop_discoverabletimeout = eina_stringshare_add("DiscoverableTimeout");
- if (e_bluez_prop_pairabletimeout == NULL)
- e_bluez_prop_pairabletimeout = eina_stringshare_add("PairableTimeout");
- if (e_bluez_prop_discovering == NULL)
- e_bluez_prop_discovering = eina_stringshare_add("Discovering");
- if (e_bluez_prop_devices == NULL)
- e_bluez_prop_devices = eina_stringshare_add("Devices");
e_bluez_conn = edbus_conn;
cb_name_owner_changed = e_dbus_signal_handler_add
_stringshare_del(&e_bluez_iface_manager);
_stringshare_del(&e_bluez_iface_adapter);
_stringshare_del(&e_bluez_iface_device);
- _stringshare_del(&e_bluez_prop_address);
- _stringshare_del(&e_bluez_prop_name);
- _stringshare_del(&e_bluez_prop_alias);
- _stringshare_del(&e_bluez_prop_class);
- _stringshare_del(&e_bluez_prop_icon);
- _stringshare_del(&e_bluez_prop_paired);
- _stringshare_del(&e_bluez_prop_trusted);
- _stringshare_del(&e_bluez_prop_connected);
- _stringshare_del(&e_bluez_prop_uuids);
- _stringshare_del(&e_bluez_prop_powered);
- _stringshare_del(&e_bluez_prop_discoverable);
- _stringshare_del(&e_bluez_prop_pairable);
- _stringshare_del(&e_bluez_prop_discoverabletimeout);
- _stringshare_del(&e_bluez_prop_pairabletimeout);
- _stringshare_del(&e_bluez_prop_discovering);
- _stringshare_del(&e_bluez_prop_devices);
return 0;
}
(element, name, object_path, NULL,
&element->_pending.agent_unregister, cb, data);
}
-
-/**
- * Get property "Address" value.
- *
- * If this property isn't found then 0 is returned.
- * If zero is returned, then this call failed and parameter-returned
- * values shall be considered invalid.
- *
- * @param address where to store the property value, must be a pointer
- * to string (const char **), it will not be allocated or
- * copied and references will be valid until element changes,
- * so copy it if you want to use it later.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_bluez_adapter_address_get(E_Bluez_Element *element, const char **address)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(address, 0);
-
- return e_bluez_element_property_get_stringshared
- (element, e_bluez_prop_address, NULL, address);
-}
-
-/**
- * Call method SetProperty("Powered", powered) at the given element on server.
- *
- *
- * @param powered value to set.
- * @param cb function to call when server replies or some error happens.
- * @param data data to give to cb when it is called.
- *
- * @return 1 on success, 0 otherwise.
- */
-bool
-e_bluez_adapter_powered_set(E_Bluez_Element *profile, bool offline, E_DBus_Method_Return_Cb cb, const void *data)
-{
- EINA_SAFETY_ON_NULL_RETURN_VAL(profile, 0);
- return e_bluez_element_property_set_full
- (profile, e_bluez_prop_powered, DBUS_TYPE_BOOLEAN,
- &offline, cb, data);
-}
extern const char *e_bluez_iface_manager;
extern const char *e_bluez_iface_adapter;
extern const char *e_bluez_iface_device;
-extern const char *e_bluez_prop_address;
-extern const char *e_bluez_prop_name;
-extern const char *e_bluez_prop_alias;
-extern const char *e_bluez_prop_class;
-extern const char *e_bluez_prop_icon;
-extern const char *e_bluez_prop_paired;
-extern const char *e_bluez_prop_trusted;
-extern const char *e_bluez_prop_connected;
-extern const char *e_bluez_prop_uuids;
-extern const char *e_bluez_prop_powered;
-extern const char *e_bluez_prop_discoverable;
-extern const char *e_bluez_prop_pairable;
-extern const char *e_bluez_prop_discoverabletimeout;
-extern const char *e_bluez_prop_pairabletimeout;
-extern const char *e_bluez_prop_discovering;
-extern const char *e_bluez_prop_devices;
extern int _e_dbus_bluez_log_dom;