e_dbus/bluez: add support to register/unregister adapters agents
[framework/uifw/edbus.git] / src / lib / bluez / e_bluez_adapter.c
1 #include "e_bluez_private.h"
2
3 /**
4  * Register new agent for handling user requests.
5  *
6  * Call method RegisterAgent(object) on server in order to
7  * register new agent for handling user requests.
8  *
9  * @param element adapter's element
10  * @param object_path object to be registered.
11  * @param capability input/output agent capabilities
12  * @param cb function to call when server replies or some error happens.
13  * @param data data to give to cb when it is called.
14  *
15  * @return 1 on success, 0 otherwise.
16  */
17 bool
18 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)
19 {
20    const char name[] = "RegisterAgent";
21
22    EINA_SAFETY_ON_NULL_RETURN_VAL(object_path, 0);
23
24    return e_bluez_element_call_with_path_and_string
25      (element, name, object_path, capability, NULL,
26       &element->_pending.agent_register, cb, data);
27 }
28
29 /**
30  * Unregister an existing agent.
31  *
32  * Call method UnregisterAgent(object) on server in order to
33  * unregister an existing agent.
34  *
35  * @param element adapter's element
36  * @param object_path agent to be unregistered.
37  * @param cb function to call when server replies or some error happens.
38  * @param data data to give to cb when it is called.
39  *
40  * @return 1 on success, 0 otherwise.
41  */
42 bool
43 e_bluez_adapter_agent_unregister(E_Bluez_Element *element, const char *object_path, E_DBus_Method_Return_Cb cb, const void *data)
44 {
45    const char name[] = "UnregisterAgent";
46
47    EINA_SAFETY_ON_NULL_RETURN_VAL(object_path, 0);
48
49    return e_bluez_element_call_with_path
50      (element, name, object_path, NULL,
51       &element->_pending.agent_unregister, cb, data);
52 }