EDBus: Insert the rest of the ghastly figures.
Now we need to start making sense of this all.
This commit is contained in:
parent
e77f558e39
commit
4fb18e5674
|
@ -33,3 +33,8 @@ atexit.register(module_cleanup)
|
|||
include "connection.pxi"
|
||||
include "message.pxi"
|
||||
include "signal_handler.pxi"
|
||||
include "pending.pxi"
|
||||
include "object.pxi"
|
||||
include "proxy.pxi"
|
||||
include "freedesktop.pxi"
|
||||
include "service.pxi"
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
#define EDBUS_NAME_REQUEST_FLAG_ALLOW_REPLACEMENT 0x1 /**< Allow another service to become the primary owner if requested */
|
||||
#define EDBUS_NAME_REQUEST_FLAG_REPLACE_EXISTING 0x2 /**< Request to replace the current primary owner */
|
||||
#define EDBUS_NAME_REQUEST_FLAG_DO_NOT_QUEUE 0x4 /**< If we can not become the primary owner do not place us in the queue */
|
||||
|
||||
# Replies to request for a name
|
||||
#define EDBUS_NAME_REQUEST_REPLY_PRIMARY_OWNER 1 /**< Service has become the primary owner of the requested name */
|
||||
#define EDBUS_NAME_REQUEST_REPLY_IN_QUEUE 2 /**< Service could not become the primary owner and has been placed in the queue */
|
||||
#define EDBUS_NAME_REQUEST_REPLY_EXISTS 3 /**< Service is already in the queue */
|
||||
#define EDBUS_NAME_REQUEST_REPLY_ALREADY_OWNER 4 /**< Service is already the primary owner */
|
||||
|
||||
def name_request(conn, bus, flags, cb, cb_data):
|
||||
EDBus_Pending *edbus_name_request(EDBus_Connection *conn, const char *bus, unsigned int flags, EDBus_Message_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
# Replies to releasing a name
|
||||
#define EDBUS_NAME_RELEASE_REPLY_RELEASED 1 /**< Service was released from the given name */
|
||||
#define EDBUS_NAME_RELEASE_REPLY_NON_EXISTENT 2 /**< The given name does not exist on the bus */
|
||||
#define EDBUS_NAME_RELEASE_REPLY_NOT_OWNER 3 /**< Service is not an owner of the given name */
|
||||
|
||||
def name_release(conn, bus, cb, cb_data):
|
||||
EDBus_Pending *edbus_name_release(EDBus_Connection *conn, const char *bus, EDBus_Message_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def name_owner_get(conn, bus, cb, cb_data):
|
||||
EDBus_Pending *edbus_name_owner_get(EDBus_Connection *conn, const char *bus, EDBus_Message_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def name_owner_has(conn, bus, cb, cb_data):
|
||||
EDBus_Pending *edbus_name_owner_has(EDBus_Connection *conn, const char *bus, EDBus_Message_Cb cb, const void *cb_data)
|
||||
|
||||
def names_list(conn, cb, cb_data):
|
||||
EDBus_Pending *edbus_names_list(EDBus_Connection *conn, EDBus_Message_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1)
|
||||
|
||||
def names_activatable_list(conn, cb, cb_data):
|
||||
EDBus_Pending *edbus_names_activatable_list(EDBus_Connection *conn, EDBus_Message_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1)
|
||||
|
||||
# Replies to service starts
|
||||
#define EDBUS_NAME_START_REPLY_SUCCESS 1 /**< Service was auto started */
|
||||
#define EDBUS_NAME_START_REPLY_ALREADY_RUNNING 2 /**< Service was already running */
|
||||
|
||||
def name_start(conn, bus, flags, cb, cb_data):
|
||||
EDBus_Pending *edbus_name_start(EDBus_Connection *conn, const char *bus, unsigned int flags, EDBus_Message_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
|
||||
typedef void (*EDBus_Name_Owner_Changed_Cb)(void *data, const char *bus, const char *old_id, const char *new_id);
|
||||
|
||||
|
||||
def name_owner_changed_callback_add(conn, bus, cb, cb_data, allow_initial_call):
|
||||
"""
|
||||
|
||||
Add a callback to be called when unique id of a bus name changed.
|
||||
|
||||
This function implicitly calls edbus_name_owner_get() in order to be able to
|
||||
monitor the name. If the only interest is to receive notifications when the
|
||||
name in fact changes, pass EINA_FALSE to @param allow_initial_call so your
|
||||
callback will not be called on first retrieval of name owner. If the
|
||||
initial state is important, pass EINA_TRUE to this parameter.
|
||||
|
||||
@param conn connection
|
||||
@param bus name of bus
|
||||
@param cb callback
|
||||
@param cb_data context data
|
||||
@param allow_initial_call allow call callback with actual id of the bus
|
||||
|
||||
"""
|
||||
void edbus_name_owner_changed_callback_add(EDBus_Connection *conn, const char *bus, EDBus_Name_Owner_Changed_Cb cb, const void *cb_data, Eina_Bool allow_initial_call) EINA_ARG_NONNULL(1, 2, 3)
|
||||
|
||||
def name_owner_changed_callback_del(conn, bus, cb, cb_data):
|
||||
"""
|
||||
|
||||
Remove callback added with edbus_name_owner_changed_callback_add().
|
||||
|
||||
@param conn connection
|
||||
@param bus name of bus
|
||||
@param cb callback
|
||||
@param cb_data context data
|
||||
|
||||
"""
|
||||
void edbus_name_owner_changed_callback_del(EDBus_Connection *conn, const char *bus, EDBus_Name_Owner_Changed_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 2, 3)
|
||||
|
||||
def object_peer_ping(obj, cb, data):
|
||||
EDBus_Pending *edbus_object_peer_ping(EDBus_Object *obj, EDBus_Message_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def object_peer_machine_id_get(obj, cb, data):
|
||||
EDBus_Pending *edbus_object_peer_machine_id_get(EDBus_Object *obj, EDBus_Message_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def object_introspect(obj, cb, data):
|
||||
EDBus_Pending *edbus_object_introspect(EDBus_Object *obj, EDBus_Message_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def proxy_properties_monitor(proxy, enable):
|
||||
"""
|
||||
|
||||
Enable or disable local cache of properties.
|
||||
|
||||
After enable you can call edbus_proxy_property_local_get() or
|
||||
edbus_proxy_property_local_get_all() to get cached properties.
|
||||
|
||||
@note After enable, it will asynchrony get the properties values.
|
||||
|
||||
"""
|
||||
void edbus_proxy_properties_monitor(EDBus_Proxy *proxy, Eina_Bool enable) EINA_ARG_NONNULL(1)
|
||||
|
||||
def proxy_property_get(proxy, name, cb, data):
|
||||
EDBus_Pending *edbus_proxy_property_get(EDBus_Proxy *proxy, const char *name, EDBus_Message_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2, 3)
|
||||
|
||||
def proxy_property_set(proxy, name, sig, value, cb, data):
|
||||
EDBus_Pending *edbus_proxy_property_set(EDBus_Proxy *proxy, const char *name, const char *sig, const void *value, EDBus_Message_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2, 3, 4)
|
||||
|
||||
def proxy_property_get_add(proxy, cb, data):
|
||||
EDBus_Pending *edbus_proxy_property_get_all(EDBus_Proxy *proxy, EDBus_Message_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def proxy_properties_changed_callback_add(proxy, cb, data):
|
||||
EDBus_Signal_Handler *edbus_proxy_properties_changed_callback_add(EDBus_Proxy *proxy, EDBus_Signal_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def proxy_property_local_get(proxy, name):
|
||||
"""
|
||||
|
||||
Return the cached value of property.
|
||||
This only work if you have enable edbus_proxy_properties_monitor or
|
||||
if you have call edbus_proxy_event_callback_add of type
|
||||
EDBUS_PROXY_EVENT_PROPERTY_CHANGED and the property you want had changed.
|
||||
|
||||
"""
|
||||
Eina_Value *edbus_proxy_property_local_get(EDBus_Proxy *proxy, const char *name) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def proxy_property_local_get_all(proxy):
|
||||
"""
|
||||
|
||||
Return a Eina_Hash with all cached properties.
|
||||
This only work if you have enable edbus_proxy_properties_monitor or
|
||||
if you have call edbus_proxy_event_callback_add of type
|
||||
EDBUS_PROXY_EVENT_PROPERTY_CHANGED.
|
||||
|
||||
"""
|
||||
const Eina_Hash *edbus_proxy_property_local_get_all(EDBus_Proxy *proxy) EINA_ARG_NONNULL(1)
|
||||
|
||||
|
||||
def object_managed_objects_get(obj, cb, data):
|
||||
EDBus_Pending *edbus_object_managed_objects_get(EDBus_Object *obj, EDBus_Message_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
cdef void edbus_object_event_cb(void *data, EDBus_Object *obj, void *event_info):
|
||||
pass
|
||||
|
||||
cdef class Object(object):
|
||||
|
||||
cdef EDBus_Object *obj
|
||||
|
||||
def __init__(self, Connection edbus_conn not None, bus, path):
|
||||
"""
|
||||
|
||||
Get an object of the given bus and path.
|
||||
|
||||
:param conn: connection where object belongs
|
||||
:param bus: name of bus or unique-id of who listens for calls of this object
|
||||
:param path: object path of this object
|
||||
|
||||
"""
|
||||
if isinstance(bus, unicode): bus = bus.encode("UTF-8")
|
||||
if isinstance(path, unicode): path = path.encode("UTF-8")
|
||||
self.obj = edbus_object_get(edbus_conn.conn, bus, path)
|
||||
|
||||
def ref(self):
|
||||
"""
|
||||
|
||||
Increase object reference.
|
||||
|
||||
"""
|
||||
# NOTE: Returns EDBus_Object *
|
||||
edbus_object_ref(self.obj)
|
||||
return self
|
||||
|
||||
def unref(self):
|
||||
"""
|
||||
|
||||
Decrease object reference.
|
||||
If reference == 0 object will be freed and all its children.
|
||||
|
||||
"""
|
||||
edbus_object_unref(self.obj)
|
||||
|
||||
def free_cb_add(self, cb, cb_data):
|
||||
"""
|
||||
|
||||
Add a callback function to be called when object will be freed.
|
||||
|
||||
:param cb: callback that will be executed
|
||||
:param data: passed to callback
|
||||
|
||||
"""
|
||||
edbus_object_free_cb_add(self.obj, EDBus_Free_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def free_cb_del(self, cb, cb_data):
|
||||
"""
|
||||
|
||||
Remove callback registered in edbus_object_free_cb_add().
|
||||
|
||||
"""
|
||||
edbus_object_free_cb_del(self.obj, EDBus_Free_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
"""
|
||||
typedef struct _EDBus_Object_Event_Interface_Added
|
||||
{
|
||||
const char *interface;
|
||||
EDBus_Proxy *proxy;
|
||||
} EDBus_Object_Event_Interface_Added;
|
||||
|
||||
typedef struct _EDBus_Object_Event_Interface_Removed
|
||||
{
|
||||
const char *interface;
|
||||
} EDBus_Object_Event_Interface_Removed;
|
||||
|
||||
typedef struct _EDBus_Object_Event_Property_Changed
|
||||
{
|
||||
const char *interface;
|
||||
EDBus_Proxy *proxy;
|
||||
const char *name;
|
||||
const Eina_Value *value;
|
||||
} EDBus_Object_Event_Property_Changed;
|
||||
|
||||
typedef struct _EDBus_Object_Event_Property_Removed
|
||||
{
|
||||
const char *interface;
|
||||
EDBus_Proxy *proxy;
|
||||
const char *name;
|
||||
} EDBus_Object_Event_Property_Removed;
|
||||
"""
|
||||
|
||||
def event_callback_add(self, event_type, cb, cb_data):
|
||||
"""
|
||||
|
||||
Add a callback function to be called when an event of the specified
|
||||
type occurs.
|
||||
|
||||
"""
|
||||
edbus_object_event_callback_add(self.obj, EDBus_Object_Event_Type type, EDBus_Object_Event_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 3)
|
||||
|
||||
def event_callback_del(self, event_type, cb, cb_data):
|
||||
"""
|
||||
|
||||
Remove callback registered in edbus_object_event_callback_add().
|
||||
|
||||
"""
|
||||
edbus_object_event_callback_del(self.obj, EDBus_Object_Event_Type type, EDBus_Object_Event_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 3)
|
||||
|
||||
property connection:
|
||||
def __get__(self):
|
||||
EDBus_Connection *edbus_object_connection_get(self.obj) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
property bus_name:
|
||||
def __get__(self):
|
||||
const char *edbus_object_bus_name_get(self.obj) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
property path:
|
||||
def __get__(self):
|
||||
const char *edbus_object_path_get(self.obj) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
def send(self, msg, cb, cb_data, timeout):
|
||||
"""
|
||||
|
||||
Send a message.
|
||||
|
||||
:param msg: message that will be sent
|
||||
:param cb: if msg is a method call a callback should be passed
|
||||
to be executed when a response arrives
|
||||
:param cb_data: data passed to callback
|
||||
:param timeout: timeout in milliseconds, -1 to default internal value or
|
||||
EDBUS_TIMEOUT_INFINITE for no timeout
|
||||
|
||||
"""
|
||||
EDBus_Pending *edbus_object_send(self.obj, EDBus_Message *msg, EDBus_Message_Cb cb, const void *cb_data, double timeout) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def signal_handler_add(self, interface, member, cb, cb_data):
|
||||
"""
|
||||
|
||||
Add a signal handler.
|
||||
|
||||
:param obj: where the signal is emitted
|
||||
:param interface: of the signal
|
||||
:param member: name of the signal
|
||||
:param cb: callback that will be called when this signal is received
|
||||
:param cb_data: data that will be passed to callback
|
||||
|
||||
"""
|
||||
EDBus_Signal_Handler *edbus_object_signal_handler_add(self.obj, const char *interface, const char *member, EDBus_Signal_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 4)
|
||||
|
||||
def method_call_new(self, interface, member):
|
||||
EDBus_Message *edbus_object_method_call_new(self.obj, const char *interface, const char *member) EINA_ARG_NONNULL(1, 2, 3) EINA_WARN_UNUSED_RESULT
|
|
@ -0,0 +1,47 @@
|
|||
cdef class Pending(object):
|
||||
|
||||
cdef EDBus_Pending *pending
|
||||
|
||||
def data_set(self, key, data):
|
||||
edbus_pending_data_set(self.pending, const char *key, const void *data) EINA_ARG_NONNULL(1, 2, 3)
|
||||
|
||||
def data_get(self, key):
|
||||
void *edbus_pending_data_get(self.pending, const char *key) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def data_del(self, key):
|
||||
void *edbus_pending_data_del(self.pending, const char *key) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def cancel(self):
|
||||
edbus_pending_cancel(self.pending)
|
||||
|
||||
property destination:
|
||||
def __get__(self):
|
||||
const char *edbus_pending_destination_get(self.pending) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
property path:
|
||||
def __get__(self):
|
||||
const char *edbus_pending_path_get(self.pending) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
property interface:
|
||||
def __get__(self):
|
||||
const char *edbus_pending_interface_get(self.pending) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
property method:
|
||||
def __get__(self):
|
||||
const char *edbus_pending_method_get(self.pending) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
def free_cb_add(self, cb, cb_data):
|
||||
"""
|
||||
|
||||
Add a callback function to be called when pending will be freed.
|
||||
|
||||
"""
|
||||
edbus_pending_free_cb_add(self.pending, EDBus_Free_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def free_cb_del(self, cb, cb_data):
|
||||
"""
|
||||
|
||||
Remove callback registered in edbus_pending_free_cb_add().
|
||||
|
||||
"""
|
||||
edbus_pending_free_cb_del(self.pending, EDBus_Free_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
|
@ -0,0 +1,181 @@
|
|||
EDBUS_PROXY_EVENT_PROPERTY_CHANGED
|
||||
EDBUS_PROXY_EVENT_PROPERTY_REMOVED
|
||||
EDBUS_PROXY_EVENT_DEL
|
||||
|
||||
|
||||
cdef class Proxy(object):
|
||||
|
||||
cdef EDBus_Proxy *proxy
|
||||
|
||||
def __init__(self, Object edbus_object not None, interface):
|
||||
"""
|
||||
|
||||
Get a proxy of the following interface name in a EDBus_Object.
|
||||
|
||||
"""
|
||||
self.proxy = edbus_proxy_get(edbus_object.obj, const char *interface) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
def ref(self):
|
||||
"""
|
||||
|
||||
Increase proxy reference.
|
||||
|
||||
"""
|
||||
# NOTE: Returns EDBus_Proxy *
|
||||
edbus_proxy_ref(self.proxy)
|
||||
return self
|
||||
|
||||
def unref(self):
|
||||
"""
|
||||
|
||||
Decrease proxy reference.
|
||||
If reference == 0 proxy will be freed and all your children.
|
||||
|
||||
"""
|
||||
void edbus_proxy_unref(self.proxy) EINA_ARG_NONNULL(1)
|
||||
|
||||
property object:
|
||||
def __get__(self):
|
||||
EDBus_Object *edbus_proxy_object_get(const EDBus_Proxy *proxy) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
property interface:
|
||||
const char *edbus_proxy_interface_get(const EDBus_Proxy *proxy) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
def data_set(self, key, data):
|
||||
void edbus_proxy_data_set(self.proxy, const char *key, const void *data) EINA_ARG_NONNULL(1, 2, 3)
|
||||
|
||||
def data_get(self, key):
|
||||
void *edbus_proxy_data_get(const EDBus_Proxy *proxy, const char *key) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def data_del(self, key):
|
||||
void *edbus_proxy_data_del(self.proxy, const char *key) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def free_cb_add(self, cb, cb_data):
|
||||
"""
|
||||
|
||||
Add a callback function to be called when occurs a event of the
|
||||
type passed.
|
||||
|
||||
"""
|
||||
edbus_proxy_free_cb_add(self.proxy, EDBus_Free_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def free_cb_del(self, cb, cb_data):
|
||||
"""
|
||||
|
||||
Remove callback registered in edbus_proxy_free_cb_add().
|
||||
|
||||
"""
|
||||
edbus_proxy_free_cb_del(self.proxy, EDBus_Free_Cb cb, const void *data) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def method_call_new(self, member):
|
||||
"""
|
||||
|
||||
Constructs a new message to invoke a method on a remote interface.
|
||||
|
||||
"""
|
||||
EDBus_Message *edbus_proxy_method_call_new(self.proxy, const char *member) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
def send(self, msg, cb, cb_data, timeout):
|
||||
"""
|
||||
|
||||
Send a message.
|
||||
|
||||
:param msg: message that will be send
|
||||
:param cb: if msg is a method call a callback should be passed
|
||||
:param cb_data: data passed to callback
|
||||
:param timeout: timeout in milliseconds, -1 to default internal value or
|
||||
EDBUS_TIMEOUT_INFINITE for no timeout
|
||||
|
||||
"""
|
||||
EDBus_Pending *edbus_proxy_send(self.proxy, EDBus_Message *msg, EDBus_Message_Cb cb, const void *cb_data, double timeout) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def call(self, member, cb, cb_data, timeout, signature, *args):
|
||||
"""
|
||||
|
||||
Call a method in proxy.
|
||||
Send a method call to interface that proxy belong with data.
|
||||
|
||||
:param member: method name
|
||||
:param cb: if msg is a method call a callback should be passed
|
||||
to be execute when response arrive
|
||||
:param cb_data: data passed to callback
|
||||
:param timeout: timeout in milliseconds, -1 to default internal value or
|
||||
EDBUS_TIMEOUT_INFINITE for no timeout
|
||||
:param signature: of data that will be send
|
||||
@param ... data value
|
||||
|
||||
@note This function only support basic type to complex types use
|
||||
edbus_message_iter_* functions.
|
||||
|
||||
"""
|
||||
EDBus_Pending *edbus_proxy_call(self.proxy, const char *member, EDBus_Message_Cb cb, const void *cb_data, double timeout, const char *signature, ...) EINA_ARG_NONNULL(1, 2, 6)
|
||||
|
||||
def vcall(self, member, cb, cb_data, timeout, signature, ap):
|
||||
"""
|
||||
|
||||
Call a method in proxy.
|
||||
Send a method call to interface that proxy belong with data.
|
||||
|
||||
:param member: method name
|
||||
:param cb: callback that will be called when response arrive.
|
||||
:param cb_data: data passed to callback
|
||||
:param timeout: timeout in milliseconds, -1 to default internal value or
|
||||
EDBUS_TIMEOUT_INFINITE for no timeout
|
||||
:param signature: of data that will be send
|
||||
:param ap: va_list of data value
|
||||
|
||||
@note This function only support basic type to complex types use
|
||||
edbus_message_iter_* functions.
|
||||
|
||||
"""
|
||||
EDBus_Pending *edbus_proxy_vcall(self.proxy, const char *member, EDBus_Message_Cb cb, const void *cb_data, double timeout, const char *signature, va_list ap) EINA_ARG_NONNULL(1, 2, 6)
|
||||
|
||||
def signal_handler_add(self, member, cb, cb_data):
|
||||
"""
|
||||
|
||||
Add a signal handler.
|
||||
|
||||
:param proxy: interface where the signal is emitted
|
||||
:param member: name of the signal
|
||||
:param cb: callback that will be called when this signal is received
|
||||
:param cb_data: data that will be passed to callback
|
||||
|
||||
"""
|
||||
EDBus_Signal_Handler *edbus_proxy_signal_handler_add(self.proxy, const char *member, EDBus_Signal_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 3)
|
||||
|
||||
"""
|
||||
typedef struct _EDBus_Proxy_Event_Property_Changed
|
||||
{
|
||||
const char *name;
|
||||
const EDBus_Proxy *proxy;
|
||||
const Eina_Value *value;
|
||||
} EDBus_Proxy_Event_Property_Changed;
|
||||
|
||||
typedef struct _EDBus_Proxy_Event_Property_Removed
|
||||
{
|
||||
const char *interface;
|
||||
const EDBus_Proxy *proxy;
|
||||
const char *name;
|
||||
} EDBus_Proxy_Event_Property_Removed;
|
||||
|
||||
typedef void (*EDBus_Proxy_Event_Cb)(void *data, EDBus_Proxy *proxy, void *event_info);
|
||||
"""
|
||||
|
||||
def event_callback_add(self, event_type, cb, cb_data):
|
||||
"""
|
||||
|
||||
Add a callback function to be called when occurs a event of the
|
||||
type passed.
|
||||
|
||||
"""
|
||||
void edbus_proxy_event_callback_add(self.proxy, EDBus_Proxy_Event_Type type, EDBus_Proxy_Event_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 3)
|
||||
|
||||
def event_callback_add(self, event_type, cb, cb_data):
|
||||
"""
|
||||
|
||||
Remove callback registered in edbus_proxy_event_callback_add().
|
||||
|
||||
"""
|
||||
void edbus_proxy_event_callback_del(self.proxy, EDBus_Proxy_Event_Type type, EDBus_Proxy_Event_Cb cb, const void *cb_data) EINA_ARG_NONNULL(1, 3)
|
||||
|
||||
|
|
@ -0,0 +1,266 @@
|
|||
#define EDBUS_METHOD_FLAG_DEPRECATED 1
|
||||
#define EDBUS_METHOD_FLAG_NOREPLY (1 << 1)
|
||||
|
||||
#define EDBUS_SIGNAL_FLAG_DEPRECATED 1
|
||||
|
||||
#define EDBUS_PROPERTY_FLAG_DEPRECATED 1
|
||||
|
||||
typedef struct _EDBus_Arg_Info
|
||||
{
|
||||
const char *signature;
|
||||
const char *name;
|
||||
} EDBus_Arg_Info;
|
||||
|
||||
|
||||
"""
|
||||
|
||||
@brief Used to insert complete types to signature of methods or signals.
|
||||
|
||||
Example: EDBUS_ARGS({"s", "interface"}, {"s", "property"})
|
||||
The signature will be "ss" and each string will have a tag name on
|
||||
introspect XML with the respective name.
|
||||
|
||||
"""
|
||||
#define EDBUS_ARGS(args...) (const EDBus_Arg_Info[]){ args, { NULL, NULL } }
|
||||
|
||||
typedef struct _EDBus_Service_Interface EDBus_Service_Interface;
|
||||
typedef EDBus_Message * (*EDBus_Method_Cb)(self.iface, const EDBus_Message *message);
|
||||
|
||||
|
||||
cdef Eina_Bool edbus_property_get_cb(self.iface, const char *propname, EDBus_Message_Iter *iter, const EDBus_Message *request_msg, EDBus_Message **error):
|
||||
"""
|
||||
|
||||
Callback function to append property value to message.
|
||||
|
||||
@param iface interface of property
|
||||
@param propname name of property
|
||||
@param iter variant iterator in which value must be appended
|
||||
@param request_msg message that request property
|
||||
@param error if a error happen you must set a message error to be send caller
|
||||
|
||||
@return EINA_TRUE if success
|
||||
|
||||
@note request_msg and error arguments are only different from NULL when a
|
||||
client request a property with Properties.Get or Properties.GetAll. Upon
|
||||
calls to edbus_service_property_changed(), this callback will also be called.
|
||||
It's a mistake to return an error in this case because if a property changed,
|
||||
it must have a new value set and it should be able to be read.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
cdef EDBus_Message *edbus_property_set_cb(self.iface, const char *propname, EDBus_Message_Iter *iter, const EDBus_Message *input_msg):
|
||||
"""
|
||||
|
||||
Callback function to set property value from message.
|
||||
|
||||
@param iface interface of property
|
||||
@param propname name of property
|
||||
@param input_msg message call where you have to get value
|
||||
|
||||
@return Message of response, could be a simple method_return, error or NULL to send response later.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
"""
|
||||
typedef struct _EDBus_Method
|
||||
{
|
||||
const char *member;
|
||||
const EDBus_Arg_Info *in;
|
||||
const EDBus_Arg_Info *out;
|
||||
EDBus_Method_Cb cb;
|
||||
unsigned int flags;
|
||||
} EDBus_Method;
|
||||
|
||||
typedef struct _EDBus_Signal
|
||||
{
|
||||
const char *name;
|
||||
const EDBus_Arg_Info *args;
|
||||
unsigned int flags;
|
||||
} EDBus_Signal;
|
||||
|
||||
typedef struct _EDBus_Property
|
||||
{
|
||||
const char *name;
|
||||
const char *type;
|
||||
EDBus_Property_Get_Cb get_func;
|
||||
EDBus_Property_Set_Cb set_func;
|
||||
unsigned int flags;
|
||||
} EDBus_Property;
|
||||
|
||||
typedef struct _EDBus_Service_Interface_Desc
|
||||
{
|
||||
const char *interface; /**< interface name */
|
||||
const EDBus_Method *methods; /**< array of the methods that should be registered in this interface, the last item of array should be filled with NULL */
|
||||
const EDBus_Signal *signals; /**< array of signal that this interface send, the last item of array should be filled with NULL */
|
||||
const EDBus_Property *properties; /**< array of property that this interface have, the last item of array should be filled with NULL */
|
||||
const EDBus_Property_Get_Cb default_get; /**< default get function, if a property don't have a get function this will be used */
|
||||
const EDBus_Property_Set_Cb default_set; /**< default set function, if a property don't have a set function this will be used */
|
||||
} EDBus_Service_Interface_Desc;
|
||||
"""
|
||||
|
||||
cdef class ServiceInterface(object):
|
||||
|
||||
cdef EDBus_Service_Interface *iface
|
||||
|
||||
def __init__(self, conn, path, desc):
|
||||
"""
|
||||
|
||||
@brief Register an interface in the given path and connection.
|
||||
|
||||
@param conn where the interface should listen
|
||||
@param path object path
|
||||
@param desc description of interface
|
||||
|
||||
@return Interface
|
||||
|
||||
"""
|
||||
self.iface = edbus_service_interface_register(EDBus_Connection *conn, const char *path, const EDBus_Service_Interface_Desc *desc) EINA_ARG_NONNULL(1, 2, 3)
|
||||
|
||||
def unregister(self):
|
||||
"""
|
||||
|
||||
@brief Unregister a interface.
|
||||
If this is the last interface of the object path, the object path will be
|
||||
removed too.
|
||||
|
||||
"""
|
||||
void edbus_service_interface_unregister(EDBus_Service_Interface *iface) EINA_ARG_NONNULL(1)
|
||||
|
||||
def object_unregister(self):
|
||||
"""
|
||||
|
||||
@brief Unregister all interfaces of the object path that this interface belongs
|
||||
and the object path.
|
||||
|
||||
"""
|
||||
void edbus_service_object_unregister(EDBus_Service_Interface *iface) EINA_ARG_NONNULL(1)
|
||||
|
||||
property connection:
|
||||
def __get__(self):
|
||||
EDBus_Connection *edbus_service_connection_get(self.iface) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
property path:
|
||||
def __get__(self):
|
||||
const char *edbus_service_object_path_get(self.iface) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
def signal_emit(self, signal_id, *args):
|
||||
"""
|
||||
|
||||
@brief Emit a signal handler of the interface with non-complex types.
|
||||
Each signal handler have a internal id, the first signal handler of
|
||||
interface is = 0 the second = 1 and go on.
|
||||
|
||||
@param iface interface of the signal
|
||||
@param signal_id id of signal
|
||||
@param ... values that will be send on signal
|
||||
|
||||
"""
|
||||
Eina_Bool edbus_service_signal_emit(self.iface, unsigned int signal_id, ...) EINA_ARG_NONNULL(1)
|
||||
|
||||
def signal_new(self, signal_id):
|
||||
"""
|
||||
|
||||
@brief Create signal message.
|
||||
Each signal handler have a internal id, the first signal handler of
|
||||
interface is = 0 the second = 1 and go on.
|
||||
This function is used when the signal has complex types.
|
||||
|
||||
@param iface interface of the signal
|
||||
@param signal_id id of signal
|
||||
|
||||
"""
|
||||
EDBus_Message *edbus_service_signal_new(self.iface, unsigned int signal_id) EINA_ARG_NONNULL(1) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
def signal_send(self, signal_msg):
|
||||
"""
|
||||
|
||||
@brief Send a signal message.
|
||||
|
||||
On success this will call edbus_message_unref() on the @param signal_msg,
|
||||
which is the intended behavior in 99% of the cases. Remember to increment
|
||||
the refcount if you want to keep it alive.
|
||||
|
||||
"""
|
||||
Eina_Bool edbus_service_signal_send(self.iface, EDBus_Message *signal_msg) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def object_data_set(self, key, data):
|
||||
"""
|
||||
|
||||
@brief Store data at object path, this data can be obtained from all interfaces
|
||||
of the same object.
|
||||
|
||||
@param iface interface that belong to the object path where data will
|
||||
be stored
|
||||
@param key to identify data
|
||||
@param data
|
||||
|
||||
"""
|
||||
void edbus_service_object_data_set(EDBus_Service_Interface *iface, const char *key, const void *data) EINA_ARG_NONNULL(1, 2, 3)
|
||||
|
||||
def object_data_get(self, key):
|
||||
"""
|
||||
|
||||
@brief Get data stored in object path.
|
||||
|
||||
@param iface interface that belongs to the object path where data are stored
|
||||
@param key that identify data
|
||||
|
||||
@return pointer to data if found otherwise NULL
|
||||
|
||||
"""
|
||||
void *edbus_service_object_data_get(self.iface, const char *key) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT
|
||||
|
||||
def object_data_del(self, key):
|
||||
"""
|
||||
|
||||
@brief Del data stored in object path.
|
||||
|
||||
@param iface interface that belongs to the object path where data are stored
|
||||
@param key that identify data
|
||||
|
||||
@return pointer to data if found otherwise NULL
|
||||
|
||||
"""
|
||||
void *edbus_service_object_data_del(EDBus_Service_Interface *iface, const char *key) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def property_changed(self, name):
|
||||
"""
|
||||
|
||||
@brief Add property to list of changed properties
|
||||
A DBus.PropertiesChanged signal will be sent in an idler with all properties
|
||||
that have changed.
|
||||
|
||||
@param iface Interface containing the changed property
|
||||
@param name Property name
|
||||
|
||||
"""
|
||||
Eina_Bool edbus_service_property_changed(self.iface, const char *name) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
|
||||
def property_invalidate_set(self, name, is_invalidate):
|
||||
Eina_Bool edbus_service_property_invalidate_set(self.iface, const char *name, Eina_Bool is_invalidate) EINA_ARG_NONNULL(1, 2)
|
||||
|
||||
def object_manager_attach(self):
|
||||
"""
|
||||
|
||||
Attach ObjectManager interface.
|
||||
|
||||
@param iface ObjectManager will be attach in object path of this interface.
|
||||
@return EINA_TRUE if success
|
||||
|
||||
"""
|
||||
Eina_Bool edbus_service_object_manager_attach(EDBus_Service_Interface *iface) EINA_ARG_NONNULL(1)
|
||||
|
||||
def object_manager_detach(self):
|
||||
"""
|
||||
|
||||
Detach ObjectManager interface.
|
||||
|
||||
@param iface ObjectManager of object path of this interface will be detach.
|
||||
@return EINA_TRUE if success
|
||||
|
||||
"""
|
||||
Eina_Bool edbus_service_object_manager_detach(EDBus_Service_Interface *iface) EINA_ARG_NONNULL(1)
|
Loading…
Reference in New Issue