|
|
@@ -76,8 +76,7 @@ namespace BPASmartClient.Device |
|
|
|
public List<object> Error { get; set; } = new List<object>(); |
|
|
|
|
|
|
|
public List<VariableMonitor> variableMonitors { get; set; } = new List<VariableMonitor>(); |
|
|
|
ConcurrentDictionary<string, object> IDevice.Log { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } |
|
|
|
ConcurrentDictionary<string, object> IDevice.Error { get => throw new NotImplementedException(); set => throw new NotImplementedException(); } |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 外设状态,硬件设备数据 |
|
|
@@ -440,6 +439,7 @@ namespace BPASmartClient.Device |
|
|
|
|
|
|
|
public object GetError() |
|
|
|
{ |
|
|
|
object time= GetPropertyValue(Error[0], "Time"); |
|
|
|
return new { data = Error }; |
|
|
|
} |
|
|
|
|
|
|
@@ -452,5 +452,19 @@ namespace BPASmartClient.Device |
|
|
|
{ |
|
|
|
return new { data = variableMonitors }; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 获取某个对象中的属性值 |
|
|
|
/// </summary> |
|
|
|
/// <param name="info"></param> |
|
|
|
/// <param name="field"></param> |
|
|
|
/// <returns></returns> |
|
|
|
public object GetPropertyValue(object info, string field) |
|
|
|
{ |
|
|
|
if (info == null) return null; |
|
|
|
Type t = info.GetType(); |
|
|
|
IEnumerable<System.Reflection.PropertyInfo> property = from pi in t.GetProperties() where pi.Name.ToLower() == field.ToLower() select pi; |
|
|
|
return property.First().GetValue(info, null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |