Module_LcmControl_Wistron.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. /*
  2. * Module_MqttClient.h
  3. *
  4. * Created on: 2021/11/6
  5. * Author: folus
  6. */
  7. #ifndef MODULE_MQTTCLIENT_H_
  8. #define MODULE_MQTTCLIENT_H_
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <sys/time.h>
  12. #include <sys/timeb.h>
  13. #include <sys/types.h>
  14. #include <sys/ioctl.h>
  15. #include <sys/socket.h>
  16. #include <sys/ipc.h>
  17. #include <sys/shm.h>
  18. #include <sys/mman.h>
  19. #include <linux/wireless.h>
  20. #include <arpa/inet.h>
  21. #include <netinet/in.h>
  22. #include <dirent.h>
  23. #include <sys/prctl.h>
  24. #include <unistd.h>
  25. #include <stdarg.h>
  26. #include <stdio.h>
  27. #include <stdlib.h>
  28. #include <unistd.h>
  29. #include <fcntl.h>
  30. #include <termios.h>
  31. #include <errno.h>
  32. #include <errno.h>
  33. #include <string.h>
  34. #include <time.h>
  35. #include <ctype.h>
  36. #include <ifaddrs.h>
  37. #include <stdbool.h>
  38. #include <stddef.h>
  39. #include <stdint.h>
  40. #include <signal.h>
  41. #include "json-c/json.h"
  42. #include "mosquitto.h"
  43. //#define TEST_MODE
  44. #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
  45. #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
  46. #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)), __LINE__, __FUNCTION__, ##args)
  47. enum TIMER_IDX
  48. {
  49. TMR_IDX_0=0,
  50. TMR_IDX_1,
  51. TMR_IDX_2,
  52. TMR_IDX_3,
  53. TMR_IDX_4,
  54. TMR_IDX_5,
  55. TMR_IDX_CNT
  56. };
  57. enum GUN_TYPE
  58. {
  59. GUN_TYPE_UNKNOWN=0,
  60. GUN_TYPE_CHAdeMO,
  61. GUN_TYPE_CCS,
  62. GUN_TYPE_GBT,
  63. GUN_TYPE_DO,
  64. GUN_TYPE_AC
  65. };
  66. enum SWITCH_STS
  67. {
  68. OFF=0,
  69. ON
  70. };
  71. enum BOOLEAN_STS
  72. {
  73. NO=0,
  74. YES
  75. };
  76. enum QOS_TYPE
  77. {
  78. QOS_ONLY_TX=0,
  79. QOS_ENSURE_BROKER,
  80. QOS_ENSURE_SUBSCRIBE
  81. };
  82. enum RETAIN_TYPE
  83. {
  84. RETAIN_NO=0,
  85. RETAIN_YES
  86. };
  87. typedef struct TEXT_LIST
  88. {
  89. uint16_t textviewIndex;
  90. char textString[256];
  91. char textFont[32];
  92. char textStyle[32];
  93. uint8_t textSize;
  94. uint16_t layout_x;
  95. uint16_t layout_y;
  96. }Text_List;
  97. typedef struct IMAGE_LIST
  98. {
  99. uint16_t imageviewIndex;
  100. uint16_t imgsrc_addr;
  101. uint16_t layout_x;
  102. uint16_t layout_y;
  103. uint16_t width;
  104. uint16_t height;
  105. }Image_List;
  106. typedef struct VIDEO_LIST
  107. {
  108. uint16_t videoviewIndex;
  109. uint16_t videosrc_addr;
  110. uint16_t layout_x;
  111. uint16_t layout_y;
  112. uint16_t width;
  113. uint16_t height;
  114. }Video_List;
  115. #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  116. #define is_error(ptr) ((unsigned long)ptr > (unsigned long)-4000L)
  117. #define BROKER_PORT 1883
  118. #define BROKER_ADDRESS "192.168.0.10"
  119. #define TIMEOUT_KEEPALIVE 60
  120. #define LOGIN_USER NULL
  121. #define LOGIN_PASSWD NULL
  122. #define PASS 1
  123. #define FAIL -1
  124. #define PROFILE_CONNECT_TIMEOUT "connect_timeout"
  125. #define OTA_TYPE_UI "ota_ui"
  126. #define OTA_TYPE_APK "ota_apk"
  127. #define OTA_TYPE_SDCARD "ota_sdcard"
  128. #define FONT_STYLE_NORMAL "normal"
  129. #define FONT_STYLE_BOLD "bold"
  130. #define FONT_STYLE_ITALIC "italic"
  131. #define FONT_STYLE_BOLD_ITALIC "bold_italic"
  132. #define FONT_ARIAL "Arial"
  133. enum BRIGHTNESS_LEVEL
  134. {
  135. BRIGHTNESS_LEVEL_0=0,
  136. BRIGHTNESS_LEVEL_1,
  137. BRIGHTNESS_LEVEL_2,
  138. BRIGHTNESS_LEVEL_3,
  139. BRIGHTNESS_LEVEL_4,
  140. BRIGHTNESS_LEVEL_5,
  141. BRIGHTNESS_LEVEL_6,
  142. BRIGHTNESS_LEVEL_7,
  143. BRIGHTNESS_LEVEL_8,
  144. BRIGHTNESS_LEVEL_9,
  145. BRIGHTNESS_LEVEL_10,
  146. BRIGHTNESS_LEVEL_11,
  147. BRIGHTNESS_LEVEL_AUTO,
  148. };
  149. enum FONT_SIZE
  150. {
  151. FONT_SIZE_8PX=8,
  152. FONT_SIZE_10PX=10,
  153. FONT_SIZE_12PX=12,
  154. FONT_SIZE_14PX=14,
  155. FONT_SIZE_16PX=16,
  156. FONT_SIZE_20PX=20,
  157. FONT_SIZE_24PX=24,
  158. FONT_SIZE_34PX=34,
  159. FONT_SIZE_48PX=48,
  160. FONT_SIZE_60PX=60,
  161. FONT_SIZE_96PX=96,
  162. };
  163. extern int StoreLogMsg(const char *fmt, ...);
  164. extern int publish_data(struct mosquitto *mosq, char *topic, char *outputStr);
  165. extern int publish_profile(struct mosquitto *mosq, char *parameter, char *value);
  166. extern int publish_upgrade(struct mosquitto *mosq, char *otaType, char *url, char *checksum, char *verInfo);
  167. extern int publish_restart(struct mosquitto *mosq, uint8_t isHardReset);
  168. extern int publish_power_saving(struct mosquitto *mosq, uint8_t isSleep);
  169. extern int publish_back_dimming(struct mosquitto *mosq, uint8_t lightLevel);
  170. extern int publish_timesync(struct mosquitto *mosq);
  171. extern int publish_textview_add(struct mosquitto *mosq, Text_List *textList, uint8_t listCount);
  172. extern int publish_imageview_add(struct mosquitto *mosq, Image_List *imageList, uint8_t listCount);
  173. extern int publish_videoview_add(struct mosquitto *mosq, Video_List *videoList, uint8_t listCount);
  174. extern int publish_view_remove(struct mosquitto *mosq, Text_List *textList, uint8_t textListCount, Image_List *imageList, uint8_t imageListCount, Video_List *videoList, uint8_t videoListCount);
  175. extern int publish_clear_screen(struct mosquitto *mosq);
  176. #endif /* MODULE_MQTTCLIENT_H_ */