From cac3f2ddac66a9c0a0872e1683e64f6af0d871ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4X2?= Date: Fri, 10 Mar 2017 15:58:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E6=8E=A5=E5=8F=A3Config?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=94=AF=E6=8C=81=E8=BF=94=E5=9B=9E=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Drivers/Esp8266/Esp8266.cpp | 4 +++- Drivers/Esp8266/Esp8266.h | 2 +- Drivers/W5500.cpp | 4 +++- Drivers/W5500.h | 2 +- Net/NetworkInterface.h | 2 +- TinyIP/TinyIP.cpp | 3 ++- TinyIP/TinyIP.h | 2 +- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Drivers/Esp8266/Esp8266.cpp b/Drivers/Esp8266/Esp8266.cpp index 5a30d031..f2c5bc72 100644 --- a/Drivers/Esp8266/Esp8266.cpp +++ b/Drivers/Esp8266/Esp8266.cpp @@ -254,7 +254,7 @@ bool Esp8266::OnLink(uint retry) } // 配置网络参数 -void Esp8266::Config() +bool Esp8266::Config() { // 设置多连接 SetMux(true); @@ -268,6 +268,8 @@ void Esp8266::Config() SetMAC(false, mac); //SetAutoConn(AutoConn); + + return true; } Socket* Esp8266::CreateSocket(NetType type) diff --git a/Drivers/Esp8266/Esp8266.h b/Drivers/Esp8266/Esp8266.h index 7537a8bc..efe48fa5 100644 --- a/Drivers/Esp8266/Esp8266.h +++ b/Drivers/Esp8266/Esp8266.h @@ -30,7 +30,7 @@ public: void Init(ITransport* port, Pin power = P0, Pin rst = P0); - virtual void Config(); + virtual bool Config(); void SetLed(Pin led); void SetLed(OutputPort& led); void RemoveLed(); diff --git a/Drivers/W5500.cpp b/Drivers/W5500.cpp index e8fb2d9c..4df6e49c 100644 --- a/Drivers/W5500.cpp +++ b/Drivers/W5500.cpp @@ -514,7 +514,7 @@ bool W5500::OnLink(uint retry) return true; } -void W5500::Config() +bool W5500::Config() { ShowConfig(); @@ -555,6 +555,8 @@ void W5500::Config() // 一次性全部写入 WriteFrame(0, bs); + + return true; } void W5500::ChangePower(int level) diff --git a/Drivers/W5500.h b/Drivers/W5500.h index 02d12459..57c028b4 100644 --- a/Drivers/W5500.h +++ b/Drivers/W5500.h @@ -29,7 +29,7 @@ public: void SetLed(Pin led); void SetLed(OutputPort& led); - virtual void Config(); + virtual bool Config(); // 读写帧,帧本身由外部构造 (包括帧数据内部的读写标志) bool WriteFrame(ushort addr, const Buffer& bs, byte socket = 0 ,byte block = 0); diff --git a/Net/NetworkInterface.h b/Net/NetworkInterface.h index d606769e..9d5f2f78 100644 --- a/Net/NetworkInterface.h +++ b/Net/NetworkInterface.h @@ -60,7 +60,7 @@ public: bool Active() const; // 应用配置 - virtual void Config() = 0; + virtual bool Config() = 0; // 保存和加载网络配置 void InitConfig(); diff --git a/TinyIP/TinyIP.cpp b/TinyIP/TinyIP.cpp index 4313ce21..5fc3215b 100644 --- a/TinyIP/TinyIP.cpp +++ b/TinyIP/TinyIP.cpp @@ -237,9 +237,10 @@ void TinyIP::OnClose() _port->Close(); } -void TinyIP::Config() +bool TinyIP::Config() { //ShowConfig(); + return true; } bool TinyIP::SendEthernet(ETH_TYPE type, const MacAddress& remote, const byte* buf, uint len) diff --git a/TinyIP/TinyIP.h b/TinyIP/TinyIP.h index 460f5ed0..105d4b96 100644 --- a/TinyIP/TinyIP.h +++ b/TinyIP/TinyIP.h @@ -59,7 +59,7 @@ public: virtual ~TinyIP(); void Init(ITransport* port); - virtual void Config(); + virtual bool Config(); ushort CheckSum(IPAddress* remote, const byte* buf, uint len, byte type); bool SendEthernet(ETH_TYPE type, const MacAddress& remote, const byte* buf, uint len);