jerry_mqtt.h 888 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef JERRY_MQTT_H__
  2. #define JERRY_MQTT_H__
  3. #include <rtthread.h>
  4. #ifdef PKG_USING_PAHOMQTT
  5. #include <jerry_util.h>
  6. #include <jerry_event.h>
  7. #include <jerry_callbacks.h>
  8. #include <jerry_buffer.h>
  9. #include "paho_mqtt.h"
  10. #define MQTT_BUFFER_SIZE 1024
  11. struct mqtt_callback_info
  12. {
  13. jerry_value_t this_value;
  14. jerry_value_t js_func;
  15. int return_count;
  16. jerry_value_t* return_value;
  17. char* event_name;
  18. } typedef mqtt_cbinfo_t;
  19. struct mqtt_client_info
  20. {
  21. jerry_value_t this_value;
  22. int subCount; //the count of topics subscribed
  23. MQTTClient* client;
  24. struct js_callback* event_callback;
  25. struct js_callback* fun_callback;
  26. struct js_callback* close_callback;
  27. struct topic_callback_list
  28. {
  29. char* topic;
  30. jerry_value_t js_func;
  31. } callbackHandler[MAX_MESSAGE_HANDLERS];
  32. rt_sem_t sem;
  33. } typedef mqtt_info_t;
  34. #endif
  35. #endif