#ifndef __INF_4G_H__
#define __INF_4G_H__

#include "usart.h"
#include "string.h"
#include "tim.h"
#include "stdio.h"
#include "stdlib.h"
#include "Driver.h"
#include "Irrigation.h"
#include "wendu.h"
#include "HLW8032.h"
#include  "Ozone.h"
#include "wendu.h"
#include "electrode.h"
#include "guangshi.h"
#define RX_BUFFER_SIZE 128
#define RESPONSE_BUFFER_SIZE 512
#define STATUS_REPORT_INTERVAL 1000  // 状态上报间隔(ms)


#define MQTT_SERVER_IP    "101.133.141.167"   // 替换为你的MQTT服务器IP地址
#define MQTT_SERVER_PORT  "1883"              // 替换为你的MQTT服务器端口
#define MQTT_CLIENT_ID    "LDMCU20250522A0002"     // 替换为你的MQTT客户端ID
#define MQTT_USERNAME     "ldhb"                    // 替换为你的MQTT用户名
#define MQTT_PASSWORD     "ldhb0813"                // 替换为你的MQTT密码
#define MQTT_TOPIC       "/server/coo/LDMCU20250522A0002" // 替换为你的MQTT订阅主题
#define MQTT_PUB_TOPIC   "/dev/coo/LDMCU20250522A0002" // 替换为你的MQTT订阅主题

#define ICCID_LENGTH 20


extern  uint16_t rxDataSize;
extern volatile uint8_t need_upload ;
extern volatile uint8_t need_process_4g;
extern volatile uint8_t mode_change_pending;  // 模式切换标志
extern volatile uint8_t new_mode;            // 新模式值

extern  uint8_t force_pump_off;    // 水泵强制关闭标志
extern uint8_t force_fan_off;     // 风机强制关闭标志

extern char sim_iccid[ICCID_LENGTH];  // 存储ICCID的变量
typedef enum {
    CMD_OFF = 0,
    CMD_ON = 1
} CmdState_t;

void Inf_4G_Init(void);
void Inf_4G_SendAtCmd(uint8_t *atcmd);
void Inf_EC800_4GInit(void);
void Inf_EC800_MQTT_Init(void);
void Inf_EC800_ReadData(void);

void Inf_EC800_MQTT_Publish(const char *topic, const char *payload);  // 添加发布函数



extern volatile uint8_t need_upload;

extern volatile float analog_status[3];  // 模拟量状态
void Upload_Device_Data(void);

// 添加信号强度相关声明
extern int8_t gsm_signal_strength;  // 信号强度变量
void Get_Signal_Strength(void);     // 获取信号强度函数
void Check_4G_Connection(void);

void Get_ICCID(void);
#endif
