From b0a4c47dd74bc41c5df3bab6ddd8de7bcc6a52b0 Mon Sep 17 00:00:00 2001 From: patrick <patrick.xu@broconcentric.com> Date: 星期五, 06 十二月 2019 18:35:42 +0800 Subject: [PATCH] 1. 重新整理项目,按照A034模式,将设备异步操作修改为类同步操作。使用任务队列来存储和分配任务。 --- src/Bro.Device.SeerAGV/SeerAGVConfig.cs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 50 insertions(+), 10 deletions(-) diff --git a/src/Bro.Device.SeerAGV/SeerAGVConfig.cs b/src/Bro.Device.SeerAGV/SeerAGVConfig.cs index a094f0c..55214f0 100644 --- a/src/Bro.Device.SeerAGV/SeerAGVConfig.cs +++ b/src/Bro.Device.SeerAGV/SeerAGVConfig.cs @@ -1,16 +1,12 @@ 锘縰sing Bro.Common.Base; using Bro.Common.Helper; -using Bro.Common.Model.Helper; +using Bro.Common.Model; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using System; using System.Collections.Generic; using System.ComponentModel; +using System.Drawing.Design; using System.Linq; -using System.Net; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; namespace Bro.Device.SeerAGV { @@ -31,7 +27,19 @@ [Category("鐩戝惉閰嶇疆")] [Description("鐩戝惉闂撮殧锛屽崟浣峬s")] - public int ScanInterval { get; set; } = 200; + public int ScanInterval { get; set; } = 500; + + //[Category("鐩戝惉閰嶇疆")] + //[Description("鐩戝惉鐨処O淇℃伅閰嶇疆闆嗗悎")] + //[TypeConverter(typeof(CollectionCountConvert))] + //[Editor(typeof(ComplexCollectionEditor<IODefinition>), typeof(UITypeEditor))] + //public List<IODefinition> IOCollection { get; set; } = new List<IODefinition>(); + + [Category("鐩戝惉璁剧疆")] + [Description("鐩戝惉鎿嶄綔閰嶇疆闆嗗悎")] + [TypeConverter(typeof(CollectionCountConvert))] + [Editor(typeof(ComplexCollectionEditor<MonitorSet>), typeof(UITypeEditor))] + public List<MonitorSet> MonitorSetCollection { get; set; } = new List<MonitorSet>(); [Category("鐩戝惉閰嶇疆")] [Description("鏄惁閲囩敤绠�鍗曠洃鍚ā寮忋�倀rue锛氱畝鍗曟ā寮忥紝鍙幏鍙栦换鍔$姸鎬侊紱false锛氬叏閮ㄦā寮忥紝鑾峰彇浠诲姟鎵�鏈変俊鎭�")] @@ -53,6 +61,22 @@ } } + private float batteryLvlToCharge_Recommand = 0.3f; + [Category("鍏呯數閰嶇疆")] + [Description("鍏呯數鐢垫睜瀹归噺锛岀數姹犲閲忎綆浜庤鍊兼椂锛岃澶囩┖闂叉椂寤鸿鍏呯數")] + public float BatteryLvlToCharge_Recommand + { + get => batteryLvlToCharge_Recommand; + set + { + if (value >= 1 || value <= 0) + { + value = 0.3f; + } + batteryLvlToCharge_Recommand = value; + } + } + private float batteryLvlChargeDone = 0.9f; [Category("鍏呯數閰嶇疆")] [Description("鍏呯數瀹屾垚鐢垫睜瀹归噺锛岀數姹犲閲忛珮浜庤鍊兼椂纭鍏呯數瀹屾垚")] @@ -68,15 +92,25 @@ batteryLvlChargeDone = value; } } + + [Category("鍔ㄤ綔璁剧疆")] + [Description("鍔ㄤ綔瓒呮椂璁剧疆锛屽崟浣峬in")] + public float OperationTimeout { get; set; } = 5; } [Device("SeerAGV", "SeerAGV", EnumHelper.DeviceAttributeType.OperationConfig)] public class SeerAGVOperationConfig : OperationConfigBase { + [Category("瀵艰埅閰嶇疆")] + [Description("AGV琛岄┒鐩殑鍦�")] + public string Location { get; set; } + [Category("瀵艰埅閰嶇疆")] + [Description("鏄惁绛夊緟瀹屾垚淇″彿")] + public bool IsWaitFinished { get; set; } = true; } - public class SeerMessage + public class SeerMessage : IComplexDisplay { private byte[] frame = null; public byte[] Frame @@ -143,13 +177,18 @@ if (data.Length < 16 + msg.DataLength) { - throw new ProcessException("鏁版嵁闀垮害閿欒", null); + throw new ProcessException("鏁版嵁闀垮害閿欒"); } msg.JsonData = data.Skip(16).Take(msg.DataLength).ToArray(); msg.JValues = JsonConvert.DeserializeObject<JObject>(System.Text.Encoding.ASCII.GetString(msg.JsonData)); return msg; + } + + public string GetDisplayText() + { + return ""; } } @@ -166,12 +205,13 @@ { QueryPosition = 0x03EC, QueryTaskStatus = 0x03FC, + QueryIO = 0x03F5, CancelTask = 0x0BBB, PauseTask = 0x0BB9, TaskOrder = 0x0BEB, - QueryBattery = 0x2AFF, + QueryBattery = 0x03EF, } public enum AGVTaskStatus -- Gitblit v1.8.0