123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- namespace MinicsConsole.Connector;
- public class UISender(Hardwares hardwares, HardwareAddress hardwareAddress, ConfigFiles configFiles) : SenderBase_SignalR, IMini8DataNotifier
- {
- public string Name { get; set; } = "UI";
- public void ChannelInfoNotify(byte mini8, byte channel, ChannelData channelData)
- {
- this.SendAll("ChannelDataUpdate", mini8, channel, channelData);
- }
- public void Mini8ConnectNotify(byte mini8, bool connected)
- {
- this.SendAll("Mini8Connect", mini8, connected);
- }
- public void AlarmNotify(byte mini8, byte channel, float temperature)
- {
- this.SendAll("AlarmNotify", mini8, channel, temperature);
- }
- public void AlarmTcBrockenNotify(byte mini8, byte channel)
- {
- this.SendAll("AlarmTcBrockenNotify", mini8, channel);
- }
- public bool UpdateMini8(byte mini8Index, Mini8Data mini8)
- {
- return SendCaller("UpdateMini8", mini8Index, mini8);
- }
- public bool UpdateAddress(byte mini8Index, Mini8Address mini8)
- {
- return SendCaller("UpdateAddress", mini8Index, mini8);
- }
- public bool UpdateMini8All()
- {
- foreach (KeyValuePair<byte, Mini8Data> mini8 in hardwares.Mini8s)
- if (!UpdateMini8(mini8.Key, mini8.Value))
- return false;
- return true;
- }
- public bool UpdateAddressAll()
- {
- foreach (KeyValuePair<byte, Mini8Address> mini8 in hardwareAddress.Mini8sAddress)
- if (!UpdateAddress(mini8.Key, mini8.Value))
- return false;
- return true;
- }
- public bool UpdateSingleChannel(byte mini8Index, byte channelIndex, ChannelData channel)
- {
- return SendCaller("UpdateSingleChannel", mini8Index, channelIndex, channel);
- }
- public bool UpdateChannel(byte channelIndex, ConcurrentDictionary<byte, ChannelData> channel)
- {
- return SendCaller("UpdateChannel", channelIndex, channel.Values.ToList());
- }
- public bool UpdateChannelAll()
- {
- bool result = true;
- foreach (KeyValuePair<byte, ConcurrentDictionary<byte, ChannelData>> channel in hardwares.Mini8Channels)
- if (!UpdateChannel(channel.Key, channel.Value))
- {
- result = false;
- continue;
- }
- return result;
- }
- public bool UpdateDataBaseInfo(int duration, DateTime dateTime)
- {
- return SendCaller("UpdateDataBaseInfo", duration, dateTime);
- }
- public bool UpdateFiles(string fileName, TemperatureConfig config)
- {
- return SendCaller("UpdateFiles", fileName, config);
- }
- public bool UpdateAllFiles()
- {
- if (!SendCaller("ClearFiles"))
- return false;
- foreach (KeyValuePair<string, TemperatureConfig> file in configFiles.Files)
- if (!SendCaller("UpdateFiles", file.Value))
- return false;
- return true;
- }
- public bool UpdateCurrentFile()
- {
- return SendCaller("CurrentFile", configFiles.CurrentConfigFile);
- }
- }
|