Sfoglia il codice sorgente

gengx

样式分支
fyf 2 anni fa
parent
commit
43a419fd5c
1 ha cambiato i file con 23 aggiunte e 13 eliminazioni
  1. +23
    -13
      BPASmartClient.IoT/DataVClient.cs

+ 23
- 13
BPASmartClient.IoT/DataVClient.cs Vedi File

@@ -41,7 +41,18 @@ namespace BPASmartClient.IoT
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString();
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString();
BroadcastPubTopic = InternetInfo.BroadcastPubTopic;
BroadcastMaintainPubTopic = $"{InternetInfo.BroadcastPubTopic}Maintain";
//MaintainTable maintainTable = new MaintainTable();
//maintainTable.Id = Guid.NewGuid().ToString();
//maintainTable.MaintainTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
//maintainTable.MaintainType = "一般";
//maintainTable.MaintainVla = "MorkS";
//maintainTable.MaintainMessage = "xxxxx故障需要维修";
//maintainTable.DeviceId = "";
//maintainTable.ClientId = ClientId;
//maintainTable.devicename = DeviceDataV.deviceTable.devicename;
//maintainTables.Add(maintainTable);
}
#endregion

@@ -51,7 +62,6 @@ namespace BPASmartClient.IoT
public string ProductKey { set; get; }
public string DeviceSecret { set; get; }
public string BroadcastPubTopic { set; get; }
public string BroadcastMaintainPubTopic { set; get; }
/// <summary>
/// DataV 服务地址
/// </summary>
@@ -112,18 +122,15 @@ namespace BPASmartClient.IoT
{
if (DeviceDataV != null && DeviceDataV.GetIsConnected() && DeviceDataV.deviceTable != null)
{
// AlarmTime = GetPropertyValue(obj, "Time").ToString(),
//AlarmType = GetPropertyValue(obj, "Type").ToString(),
//AlarmMessage = GetPropertyValue(obj, "Text").ToString(),
//AlarmVla = "告警",
//DeviceId = Devid.ToString(),
//KeyID = id,
maintainTable.MaintainTime = DateTime.Now.ToString();
maintainTable.MaintainType = "一般";
maintainTable.MaintainVla = "维修";
maintainTable.Id=Guid.NewGuid().ToString();
//maintainTable.MaintainTime = DateTime.Now.ToString();
//maintainTable.MaintainType = "一般";
//maintainTable.MaintainVla = "MorkS";
//maintainTable.MaintainMessage = "xxxxx故障需要维修";
//maintainTable.DeviceId = "";
maintainTable.ClientId = ClientId;
maintainTable.devicename = DeviceDataV.deviceTable.devicename;
DeviceDataV.IOT_Publish(BroadcastMaintainPubTopic, Tools.JsonConvertTools(maintainTable));
maintainTables.Add(maintainTable);
}
}
catch (Exception ex)
@@ -243,7 +250,10 @@ namespace BPASmartClient.IoT
});
if (dataVNode.Count > 0)
{
iOTDevSXModel.Maintain= Tools.JsonConvertTools(maintainTables);
if (maintainTables.Count > 0)
{
iOTDevSXModel.Maintain = Tools.JsonConvertTools(maintainTables);
}
iOTDevSXModel.NodeStatus = Tools.JsonConvertTools(new { data = dataVNode });
DeviceDataV.IOT_Publish(DeviceDataV.PubTopic, iOTDevSXModel.Tojson());
}


Caricamento…
Annulla
Salva