diff --git a/App/Button_GrayLevel.cpp b/App/Button_GrayLevel.cpp index ff7c48f1..88a7f0d8 100644 --- a/App/Button_GrayLevel.cpp +++ b/App/Button_GrayLevel.cpp @@ -16,12 +16,14 @@ #define btn_printf(format, ...) #endif +static Button_GrayLevelConfig* ButtonConfig = nullptr; + /******************************** 调光配置 ********************************/ Button_GrayLevelConfig::Button_GrayLevelConfig() { - _Name = "Gray"; - _Start = &OnGrayLevel; - _End = &TagEnd; + _Name = "Gray"; + _Start = &OnGrayLevel; + _End = &TagEnd; Init(); OnGrayLevel = 0xff; diff --git a/App/Button_GrayLevel.h b/App/Button_GrayLevel.h index 54e08e7b..460a1b27 100644 --- a/App/Button_GrayLevel.h +++ b/App/Button_GrayLevel.h @@ -31,7 +31,6 @@ using TAction = Delegate::TAction; // 这里必须使用_packed关键字,生成对齐的代码,否则_Value只占一个字节,导致后面的成员进行内存操作时错乱 //__packed class Button // 干脆把_Value挪到最后解决问题 -static Button_GrayLevelConfig* ButtonConfig = nullptr; class Button_GrayLevel : public ByteDataPort { diff --git a/Board/BaseBoard.h b/Board/BaseBoard.h index 97a4da66..18b2942f 100644 --- a/Board/BaseBoard.h +++ b/Board/BaseBoard.h @@ -3,7 +3,8 @@ #include "Sys.h" #include "Device\RTC.h" -struct + +/*struct { byte ClksCount; byte OldIdx; // 初始值无效 @@ -14,7 +15,7 @@ struct OldIdx = 0xff; LastClkTim = 0; }; -}ClickStr; +}ClickStr;*/ class BaseBoard { diff --git a/Net/DNS.cpp b/Net/DNS.cpp index 605cab9b..278c6a1e 100644 --- a/Net/DNS.cpp +++ b/Net/DNS.cpp @@ -359,25 +359,25 @@ short dns_makequery(short op, const String& name, Buffer& bs) DNS::DNS(NetworkInterface& host, const IPAddress& dns) : Host(host) { - Socket = host.CreateSocket(NetType::Udp); + _Socket = host.CreateSocket(NetType::Udp); - Socket->Remote.Port = 53; - Socket->Remote.Address = !dns.IsAny() ? dns : host.DNSServer; + _Socket->Remote.Port = 53; + _Socket->Remote.Address = !dns.IsAny() ? dns : host.DNSServer; - auto port = dynamic_cast(Socket); + auto port = dynamic_cast(_Socket); port->Register(OnReceive, this); } DNS::~DNS() { - delete Socket; + delete _Socket; } IPAddress DNS::Query(const String& domain, int msTimeout) { #if NET_DEBUG net_printf("DNS::Query %s Timeout: %dms DNS Server : ", domain.GetBuffer(), msTimeout); - Socket->Remote.Address.Show(true); + _Socket->Remote.Address.Show(true); #endif auto ip = IPAddress::Parse(domain); @@ -391,7 +391,7 @@ IPAddress DNS::Query(const String& domain, int msTimeout) _Buffer = &rs; dns_makequery(0, domain, bs); - Socket->Send(bs); + _Socket->Send(bs); TimeWheel tw(msTimeout); tw.Sleep = 100; @@ -420,7 +420,7 @@ uint DNS::OnReceive(ITransport* port, Buffer& bs, void* param, void* param2) void DNS::Process(Buffer& bs, const IPEndPoint& server) { // 只要来自服务器的 - if(server.Address != Socket->Remote.Address) return; + if(server.Address != _Socket->Remote.Address) return; //net_printf("DNS::Process [%d] = 0x%08X [%d] = 0x%08X \r\n", bs.Length(), bs.GetBuffer(), _Buffer->Length(), _Buffer->GetBuffer()); //bs.Show(true); diff --git a/Net/DNS.h b/Net/DNS.h index 577569a9..fecfa2a4 100644 --- a/Net/DNS.h +++ b/Net/DNS.h @@ -21,7 +21,7 @@ private: static uint OnReceive(ITransport* port, Buffer& bs, void* param, void* param2); void Process(Buffer& bs, const IPEndPoint& server); - Socket* Socket; + Socket* _Socket; Array* _Buffer; }; diff --git a/Net/Dhcp.cpp b/Net/Dhcp.cpp index 4f32a41d..822ad97f 100644 --- a/Net/Dhcp.cpp +++ b/Net/Dhcp.cpp @@ -19,11 +19,11 @@ Dhcp::Dhcp(NetworkInterface& host) : Host(host) { - Socket = host.CreateSocket(NetType::Udp); + _Socket = host.CreateSocket(NetType::Udp); - Socket->Local.Port = 68; - Socket->Remote.Port = 67; - Socket->Remote.Address = IPAddress::Broadcast(); + _Socket->Local.Port = 68; + _Socket->Remote.Port = 67; + _Socket->Remote.Address = IPAddress::Broadcast(); IP = host.IP; @@ -35,14 +35,14 @@ Dhcp::Dhcp(NetworkInterface& host) : Host(host) taskID = 0; - auto port = dynamic_cast(Socket); + auto port = dynamic_cast(_Socket); port->Register(OnReceive, this); } Dhcp::~Dhcp() { Sys.RemoveTask(taskID); - delete Socket; + delete _Socket; } void Dhcp::SendDhcp(byte* buf, uint len) @@ -78,7 +78,7 @@ void Dhcp::SendDhcp(byte* buf, uint len) Host.Mac.CopyTo(dhcp->ClientMac); Buffer bs(dhcp, sizeof(DHCP_HEADER) + len); - Socket->Send(bs); + _Socket->Send(bs); } // 找服务器 @@ -141,7 +141,7 @@ void Dhcp::Start() } // 发送网络请求时会自动开始 - //auto port = dynamic_cast(Socket); + //auto port = dynamic_cast(_Socket); //if(port) port->Open(); // 创建任务,每500ms发送一次Discover @@ -161,7 +161,7 @@ void Dhcp::Stop() { if(!Running) return; - auto port = dynamic_cast(Socket); + auto port = dynamic_cast(_Socket); if(port) port->Close(); Running = false; diff --git a/Net/Dhcp.h b/Net/Dhcp.h index 35d8e31e..738d6f21 100644 --- a/Net/Dhcp.h +++ b/Net/Dhcp.h @@ -8,7 +8,7 @@ private: uint dhcpid; // 事务ID uint taskID; // 任务ID UInt64 _expired; // 目标过期时间,毫秒 - Socket* Socket; + Socket* _Socket; void Discover(); void Request(); diff --git a/TokenNet/TokenClient.cpp b/TokenNet/TokenClient.cpp index d3eb7e65..1a94e243 100644 --- a/TokenNet/TokenClient.cpp +++ b/TokenNet/TokenClient.cpp @@ -98,7 +98,7 @@ static TokenController* AddMaster(TokenClient& client) // 创建连接服务器的控制器 auto ctrl = new TokenController(); - ctrl->Socket = socket; + ctrl->_Socket = socket; // 创建客户端 client.Master = ctrl; @@ -114,7 +114,7 @@ static TokenController* AddControl(TokenClient& client, NetworkInterface* host, // 创建连接服务器的控制器 auto ctrl = new TokenController(); - ctrl->Socket = socket; + ctrl->_Socket = socket; // 创建客户端 socket->Remote.Address = IPAddress::Broadcast(); @@ -141,13 +141,13 @@ void TokenClient::CheckNet() auto ctrl = AddMaster(*this); if(!ctrl) return; - debug_printf("TokenClient::CheckNet %s 成功创建主连接\r\n", ctrl->Socket->Host->Name); + debug_printf("TokenClient::CheckNet %s 成功创建主连接\r\n", ctrl->_Socket->Host->Name); } // 检测主链接是否已经断开 - else if(!mst->Socket->Host->Linked) + else if(!mst->_Socket->Host->Linked) { linked = false; - debug_printf("TokenClient::CheckNet %s断开,切换主连接\r\n", mst->Socket->Host->Name); + debug_printf("TokenClient::CheckNet %s断开,切换主连接\r\n", mst->_Socket->Host->Name); delete mst; Master = nullptr; @@ -170,7 +170,7 @@ void TokenClient::CheckNet() mst->Received = dlg; mst->Open(); - Cfg->ServerIP = mst->Socket->Remote.Address.Value; + Cfg->ServerIP = mst->_Socket->Remote.Address.Value; } // 为其它网卡创建本地会话 @@ -184,7 +184,7 @@ void TokenClient::CheckNet() bool flag = false; for (int i = 0; i < cs.Count(); i++) { - if(cs[i]->Socket->Host == nis[k]) + if(cs[i]->_Socket->Host == nis[k]) { flag = true; break; @@ -459,7 +459,7 @@ void TokenClient::SayHello(bool broadcast) if (cs.Count() > 0) { auto ctrl = cs[0]; - auto sock = ctrl->Socket; + auto sock = ctrl->_Socket; //ext.EndPoint.Address = sock->Local.Address; ext.EndPoint = sock->Local; ext.Protocol = sock->Protocol == NetType::Udp ? 17 : 6; @@ -482,11 +482,11 @@ void TokenClient::SayHello(bool broadcast) { msg.OneWay = true; - //msg.State = &ctrl->Socket->Remote; + //msg.State = &ctrl->_Socket->Remote; for (int i = 0; i < cs.Count(); i++) { auto ctrl = cs[i]; - msg.State = &ctrl->Socket->Remote; + msg.State = &ctrl->_Socket->Remote; if (ctrl->Port != nullptr) { Send(msg, ctrl); @@ -584,7 +584,7 @@ bool TokenClient::ChangeIPEndPoint(const NetUri& uri) uri.Show(true); auto ctrl = Master; - auto socket = ctrl->Socket; + auto socket = ctrl->_Socket; if (socket == nullptr) return false; ctrl->Port->Close(); diff --git a/TokenNet/TokenController.cpp b/TokenNet/TokenController.cpp index ce9db9f3..cf8063e1 100644 --- a/TokenNet/TokenController.cpp +++ b/TokenNet/TokenController.cpp @@ -60,7 +60,7 @@ TokenController::TokenController() : Controller(), Key(0) MinSize = TokenMessage::MinSize; - Socket = nullptr; + _Socket = nullptr; Server = nullptr; ShowRemote = false; @@ -81,8 +81,8 @@ void TokenController::Open() { if (Opened) return; - assert(Socket, "还没有Socket呢"); - if (!Port) Port = dynamic_cast(Socket); + assert(_Socket, "还没有Socket呢"); + if (!Port) Port = dynamic_cast(_Socket); assert(Port, "还没有传输口呢"); debug_printf("TokenNet::Inited 使用传输接口 "); @@ -92,7 +92,7 @@ void TokenController::Open() //Port->Show(true); #endif - Server = &Socket->Remote; + Server = &_Socket->Remote; #if DEBUG if (!Stat) diff --git a/TokenNet/TokenController.h b/TokenNet/TokenController.h index b92de48a..7c51e3e6 100644 --- a/TokenNet/TokenController.h +++ b/TokenNet/TokenController.h @@ -24,8 +24,8 @@ protected: //virtual bool SendInternal(const Buffer& bs, const void* state); public: - Socket* Socket; - + Socket* _Socket; + uint Token; // 令牌 ByteArray Key; // 通信密码 diff --git a/TokenNet/TokenSession.cpp b/TokenNet/TokenSession.cpp index 1af0d7f2..d5cd7a75 100644 --- a/TokenNet/TokenSession.cpp +++ b/TokenNet/TokenSession.cpp @@ -182,7 +182,7 @@ bool TokenSession::OnHello(TokenMessage& msg) } ext2.Key = key; - auto sock = Control.Socket; + auto sock = Control._Socket; //ext2.EndPoint.Address = sock->Host->IP; ext2.EndPoint = sock->Local;