27 lines
906 B
C
27 lines
906 B
C
#ifndef NETWORK_H
|
||
#define NETWORK_H
|
||
|
||
#include "main.h"
|
||
#include <stdint.h>
|
||
|
||
/*===== 网络状态 =====*/
|
||
extern volatile uint8_t g_net_mqtt_ready;
|
||
extern volatile uint8_t g_net_first_publish_ok;
|
||
extern volatile uint8_t g_no_sim_detected;
|
||
|
||
/* 网络发送互斥:置位期间 NET_publish_* 直接丢弃(OTA 下载等 AT 交互期间使用,
|
||
* 防止业务发布与进行中的 AT 指令在 USART3 上交织导致应答误判) */
|
||
extern volatile uint8_t g_net_tx_busy;
|
||
|
||
/*===== API =====*/
|
||
void NET_init(void);
|
||
void NET_process(void);
|
||
void NET_publish_status(int feeding, int sw2, int sw3, int sw4,
|
||
float weight_kg, float once_wt_kg, float zero_kg);
|
||
void NET_publish_response(const char *cmd_id, int ok, const char *msg);
|
||
void NET_publish_power(int on);
|
||
void NET_mqtt_report(const char *header, const char *ota_id, int val);
|
||
void NET_ota_confirm(void);
|
||
|
||
#endif /* NETWORK_H */
|