Browse Source

init

样式分支
applelon 2 years ago
parent
commit
c414944cd6
63 changed files with 2451 additions and 0 deletions
  1. +7
    -0
      BPASmartClient.DRCoffee/BPASmartClient.DRCoffee.csproj
  2. +8
    -0
      BPASmartClient.DRCoffee/Class1.cs
  3. +7
    -0
      BPASmartClient.Device/BPASmartClient.Device.csproj
  4. +13
    -0
      BPASmartClient.Device/IDevice.cs
  5. +12
    -0
      BPASmartClient.Device/IDeviceStatus.cs
  6. +7
    -0
      BPASmartClient.DeviceProxy/BPASmartClient.DeviceProxy.csproj
  7. +8
    -0
      BPASmartClient.DeviceProxy/Class1.cs
  8. +7
    -0
      BPASmartClient.GSIceCream/BPASmartClient.GSIceCream.csproj
  9. +8
    -0
      BPASmartClient.GSIceCream/Class1.cs
  10. +94
    -0
      BPASmartClient.Helper/APIHelper.cs
  11. +128
    -0
      BPASmartClient.Helper/ActionManage.cs
  12. +28
    -0
      BPASmartClient.Helper/BPASmartClient.Helper.csproj
  13. +43
    -0
      BPASmartClient.Helper/DataStorage.cs
  14. +75
    -0
      BPASmartClient.Helper/Delay.cs
  15. +73
    -0
      BPASmartClient.Helper/DelayRTrig.cs
  16. +67
    -0
      BPASmartClient.Helper/DelayTTrig.cs
  17. +100
    -0
      BPASmartClient.Helper/ExpandMethod.cs
  18. +95
    -0
      BPASmartClient.Helper/Json.cs
  19. +26
    -0
      BPASmartClient.Helper/LocaPath.cs
  20. +40
    -0
      BPASmartClient.Helper/RTrig.cs
  21. +31
    -0
      BPASmartClient.Helper/Singleton.cs
  22. +237
    -0
      BPASmartClient.Helper/SystemHelper.cs
  23. +39
    -0
      BPASmartClient.Helper/TTrig.cs
  24. +64
    -0
      BPASmartClient.Helper/TextHelper.cs
  25. +164
    -0
      BPASmartClient.Helper/ThreadManage.cs
  26. +49
    -0
      BPASmartClient.Helper/UniversalHelper.cs
  27. +7
    -0
      BPASmartClient.Http/BPASmartClient.Http.csproj
  28. +8
    -0
      BPASmartClient.Http/Class1.cs
  29. +7
    -0
      BPASmartClient.IoT/BPASmartClient.IoT.csproj
  30. +8
    -0
      BPASmartClient.IoT/Class1.cs
  31. +7
    -0
      BPASmartClient.KLMCoffee/BPASmartClient.KLMCoffee.csproj
  32. +8
    -0
      BPASmartClient.KLMCoffee/Class1.cs
  33. +7
    -0
      BPASmartClient.Lebai/BPASmartClient.Lebai.csproj
  34. +8
    -0
      BPASmartClient.Lebai/Class1.cs
  35. +16
    -0
      BPASmartClient.MQTT/BPASmartClient.MQTT.csproj
  36. +183
    -0
      BPASmartClient.MQTT/MqttHelper.cs
  37. +7
    -0
      BPASmartClient.Message/BPASmartClient.Message.csproj
  38. +67
    -0
      BPASmartClient.Message/MessageLog.cs
  39. +7
    -0
      BPASmartClient.Modbus/BPASmartClient.Modbus.csproj
  40. +8
    -0
      BPASmartClient.Modbus/Class1.cs
  41. +7
    -0
      BPASmartClient.MorkD/BPASmartClient.MorkD.csproj
  42. +8
    -0
      BPASmartClient.MorkD/Class1.cs
  43. +7
    -0
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  44. +8
    -0
      BPASmartClient.MorkS/Class1.cs
  45. +7
    -0
      BPASmartClient.MorkT/BPASmartClient.MorkT.csproj
  46. +7
    -0
      BPASmartClient.SCChip/BPASmartClient.SCChip.csproj
  47. +8
    -0
      BPASmartClient.SCChip/Class1.cs
  48. +15
    -0
      BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj
  49. +50
    -0
      BPASmartClient.SerialPort/SerialParameter.cs
  50. +243
    -0
      BPASmartClient.SerialPort/SerialPortClient.cs
  51. +7
    -0
      BPASmartClient.Socket/BPASmartClient.Socket.csproj
  52. +8
    -0
      BPASmartClient.Socket/Class1.cs
  53. +7
    -0
      BPASmartClient.Status/BPASmartClient.Status.csproj
  54. +8
    -0
      BPASmartClient.Status/Class1.cs
  55. +9
    -0
      BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj
  56. +8
    -0
      BPASmartClient.ViewModel/Class1.cs
  57. +9
    -0
      BPASmartClient/App.xaml
  58. +17
    -0
      BPASmartClient/App.xaml.cs
  59. +10
    -0
      BPASmartClient/AssemblyInfo.cs
  60. +10
    -0
      BPASmartClient/BPASmartClient.csproj
  61. +12
    -0
      BPASmartClient/MainWindow.xaml
  62. +28
    -0
      BPASmartClient/MainWindow.xaml.cs
  63. +180
    -0
      SmartClient.sln

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

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

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

</Project>

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

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

namespace BPASmartClient.DRCoffee
{
public class Class1
{
}
}

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

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

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

</Project>

+ 13
- 0
BPASmartClient.Device/IDevice.cs View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Device
{
public interface IDevice
{

}
}

+ 12
- 0
BPASmartClient.Device/IDeviceStatus.cs View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Device
{
internal class IDeviceStatus
{
}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.DeviceProxy
{
public class Class1
{
}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.GSIceCream
{
public class Class1
{
}
}

+ 94
- 0
BPASmartClient.Helper/APIHelper.cs View File

@@ -0,0 +1,94 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using Newtonsoft.Json;
using HBLConsole.Service;

namespace BPASmartClient.Helper
{
public class APIHelper
{

private volatile static APIHelper _Instance;
public static APIHelper GetInstance => _Instance ?? (_Instance = new APIHelper());
private APIHelper() { }

public string PostData(string url, string data, string head)
{
byte[] b = Encoding.UTF8.GetBytes(data);//把字符串转换为二进制
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Proxy = null;
request.ContentType = "application/json";
request.Method = "POST"; //设置请求方法
request.ContentLength = b.Length; //设置长度
request.Headers["Authorize"] = head;
Stream postStream = request.GetRequestStream(); //requst流
postStream.Write(b, 0, b.Length); //写入POST数据,二进制类型的
postStream.Close(); //关闭
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); //获取response
Stream stream = response.GetResponseStream(); // 得到response响应流
StreamReader sr = new StreamReader(stream);
string str = sr.ReadToEnd(); //读取流

sr.Close();
stream.Close();
return str;
}

public string GetData(string url, string head)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Accept = "text/html, application/xhtml+xml, */*";
request.ContentType = "application/json";
request.Headers["Authorize"] = head;
byte[] buffer = Encoding.UTF8.GetBytes(head);
request.ContentLength = buffer.Length;
request.GetRequestStream().Write(buffer, 0, buffer.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader myStreamReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
return myStreamReader.ReadToEnd();
}
}

public string HttpRequest(string url, string head, object data, RequestType requestType)
{
if (requestType == RequestType.POST)
{
return PostData(url, JsonConvert.SerializeObject(data), head);
}
else
{
StringBuilder sb = new StringBuilder();
sb.Append("?");
foreach (System.Reflection.PropertyInfo p in data.GetType().GetProperties())
{
if (sb.ToString().Last() != '?')
{
sb.Append("&");
}
sb.Append(p.Name);
sb.Append("=");
sb.Append(p.GetValue(data));
}
return GetData(url + sb.ToString(), head);
}
}

}

public enum RequestType
{
POST,
PUT,
DELETE,
GET
}
}

+ 128
- 0
BPASmartClient.Helper/ActionManage.cs View File

@@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;

namespace BPASmartClient.Helper
{
public class ActionManage
{

private volatile static ActionManage _Instance;
public static ActionManage GetInstance => _Instance ?? (_Instance = new ActionManage());
private ActionManage() { }

private static ConcurrentDictionary<string, Delegation> actions = new ConcurrentDictionary<string, Delegation>();

static readonly object SendLock = new object();
static readonly object SendParLock = new object();
static readonly object RegisterLock = new object();

/// <summary>
/// 注销委托
/// </summary>
/// <param name="key"></param>
public void CancelRegister(string key)
{
if (actions.ContainsKey(key))
actions.TryRemove(key, out Delegation t);
}

/// <summary>
/// 执行注册过的委托
/// </summary>
/// <param name="key">注册委托的key</param>
/// <param name="par">委托参数</param>
/// <param name="Callback">委托回调</param>
public void Send(string key, object par, Action Callback = null)
{
lock (SendLock)
if (actions.ContainsKey(key)) actions[key].ActionPar.Invoke(par, Callback);
//if (actions[key].ActionPar != null)
//{
// actions[key].ActionPar(par);
// if (Callback != null) Callback();
//}
}

/// <summary>
/// 执行注册过的委托
/// </summary>
/// <param name="key">注册委托的key</param>
/// <param name="Callback">委托回调</param>
public void Send(string key, Action Callback = null)
{
lock (SendLock)
if (actions.ContainsKey(key)) actions[key].ActionBus?.Invoke(Callback);
}

public object SendResult(string key, object par = null)
{
lock (SendLock)
if (actions.ContainsKey(key))
if (par == null)
{
if (actions[key].FuncObj != null)
return actions[key].FuncObj;
}
else
{
if (actions[key].FuncPar != null)
return actions[key].FuncPar(par);
}
return default;
}

public void Register<T>(T action, string key)
{
lock (RegisterLock)
{
if (action != null)
{
if (!actions.ContainsKey(key))
{
if (action is Action actionBus)
actions.TryAdd(key, new Delegation() { ActionBus = actionBus });

if (action is Action<object> actionObj)
actions.TryAdd(key, new Delegation() { ActionPar = actionObj });

if (action is Func<object> funcObj)
actions.TryAdd(key, new Delegation() { FuncObj = funcObj });

if (action is Func<object, object> puncPar)
actions.TryAdd(key, new Delegation() { FuncPar = puncPar });
}
}
}

}

}


internal class Delegation
{
/// <summary>
/// 带参数的委托
/// </summary>
public Action<object> ActionPar { get; set; }
/// <summary>
/// 无参数的委托
/// </summary>
public Action ActionBus { get; set; }
public Action CallBack { get; set; }
/// <summary>
/// 有返回值的委托
/// </summary>
public Func<object> FuncObj { get; set; }
/// <summary>
/// 有返回值,有参数的委托
/// </summary>
public Func<object, object> FuncPar { get; set; }
}


}

+ 28
- 0
BPASmartClient.Helper/BPASmartClient.Helper.csproj View File

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

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

<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>0</VersionMinor>
<VersionMajor>1</VersionMajor>
<Guid>f935dc20-1cf0-11d0-adb9-00c04fd58a0b</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Message\BPASmartClient.Message.csproj" />
</ItemGroup>

</Project>

+ 43
- 0
BPASmartClient.Helper/DataStorage.cs View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Helper
{
/// <summary>
/// 数据仓库
/// </summary>
public class DataStorage<T>
{
private ConcurrentQueue<T> cache = new ConcurrentQueue<T>();

public void PutData(T data)
{
cache.Enqueue(data);
}

public void PutData(T[] data)
{
foreach (var item in data)
cache.Enqueue(item);
}

public T GetData()
{
if (cache.Count >= 0)
{
cache.TryDequeue(out T data);
return data;
}
return default(T);
}

public int GetSize()
{
return cache.Count;
}
}
}

+ 75
- 0
BPASmartClient.Helper/Delay.cs View File

@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;

namespace BPASmartClient.Helper
{
/// <summary>
/// 延时操作
/// </summary>
public class Delay
{
/// <summary>
/// 计时条件
/// </summary>
//public bool IN { get; set; }


private volatile static ConcurrentDictionary<string, Delay> _Instance;
public static Delay GetInstance(string name)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, Delay>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new Delay());
return _Instance[name];
}
private Delay() { }

/// <summary>
/// 移除指定的定时器
/// </summary>
/// <param name="name"></param>
public static void RemoveDelay(string name)
{
if (_Instance.ContainsKey(name))
_Instance.TryRemove(name, out Delay delay);
}

/// <summary>
/// 当前时间
/// </summary>
public long ET { get; private set; } = 0;
public bool Q { get; private set; }

private bool flag;
DateTime startTime = new DateTime();

/// <summary>
/// 开始计时(时间单位/秒)
/// </summary>
/// <param name="PT">计时时间(单位 秒)</param>
/// <returns></returns>
public bool Start(bool IN, int PT)
{
if (IN)
{
if (!flag)
{
startTime = DateTime.Now;
flag = true;
}
if (ET < PT) ET = Convert.ToInt64(DateTime.Now.Subtract(startTime).TotalSeconds);
}
else
{
ET = 0;
flag = false;
}
Q = ET >= PT;
return Q;
}

}
}

+ 73
- 0
BPASmartClient.Helper/DelayRTrig.cs View File

@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Concurrent;

namespace BPASmartClient.Helper
{
/// <summary>
/// 延时上升沿触发
/// </summary>
public class DelayRTrig
{

private volatile static ConcurrentDictionary<string, DelayRTrig> _Instance;
public static DelayRTrig GetInstance(string name)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, DelayRTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new DelayRTrig());
return _Instance[name];
}

private DelayRTrig() { }

/// <summary>
/// 计时条件
/// </summary>
//public bool IN { get; set; }

/// <summary>
/// 当前时间
/// </summary>
public long ET { get; private set; } = 0;

private bool flag1;
public bool Q { get; private set; }
private bool IN1
{
set
{
Q = value && !flag1;
flag1 = value;
}
}

private bool flag;
DateTime startTime = new DateTime();

/// <summary>
/// 开始计时(时间单位/秒)
/// </summary>
/// <param name="PT">计时时间(单位 秒)</param>
/// <returns></returns>
public bool Start(bool IN, int PT)
{
if (IN)
{
if (!flag)
{
startTime = DateTime.Now;
flag = true;
}
if (ET < PT) ET = Convert.ToInt64(DateTime.Now.Subtract(startTime).TotalSeconds);
}
else
{
ET = 0;
flag = false;
}
IN1 = ET >= PT;
return Q;
}
}
}

+ 67
- 0
BPASmartClient.Helper/DelayTTrig.cs View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections.Concurrent;

namespace BPASmartClient.Helper
{
/// <summary>
/// 延时下降沿触发
/// </summary>
public class DelayTTrig
{

private volatile static ConcurrentDictionary<string, DelayTTrig> _Instance;
public static DelayTTrig GetInstance(string name)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, DelayTTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new DelayTTrig());
return _Instance[name];
}
private DelayTTrig() { }

/// <summary>
/// 当前时间
/// </summary>
public long ET { get; private set; } = 0;

private bool flag1;
private bool Q { get; set; }
private bool IN1
{
set
{
Q = !value && flag1;
flag1 = value;
}
}

private bool flag;
DateTime startTime = new DateTime();

/// <summary>
/// 开始计时(时间单位/秒)
/// </summary>
/// <param name="PT">计时时间(单位 秒)</param>
/// <returns></returns>
public bool Start(bool IN, int PT)
{
if (IN)
{
if (!flag)
{
startTime = DateTime.Now;
flag = true;
}
if (ET < PT) ET = Convert.ToInt64(DateTime.Now.Subtract(startTime).TotalSeconds);
}
else
{
ET = 0;
flag = false;
}
IN1 = ET >= PT;
return Q;
}
}
}

+ 100
- 0
BPASmartClient.Helper/ExpandMethod.cs View File

@@ -0,0 +1,100 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Helper
{
public static class ExpandMethod
{
/// <summary>
/// 获取布尔数组指定值得索引
/// </summary>
/// <param name="obj">要获取索引的数组</param>
/// <param name="value">要获取索引的值</param>
/// <returns></returns>
public static int GetIndex(this bool[] obj, bool value)
{
if (obj == null) return -1;
return Array.FindIndex(obj, p => p == value);
}

/// <summary>
/// 获取字符串数组指定值得索引
/// </summary>
/// <param name="obj">要获取索引的数组</param>
/// <param name="value">要获取索引的值</param>
/// <returns></returns>
public static int GetIndex(this string[] obj, string value)
{
if (obj == null || value == null) return -1;
return Array.FindIndex(obj, p => p == value && p.Length > 0);
}

/// <summary>
/// 委托回调
/// </summary>
/// <param name="action">要执行的委托</param>
/// <param name="callback">委托回调</param>
public static void Invoke(this Action action, Action callback)
{
if (action != null)
{
action();
if (callback != null) callback();
}
}

/// <summary>
/// 委托回调
/// </summary>
/// <param name="action">要执行的委托</param>
/// <param name="par">要执行的委托的参数</param>
/// <param name="callback">委托回调</param>
public static void Invoke(this Action<object> action, object par, Action callback)
{
if (action != null)
{
action(par);
if (callback != null) callback();
}
}



///// <summary>
///// 保存数据
///// </summary>
//public static void Save<T>(this T ot)
//{
// string outjson = JsonConvert.SerializeObject(ot);
// var str = ot.GetType().GenericTypeArguments;
// if (str != null && str.Length > 0)
// {
// File.WriteAllText(LocaPath.GetInstance.Getpath(str[0].Name), outjson);
// }

//}

///// <summary>
///// 获取保存的数据
///// </summary>
//public static void Read(this object ot)
//{
// var str = ot.GetType().GenericTypeArguments;
// if (str != null && str.Length > 0)
// {
// string pa = LocaPath.GetInstance.Getpath(str[0].Name);
// if (File.Exists(pa))
// {
// string JsonString = File.ReadAllText(pa);
// var result = JsonConvert.DeserializeObject<object>(JsonString);
// if (result != null) { Json<object>.Data = result; }
// }
// }
//}
}
}

+ 95
- 0
BPASmartClient.Helper/Json.cs View File

@@ -0,0 +1,95 @@
using Newtonsoft.Json;
using System;
using System.IO;
using System.Collections.Concurrent;
using System.Reflection;

namespace BPASmartClient.Helper
{
/// <summary>
/// Json参数服务类
/// </summary>
public class Json<T> where T : class, new()
{

//private static string DeviceType = ActionManage.GetInstance.SendResult("GetDeviceType").ToString();

//static string path
//{
// get
// {
// Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\{DeviceType}\\JSON"));
// return $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\{DeviceType}\\JSON\\{typeof(T).Name}.json";
// }
//}

static string path
{
get
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{LocaPath.GetInstance.FilePath}\\JSON"));
return $"{AppDomain.CurrentDomain.BaseDirectory}{LocaPath.GetInstance.FilePath}JSON\\{typeof(T).Name}.json";
}
}

public static T Data { get; set; } = new T();

/// <summary>
/// 保存数据
/// </summary>
public static void Save()
{
string outjson = JsonConvert.SerializeObject(Data);
File.WriteAllText(path, outjson);
}



/// <summary>
/// 获取保存的数据
/// </summary>
public static void Read()
{
if (File.Exists(path))
{
string JsonString = File.ReadAllText(path);
var result = JsonConvert.DeserializeObject<T>(JsonString);
if (result != null) { Data = result; }
}
}

/// <summary>
/// 保存带接口的对象
/// </summary>
public static void SaveInterface()
{
var settings = new JsonSerializerSettings();
settings.TypeNameHandling = TypeNameHandling.Objects;
string outjson = JsonConvert.SerializeObject(Data, Formatting.Indented, settings);
File.WriteAllText(path, outjson);
}

/// <summary>
/// 获取带接口对象的字符串
/// </summary>
public static void ReadInterface()
{
if (File.Exists(path))
{
var settings = new JsonSerializerSettings();
settings.TypeNameHandling = TypeNameHandling.Objects;
string JsonString = File.ReadAllText(path);
var result = JsonConvert.DeserializeObject<T>(JsonString, settings);
if (result != null) { Data = result; }
}
}

/*
使用反序列化接口对象的方法
一、使用 SaveInterface 方法保存成字符串,使用 ReadInterface 方法获取对象
二、在接口属性上加一个特性 [JsonProperty(TypeNameHandling = TypeNameHandling.Auto)]
*/


}
}

+ 26
- 0
BPASmartClient.Helper/LocaPath.cs View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Helper
{
public class LocaPath
{

private volatile static LocaPath _Instance;
public static LocaPath GetInstance => _Instance ?? (_Instance = new LocaPath());
private LocaPath() { }

public string FilePath { get; set; } = string.Empty;

public string Getpath(string name)
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{FilePath}\\JSON"));
return $"{AppDomain.CurrentDomain.BaseDirectory}{FilePath}JSON\\{name}.json";
}

}
}

+ 40
- 0
BPASmartClient.Helper/RTrig.cs View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Helper
{
/// <summary>
/// 上升沿操作类
/// </summary>
public class RTrig
{
private volatile static ConcurrentDictionary<string, RTrig> _Instance;
public static RTrig GetInstance(string name)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, RTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new RTrig());
return _Instance[name];
}
private RTrig() { }

private bool flag1;
public bool Q { get; private set; }
private bool IN1
{
set
{
Q = value && !flag1;
flag1 = value;
}
}
public bool Start(bool IN)
{
IN1 = IN;
return Q;
}
}
}

+ 31
- 0
BPASmartClient.Helper/Singleton.cs View File

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

/* ***********************************************
 * subject 单例对象基类
 * author 张原川
 * date   2019/6/3 9:49:03
 * ***********************************************/

namespace BPASmartClient.Helper
{
/// <summary>
/// 单例对象基类
/// </summary>
/// <typeparam name="T"></typeparam>
public class Singleton<T> where T : new()
{
private static object _async = new object();

private static T _instance;

static readonly Lazy<T> instance = new();
/// <summary>
/// 获取实例
/// </summary>
/// <returns></returns>
public static T GetInstance()
{
return instance.Value;
}
}
}

+ 237
- 0
BPASmartClient.Helper/SystemHelper.cs View File

@@ -0,0 +1,237 @@
using IWshRuntimeLibrary;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Helper
{
/// <summary>
/// 系统操作类
/// </summary>
public class SystemHelper
{
private volatile static SystemHelper _Instance;
public static SystemHelper GetInstance => _Instance ?? (_Instance = new SystemHelper());
private SystemHelper() { }

/// <summary>
/// 获取当前应用程序名称,包括后缀名
/// </summary>
public string GetApplicationName => $"{AppDomain.CurrentDomain.FriendlyName}.exe";

/// <summary>
/// 获取当前应用程序完整路径
/// </summary>
public string GetApplicationPath => $"{AppDomain.CurrentDomain.BaseDirectory}{GetApplicationName}";

/// <summary>
/// 创建桌面快捷方式
/// </summary>
/// <returns>成功或失败</returns>
public bool CreateDesktopShortcut()
{
//1、在COM对象中找到 Windows Script Host Object Model
//2、添加引用 using IWshRuntimeLibrary;
string deskTop = string.Empty;
try
{
deskTop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\";
if (System.IO.File.Exists(deskTop + GetApplicationName + ".lnk")) //
{
return true;
//System.IO.File.Delete(deskTop + FileName + ".lnk");//删除原来的桌面快捷键方式
}
WshShell shell = new WshShell();
//快捷键方式创建的位置、名称
IWshShortcut shortcut = shell.CreateShortcut(deskTop + GetApplicationName + ".lnk") as IWshShortcut;
shortcut.TargetPath = GetApplicationPath; //目标文件
//该属性指定应用程序的工作目录,当用户没有指定一个具体的目录时,快捷方式的目标应用程序将使用该属性所指定的目录来装载或保存文件。
shortcut.WorkingDirectory = System.Environment.CurrentDirectory;
shortcut.WindowStyle = 1; //目标应用程序的窗口状态分为普通、最大化、最小化【1,3,7】
shortcut.Description = GetApplicationName; //描述
//shortcut.IconLocation = exePath + "\\logo.ico"; //快捷方式图标
shortcut.Arguments = "";
//shortcut.Hotkey = "CTRL+ALT+F11"; // 快捷键
shortcut.Save(); //必须调用保存快捷才成创建成功
return true;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
return false;
}
}

/// <summary>
/// 设置开机自启动
/// </summary>
/// <param name="isAuto">true:开机启动,false:不开机自启</param>
public void AutoStart(bool isAuto = true)
{
if (isAuto == true)
{
RegistryKey R_local = Registry.CurrentUser;
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
R_run.SetValue(GetApplicationName, GetApplicationPath);
R_run.Close();
R_local.Close();
}
else
{
RegistryKey R_local = Registry.CurrentUser;
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
R_run.DeleteValue(GetApplicationName, false);
R_run.Close();
R_local.Close();
}
}

/// <summary>
/// 判断是否是自动启动
/// </summary>
/// <returns></returns>
public bool IsAutoStart()
{
RegistryKey R_local = Registry.CurrentUser;
RegistryKey R_run = R_local.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
bool res = R_run.GetValueNames().Contains(GetApplicationName);
R_run.Close();
R_local.Close();
return res;
}

#region U盘,串口插拔信息
private const int WM_DEVICECHANGE = 0x219; //设备改变
private const int DBT_DEVICEARRIVAL = 0x8000; //检测到新设备
private const int DBT_DEVICEREMOVECOMPLETE = 0x8004; //移除设备
public const int DBT_DEVTYP_PORT = 0x00000003;
public const int DBT_DEVTYP_VOLUME = 0x00000002;

public IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == WM_DEVICECHANGE)
{
//插入
if (wParam.ToInt32() == DBT_DEVICEARRIVAL)
{
var volume = (DEV_BROADCAST_HDR)Marshal.PtrToStructure(lParam, typeof(DEV_BROADCAST_HDR));

switch (volume.dbch_devicetype)
{
case DBT_DEVTYP_PORT://串口设备
string portName = Marshal.PtrToStringUni(lParam + Marshal.SizeOf(typeof(DEV_BROADCAST_PORT)));
MessageLog.GetInstance.Show($"插入串口:[{portName}]");
break;
case DBT_DEVTYP_VOLUME:
var drive = GetDrive(lParam);
MessageLog.GetInstance.Show($"usb插入:[{drive}]");
break;
default:
break;
}
}

//拔出
if (wParam.ToInt32() == DBT_DEVICEREMOVECOMPLETE)
{
var volume = (DEV_BROADCAST_HDR)Marshal.PtrToStructure(lParam, typeof(DEV_BROADCAST_HDR));
switch (volume.dbch_devicetype)
{
case DBT_DEVTYP_PORT://串口设备
string portName = Marshal.PtrToStringUni(lParam + Marshal.SizeOf(typeof(DEV_BROADCAST_PORT)));
MessageLog.GetInstance.Show($"拔出串口:[{portName}]");
break;
case DBT_DEVTYP_VOLUME:
var drive = GetDrive(lParam);
MessageLog.GetInstance.Show($"usb拔出:[{drive}]");
break;
default:
break;
}
}
}
return IntPtr.Zero;
}

private static string GetDrive(IntPtr lParam)
{
var volume = (DEV_BROADCAST_VOLUME)Marshal.PtrToStructure(lParam, typeof(DEV_BROADCAST_VOLUME));
var letter = GetLetter(volume.dbcv_unitmask);
return string.Format("{0}:\\", letter);
}

/// <summary>
/// 获得盘符
/// </summary>
/// <param name="dbcvUnitmask">
/// 1 = A
/// 2 = B
/// 4 = C...
/// </param>
/// <returns>结果是A~Z的任意一个字符或者为'?'</returns>
private static char GetLetter(uint dbcvUnitmask)
{
const char nona = '?';
const string drives = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (dbcvUnitmask == 0) return nona;
var i = 0;
var pom = dbcvUnitmask >> 1;
while (pom != 0)
{
pom = pom >> 1;
i++;
}
if (i < drives.Length)
return drives[i];
return nona;
}


#endregion
}

[StructLayout(LayoutKind.Sequential)]
struct DEV_BROADCAST_HDR
{
public UInt32 dbch_size;
public UInt32 dbch_devicetype;
public UInt32 dbch_reserved;
}

[StructLayout(LayoutKind.Sequential)]
struct DEV_BROADCAST_PORT
{
public uint dbcp_size;
public uint dbcp_devicetype;
public uint dbcp_reserved;
}

[StructLayout(LayoutKind.Sequential)]
struct DEV_BROADCAST_PORT_A
{
public uint dbcp_size;
public uint dbcp_devicetype;
public uint dbcp_reserved;
//public string dbcp_name;
}

[StructLayout(LayoutKind.Sequential)]
struct DEV_BROADCAST_VOLUME
{
/// DWORD->unsigned int
public uint dbcv_size;
/// DWORD->unsigned int
public uint dbcv_devicetype;
/// DWORD->unsigned int
public uint dbcv_reserved;
/// DWORD->unsigned int
public uint dbcv_unitmask;
/// WORD->unsigned short
public ushort dbcv_flags;
}
}

+ 39
- 0
BPASmartClient.Helper/TTrig.cs View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Text;

namespace BPASmartClient.Helper
{
/// <summary>
/// 下降沿操作
/// </summary>
public class TTrig
{
private volatile static ConcurrentDictionary<string, TTrig> _Instance;
public static TTrig GetInstance(string name)
{
if (_Instance == null) _Instance = new ConcurrentDictionary<string, TTrig>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new TTrig());
return _Instance[name];
}
private TTrig() { }

private bool flag1;
public bool Q { get; private set; }
private bool IN1
{
set
{
Q = !value && flag1;
flag1 = value;
}
}
public bool Start(bool IN)
{
IN1 = IN;
return Q;
}

}
}

+ 64
- 0
BPASmartClient.Helper/TextHelper.cs View File

@@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Helper
{
public class TextHelper
{

private volatile static TextHelper _Instance;
public static TextHelper GetInstance => _Instance ?? (_Instance = new TextHelper());
private TextHelper() { }

/// <summary>
/// 保存日志信息
/// </summary>
/// <param name="info"></param>
public void SaveLogInfo(string info, string name, string DicrectoryName = "Log")
{
if (info?.Length > 0)
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{LocaPath.GetInstance.FilePath}\\{DicrectoryName}"));
string path = $"{AppDomain.CurrentDomain.BaseDirectory}{LocaPath.GetInstance.FilePath}\\{DicrectoryName}\\{DateTime.Now.ToString("yyyy-MM-dd") + " " + name}.txt";
StringBuilder sb = new StringBuilder();
sb.Append($"****************************************** {DateTime.Now} ******************************************" + "\n");
sb.Append(info);
sb.Append("**********************************************************************************************************" + "\n\n");
FileStream fs = new FileStream($"{path}", FileMode.Append);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(sb.ToString());
sw.Close();
fs.Close();
}
}

public string ReadTextInfo(string fileName, string DicrectoryName = "")
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\{DicrectoryName}"));
string path = $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\{DicrectoryName}\\{fileName}.txt";
FileStream fs = new FileStream(path, FileMode.OpenOrCreate);
StreamReader sr = new StreamReader(fs);
string GetStr = sr.ReadLine();
if (GetStr == null) GetStr = string.Empty;
sr.Close();
fs.Close();
return GetStr;
}

public void WriteTextInfo(string info, string fileName, string DicrectoryName = "")
{
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\{DicrectoryName}"));
string path = $"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\{DicrectoryName}\\{fileName}.txt";
FileStream fs = new FileStream(path, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(info);
sw.Close();
fs.Close();
}

}
}

+ 164
- 0
BPASmartClient.Helper/ThreadManage.cs View File

@@ -0,0 +1,164 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading;

namespace BPASmartClient.Helper
{
/// <summary>
/// 线程管理
/// </summary>
public class ThreadManage
{
private volatile static ThreadManage _Instance;
public static ThreadManage GetInstance => _Instance ?? (_Instance = new ThreadManage());
private ThreadManage() { }
string guid = "871d7e28-c413-4675-8d28-64e4dca4c2d3-";
private static readonly object _lock = new object();
StringBuilder callbackKey = new StringBuilder();
List<string> keys = new List<string>();
ConcurrentDictionary<string, Task> Threads = new ConcurrentDictionary<string, Task>();
ConcurrentDictionary<string, CancellationTokenSource> CancellationTokenSources = new ConcurrentDictionary<string, CancellationTokenSource>();

/// <summary>
/// 停止指定任务
/// </summary>
/// <param name="key">任务名</param>
/// <param name="ExitCallback">任务结束的回调</param>
public void StopTask(string key, Action ExitCallback = null)
{
if (CancellationTokenSources.ContainsKey(guid + key))
CancellationTokenSources[guid + key]?.Cancel();
ActionManage.GetInstance.Register(ExitCallback, guid + key);
}

/// <summary>
/// 长任务,带 while true 的循环
/// </summary>
/// <param name="action"></param>
/// <param name="key"></param>
public void StartLong(Action action, string key, bool IsRestart = false, Action RunComplete = null)
{
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource());
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() =>
{
ReStart:
try
{
while (!CancellationTokenSources[guid + key].IsCancellationRequested)
{
if (action != null) action();
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
if (IsRestart)
{
Thread.Sleep(2000);
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已重启");
goto ReStart;
}
else
{
CancellationTokenSources.TryRemove(guid + key, out CancellationTokenSource temp);
Threads.TryRemove(guid + key, out Task temp1);
MessageLog.GetInstance.Show($"线程 【{key}】运行发生异常,已退出");
}
}
}), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) =>
{
ThreadStatus(t, o.ToString());
if (RunComplete != null) RunComplete();
}), guid + key));
MessageLog.GetInstance.Show($"启动线程 【{key}】");
if (!result) MessageLog.GetInstance.Show($"【{key}】任务已存在,请检查 TaskName");

}


/// <summary>
/// 不带 while true 的循环任务
/// </summary>
/// <param name="action"></param>
/// <param name="key"></param>
public void Start(Action action, string key)
{
CancellationTokenSources.TryAdd(guid + key, new CancellationTokenSource());
bool result = Threads.TryAdd(guid + key, Task.Factory.StartNew(new Action(() =>
{
if (action != null) action();
}), CancellationTokenSources[guid + key].Token).ContinueWith(new Action<Task, object>((t, o) =>
{
ThreadStatus(t, o.ToString());
}), guid + key));
if (!result) MessageLog.GetInstance.Show($"【{key}】任务已存在,请检查 TaskName");
}

private void ThreadStatus(Task task, string key)
{
bool IsRemove = false;
string name = key.Substring(key.LastIndexOf('-') + 1);
switch (task.Status)
{
case TaskStatus.RanToCompletion:
MessageLog.GetInstance.Show($"线程【{name}】执行完成");
IsRemove = true;
break;
case TaskStatus.Faulted:
MessageLog.GetInstance.Show($"线程【{name}】执行异常,{task.Exception}");
IsRemove = true;
break;
case TaskStatus.Canceled:
MessageLog.GetInstance.Show($"线程【{name}】已取消");
IsRemove = true;
break;
default:
break;
}

if (IsRemove)
{
if (Threads.ContainsKey(key))
Threads.TryRemove(key, out Task t);
//Threads.TryRemove(Threads.FirstOrDefault(p => p.Key == TaskName));


if (CancellationTokenSources.ContainsKey(key))
CancellationTokenSources.TryRemove(key, out CancellationTokenSource cts);
//CancellationTokenSources.TryRemove(CancellationTokenSources.FirstOrDefault(p => p.Key == TaskName));
//keys.Remove(key);
//if (keys != null && keys.Count == 0) ActionManage.GetInstance.Send(callbackKey.ToString());
ActionManage.GetInstance.Send(key);
}
}

/// <summary>
/// 释放所有线程资源
/// </summary>
public void Dispose()
{
for (int i = 0; i < CancellationTokenSources.Count; i++)
{
CancellationTokenSources.ElementAt(i).Value.Cancel();
}
}

/// <summary>
/// 判断指定线程是否完成
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public bool IsComplete(string key)
{
if (Threads.ContainsKey(guid + key)) return Threads[guid + key].IsCompleted;
return false;
}

}

}

+ 49
- 0
BPASmartClient.Helper/UniversalHelper.cs View File

@@ -0,0 +1,49 @@
//using GVL;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.Helper
{
/// <summary>
/// 其它通用库
/// </summary>
public class UniversalHelper:Singleton<UniversalHelper>
{

[DllImport("wininet")]
//判断网络状况的方法,返回值true为连接,false为未连接
public extern static bool InternetGetConnectedState(out int conState, int reder);

/// <summary>
/// 获取当前网络连接状态
/// </summary>
/// <returns>成功连接网络返回 true,未连接返回 false</returns>
public bool GetNetworkState()
{
return InternetGetConnectedState(out int i, 0);
}

public void Init()
{
//while (!GVL_VAR.GetInstance.NetworkConnectState)
//{
// //GVL_VAR.GetInstance.NetworkConnectState = GetNetworkState();
// Thread.Sleep(1000);
//}
//ThreadManagerment.GetInstance.StartLong(new Action(() =>
//{
// //GVL_VAR.GetInstance.NetworkConnectState = GetNetworkState();
// Thread.Sleep(1000);
//}), "网络监听状态");
}



}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.Http
{
public class Class1
{
}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.IoT
{
public class Class1
{
}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.KLMCoffee
{
public class Class1
{
}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.Lebai
{
public class Class1
{
}
}

+ 16
- 0
BPASmartClient.MQTT/BPASmartClient.MQTT.csproj View File

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

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

<ItemGroup>
<PackageReference Include="BPA.MQTTnet" Version="1.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.Message\BPASmartClient.Message.csproj" />
</ItemGroup>

</Project>

+ 183
- 0
BPASmartClient.MQTT/MqttHelper.cs View File

@@ -0,0 +1,183 @@
using BPASmartClient.Helper;
using HBLConsole.Service;
using MQTTnet;
using MQTTnet.Client;
using MQTTnet.Client.Options;
using System;
using System.Threading;

namespace HBLConsole.Communication
{
public class MqttHelper
{

private volatile static MqttHelper _Instance;
public static MqttHelper GetInstance => _Instance ?? (_Instance = new MqttHelper());
private MqttHelper() { }

private IMqttClient client;
IMqttClientOptions options;

/// <summary>
/// MQTT 接收消息
/// </summary>
public Action<MqttApplicationMessageReceivedEventArgs> MqttReceive { get; set; }

/// <summary>
/// MQTT 连接成功
/// </summary>
public Action ConnectOk { get; set; }

/// <summary>
/// 重连成功
/// </summary>
public Action Reconnection { get; set; }

Action UseDisconnectedAction;


public async void MqttInitAsync(string UserName, string pass, string IP, int port, string clientID)
{
options = new MqttClientOptionsBuilder().WithTcpServer(IP, port).WithClientId(clientID).WithCredentials(UserName, pass).Build();
client = new MqttFactory().CreateMqttClient();
client.UseDisconnectedHandler(c =>
{
if (UseDisconnectedAction == null)
{
Reconnect();
UseDisconnectedAction();
}

}).UseApplicationMessageReceivedHandler(c =>
{
MqttReceive(c);
}).UseConnectedHandler((e) =>
{
MessageLog.GetInstance.Show($"连接成功");
});

try
{
await client.ConnectAsync(options);
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.Message);
MessageLog.GetInstance.Show("mqtt连接失败!重连执行中");
}

if (client.IsConnected)
{
MessageLog.GetInstance.Show("MQTT连接成功!");
if (ConnectOk != null) ConnectOk();
}

}

private void Reconnect()
{
UseDisconnectedAction = new Action(() =>
{
Thread.Sleep(2000);
while (!UniversalHelper.GetInstance().GetNetworkState())
{
Thread.Sleep(2000);
}
MessageLog.GetInstance.Show($"断开连接");
bool ErrorFlag = false;
while (!client.IsConnected)
{
try
{
MessageLog.GetInstance.Show($"重连中");
client.ConnectAsync(options).Wait();
}
catch (Exception ex)
{
if (!ErrorFlag)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
ErrorFlag = true;
}
}
Thread.Sleep(3000);
}

if (client.IsConnected)
{
MessageLog.GetInstance.Show("MQTT重连成功!");
if (Reconnection != null) Reconnection();
}
UseDisconnectedAction = null;
});
}

/// <summary>
/// Mqtt 订阅
/// </summary>
/// <param name="topic">需要订阅的主题</param>
public async void MqttSubscriptionAsync(string topic)
{
if (client != null)
{
if (client.IsConnected)
{
try
{
var result = await client.SubscribeAsync(new MqttTopicFilterBuilder().WithTopic(topic).WithExactlyOnceQoS().Build());
}
catch { }
}
}
}

/// <summary>
/// Mqtt 订阅
/// </summary>
/// <param name="topic">需要订阅的主题</param>
public async void MqttSubscriptionAsync(string[] topic)
{
if (client != null)
{
if (client.IsConnected)
{
try
{
foreach (var item in topic)
{
var result = await client.SubscribeAsync(new MqttTopicFilterBuilder().WithTopic(item).WithExactlyOnceQoS().Build());
}

}
catch { }
}
}
}

/// <summary>
/// Mqtt 发布
/// </summary>
/// <param name="topic">需要发布的主题</param>
/// <param name="content">需要发布的内容</param>
public async void MqttPublishAsync(string topic, string content)
{
if (client != null)
{
if (client.IsConnected)
{

var msg = new MqttApplicationMessageBuilder().WithTopic(topic).WithPayload(content).WithExactlyOnceQoS().Build();
try
{
var result = await client.PublishAsync(msg);
}
catch { }
}
}
}




}
}

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

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

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

</Project>

+ 67
- 0
BPASmartClient.Message/MessageLog.cs View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HBLConsole.Service
{
public class MessageLog
{
private volatile static MessageLog _Instance;
public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog());
private MessageLog() { }

#region 普通消息日志
/// <summary>
/// 日志显示委托
/// </summary>
public Action<string> InfoNotify { get; set; }

/// <summary>
/// 日志信息
/// </summary>
public string LogInfo { get; set; } = string.Empty;

/// <summary>
/// 普通日志输出
/// </summary>
/// <param name="info"></param>
public void Show(string info)
{
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
LogInfo = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {LogInfo}";
if (InfoNotify != null) InfoNotify(info);
}
#endregion

#region 异常消息日志
/// <summary>
/// 异常日志委托
/// </summary>
public Action<string> ExInfoNotify { get; set; }

/// <summary>
/// 异常日志信息
/// </summary>
public string ExLogInfo { get; set; } = string.Empty;

/// <summary>
/// 异常日志输出
/// </summary>
/// <param name="info"></param>
public void ShowEx(string info)
{
Debug.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{info}");
ExLogInfo = $"{DateTime.Now.ToString("HH:mm:ss")}:{info} \n\r {ExLogInfo}";
if (ExInfoNotify != null) ExInfoNotify(info);
}
#endregion





}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.Modbus
{
public class Class1
{
}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.MorkD
{
public class Class1
{
}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.MorkS
{
public class Class1
{
}
}

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

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

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

</Project>

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

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

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

</Project>

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

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

namespace BPASmartClient.SCChip
{
public class Class1
{
}
}

+ 15
- 0
BPASmartClient.SerialPort/BPASmartClient.SerialPort.csproj View File

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

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

<ItemGroup>
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
</ItemGroup>

</Project>

+ 50
- 0
BPASmartClient.SerialPort/SerialParameter.cs View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.SerialPort
{
#region 波特率、数据位的枚举
/// <summary>
/// 串口数据位列表(5,6,7,8)
/// </summary>
public enum DataBits : int
{
Five = 5,
Six = 6,
Sevent = 7,
Eight = 8
}

/// <summary>
/// 串口波特率列表。
/// 75,110,150,300,600,1200,2400,4800,9600,14400,19200,28800,38400,56000,57600,
/// 115200,128000,230400,256000
/// </summary>
public enum BaudRates : int
{
BR_75 = 75,
BR_110 = 110,
BR_150 = 150,
BR_300 = 300,
BR_600 = 600,
BR_1200 = 1200,
BR_2400 = 2400,
BR_4800 = 4800,
BR_9600 = 9600,
BR_14400 = 14400,
BR_19200 = 19200,
BR_28800 = 28800,
BR_38400 = 38400,
BR_56000 = 56000,
BR_57600 = 57600,
BR_115200 = 115200,
BR_128000 = 128000,
BR_230400 = 230400,
BR_256000 = 256000
}
#endregion

}

+ 243
- 0
BPASmartClient.SerialPort/SerialPortClient.cs View File

@@ -0,0 +1,243 @@
using BPASmartClient.Helper;
using System;
using System.IO.Ports;
using System.Linq;

namespace BPASmartClient.SerialPort
{
public class SerialPortClient
{
#region 变量属性
private DataStorage<byte> dataStorage;
public event SerialErrorReceivedEventHandler ErrorReceived;

private System.IO.Ports.SerialPort comPort = new System.IO.Ports.SerialPort();
private string portName = "COM1";//串口号,默认COM1
private BaudRates baudRate = BaudRates.BR_9600;//波特率
private Parity parity = Parity.None;//校验位
private StopBits stopBits = StopBits.One;//停止位
private DataBits dataBits = DataBits.Eight;//数据位

/// <summary>
/// 串口号
/// </summary>
public string PortName
{
get { return portName; }
set { portName = value; }
}

/// <summary>
/// 波特率
/// </summary>
public BaudRates BaudRate
{
get { return baudRate; }
set { baudRate = value; }
}
#endregion

#region 构造函数
/// <summary>
/// 无参构造函数
/// </summary>
public SerialPortClient(string name, BaudRates baud)
{
this.portName = name;
this.baudRate = baud;
BoundEvents();
}

void BoundEvents()
{
comPort.DataReceived += new SerialDataReceivedEventHandler(comPort_DataReceived);
comPort.ErrorReceived += new SerialErrorReceivedEventHandler(comPort_ErrorReceived);
}

/// <summary>
/// 参数构造函数(使用枚举参数构造)
/// </summary>
/// <param name="baud">波特率</param>
/// <param name="par">奇偶校验位</param>
/// <param name="sBits">停止位</param>
/// <param name="dBits">数据位</param>
/// <param name="name">串口号</param>
public SerialPortClient(string name, BaudRates baud, Parity par, DataBits dBits, StopBits sBits)
{
this.portName = name;
this.baudRate = baud;
this.parity = par;
this.dataBits = dBits;
this.stopBits = sBits;
BoundEvents();
}

/// <summary>
/// 参数构造函数(使用字符串参数构造)
/// </summary>
/// <param name="baud">波特率</param>
/// <param name="par">奇偶校验位</param>
/// <param name="sBits">停止位</param>
/// <param name="dBits">数据位</param>
/// <param name="name">串口号</param>
public SerialPortClient(string name, string baud, string par, string dBits, string sBits)
{
this.portName = name;
this.baudRate = (BaudRates)Enum.Parse(typeof(BaudRates), baud);
this.parity = (Parity)Enum.Parse(typeof(Parity), par);
this.dataBits = (DataBits)Enum.Parse(typeof(DataBits), dBits);
this.stopBits = (StopBits)Enum.Parse(typeof(StopBits), sBits);
BoundEvents();
}
#endregion

#region 事件处理函数
/// <summary>
/// 数据接收处理
/// </summary>
void comPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
if (comPort.IsOpen) //判断是否打开串口
{

byte[] receivedData = new byte[comPort.BytesToRead]; //创建接收字节数组
comPort.Read(receivedData, 0, receivedData.Length); //读取数据

//触发整条记录的处理
if (dataStorage != null)
{
dataStorage.PutData(receivedData);
}

}
else
{
Console.WriteLine("请打开某个串口", "Error");
}
}
/// <summary>
/// 错误处理函数
/// </summary>
void comPort_ErrorReceived(object sender, SerialErrorReceivedEventArgs e)
{
if (ErrorReceived != null)
{
ErrorReceived(sender, e);
}
}
#endregion

#region 串口关闭/打开
/// <summary>
/// 端口是否已经打开
/// </summary>
public bool IsOpen
{
get
{
return comPort.IsOpen;
}
}

/// <summary>
/// 判断是否有这个串口
/// </summary>
public bool IsHavePort => System.IO.Ports.SerialPort.GetPortNames().Contains(PortName);

/// <summary>
/// 打开端口
/// </summary>
/// <returns></returns>
public void Open()
{
lock (lck4Serial)
{
if (!IsHavePort) return;
if (comPort.IsOpen) comPort.Close();
comPort.PortName = portName;
comPort.BaudRate = (int)baudRate;
comPort.Parity = parity;
comPort.DataBits = (int)dataBits;
comPort.StopBits = stopBits;
comPort.Open();
}
}

/// <summary>
/// 关闭端口
/// </summary>
public void Close()
{
if (!IsHavePort) return;
if (comPort.IsOpen) comPort.Close();
}

/// <summary>
/// 丢弃来自串行驱动程序的接收和发送缓冲区的数据
/// </summary>
public void DiscardBuffer()
{
comPort.DiscardInBuffer();
comPort.DiscardOutBuffer();
}
#endregion

private object lck4Serial = new object();
#region 写入数据
/// <summary>
/// 写入数据
/// </summary>
/// <param name="buffer"></param>
public void Write(byte[] buffer, int offset, int count)
{
lock (lck4Serial)
{
if (!IsHavePort) return;
if (!(comPort.IsOpen)) comPort.Open();
comPort.Write(buffer, offset, count);
}
}

/// <summary>
/// 读取数据
/// </summary>
/// <returns></returns>
public byte[] Read()
{
lock (lck4Serial)
{
if (!IsHavePort) return new byte[0];
if (!(comPort.IsOpen)) comPort.Open();
byte[] buffer = new byte[1024];
comPort.Read(buffer, 0, buffer.Length);
return buffer;
}
}
public void Start()
{
Open();
}

public void Stop()
{
Close();
}

/// <summary>
/// 发送数据
/// </summary>
/// <param name="data">发送数据</param>
public void SendData(byte[] data)
{
Write(data, 0, data.Length);
}

public void SetDataStorage(DataStorage<byte> dataStorage)
{
this.dataStorage = dataStorage;
}
#endregion

}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.Socket
{
public class Class1
{
}
}

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

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

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

</Project>

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

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

namespace BPASmartClient.Status
{
public class Class1
{
}
}

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

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

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

</Project>

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

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

namespace BPASmartClient.ViewModel
{
public class Class1
{
}
}

+ 9
- 0
BPASmartClient/App.xaml View File

@@ -0,0 +1,9 @@
<Application x:Class="BPASmartClient.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmartClient"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>

+ 17
- 0
BPASmartClient/App.xaml.cs View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
BPASmartClient/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 10
- 0
BPASmartClient/BPASmartClient.csproj View File

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

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

</Project>

+ 12
- 0
BPASmartClient/MainWindow.xaml View File

@@ -0,0 +1,12 @@
<Window x:Class="BPASmartClient.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>

</Grid>
</Window>

+ 28
- 0
BPASmartClient/MainWindow.xaml.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}

+ 180
- 0
SmartClient.sln View File

@@ -0,0 +1,180 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32002.185
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.DRCoffee", "BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj", "{31E9DC70-5889-4BA5-A5BA-FFDE66AFF314}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "4.Driver", "4.Driver", "{666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.KLMCoffee", "BPASmartClient.KLMCoffee\BPASmartClient.KLMCoffee.csproj", "{BA543940-3C97-410D-B66C-1B928FCBB567}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.GSIceCream", "BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj", "{51E93537-DE9A-460C-B2B6-5FCB7A616A94}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.SCChip", "BPASmartClient.SCChip\BPASmartClient.SCChip.csproj", "{F57AF771-8514-4020-BBF3-1708388DD4B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Lebai", "BPASmartClient.Lebai\BPASmartClient.Lebai.csproj", "{69F90530-ADA4-4A0C-8068-AAC5584072D7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "5.Communication", "5.Communication", "{3D1D0E04-03FD-480A-8CF8-6E01A2E28625}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.SerialPort", "BPASmartClient.SerialPort\BPASmartClient.SerialPort.csproj", "{2344EB60-1760-4DF0-961A-FA5BE5BC47CC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Http", "BPASmartClient.Http\BPASmartClient.Http.csproj", "{202763AA-4C4C-4738-B530-93A9A1ECE578}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Modbus", "BPASmartClient.Modbus\BPASmartClient.Modbus.csproj", "{13C86146-CD3C-4CD3-AB7F-7A155E222832}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "3.Device", "3.Device", "{9FB27073-61A0-4FE3-94DB-5FDDE062332F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkS", "BPASmartClient.MorkS\BPASmartClient.MorkS.csproj", "{0827FA85-8180-4A85-BE58-9483AC4BB3BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkD", "BPASmartClient.MorkD\BPASmartClient.MorkD.csproj", "{8878BCFD-AC5E-4D84-8C63-CA99DDE036EE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkT", "BPASmartClient.MorkT\BPASmartClient.MorkT.csproj", "{B399BCFF-82E8-4940-9CE5-B7DCDDFDC696}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "2.Business", "2.Business", "{6CEA3385-6F62-452A-8275-033A6037235D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "1.UI", "1.UI", "{8712125E-14CD-4E1B-A1CE-4BDE03805942}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "6.Uitility", "6.Uitility", "{1A9920BA-7C8D-4BDC-8D7D-6544A71AF3CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Helper", "BPASmartClient.Helper\BPASmartClient.Helper.csproj", "{A2A5CB83-11C7-4534-A65D-6F957B60EEFF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Message", "BPASmartClient.Message\BPASmartClient.Message.csproj", "{C517D33F-8800-405E-9D59-E1F6CA201431}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.DeviceProxy", "BPASmartClient.DeviceProxy\BPASmartClient.DeviceProxy.csproj", "{9D26C2D6-CF32-4FB6-A15E-8A1455DACD69}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Status", "BPASmartClient.Status\BPASmartClient.Status.csproj", "{2C8DAB92-D5EB-4462-87C1-0BED75B26C54}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.IoT", "BPASmartClient.IoT\BPASmartClient.IoT.csproj", "{D3DBCC2D-086E-4E3A-B70A-22A79FB295CF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient", "BPASmartClient\BPASmartClient.csproj", "{2BA531E8-7F85-4EBF-AE97-811CD7C83EF2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.ViewModel", "BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj", "{4E393E60-D39A-4118-8BD5-427DC72E9ACE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Device", "BPASmartClient.Device\BPASmartClient.Device.csproj", "{FFECD10B-FE66-4331-A915-409F5BE04480}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MQTT", "BPASmartClient.MQTT\BPASmartClient.MQTT.csproj", "{7D290C8E-ACA7-4F03-91DF-D507FB3E2E87}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.Socket", "BPASmartClient.Socket\BPASmartClient.Socket.csproj", "{F9AD1657-7FF9-470F-BE7F-2379ADAC0BB0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{31E9DC70-5889-4BA5-A5BA-FFDE66AFF314}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{31E9DC70-5889-4BA5-A5BA-FFDE66AFF314}.Debug|Any CPU.Build.0 = Debug|Any CPU
{31E9DC70-5889-4BA5-A5BA-FFDE66AFF314}.Release|Any CPU.ActiveCfg = Release|Any CPU
{31E9DC70-5889-4BA5-A5BA-FFDE66AFF314}.Release|Any CPU.Build.0 = Release|Any CPU
{BA543940-3C97-410D-B66C-1B928FCBB567}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA543940-3C97-410D-B66C-1B928FCBB567}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA543940-3C97-410D-B66C-1B928FCBB567}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA543940-3C97-410D-B66C-1B928FCBB567}.Release|Any CPU.Build.0 = Release|Any CPU
{51E93537-DE9A-460C-B2B6-5FCB7A616A94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51E93537-DE9A-460C-B2B6-5FCB7A616A94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51E93537-DE9A-460C-B2B6-5FCB7A616A94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51E93537-DE9A-460C-B2B6-5FCB7A616A94}.Release|Any CPU.Build.0 = Release|Any CPU
{F57AF771-8514-4020-BBF3-1708388DD4B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F57AF771-8514-4020-BBF3-1708388DD4B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F57AF771-8514-4020-BBF3-1708388DD4B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F57AF771-8514-4020-BBF3-1708388DD4B3}.Release|Any CPU.Build.0 = Release|Any CPU
{69F90530-ADA4-4A0C-8068-AAC5584072D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69F90530-ADA4-4A0C-8068-AAC5584072D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69F90530-ADA4-4A0C-8068-AAC5584072D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{69F90530-ADA4-4A0C-8068-AAC5584072D7}.Release|Any CPU.Build.0 = Release|Any CPU
{2344EB60-1760-4DF0-961A-FA5BE5BC47CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2344EB60-1760-4DF0-961A-FA5BE5BC47CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2344EB60-1760-4DF0-961A-FA5BE5BC47CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2344EB60-1760-4DF0-961A-FA5BE5BC47CC}.Release|Any CPU.Build.0 = Release|Any CPU
{202763AA-4C4C-4738-B530-93A9A1ECE578}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{202763AA-4C4C-4738-B530-93A9A1ECE578}.Debug|Any CPU.Build.0 = Debug|Any CPU
{202763AA-4C4C-4738-B530-93A9A1ECE578}.Release|Any CPU.ActiveCfg = Release|Any CPU
{202763AA-4C4C-4738-B530-93A9A1ECE578}.Release|Any CPU.Build.0 = Release|Any CPU
{13C86146-CD3C-4CD3-AB7F-7A155E222832}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13C86146-CD3C-4CD3-AB7F-7A155E222832}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13C86146-CD3C-4CD3-AB7F-7A155E222832}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13C86146-CD3C-4CD3-AB7F-7A155E222832}.Release|Any CPU.Build.0 = Release|Any CPU
{0827FA85-8180-4A85-BE58-9483AC4BB3BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0827FA85-8180-4A85-BE58-9483AC4BB3BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0827FA85-8180-4A85-BE58-9483AC4BB3BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0827FA85-8180-4A85-BE58-9483AC4BB3BA}.Release|Any CPU.Build.0 = Release|Any CPU
{8878BCFD-AC5E-4D84-8C63-CA99DDE036EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8878BCFD-AC5E-4D84-8C63-CA99DDE036EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8878BCFD-AC5E-4D84-8C63-CA99DDE036EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8878BCFD-AC5E-4D84-8C63-CA99DDE036EE}.Release|Any CPU.Build.0 = Release|Any CPU
{B399BCFF-82E8-4940-9CE5-B7DCDDFDC696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B399BCFF-82E8-4940-9CE5-B7DCDDFDC696}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B399BCFF-82E8-4940-9CE5-B7DCDDFDC696}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B399BCFF-82E8-4940-9CE5-B7DCDDFDC696}.Release|Any CPU.Build.0 = Release|Any CPU
{A2A5CB83-11C7-4534-A65D-6F957B60EEFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A2A5CB83-11C7-4534-A65D-6F957B60EEFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A2A5CB83-11C7-4534-A65D-6F957B60EEFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A2A5CB83-11C7-4534-A65D-6F957B60EEFF}.Release|Any CPU.Build.0 = Release|Any CPU
{C517D33F-8800-405E-9D59-E1F6CA201431}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
{9D26C2D6-CF32-4FB6-A15E-8A1455DACD69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D26C2D6-CF32-4FB6-A15E-8A1455DACD69}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D26C2D6-CF32-4FB6-A15E-8A1455DACD69}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D26C2D6-CF32-4FB6-A15E-8A1455DACD69}.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
{D3DBCC2D-086E-4E3A-B70A-22A79FB295CF}.Release|Any CPU.Build.0 = Release|Any CPU
{2BA531E8-7F85-4EBF-AE97-811CD7C83EF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BA531E8-7F85-4EBF-AE97-811CD7C83EF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BA531E8-7F85-4EBF-AE97-811CD7C83EF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BA531E8-7F85-4EBF-AE97-811CD7C83EF2}.Release|Any CPU.Build.0 = Release|Any CPU
{4E393E60-D39A-4118-8BD5-427DC72E9ACE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E393E60-D39A-4118-8BD5-427DC72E9ACE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E393E60-D39A-4118-8BD5-427DC72E9ACE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E393E60-D39A-4118-8BD5-427DC72E9ACE}.Release|Any CPU.Build.0 = Release|Any CPU
{FFECD10B-FE66-4331-A915-409F5BE04480}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FFECD10B-FE66-4331-A915-409F5BE04480}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FFECD10B-FE66-4331-A915-409F5BE04480}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FFECD10B-FE66-4331-A915-409F5BE04480}.Release|Any CPU.Build.0 = Release|Any CPU
{7D290C8E-ACA7-4F03-91DF-D507FB3E2E87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D290C8E-ACA7-4F03-91DF-D507FB3E2E87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D290C8E-ACA7-4F03-91DF-D507FB3E2E87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D290C8E-ACA7-4F03-91DF-D507FB3E2E87}.Release|Any CPU.Build.0 = Release|Any CPU
{F9AD1657-7FF9-470F-BE7F-2379ADAC0BB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F9AD1657-7FF9-470F-BE7F-2379ADAC0BB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F9AD1657-7FF9-470F-BE7F-2379ADAC0BB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F9AD1657-7FF9-470F-BE7F-2379ADAC0BB0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{31E9DC70-5889-4BA5-A5BA-FFDE66AFF314} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{BA543940-3C97-410D-B66C-1B928FCBB567} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{51E93537-DE9A-460C-B2B6-5FCB7A616A94} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{F57AF771-8514-4020-BBF3-1708388DD4B3} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{69F90530-ADA4-4A0C-8068-AAC5584072D7} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{2344EB60-1760-4DF0-961A-FA5BE5BC47CC} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{202763AA-4C4C-4738-B530-93A9A1ECE578} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{13C86146-CD3C-4CD3-AB7F-7A155E222832} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{0827FA85-8180-4A85-BE58-9483AC4BB3BA} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{8878BCFD-AC5E-4D84-8C63-CA99DDE036EE} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{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}
{9D26C2D6-CF32-4FB6-A15E-8A1455DACD69} = {6CEA3385-6F62-452A-8275-033A6037235D}
{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}
{FFECD10B-FE66-4331-A915-409F5BE04480} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{7D290C8E-ACA7-4F03-91DF-D507FB3E2E87} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{F9AD1657-7FF9-470F-BE7F-2379ADAC0BB0} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}
EndGlobalSection
EndGlobal

Loading…
Cancel
Save