events.h 590 B

1234567891011121314151617181920212223242526
  1. /*
  2. * events.h
  3. *
  4. * Created on: Jan 5, 2018
  5. * Author: Philipp Hinz
  6. */
  7. #ifndef EVENTS_H_
  8. #define EVENTS_H_
  9. #define EVENT_LENGTH 20 /*< Maximum length of an event */
  10. struct event_t {
  11. const char *event;
  12. void *data = NULL;
  13. int len = 0;
  14. };
  15. void event_subscribe(const char *event, void (*handler)(event_t *), const char *subscriber);
  16. void event_trigger(event_t *event);
  17. void event_trigger(char *event);
  18. void event_trigger(const char *event);
  19. void event_trigger(const char *event, void *data, int len);
  20. void event_trigger(char *event, void *data, int len);
  21. #endif /* EVENTS_H_ */