MqttDef.h 1000 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stddef.h>
  4. #include <MqttBuildInfo.h>
  5. #if defined _WIN32 || defined _WIN64
  6. #define MQTT_DECL_EXPORT __declspec(dllexport)
  7. #define MQTT_DECL_IMPORT __declspec(dllimport)
  8. #else
  9. #define MQTT_DECL_EXPORT __attribute__((visibility("default")))
  10. #define MQTT_DECL_IMPORT
  11. #endif
  12. #ifdef USE_WASM
  13. #include <emscripten.h>
  14. #include <emscripten/bind.h>
  15. #include <emscripten/val.h>
  16. #include <emscripten/websocket.h>
  17. #define MQTTAPI EMSCRIPTEN_KEEPALIVE
  18. #elif defined MQTT_EXPORT
  19. #define MQTTAPI MQTT_DECL_EXPORT
  20. #else
  21. #define MQTTAPI MQTT_DECL_IMPORT
  22. #endif
  23. enum MqttErrorCode
  24. {
  25. MqttErrorSuccess,
  26. MqttErrorFailure = -1,
  27. MqttErrorDisconnected = -3,
  28. MqttErrorBadString = -5,
  29. MqttErrorNullParameter = -6,
  30. MqttErrorBadStructure = -7,
  31. MqttErrorBadQos = -8,
  32. MqttErrorNotSupported = -9,
  33. MqttErrorBadVersion = -10,
  34. MqttErrorBadProtocol = -11,
  35. };
  36. enum MqttVersion
  37. {
  38. MqttVersion_3_1 = 3,
  39. MqttVersion_3_1_1 = 4,
  40. MqttVersion_5 = 5,
  41. MqttVersion_6 = 6,
  42. };