dbus-client.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. *
  3. * Embedded Linux library
  4. *
  5. * Copyright (C) 2011-2014 Intel Corporation. All rights reserved.
  6. * Copyright (C) 2017 Codecoup. All rights reserved.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  21. *
  22. */
  23. #ifndef __ELL_DBUS_CLIENT_H
  24. #define __ELL_DBUS_CLIENT_H
  25. #include <stdbool.h>
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29. struct l_dbus;
  30. struct l_dbus_message;
  31. struct l_dbus_client;
  32. struct l_dbus_proxy;
  33. typedef void (*l_dbus_client_ready_func_t)(struct l_dbus_client *client,
  34. void *user_data);
  35. typedef void (*l_dbus_client_proxy_func_t) (struct l_dbus_proxy *proxy,
  36. void *user_data);
  37. typedef void (*l_dbus_client_proxy_result_func_t) (struct l_dbus_proxy *proxy,
  38. struct l_dbus_message *result,
  39. void *user_data);
  40. typedef void (*l_dbus_client_property_function_t) (struct l_dbus_proxy *proxy,
  41. const char *name,
  42. struct l_dbus_message *msg,
  43. void *user_data);
  44. struct l_dbus_client *l_dbus_client_new(struct l_dbus *dbus,
  45. const char *service, const char *path);
  46. void l_dbus_client_destroy(struct l_dbus_client *client);
  47. bool l_dbus_client_set_connect_handler(struct l_dbus_client *client,
  48. l_dbus_watch_func_t function,
  49. void *user_data,
  50. l_dbus_destroy_func_t destroy);
  51. bool l_dbus_client_set_disconnect_handler(struct l_dbus_client *client,
  52. l_dbus_watch_func_t function,
  53. void *user_data,
  54. l_dbus_destroy_func_t destroy);
  55. bool l_dbus_client_set_ready_handler(struct l_dbus_client *client,
  56. l_dbus_client_ready_func_t function,
  57. void *user_data,
  58. l_dbus_destroy_func_t destroy);
  59. bool l_dbus_client_set_proxy_handlers(struct l_dbus_client *client,
  60. l_dbus_client_proxy_func_t proxy_added,
  61. l_dbus_client_proxy_func_t proxy_removed,
  62. l_dbus_client_property_function_t property_changed,
  63. void *user_data, l_dbus_destroy_func_t destroy);
  64. const char *l_dbus_proxy_get_path(struct l_dbus_proxy *proxy);
  65. const char *l_dbus_proxy_get_interface(struct l_dbus_proxy *proxy);
  66. bool l_dbus_proxy_get_property(struct l_dbus_proxy *proxy, const char *name,
  67. const char *signature, ...);
  68. bool l_dbus_proxy_set_property(struct l_dbus_proxy *proxy,
  69. l_dbus_client_proxy_result_func_t result,
  70. void *user_data, l_dbus_destroy_func_t destroy,
  71. const char *name, const char *signature, ...);
  72. uint32_t l_dbus_proxy_method_call(struct l_dbus_proxy *proxy,
  73. const char *method,
  74. l_dbus_message_func_t setup,
  75. l_dbus_client_proxy_result_func_t reply,
  76. void *user_data,
  77. l_dbus_destroy_func_t destroy);
  78. #ifdef __cplusplus
  79. }
  80. #endif
  81. #endif /* __ELL_DBUS_CLIENT_H */