Data Structures | |
struct | _MicrofeedProviderCallbacks |
Typedefs | |
typedef struct _MicrofeedProvider | MicrofeedProvider |
An opaque datatype presenting a provider. | |
typedef void(* | MicrofeedProviderNoMorePublishersCallback )(MicrofeedProvider *provider, void *user_data) |
typedef struct _MicrofeedProviderCallbacks | MicrofeedProviderCallbacks |
Functions | |
MicrofeedProvider * | microfeed_provider_new (const char *bus_name, DBusConnection *connection, MicrofeedProviderCallbacks *callbacks, void *user_data) |
Instantiates a new provider. | |
void | microfeed_provider_free (MicrofeedProvider *provider) |
Frees the resources allocated for the provider. | |
void | microfeed_provider_add_publisher (MicrofeedProvider *provider, MicrofeedPublisher *publisher) |
Adds a new publisher. | |
void | microfeed_provider_remove_publisher (MicrofeedProvider *provider, MicrofeedPublisher *publisher) |
Removes an existing publisher. | |
DBusConnection * | microfeed_provider_get_dbus_connection (MicrofeedProvider *provider) |
Returns the DBus connection used by the provider. | |
const char * | microfeed_provider_get_bus_name (MicrofeedProvider *provider) |
Return the well-known DBus bus name reserved by the provider. |
Provider instantiates existing publishers as requested by subscribers. In addition, a new or existing publisher can also be instantiated using microfeed_publisher_new function and then added into Provider with the microfeed_provider_add_publisher function. Provider also monitors name changes in the DBus and informs its publishers by calling microfeed_publisher_remove_subscriber when a potential subscriber has terminated.
typedef struct _MicrofeedProvider MicrofeedProvider |
typedef struct _MicrofeedProviderCallbacks MicrofeedProviderCallbacks |
typedef void(* MicrofeedProviderNoMorePublishersCallback)(MicrofeedProvider *provider, void *user_data) |
Definition at line 39 of file microfeedprovider.h.
void microfeed_provider_add_publisher | ( | MicrofeedProvider * | provider, | |
MicrofeedPublisher * | publisher | |||
) |
Adds a new publisher.
Normally this function is not needed since the provider autimatically instantiates existing publishers when a first message to a non-instantiated publisher is received from a subscriber.
provider | Instantiated MicrofeedProvider. | |
publisher | Instantiated MicrofeedPublisher. |
Definition at line 96 of file microfeedprovider.c.
References microfeed_store_insert(), and _MicrofeedProvider::publishers.
void microfeed_provider_free | ( | MicrofeedProvider * | provider | ) |
Frees the resources allocated for the provider.
Removes the DBUs message filter and releases the DBus bus name.
publisher | Instantiated MicrofeedPublisher. |
Definition at line 74 of file microfeedprovider.c.
References _MicrofeedProvider::bus_name, _MicrofeedProvider::connection, and microfeed_memory_free().
const char* microfeed_provider_get_bus_name | ( | MicrofeedProvider * | provider | ) |
Return the well-known DBus bus name reserved by the provider.
provider | Instantiated MicrofeedProvider. |
Definition at line 127 of file microfeedprovider.c.
References _MicrofeedProvider::bus_name.
DBusConnection* microfeed_provider_get_dbus_connection | ( | MicrofeedProvider * | provider | ) |
Returns the DBus connection used by the provider.
Instantiated | MicrofeedProvider. |
Definition at line 116 of file microfeedprovider.c.
References _MicrofeedProvider::connection.
MicrofeedProvider* microfeed_provider_new | ( | const char * | bus_name, | |
DBusConnection * | connection, | |||
MicrofeedProviderCallbacks * | callbacks, | |||
void * | user_data | |||
) |
Instantiates a new provider.
The provider requests the given DBus bus name and adds a DBus message filter to monitor name owner changes.
Usually there is one provider in the provider implementation. If you use MicrofeedMain as a main loop, you can get the connection with microfeed_main_get_dbus_connection.
bus_name | A well-known DBus bus name for the provider. | |
configuration | Instantiated MicrofeedConfiguration. | |
connection | A DBus connection. | |
callbacks | A callback functions that are needed when a new MicrofeedPublisher is instantiated. | |
user_data | A pointer to user data that is needed when a new MicrofeedPublisher is instantiated. |
Definition at line 36 of file microfeedprovider.c.
References _MicrofeedProvider::bus_name, _MicrofeedProvider::callbacks, _MicrofeedProvider::configuration, _MicrofeedProvider::connection, microfeed_configuration_new(), microfeed_memory_allocate, microfeed_memory_free(), microfeed_publisher_get_object_path(), microfeed_store_new_sorted(), _MicrofeedProvider::publishers, and _MicrofeedProvider::user_data.
void microfeed_provider_remove_publisher | ( | MicrofeedProvider * | provider, | |
MicrofeedPublisher * | publisher | |||
) |
Removes an existing publisher.
provider | Instantiated MicrofeedProvider. | |
publisher | Instantiated MicrofeedPublisher that has previously added with microfeed_provider_add_publisher. |
Definition at line 106 of file microfeedprovider.c.
References microfeed_store_remove(), and _MicrofeedProvider::publishers.