aiengine.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef AIENGINE_H_
  2. #define AIENGINE_H_
  3. #define AIENGINE_VERSION "2.2.8"
  4. #if (!(defined AIENGINE_CALL) || !(defined AIENGINE_IMPORT_OR_EXPORT))
  5. # if defined __WIN32__ || defined _WIN32 || defined _WIN64
  6. # define AIENGINE_CALL __stdcall
  7. # ifdef AIENGINE_IMPLEMENTION
  8. # define AIENGINE_IMPORT_OR_EXPORT __declspec(dllexport)
  9. # else
  10. # define AIENGINE_IMPORT_OR_EXPORT __declspec(dllimport)
  11. # endif
  12. # else
  13. # define AIENGINE_CALL
  14. # define AIENGINE_IMPORT_OR_EXPORT __attribute ((visibility("default")))
  15. # endif
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. enum {
  21. AIENGINE_MESSAGE_TYPE_JSON = 1,
  22. AIENGINE_MESSAGE_TYPE_BIN
  23. };
  24. #define AIENGINE_GET_VERSION AIENGINE_OPT_GET_VERSION
  25. #define AIENGINE_GET_MODULES AIENGINE_OPT_GET_MODULES
  26. #define AIENGINE_GET_TRAFFIC AIENGINE_OPT_GET_TRAFFIC
  27. #define AIENGINE_SET_WIFI_STATUS AIENGINE_OPT_SET_WIFI_STATUS
  28. #define AIENGINE_GET_PROVISION AIENGINE_OPT_GET_PROVISION
  29. #define AIENGINE_GET_SERIAL_NUMBER AIENGINE_OPT_GET_SERIAL_NUMBER
  30. #define AIENGINE_SET_AILAS_ADDRESS AIENGINE_OPT_SET_AILAS_ADDRESS
  31. enum {
  32. AIENGINE_OPT_INVALID = 0,
  33. AIENGINE_OPT_GET_VERSION,
  34. AIENGINE_OPT_GET_MODULES,
  35. AIENGINE_OPT_GET_TRAFFIC,
  36. AIENGINE_OPT_SET_WIFI_STATUS,
  37. AIENGINE_OPT_GET_PROVISION,
  38. AIENGINE_OPT_GET_SERIAL_NUMBER,
  39. AIENGINE_OPT_SET_AILAS_ADDRESS,
  40. AIENGINE_OPT_MAX
  41. };
  42. struct aiengine;
  43. typedef int (AIENGINE_CALL *aiengine_callback)(const void *usrdata, const char *id, int type, const void *message, int size);
  44. AIENGINE_IMPORT_OR_EXPORT struct aiengine *AIENGINE_CALL aiengine_new(const char *cfg);
  45. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_delete(struct aiengine *engine);
  46. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_start(struct aiengine *engine, const char *param, char id[64], aiengine_callback callback, const void *usrdata);
  47. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_feed(struct aiengine *engine, const void *data, int size);
  48. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_stop(struct aiengine *engine);
  49. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_redo(struct aiengine *engine, char id[64], aiengine_callback callback, const void *usrdata);
  50. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_log(struct aiengine *engine, const char *log);
  51. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_get_device_id(char device_id[64]);
  52. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_cancel(struct aiengine *engine);
  53. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_opt(struct aiengine *engine, int opt, char *data, int size);
  54. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_get_last_error_code();
  55. AIENGINE_IMPORT_OR_EXPORT int AIENGINE_CALL aiengine_get_last_sub_error_code();
  56. AIENGINE_IMPORT_OR_EXPORT const char *AIENGINE_CALL aiengine_get_last_error_text();
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif