regfunc.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef __XYHL_REGFUNC_H
  2. #define __XYHL_REGFUNC_H
  3. /********************************************************************************
  4. * @file name: regfunc.c
  5. * @Description: 注册函数,和 业务逻辑模块
  6. * @version: v1.0.0
  7. * @Author: bighead
  8. * @Date: 2020-11-15 11:05:28
  9. * @LastEditors: sunny.sun
  10. * @LastEditTime: 2020-11-16 09:33:46
  11. *******************************************************************************/
  12. #include <stdio.h>
  13. #include <unistd.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include "cJSON.h"
  17. #include "../include/mysql.sdk.h"
  18. #include "../include/globle.h"
  19. #include "../include/debug.h"
  20. #include "../src/main.h"
  21. #include "MQTTAsync.h"
  22. struct cmd_pro
  23. {
  24. char topic_name[256]; //频道名字
  25. unsigned int cnt; //调用次数
  26. int (*bc)(char *topic, MQTTAsync_message *msg, MYSQL *_db); //处理函数
  27. };
  28. typedef struct cmd_pro *cmd_pro_t;
  29. #define UNUSED(x) (void)(x)
  30. /********************************************************************************
  31. * @Function:
  32. * @Brief: 控制类消息处理函数
  33. * @Param:
  34. * @Return: 无
  35. * @Date: 2020-11-15 17:22:17
  36. *******************************************************************************/
  37. int decode_msg_handle( char *topic, MQTTAsync_message *msg );
  38. // 从配置文件中加载需要启用的Topic列表
  39. int initTopicConf(void);
  40. // 自动注册需要监听的消息列表
  41. int regTopicFromTable(void);
  42. /********************************************************************************
  43. * @Function: print_stats
  44. * @Brief: 打印运行统计
  45. * @Param: msg:消息报文
  46. * @Return: 无
  47. * @Date: 2019-08-26 14:54:18
  48. *******************************************************************************/
  49. int print_stats(void);
  50. #endif