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 void(* | MicrofeedPublisherTimeoutHandler )(void *data) |
typedef void *(* | MicrofeedPublisherAddTimeoutCallback )(MicrofeedPublisher *publisher, unsigned long int interval, MicrofeedPublisherTimeoutHandler handler, void *data, void *user_data) |
typedef void(* | MicrofeedPublisherRemoveTimeoutCallback )(MicrofeedPublisher *publisher, void *timeout_implementation, 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, const char *uid, const char *text, const char *unit, const char *type, const char *length, const char *value) |
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. | |
char * | microfeed_publisher_get_setting_value (MicrofeedPublisher *publisher, const char *uid, const char *default_value) |
Returns a copy of a value of a setting, or if the setting does not exist returns a copy of the given default value. | |
long int | microfeed_publisher_get_setting_value_integer (MicrofeedPublisher *publisher, const char *uid, long int default_value) |
Returns a value of a setting in integer, or if the setting does not exist returns the given 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 void*(* MicrofeedPublisherAddTimeoutCallback)(MicrofeedPublisher *publisher, unsigned long int interval, MicrofeedPublisherTimeoutHandler handler, void *data, void *user_data) |
Definition at line 78 of file microfeedpublisher.h.
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 74 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 60 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 49 of file microfeedpublisher.h.
typedef void(* MicrofeedPublisherNoMoreSubscribersCallback)(MicrofeedPublisher *publisher, void *user_data) |
Definition at line 51 of file microfeedpublisher.h.
typedef void(* MicrofeedPublisherRemoveTimeoutCallback)(MicrofeedPublisher *publisher, void *timeout_implementation, void *user_data) |
Definition at line 80 of file microfeedpublisher.h.
typedef void(* MicrofeedPublisherTimeoutHandler)(void *data) |
Definition at line 76 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 72 of file microfeedpublisher.h.
void microfeed_publisher_add_setting | ( | MicrofeedPublisher * | publisher, | |
const char * | uid, | |||
const char * | text, | |||
const char * | unit, | |||
const char * | type, | |||
const char * | length, | |||
const char * | value | |||
) |
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. |
Definition at line 216 of file microfeedpublisher.c.
References microfeed_feed_get_item(), microfeed_feed_replace_item(), microfeed_item_get_property(), microfeed_item_new(), MICROFEED_ITEM_PROPERTY_NAME_SETTING_LENGTH, MICROFEED_ITEM_PROPERTY_NAME_SETTING_TEXT, MICROFEED_ITEM_PROPERTY_NAME_SETTING_TYPE, MICROFEED_ITEM_PROPERTY_NAME_SETTING_UNIT, MICROFEED_ITEM_PROPERTY_NAME_SETTING_VALUE, microfeed_item_set_property(), and _MicrofeedPublisher::settings_feed.
void microfeed_publisher_free | ( | MicrofeedPublisher * | publisher | ) |
Frees the resources allocated for the publisher.
publisher | Instantiated MicrofeedPublisher. |
Definition at line 190 of file microfeedpublisher.c.
References _MicrofeedPublisher::connection, _MicrofeedPublisher::database_environment, _MicrofeedPublisher::feeds, _MicrofeedPublisher::identifier, _MicrofeedPublisher::image_properties, _MicrofeedPublisher::images_feed, microfeed_database_environment_free(), microfeed_feed_remove_subscriber(), microfeed_store_free(), microfeed_thread_free(), _MicrofeedPublisher::object_path, _MicrofeedPublisher::settings_feed, _MicrofeedPublisher::singleton_update_thread, _MicrofeedPublisher::subscribers, and _MicrofeedPublisher::timeouts.
char* microfeed_publisher_get_setting_value | ( | MicrofeedPublisher * | publisher, | |
const char * | uid, | |||
const char * | default_value | |||
) |
Returns a copy of a value of a setting, or if the setting does not exist returns a copy of 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 251 of file microfeedpublisher.c.
References microfeed_feed_get_item(), microfeed_item_free(), microfeed_item_get_property(), MICROFEED_ITEM_PROPERTY_NAME_SETTING_VALUE, and _MicrofeedPublisher::settings_feed.
long int microfeed_publisher_get_setting_value_integer | ( | MicrofeedPublisher * | publisher, | |
const char * | uid, | |||
long int | default_value | |||
) |
Returns a value of a setting in integer, 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 278 of file microfeedpublisher.c.
References microfeed_feed_get_item(), microfeed_item_free(), microfeed_item_get_property(), MICROFEED_ITEM_PROPERTY_NAME_SETTING_VALUE, and _MicrofeedPublisher::settings_feed.
Referenced by microfeed_publisher_new().
MicrofeedThread* microfeed_publisher_get_singleton_update_thread | ( | MicrofeedPublisher * | publisher | ) |
Definition at line 337 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 132 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_PREFIX_PUBLISHER, microfeed_feed_add_subscriber(), microfeed_feed_get_uri(), microfeed_feed_new(), MICROFEED_FEED_PERMISSION_NONE, MICROFEED_FEED_URI_IMAGES, MICROFEED_FEED_URI_SETTINGS, MICROFEED_ITEM_PROPERTY_NAME_CONTENT_IMAGE, MICROFEED_ITEM_PROPERTY_NAME_USER_IMAGE, microfeed_memory_allocate, microfeed_memory_free(), microfeed_publisher_get_setting_value_integer(), MICROFEED_PUBLISHER_IDENTIFIER_SEPARATOR_CHAR, microfeed_store_compare_keys_direct(), 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, _MicrofeedPublisher::timeouts, and _MicrofeedPublisher::user_data.
MicrofeedThread* microfeed_publisher_queue_thread | ( | MicrofeedPublisher * | publisher, | |
MicrofeedThreadFunction | function, | |||
void * | data | |||
) |
Definition at line 324 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 239 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 310 of file microfeedpublisher.c.
References microfeed_feed_get_item(), microfeed_feed_replace_item(), microfeed_item_free(), MICROFEED_ITEM_PROPERTY_NAME_SETTING_VALUE, 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 329 of file microfeedpublisher.c.
References microfeed_thread_new(), and _MicrofeedPublisher::singleton_update_thread.