diff --git a/EGFramework.csproj b/EGFramework.csproj index 0390623..da44c03 100644 --- a/EGFramework.csproj +++ b/EGFramework.csproj @@ -12,6 +12,9 @@ - + + + + \ No newline at end of file diff --git a/Example/UsingTest/Script/EGTest.cs b/Example/UsingTest/Script/EGTest.cs index 60809eb..93488e8 100644 --- a/Example/UsingTest/Script/EGTest.cs +++ b/Example/UsingTest/Script/EGTest.cs @@ -6,308 +6,310 @@ using Newtonsoft.Json; using System; using System.Net; -public partial class EGTest : Node,IEGFramework -{ - public Label label { set; get; } - - public override void _Ready() - { - this.EGEnabledProtocolTools(); - - this.EGMqtt().ConnectMQTTServer("192.168.1.220"); - - //this.EGUDP().UDPDevices[5555].Connect(IPAddress.Parse("224.0.0.251"),5353); - //byte[] sendData = { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x5F, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x07, 0x5F, 0x64, 0x6E, 0x73, 0x2D, 0x73, 0x64, 0x04, 0x5F, 0x75, 0x64, 0x70, 0x05, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x00, 0x00, 0x0C, 0x00, 0x01 }; - //this.EGUDP().UDPDevices[5555].Send(sendData); - // this.EGRegisterMessageEvent((e,sender,protocol)=>{ - // Print(sender); - // }); - // this.EGOnMessage(); - // this.EGReadFromFile("SaveData/MySeg2.seg2"); - //TestTCPClient(); - //TestSerialPort(); - //TestTCPServer(); - //this.EGUDP(); - //this.EGUDPListen(11000); - //this.EGSendMessage(new MessageStruct(1,"xxx"),"192.168.1.192:9002",ProtocolType.UDP); - //this.EGHttpClient(); - //this.EGHttpServer().Listen("http://+:6555/index/"); - } - public override void _Process(double delta) - { - //Print(this.EGMqtt().MqttDevices["192.168.1.220"].IsConnected); - } - public override void _ExitTree() +namespace EGFramework.Examples{ + public partial class EGTest : Node,IEGFramework { + public Label label { set; get; } - } + public override void _Ready() + { + this.EGEnabledProtocolTools(); + + this.EGMqtt().ConnectMQTTServer("192.168.1.220"); + + //this.EGUDP().UDPDevices[5555].Connect(IPAddress.Parse("224.0.0.251"),5353); + //byte[] sendData = { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x5F, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x07, 0x5F, 0x64, 0x6E, 0x73, 0x2D, 0x73, 0x64, 0x04, 0x5F, 0x75, 0x64, 0x70, 0x05, 0x6C, 0x6F, 0x63, 0x61, 0x6C, 0x00, 0x00, 0x0C, 0x00, 0x01 }; + //this.EGUDP().UDPDevices[5555].Send(sendData); + // this.EGRegisterMessageEvent((e,sender,protocol)=>{ + // Print(sender); + // }); + // this.EGOnMessage(); + // this.EGReadFromFile("SaveData/MySeg2.seg2"); + //TestTCPClient(); + //TestSerialPort(); + //TestTCPServer(); + //this.EGUDP(); + //this.EGUDPListen(11000); + //this.EGSendMessage(new MessageStruct(1,"xxx"),"192.168.1.192:9002",ProtocolType.UDP); + //this.EGHttpClient(); + //this.EGHttpServer().Listen("http://+:6555/index/"); + } + public override void _Process(double delta) + { + //Print(this.EGMqtt().MqttDevices["192.168.1.220"].IsConnected); + } + public override void _ExitTree() + { - public void OnButton1Click(){ - this.EGMqtt().SubScribeTheme("192.168.1.220","test"); - byte[] testData = {0x3A,0x55}; - this.EGMqtt().PublishTheme("192.168.1.220","test",testData); - } - - public void RefreshMsg(bool coil){ - label.Text += coil+" "; - } - public void OnTimer(){ - //this.EGSendMessage(new MessageStruct(1,"山东博裕1"),"COM4",ProtocolType.SerialPort); - //this.EGSendMessage(new MessageStruct(1,"山东博裕1"),"192.168.1.244:6060",ProtocolType.TCPClient); - //this.EGSendMessage(new ModbusTCP_WriteMultiCoil(1,0,sendData),"192.168.1.200:3000",ProtocolType.TCPClient); - //TestSingleCoil(); - //TestMultiCoil(); - //TestSingleHoldingRegister(); - //TestMultiHoldingRegister(); - } - public void TestModbus(){ - label = this.GetNode