dbus-service.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. *
  3. * Embedded Linux library
  4. *
  5. * Copyright (C) 2011-2014 Intel Corporation. All rights reserved.
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. */
  22. #ifndef __ELL_SERVICE_H
  23. #define __ELL_SERVICE_H
  24. #include <stdint.h>
  25. #include <stdbool.h>
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. struct l_dbus;
  30. struct l_dbus_interface;
  31. struct l_dbus_message;
  32. enum l_dbus_method_flag {
  33. L_DBUS_METHOD_FLAG_DEPRECATED = 1,
  34. L_DBUS_METHOD_FLAG_NOREPLY = 2,
  35. L_DBUS_METHOD_FLAG_ASYNC = 4,
  36. };
  37. enum l_dbus_signal_flag {
  38. L_DBUS_SIGNAL_FLAG_DEPRECATED = 1,
  39. };
  40. enum l_dbus_property_flag {
  41. L_DBUS_PROPERTY_FLAG_DEPRECATED = 1,
  42. L_DBUS_PROPERTY_FLAG_AUTO_EMIT = 2,
  43. };
  44. typedef struct l_dbus_message *(*l_dbus_interface_method_cb_t) (struct l_dbus *,
  45. struct l_dbus_message *message,
  46. void *user_data);
  47. typedef void (*l_dbus_property_complete_cb_t) (struct l_dbus *,
  48. struct l_dbus_message *,
  49. struct l_dbus_message *error);
  50. typedef struct l_dbus_message *(*l_dbus_property_set_cb_t) (struct l_dbus *,
  51. struct l_dbus_message *message,
  52. struct l_dbus_message_iter *new_value,
  53. l_dbus_property_complete_cb_t complete,
  54. void *user_data);
  55. typedef bool (*l_dbus_property_get_cb_t) (struct l_dbus *,
  56. struct l_dbus_message *message,
  57. struct l_dbus_message_builder *builder,
  58. void *user_data);
  59. bool l_dbus_interface_method(struct l_dbus_interface *interface,
  60. const char *name, uint32_t flags,
  61. l_dbus_interface_method_cb_t cb,
  62. const char *return_sig, const char *param_sig,
  63. ...);
  64. bool l_dbus_interface_signal(struct l_dbus_interface *interface,
  65. const char *name, uint32_t flags,
  66. const char *signature, ...);
  67. bool l_dbus_interface_property(struct l_dbus_interface *interface,
  68. const char *name, uint32_t flags,
  69. const char *signature,
  70. l_dbus_property_get_cb_t getter,
  71. l_dbus_property_set_cb_t setter);
  72. bool l_dbus_property_changed(struct l_dbus *dbus, const char *path,
  73. const char *interface, const char *property);
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* __ELL_DBUS_SERVICE_H */