Helixis 1.0
Task Programming API
includes/hlx/events.h
Go to the documentation of this file.
00001 /*
00002 ** Copyright 2009-2011, helixis.org
00003 ** All rights reserved.
00004 **
00005 ** Redistribution and use in source and binary forms, with or without modification, are permitted provided
00006 ** that the following conditions are met:
00007 **
00008 ** Redistributions of source code must retain the above copyright notice, this list of conditions and the
00009 ** following disclaimer.
00010 **
00011 ** Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
00012 ** the following disclaimer in the documentation and/or other materials provided with the distribution.
00013 **
00014 ** Neither the name of the helixis.org nor the names of its contributors may be used to endorse or promote
00015 ** products derived from this software without specific prior written permission.
00016 **
00017 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
00018 ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00019 ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00020 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00021 ** TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00022 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00023 ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00024 ** POSSIBILITY OF SUCH DAMAGE.
00025 */
00026 
00027 #ifndef __HLX_EVENTS_H__
00028 # define __HLX_EVENTS_H__
00029 
00030 #ifdef __cplusplus
00031 extern "C"
00032 {
00033 #endif
00034 
00035 /*
00036 ** MACROS
00037 */
00038 
00039 # define HLX_EVENT_NO_ARGS      (0)
00040 
00041 /*
00042 ** TYPES
00043 */
00044 
00045 typedef struct
00046 {
00047         char    dev_slash_0; /* we have nothing in the manager today. */
00048 }                               hlx_event_manager;
00049 
00050 
00051 /* EVENT ERRORS */
00052 typedef enum
00053 {
00054         EV_ERROR_SUCCESS = 0,
00055         EV_ERROR_INTERNAL_ERROR = 1,
00056         EV_ERROR_MEMORY_EXHAUSTED = 2,
00057         EV_ERROR_ALREADY_EXISTS = 3,
00058         EV_ERROR_UNDEFINED = 4,
00059         EV_ERROR_NO_EVENT_DATA = 5
00060 }               hlx_event_errors;
00061 
00062 /* EVENT ARGS */
00063 typedef struct
00064 {
00065         void*                           event_data;
00066         void*                           user_data;
00067         hlx_task_callback       callback;
00068 }                                               hlx_event_args;
00069 
00070 typedef void                    (*hlx_event_user_callback)(hlx_event_args*);
00071 
00072 /*
00073 ** FUNCTIONS
00074 */
00075 
00082 hlx_event_manager*              hlx_event_manager_create(void);
00088 hlx_event_manager*              hlx_event_get_default_manager(void);
00094 void                                    hlx_event_manager_destroy(hlx_event_manager* manager);
00104 hlx_event_errors                hlx_event_handler_create(hlx_event_manager* manager, unsigned long id, unsigned int size);
00113 hlx_event_errors                hlx_event_handler_destroy(hlx_event_manager* manager, unsigned long id);
00124 hlx_event_errors                hlx_event_register_callback_func(hlx_event_manager* manager, unsigned long id, hlx_event_user_callback func, void* user_data);
00136 hlx_event_errors                hlx_event_register_callback_func_with_group(hlx_event_manager* manager, unsigned long id, hlx_event_user_callback func, void* user_data, hlx_group_id group_id);
00147 hlx_event_errors                hlx_event_register_callback_task(hlx_event_manager* manager, unsigned long id, hlx_task_func task, void* user_data);
00159 hlx_event_errors                hlx_event_register_callback_task_with_group(hlx_event_manager* manager, unsigned long id, hlx_task_func task, void* user_data, hlx_group_id group_id);
00172 hlx_event_errors                hlx_event_notify(hlx_event_manager* manager, unsigned long id, void* event_data);
00173 
00174 #ifdef __cplusplus
00175 }
00176 #endif
00177 
00178 #endif  /* !_HLX_EVENTS_H_ */
00179 
00180 /*
00181 ** END OF FILE
00182 */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines