2 Star 4 Fork 4

caisiyu / esp8266_iot_bin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
include.h 2.37 KB
一键复制 编辑 原始数据 按行查看 历史
caisiyu 提交于 2021-09-09 13:43 . 增加验证秘钥功能
#ifndef _INCLUDE_H
#define _INCLUDE_H
/* 引入库*/
#include <Ticker.h> //导入定时器库
#include <EEPROM.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <Arduino_JSON.h>
#define NO_Connect_Wifi 0
#define Connected_Wifi 1
#define NO_Connect_Server 2
#define Connected_Server 3
#define Error_Secretkey 9
#define Other_Status 10
#define Led_Blink_very_fast 50 //50ms
#define Led_Blink_General_fast 200 //200ms
#define Led_Blink_General_slow 1000 //1s
#define Led_Blink_very_slow 2000 //2s
WiFiClient client;
/* 延时器*/
long lastMsg_time = 0;
/* 先定义一个结构体,里面添加想要存储的数据类型*/
struct Config_wifi_struct{
char ssid[20];
char password[20];
};
Config_wifi_struct wifi_struct;
/* 先定义一个结构体,系统状态*/
struct System_status{
char net_status = 0;
char net_status_last = 0;
char debug_str[50];
String serial_buf = "";
JSONVar json_object;
String current_protocol = "";
String client_CallBack_msg = "";
int Led_blink_interval = 0;
String secret_key = "";
bool secret_key_value = false;
};
System_status system_status;
/* 先定义一个结构体,网络协议*/
struct Net_com_protocol{
const char* tcp = "tcp";
const char* udp = "udp";
const char* mqtt = "mqtt";
const char* post = "post";
const char* get = "get";
};
Net_com_protocol net_com_protocol;
/* TCP协议的几个参数*/
struct TCP_config_parameter{
String ip_add = "";
String ip_port = "";
String msg = "";
};
TCP_config_parameter tcp_config_parameter;
/* UDP协议的几个参数*/
struct UDP_config_parameter{
String ip_add = "";
String ip_local_port = "";
String ip_remote_port = "";
String msg = "";
bool udp_status = false;
};
UDP_config_parameter udp_config_parameter;
/* MQTT协议的几个参数*/
struct MQTT_config_parameter{
String ip_add = "";
String ip_port = "";
String msg_status_type = "0"; //设置发布主题,还是订阅主题
String topic = "";
String msg = "";
String client_Id = "";
String user_name = "";
String user_pwd = "";
};
MQTT_config_parameter mqtt_config_parameter;
/* HTTP协议的几个参数*/
struct HTTP_config_parameter{
String server_ip = "";
String parameter = "";
String msg = "";
bool http_status = false;
};
HTTP_config_parameter http_config_parameter;
#endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/caisiyu/esp8266_iot_bin.git
git@gitee.com:caisiyu/esp8266_iot_bin.git
caisiyu
esp8266_iot_bin
esp8266_iot_bin
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891