fota.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2018-2021 Alibaba Group Holding Limited
  3. */
  4. #ifndef __FOTA_H__
  5. #define __FOTA_H__
  6. #include <dbus/dbus.h>
  7. #include <fotax.h>
  8. #define FOTA_DBUS_SERVER "org.fota.server"
  9. #define FOTA_DBUS_PATH "/org/fota/path"
  10. #define FOTA_DBUS_INTERFACE "org.fota.interface"
  11. #define FOTA_DBUS_SIGNAL_VERSION "version" // 带字符串
  12. #define FOTA_DBUS_SIGNAL_DOWNLOAD "download" // 带字符串
  13. #define FOTA_DBUS_SIGNAL_END "end" // 带字符串
  14. #define FOTA_DBUS_SIGNAL_RESTART "restart" // 带字符串
  15. #define FOTA_DBUS_METHOD_CALL_START "start"
  16. #define FOTA_DBUS_METHOD_CALL_STOP "stop"
  17. #define FOTA_DBUS_METHOD_CALL_GET_STATE "getState"
  18. #define FOTA_DBUS_METHOD_CALL_VERSION_CHECK "versionCheck"
  19. #define FOTA_DBUS_METHOD_CALL_DOWNLOAD "download"
  20. #define FOTA_DBUS_METHOD_CALL_RESTART "restart"
  21. #define FOTA_DBUS_METHOD_CALL_SIZE "availableSize"
  22. typedef struct fota {
  23. DBusConnection *conn; /* DBus connection handle */
  24. int watch_rfd;
  25. void *watch;
  26. fotax_t fotax;
  27. void *priv;
  28. } fota_server_t;
  29. fota_server_t *fota_init(void);
  30. void fota_deinit(fota_server_t *fota);
  31. int fota_dbus_init(fota_server_t *fota);
  32. void fota_dbus_deinit(fota_server_t *fota);
  33. void fota_dbus_register_desc(void);
  34. void fota_loop_run(fota_server_t *fota);
  35. #endif