|
|
@@ -35,14 +35,13 @@ namespace BPASmartClient.IoT |
|
|
|
public DataVClient() |
|
|
|
{ |
|
|
|
DataVApiAddress = InternetInfo.DataVApiAddress; |
|
|
|
//DataVApiAddress = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString(); |
|
|
|
ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); |
|
|
|
DeviceName = System.Configuration.ConfigurationManager.AppSettings["DeviceName"].ToString(); |
|
|
|
ProductKey = System.Configuration.ConfigurationManager.AppSettings["ProductKey"].ToString(); |
|
|
|
DeviceSecret = System.Configuration.ConfigurationManager.AppSettings["DeviceSecret"].ToString(); |
|
|
|
StartupMode = System.Configuration.ConfigurationManager.AppSettings["StartupMode"].ToString(); |
|
|
|
BroadcastPubTopic = InternetInfo.BroadcastPubTopic; |
|
|
|
//BroadcastPubTopic = System.Configuration.ConfigurationManager.AppSettings["BroadcastPubTopic"].ToString(); |
|
|
|
BroadcastMaintainPubTopic = $"{InternetInfo.BroadcastPubTopic}Maintain"; |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
@@ -52,6 +51,7 @@ 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> |
|
|
@@ -97,6 +97,37 @@ namespace BPASmartClient.IoT |
|
|
|
} |
|
|
|
return alarmTable.KeyID; |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 增加维保信息 |
|
|
|
/// </summary> |
|
|
|
/// <param name="maintainTable"></param> |
|
|
|
/// <returns></returns> |
|
|
|
public string HttpAddMaintain(MaintainTable maintainTable) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
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.ClientId = ClientId; |
|
|
|
maintainTable.devicename = DeviceDataV.deviceTable.devicename; |
|
|
|
DeviceDataV.IOT_Publish(BroadcastMaintainPubTopic, Tools.JsonConvertTools(maintainTable)); |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
MessageLog.GetInstance.Show(ex.Message); |
|
|
|
} |
|
|
|
return maintainTable.KeyID; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 增加日志信息 |
|
|
@@ -254,7 +285,6 @@ namespace BPASmartClient.IoT |
|
|
|
}); |
|
|
|
keyValues[GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString()] = id; |
|
|
|
//MessageLog.GetInstance.AddDeviceAlarmLogShow(GetPropertyValue(obj, "Time").ToString() + GetPropertyValue(obj, "Type").ToString() + GetPropertyValue(obj, "Text").ToString(),id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
@@ -277,7 +307,6 @@ namespace BPASmartClient.IoT |
|
|
|
State = "n" |
|
|
|
}); |
|
|
|
//MessageLog.GetInstance.DeleteDeviceAlarmLogShow(message, keyValues[message]); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|