diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-03-14 23:15:16 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-03-14 23:36:30 +0100 |
commit | 470989bd708d9a425dbbf2d83b8fcbd0a8d0f488 (patch) | |
tree | f3bef37bc0f8ff7da4beddad9903209ced1bc25a /apps/plugin.h | |
parent | 50f0dd80d660b332a1739e07a630c2cef1b678c6 (diff) |
events: Rework event subsystem (add_event, send_event) to be more versatile.
add_event_ex is added that takes an extra user_data pointer. This pointer is
passed to the callback (add_event and add_event_ex have slightly different
callbacks types). All callbacks also get the event id passed. Events added
with add_event_ex must be removed with remove_event_ex because the user_data
pointer must match in addition to the callback pointer.
On the other add_event is simplified to omit the oneshort parameter which
was almost always false (still there with add_event_ex).
As a side effect the ata_idle_notify callbacks are changed as well, they
do not take a data parameter anymore which was always NULL anyway.
This commit also adds some documentation to events.h
Change-Id: I13e29a0f88ef908f175b376d83550f9e0231f772
Diffstat (limited to 'apps/plugin.h')
-rw-r--r-- | apps/plugin.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/plugin.h b/apps/plugin.h index ffdfa8fb77..874f6e0069 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -160,12 +160,12 @@ void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 227 +#define PLUGIN_API_VERSION 228 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 227 +#define PLUGIN_MIN_API_VERSION 228 /* plugin return codes */ /* internal returns start at 0x100 to make exit(1..255) work */ @@ -450,8 +450,8 @@ struct plugin_api { void (*storage_spin)(void); void (*storage_spindown)(int seconds); #if USING_STORAGE_CALLBACK - void (*register_storage_idle_func)(void (*function)(void *data)); - void (*unregister_storage_idle_func)(void (*function)(void *data), bool run); + void (*register_storage_idle_func)(void (*function)(void)); + void (*unregister_storage_idle_func)(void (*function)(void), bool run); #endif /* USING_STORAGE_CALLBACK */ void (*reload_directory)(void); char *(*create_numbered_filename)(char *buffer, const char *path, @@ -569,8 +569,8 @@ struct plugin_api { void (*profile_func_exit)(void *this_fn, void *call_site); #endif /* event api */ - bool (*add_event)(unsigned short id, bool oneshot, void (*handler)(void *data)); - void (*remove_event)(unsigned short id, void (*handler)(void *data)); + bool (*add_event)(unsigned short id, void (*handler)(unsigned short id, void *data)); + void (*remove_event)(unsigned short id, void (*handler)(unsigned short id, void *data)); void (*send_event)(unsigned short id, void *data); #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |