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) | |
download | rockbox-470989bd708d9a425dbbf2d83b8fcbd0a8d0f488.tar.gz rockbox-470989bd708d9a425dbbf2d83b8fcbd0a8d0f488.zip |
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); | |||
160 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ | 160 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
161 | 161 | ||
162 | /* increase this every time the api struct changes */ | 162 | /* increase this every time the api struct changes */ |
163 | #define PLUGIN_API_VERSION 227 | 163 | #define PLUGIN_API_VERSION 228 |
164 | 164 | ||
165 | /* update this to latest version if a change to the api struct breaks | 165 | /* update this to latest version if a change to the api struct breaks |
166 | backwards compatibility (and please take the opportunity to sort in any | 166 | backwards compatibility (and please take the opportunity to sort in any |
167 | new function which are "waiting" at the end of the function table) */ | 167 | new function which are "waiting" at the end of the function table) */ |
168 | #define PLUGIN_MIN_API_VERSION 227 | 168 | #define PLUGIN_MIN_API_VERSION 228 |
169 | 169 | ||
170 | /* plugin return codes */ | 170 | /* plugin return codes */ |
171 | /* internal returns start at 0x100 to make exit(1..255) work */ | 171 | /* internal returns start at 0x100 to make exit(1..255) work */ |
@@ -450,8 +450,8 @@ struct plugin_api { | |||
450 | void (*storage_spin)(void); | 450 | void (*storage_spin)(void); |
451 | void (*storage_spindown)(int seconds); | 451 | void (*storage_spindown)(int seconds); |
452 | #if USING_STORAGE_CALLBACK | 452 | #if USING_STORAGE_CALLBACK |
453 | void (*register_storage_idle_func)(void (*function)(void *data)); | 453 | void (*register_storage_idle_func)(void (*function)(void)); |
454 | void (*unregister_storage_idle_func)(void (*function)(void *data), bool run); | 454 | void (*unregister_storage_idle_func)(void (*function)(void), bool run); |
455 | #endif /* USING_STORAGE_CALLBACK */ | 455 | #endif /* USING_STORAGE_CALLBACK */ |
456 | void (*reload_directory)(void); | 456 | void (*reload_directory)(void); |
457 | char *(*create_numbered_filename)(char *buffer, const char *path, | 457 | char *(*create_numbered_filename)(char *buffer, const char *path, |
@@ -569,8 +569,8 @@ struct plugin_api { | |||
569 | void (*profile_func_exit)(void *this_fn, void *call_site); | 569 | void (*profile_func_exit)(void *this_fn, void *call_site); |
570 | #endif | 570 | #endif |
571 | /* event api */ | 571 | /* event api */ |
572 | bool (*add_event)(unsigned short id, bool oneshot, void (*handler)(void *data)); | 572 | bool (*add_event)(unsigned short id, void (*handler)(unsigned short id, void *data)); |
573 | void (*remove_event)(unsigned short id, void (*handler)(void *data)); | 573 | void (*remove_event)(unsigned short id, void (*handler)(unsigned short id, void *data)); |
574 | void (*send_event)(unsigned short id, void *data); | 574 | void (*send_event)(unsigned short id, void *data); |
575 | 575 | ||
576 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) | 576 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |