map-event.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. *
  4. * OBEX
  5. *
  6. * Copyright (C) 2013 BMW Car IT GmbH. All rights reserved.
  7. *
  8. *
  9. */
  10. struct obc_session;
  11. enum map_event_type {
  12. MAP_ET_NEW_MESSAGE,
  13. MAP_ET_DELIVERY_SUCCESS,
  14. MAP_ET_SENDING_SUCCESS,
  15. MAP_ET_DELIVERY_FAILURE,
  16. MAP_ET_SENDING_FAILURE,
  17. MAP_ET_MEMORY_FULL,
  18. MAP_ET_MEMORY_AVAILABLE,
  19. MAP_ET_MESSAGE_DELETED,
  20. MAP_ET_MESSAGE_SHIFT
  21. };
  22. struct map_event {
  23. enum map_event_type type;
  24. uint64_t handle;
  25. char *folder;
  26. char *old_folder;
  27. char *msg_type;
  28. char *datetime;
  29. char *subject;
  30. char *sender_name;
  31. char *priority;
  32. };
  33. /* Handle notification in map client.
  34. *
  35. * event: Event report.
  36. *
  37. * Callback shall be called for every received event.
  38. */
  39. typedef void (*map_event_cb) (struct map_event *event, void *user_data);
  40. /* Registers client notification handler callback for events that are
  41. * addressed to the given mas instance id for the given device.
  42. */
  43. bool map_register_event_handler(struct obc_session *session, int mas_id,
  44. map_event_cb cb, void *user_data);
  45. /* Unregisters client notification handler callback.
  46. */
  47. void map_unregister_event_handler(struct obc_session *session, int mas_id);
  48. /* Dispatch notification to a registered notification handler callback.
  49. */
  50. void map_dispatch_event(int mas_id, const char *device,
  51. struct map_event *event);