Browse Source

增加状态汇总

样式分支
applelon 2 years ago
parent
commit
7188eb8689
7 changed files with 28 additions and 43 deletions
  1. +2
    -0
      BPASmartClient.Business/MainConsole.cs
  2. +15
    -1
      BPASmartClient.Business/Plugin/StatusMgr.cs
  3. +10
    -3
      BPASmartClient.Device/DeviceStatus.cs
  4. +0
    -9
      BPASmartClient.OrderProxy/BPASmartClient.OrderProxy.csproj
  5. +0
    -7
      BPASmartClient.Status/BPASmartClient.Status.csproj
  6. +0
    -8
      BPASmartClient.Status/Class1.cs
  7. +1
    -15
      SmartClient.sln

+ 2
- 0
BPASmartClient.Business/MainConsole.cs View File

@@ -23,6 +23,8 @@ namespace BPASmartClient.Business
Plugin.GetInstance().Init();
//主题初始化
TopicDefine.GetInstance().Initialize(Plugin.GetInstance().GetPlugin<DeviceMgr>().GetDevices());
//设备开启
Plugin.GetInstance().GetPlugin<DeviceMgr>().StartService();
}

/// <summary>


+ 15
- 1
BPASmartClient.Business/Plugin/StatusMgr.cs View File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -16,9 +17,22 @@ namespace BPASmartClient.Business
//设备管理
private DeviceMgr deviceMgr;

private Dictionary<int, Dictionary<string, object>> deviceStatus = new Dictionary<int, Dictionary<string, object>>();

public void Initialize()
{
deviceMgr = Plugin.GetInstance().GetPlugin<DeviceMgr>();
ThreadManage.GetInstance().StartLong(() =>
{
while (running)
{
foreach (var device in deviceMgr.GetDevices())
{
deviceStatus[device.DeviceId] = device.Status.GetStatus();
}
Thread.Sleep(50);
}
}, "MQTT 消息处理");
}

public void Dispose()


+ 10
- 3
BPASmartClient.Device/DeviceStatus.cs View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,10 +9,16 @@ namespace BPASmartClient.Device
{
public class DeviceStatus
{
public Dictionary<string,object> status=new Dictionary<string,object>();
public ConcurrentDictionary<string, object> status = new ConcurrentDictionary<string, object>();

public void Update(string key, object value) {
status[key] = value;
public void Update(string key, object value)
{
status.AddOrUpdate(key, value, (key, value) => value);
}

public Dictionary<string, object> GetStatus()
{
return status.ToDictionary(x => x.Key, x => x.Value);
}
}
}

+ 0
- 9
BPASmartClient.OrderProxy/BPASmartClient.OrderProxy.csproj View File

@@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>

+ 0
- 7
BPASmartClient.Status/BPASmartClient.Status.csproj View File

@@ -1,7 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

</Project>

+ 0
- 8
BPASmartClient.Status/Class1.cs View File

@@ -1,8 +0,0 @@
using System;

namespace BPASmartClient.Status
{
public class Class1
{
}
}

+ 1
- 15
SmartClient.sln View File

@@ -41,8 +41,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Helper", "BP
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Message", "BPASmartClient.Message\BPASmartClient.Message.csproj", "{C517D33F-8800-405E-9D59-E1F6CA201431}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Status", "BPASmartClient.Status\BPASmartClient.Status.csproj", "{2C8DAB92-D5EB-4462-87C1-0BED75B26C54}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.IoT", "BPASmartClient.IoT\BPASmartClient.IoT.csproj", "{D3DBCC2D-086E-4E3A-B70A-22A79FB295CF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient", "BPASmartClient\BPASmartClient.csproj", "{2BA531E8-7F85-4EBF-AE97-811CD7C83EF2}"
@@ -57,8 +55,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Socket", "BP
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Peripheral", "BPASmartClient.Peripheral\BPASmartClient.Peripheral.csproj", "{9F5E2879-972A-45FB-913C-89E9F0CEB189}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.OrderProxy", "BPASmartClient.OrderProxy\BPASmartClient.OrderProxy.csproj", "{EBDFF87C-0B98-4BB5-8760-D86964E38A88}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MessageCommunication", "BPASmartClient.MessageCommunication\BPASmartClient.MessageCommunication.csproj", "{DCC07B39-E342-4841-B9E4-4D44DA2978FD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.EventBus", "BPASmartClient.EventBus\BPASmartClient.EventBus.csproj", "{C7FC5FC8-4C72-4CD3-973E-327BDA880DF5}"
@@ -76,7 +72,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.CustomResour
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lebai.SDK", "Lebai.SDK\Lebai.SDK.csproj", "{3A55F68A-D526-4CFC-A5A6-B69FB76716C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MORKSM.BK.PLC", "BPASmartClient.MORKSM.BK.PLC\BPASmartClient.MORKSM.BK.PLC.csproj", "{7F04A788-38B5-42CB-B601-70C657C953B8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MORKSM.BK.PLC", "BPASmartClient.MORKSM.BK.PLC\BPASmartClient.MORKSM.BK.PLC.csproj", "{7F04A788-38B5-42CB-B601-70C657C953B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -136,10 +132,6 @@ Global
{C517D33F-8800-405E-9D59-E1F6CA201431}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C517D33F-8800-405E-9D59-E1F6CA201431}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C517D33F-8800-405E-9D59-E1F6CA201431}.Release|Any CPU.Build.0 = Release|Any CPU
{2C8DAB92-D5EB-4462-87C1-0BED75B26C54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C8DAB92-D5EB-4462-87C1-0BED75B26C54}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C8DAB92-D5EB-4462-87C1-0BED75B26C54}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C8DAB92-D5EB-4462-87C1-0BED75B26C54}.Release|Any CPU.Build.0 = Release|Any CPU
{D3DBCC2D-086E-4E3A-B70A-22A79FB295CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3DBCC2D-086E-4E3A-B70A-22A79FB295CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3DBCC2D-086E-4E3A-B70A-22A79FB295CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -168,10 +160,6 @@ Global
{9F5E2879-972A-45FB-913C-89E9F0CEB189}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F5E2879-972A-45FB-913C-89E9F0CEB189}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F5E2879-972A-45FB-913C-89E9F0CEB189}.Release|Any CPU.Build.0 = Release|Any CPU
{EBDFF87C-0B98-4BB5-8760-D86964E38A88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EBDFF87C-0B98-4BB5-8760-D86964E38A88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EBDFF87C-0B98-4BB5-8760-D86964E38A88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EBDFF87C-0B98-4BB5-8760-D86964E38A88}.Release|Any CPU.Build.0 = Release|Any CPU
{DCC07B39-E342-4841-B9E4-4D44DA2978FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCC07B39-E342-4841-B9E4-4D44DA2978FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCC07B39-E342-4841-B9E4-4D44DA2978FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -218,7 +206,6 @@ Global
{B399BCFF-82E8-4940-9CE5-B7DCDDFDC696} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{A2A5CB83-11C7-4534-A65D-6F957B60EEFF} = {1A9920BA-7C8D-4BDC-8D7D-6544A71AF3CF}
{C517D33F-8800-405E-9D59-E1F6CA201431} = {1A9920BA-7C8D-4BDC-8D7D-6544A71AF3CF}
{2C8DAB92-D5EB-4462-87C1-0BED75B26C54} = {6CEA3385-6F62-452A-8275-033A6037235D}
{D3DBCC2D-086E-4E3A-B70A-22A79FB295CF} = {6CEA3385-6F62-452A-8275-033A6037235D}
{2BA531E8-7F85-4EBF-AE97-811CD7C83EF2} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{4E393E60-D39A-4118-8BD5-427DC72E9ACE} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
@@ -226,7 +213,6 @@ Global
{7D290C8E-ACA7-4F03-91DF-D507FB3E2E87} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{F9AD1657-7FF9-470F-BE7F-2379ADAC0BB0} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{9F5E2879-972A-45FB-913C-89E9F0CEB189} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{EBDFF87C-0B98-4BB5-8760-D86964E38A88} = {6CEA3385-6F62-452A-8275-033A6037235D}
{DCC07B39-E342-4841-B9E4-4D44DA2978FD} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{C7FC5FC8-4C72-4CD3-973E-327BDA880DF5} = {1A9920BA-7C8D-4BDC-8D7D-6544A71AF3CF}
{268012B6-C4FC-4C40-802C-74D5FAD3CA45} = {1A9920BA-7C8D-4BDC-8D7D-6544A71AF3CF}


Loading…
Cancel
Save