Data Structures | |
struct | _MicrofeedPublisherCallbacks |
Functions that are called when a publisher receives a message from a subscriber. More... | |
Typedefs | |
typedef struct _MicrofeedPublisher | MicrofeedPublisher |
Opaque data type representing a publisher. | |
typedef MicrofeedFeed *(* | MicrofeedPublisherInstantiateFeedCallback )(MicrofeedPublisher *publisher, const char *uri, void *user_data) |
A function that is called when a subscriber subscribes a feed that is not previously subscribed by any subscriber. | |
typedef void(* | MicrofeedPublisherNoMoreSubscribersCallback )(MicrofeedPublisher *publisher, void *user_data) |
typedef void(* | MicrofeedPublisherInitializeSettingsCallback )(MicrofeedPublisher *publisher, void *user_data) |
A function that is called after a new publisher is created. | |
typedef int(* | MicrofeedPublisherUpdateSettingCallback )(MicrofeedPublisher *publisher, const char *key, const char *value, void *user_data) |
A function that is called when a subscriber tries to update a setting. | |
typedef MicrofeedError *(* | MicrofeedPublisherDownloadImageCallback )(MicrofeedPublisher *publisher, const char *uid, void **data, size_t *length, void *user_data) |
typedef struct _MicrofeedPublisherCallbacks | MicrofeedPublisherCallbacks |
Functions that are called when a publisher receives a message from a subscriber. | |
Functions | |
MicrofeedPublisher * | microfeed_publisher_new (const char *unique_identifier, const char *directory, DBusConnection *connection, MicrofeedPublisherCallbacks *callbacks, void *user_data) |
Instantiates a new publisher. | |
void | microfeed_publisher_free (MicrofeedPublisher *publisher) |
Frees the resources allocated for the publisher. | |
void | microfeed_publisher_add_setting (MicrofeedPublisher *publisher, MicrofeedItem *item) |
Adds a new setting or changes other properties than the value of an existing setting in the org.microfeed.Publisher.Settings feed. | |
void | microfeed_publisher_remove_setting (MicrofeedPublisher *publisher, const char *uid) |
Removes a setting from the org.microfeed.Publisher.Settings feed. | |
const char * | microfeed_publisher_get_setting_value (MicrofeedPublisher *publisher, const char *uid, const char *default_value) |
Returns a value of a setting, or if the setting does not exist returns the given default value. | |
long int | microfeed_publisher_get_setting_value_integer (MicrofeedPublisher *publisher, const char *uid, long int default_value) |
int | microfeed_publisher_set_setting_value (MicrofeedPublisher *publisher, const char *uid, const char *value) |
Sets the value of a setting if the setting exists. | |
MicrofeedThread * | microfeed_publisher_queue_thread (MicrofeedPublisher *publisher, MicrofeedThreadFunction function, void *data) |
MicrofeedThread * | microfeed_publisher_start_singleton_update_thread (MicrofeedPublisher *publisher, MicrofeedThreadFunction function, void *user_data) |
MicrofeedThread * | microfeed_publisher_get_singleton_update_thread (MicrofeedPublisher *publisher) |
Publisher can be used as a stand-alone module, but it is suggested that an application uses MicrofeedProvider instead and leaves the instantiation of specific publishers to the provider.
typedef struct _MicrofeedPublisher MicrofeedPublisher |
typedef struct _MicrofeedPublisherCallbacks MicrofeedPublisherCallbacks |
Functions that are called when a publisher receives a message from a subscriber.
typedef MicrofeedError*(* MicrofeedPublisherDownloadImageCallback)(MicrofeedPublisher *publisher, const char *uid, void **data, size_t *length, void *user_data) |
Definition at line 72 of file microfeedpublisher.h.
typedef void(* MicrofeedPublisherInitializeSettingsCallback)(MicrofeedPublisher *publisher, void *user_data) |
A function that is called after a new publisher is created.
The function call is a consequence of the CreatePublisher DBus Message.
This function should initialize settings by calling microfeed_publisher_add_setting function.
Definition at line 58 of file microfeedpublisher.h.
typedef MicrofeedFeed*(* MicrofeedPublisherInstantiateFeedCallback)(MicrofeedPublisher *publisher, const char *uri, void *user_data) |
A function that is called when a subscriber subscribes a feed that is not previously subscribed by any subscriber.
The function call is a consequence of the SubscribeFeed DBus Message.
Note that this function just instantiates a MicrofeedFeed instance with suitable callbacks rather than creates a whole new feed into a service.
Definition at line 47 of file microfeedpublisher.h.
typedef void(* MicrofeedPublisherNoMoreSubscribersCallback)(MicrofeedPublisher *publisher, void *user_data) |
Definition at line 49 of file microfeedpublisher.h.
typedef int(* MicrofeedPublisherUpdateSettingCallback)(MicrofeedPublisher *publisher, const char *key, const char *value, void *user_data) |
A function that is called when a subscriber tries to update a setting.
This function call is a consequence of the ModifyItem DBus Message targeted at org.microfeed.Publisher.Settings feed.
The setting value is actually changed only if this function returns true. In other case, the error message is automatically generated.
Definition at line 70 of file microfeedpublisher.h.
void microfeed_publisher_add_setting | ( | MicrofeedPublisher * | publisher, | |
MicrofeedItem * | item | |||
) |
Adds a new setting or changes other properties than the value of an existing setting in the org.microfeed.Publisher.Settings feed.
publisher | Instantiated MicrofeedPublisher. | |
item | A new setting or an existing setting with a new value property. |
Definition at line 182 of file microfeedpublisher.c.
References microfeed_feed_get_item(), microfeed_feed_replace_item(), microfeed_item_get_property(), microfeed_item_get_uid(), microfeed_item_set_property(), and _MicrofeedPublisher::settings_feed.
void microfeed_publisher_free | ( | MicrofeedPublisher * | publisher | ) |
Frees the resources allocated for the publisher.
TODO: This function is not yet implemented.
publisher | Instantiated MicrofeedPublisher. |
Definition at line 171 of file microfeedpublisher.c.
const char* microfeed_publisher_get_setting_value | ( | MicrofeedPublisher * | publisher, | |
const char * | uid, | |||
const char * | default_value | |||
) |
Returns a value of a setting, or if the setting does not exist returns the given default value.
publisher | Instantiated MicrofeedPublisher. | |
key | The unique identifier of the setting item. | |
default_value | The value that is returned if the setting does not exist. |
Definition at line 209 of file microfeedpublisher.c.
References microfeed_feed_get_item(), microfeed_item_free(), microfeed_item_get_property(), and _MicrofeedPublisher::settings_feed.
long int microfeed_publisher_get_setting_value_integer | ( | MicrofeedPublisher * | publisher, | |
const char * | uid, | |||
long int | default_value | |||
) |
Definition at line 225 of file microfeedpublisher.c.
References microfeed_feed_get_item(), microfeed_item_free(), microfeed_item_get_property(), and _MicrofeedPublisher::settings_feed.
Referenced by microfeed_publisher_new().
MicrofeedThread* microfeed_publisher_get_singleton_update_thread | ( | MicrofeedPublisher * | publisher | ) |
Definition at line 284 of file microfeedpublisher.c.
References _MicrofeedPublisher::singleton_update_thread.
Referenced by microfeed_feed_stop_update(), and microfeed_feed_update().
MicrofeedPublisher* microfeed_publisher_new | ( | const char * | publisher_identifier, | |
const char * | directory, | |||
DBusConnection * | connection, | |||
MicrofeedPublisherCallbacks * | callbacks, | |||
void * | user_data | |||
) |
Instantiates a new publisher.
The publisher registers a DBus object path /org/microfeed/publisher/<publisher_identifier> and creates or opens a database environment in the given directory using publisher_identifier as a name.
publisher_identifier | A string containing unique publisher identifier. | |
directory | A directory where the database environment is created or opened (if exists). | |
connection | A DBus connection. | |
callbacks | Functions that are called when a publisher receives a message from a subscriber. | |
user_data | A pointer to user data that is given as a parameter when a callback function is called. |
Definition at line 114 of file microfeedpublisher.c.
References _MicrofeedPublisher::callbacks, _MicrofeedPublisher::connection, _MicrofeedPublisher::database_environment, _MicrofeedPublisher::feeds, _MicrofeedPublisher::identifier, _MicrofeedPublisher::image_properties, _MicrofeedPublisher::images_feed, microfeed_database_environment_new(), MICROFEED_DBUS_OBJECT_PATH_PUBLISHER, microfeed_feed_add_subscriber(), microfeed_feed_get_uri(), microfeed_feed_new(), MICROFEED_FEED_URI_IMAGES, MICROFEED_FEED_URI_SETTINGS, microfeed_memory_allocate, microfeed_memory_free(), microfeed_publisher_get_setting_value_integer(), microfeed_store_insert(), microfeed_store_new_sorted(), microfeed_thread_pool_new_with_exit_callback(), microfeed_util_string_concatenate(), _MicrofeedPublisher::object_path, _MicrofeedPublisher::settings_feed, _MicrofeedPublisher::subscribers, _MicrofeedPublisher::thread_pool, and _MicrofeedPublisher::user_data.
MicrofeedThread* microfeed_publisher_queue_thread | ( | MicrofeedPublisher * | publisher, | |
MicrofeedThreadFunction | function, | |||
void * | data | |||
) |
Definition at line 271 of file microfeedpublisher.c.
References microfeed_thread_pool_queue_thread(), and _MicrofeedPublisher::thread_pool.
Referenced by microfeed_feed_call_modify_item_callback(), microfeed_feed_republish(), microfeed_feed_send_item_data(), and microfeed_feed_update().
void microfeed_publisher_remove_setting | ( | MicrofeedPublisher * | publisher, | |
const char * | uid | |||
) |
Removes a setting from the org.microfeed.Publisher.Settings feed.
publisher | Instantiated MicrofeedPublisher. | |
uid | The unique identifier of the setting item. |
Definition at line 197 of file microfeedpublisher.c.
References microfeed_feed_remove_item(), and _MicrofeedPublisher::settings_feed.
int microfeed_publisher_set_setting_value | ( | MicrofeedPublisher * | publisher, | |
const char * | uid, | |||
const char * | value | |||
) |
Sets the value of a setting if the setting exists.
publisher | Instantiated MicrofeedPublisher. | |
uid | The unique identified of the setting item. | |
value | The new value for the setting. |
Definition at line 257 of file microfeedpublisher.c.
References microfeed_feed_get_item(), microfeed_feed_replace_item(), microfeed_item_free(), microfeed_item_set_property(), and _MicrofeedPublisher::settings_feed.
MicrofeedThread* microfeed_publisher_start_singleton_update_thread | ( | MicrofeedPublisher * | publisher, | |
MicrofeedThreadFunction | function, | |||
void * | user_data | |||
) |
Definition at line 276 of file microfeedpublisher.c.
References microfeed_thread_new(), and _MicrofeedPublisher::singleton_update_thread.