提交全部资料
This commit is contained in:
18
4.测试上位机/VS工程/MqttClientWin/App.config
Normal file
18
4.测试上位机/VS工程/MqttClientWin/App.config
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
339
4.测试上位机/VS工程/MqttClientWin/FmMqttClient.Designer.cs
generated
Normal file
339
4.测试上位机/VS工程/MqttClientWin/FmMqttClient.Designer.cs
generated
Normal file
@@ -0,0 +1,339 @@
|
||||
namespace MqttClientWin
|
||||
{
|
||||
partial class FmMqttClient
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows 窗体设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FmMqttClient));
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtSubTopic = new System.Windows.Forms.TextBox();
|
||||
this.txtReceiveMessage = new System.Windows.Forms.TextBox();
|
||||
this.txtMessage = new System.Windows.Forms.TextBox();
|
||||
this.btnSubscribe = new System.Windows.Forms.Button();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtSubService = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.btn_n = new System.Windows.Forms.Button();
|
||||
this.btn_p = new System.Windows.Forms.Button();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.button10 = new System.Windows.Forms.Button();
|
||||
this.button9 = new System.Windows.Forms.Button();
|
||||
this.btn_c = new System.Windows.Forms.Button();
|
||||
this.btn_r = new System.Windows.Forms.Button();
|
||||
this.btn_m = new System.Windows.Forms.Button();
|
||||
this.btn_e = new System.Windows.Forms.Button();
|
||||
this.btn_q = new System.Windows.Forms.Button();
|
||||
this.btn_s = new System.Windows.Forms.Button();
|
||||
this.btn_t = new System.Windows.Forms.Button();
|
||||
this.panel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(77, 107);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(63, 14);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "订阅主题";
|
||||
//
|
||||
// txtSubTopic
|
||||
//
|
||||
this.txtSubTopic.Location = new System.Drawing.Point(144, 104);
|
||||
this.txtSubTopic.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
|
||||
this.txtSubTopic.Name = "txtSubTopic";
|
||||
this.txtSubTopic.Size = new System.Drawing.Size(337, 23);
|
||||
this.txtSubTopic.TabIndex = 1;
|
||||
//
|
||||
// txtReceiveMessage
|
||||
//
|
||||
this.txtReceiveMessage.Location = new System.Drawing.Point(42, 333);
|
||||
this.txtReceiveMessage.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
|
||||
this.txtReceiveMessage.Multiline = true;
|
||||
this.txtReceiveMessage.Name = "txtReceiveMessage";
|
||||
this.txtReceiveMessage.Size = new System.Drawing.Size(368, 202);
|
||||
this.txtReceiveMessage.TabIndex = 2;
|
||||
this.txtReceiveMessage.TextChanged += new System.EventHandler(this.txtReceiveMessage_TextChanged);
|
||||
//
|
||||
// txtMessage
|
||||
//
|
||||
this.txtMessage.Location = new System.Drawing.Point(42, 156);
|
||||
this.txtMessage.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
|
||||
this.txtMessage.Multiline = true;
|
||||
this.txtMessage.Name = "txtMessage";
|
||||
this.txtMessage.Size = new System.Drawing.Size(368, 141);
|
||||
this.txtMessage.TabIndex = 5;
|
||||
//
|
||||
// btnSubscribe
|
||||
//
|
||||
this.btnSubscribe.Location = new System.Drawing.Point(485, 71);
|
||||
this.btnSubscribe.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
|
||||
this.btnSubscribe.Name = "btnSubscribe";
|
||||
this.btnSubscribe.Size = new System.Drawing.Size(70, 56);
|
||||
this.btnSubscribe.TabIndex = 7;
|
||||
this.btnSubscribe.Text = "订阅";
|
||||
this.btnSubscribe.UseVisualStyleBackColor = true;
|
||||
this.btnSubscribe.Click += new System.EventHandler(this.BtnSubscribe_ClickAsync);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(63, 74);
|
||||
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(77, 14);
|
||||
this.label3.TabIndex = 8;
|
||||
this.label3.Text = "服务器地址";
|
||||
//
|
||||
// txtSubService
|
||||
//
|
||||
this.txtSubService.Location = new System.Drawing.Point(144, 71);
|
||||
this.txtSubService.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
|
||||
this.txtSubService.Name = "txtSubService";
|
||||
this.txtSubService.Size = new System.Drawing.Size(337, 23);
|
||||
this.txtSubService.TabIndex = 9;
|
||||
this.txtSubService.TextChanged += new System.EventHandler(this.txtSubService_TextChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label2.Location = new System.Drawing.Point(38, 309);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(52, 21);
|
||||
this.label2.TabIndex = 10;
|
||||
this.label2.Text = "日志";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Font = new System.Drawing.Font("宋体", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.label5.Location = new System.Drawing.Point(38, 132);
|
||||
this.label5.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(52, 21);
|
||||
this.label5.TabIndex = 12;
|
||||
this.label5.Text = "解码";
|
||||
this.label5.Click += new System.EventHandler(this.label5_Click);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.panel1.Controls.Add(this.btn_n);
|
||||
this.panel1.Controls.Add(this.btn_p);
|
||||
this.panel1.Controls.Add(this.button1);
|
||||
this.panel1.Controls.Add(this.button10);
|
||||
this.panel1.Controls.Add(this.button9);
|
||||
this.panel1.Controls.Add(this.btn_c);
|
||||
this.panel1.Controls.Add(this.btn_r);
|
||||
this.panel1.Controls.Add(this.btn_m);
|
||||
this.panel1.Controls.Add(this.btn_e);
|
||||
this.panel1.Controls.Add(this.btn_q);
|
||||
this.panel1.Controls.Add(this.btn_s);
|
||||
this.panel1.Controls.Add(this.btn_t);
|
||||
this.panel1.Location = new System.Drawing.Point(435, 156);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(162, 379);
|
||||
this.panel1.TabIndex = 14;
|
||||
//
|
||||
// btn_n
|
||||
//
|
||||
this.btn_n.Location = new System.Drawing.Point(84, 192);
|
||||
this.btn_n.Name = "btn_n";
|
||||
this.btn_n.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_n.TabIndex = 12;
|
||||
this.btn_n.Text = "空 N";
|
||||
this.btn_n.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_p
|
||||
//
|
||||
this.btn_p.Location = new System.Drawing.Point(3, 192);
|
||||
this.btn_p.Name = "btn_p";
|
||||
this.btn_p.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_p.TabIndex = 11;
|
||||
this.btn_p.Text = "人员 P";
|
||||
this.btn_p.UseVisualStyleBackColor = true;
|
||||
this.btn_p.Click += new System.EventHandler(this.button2_Click_1);
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.ForeColor = System.Drawing.SystemColors.InactiveCaption;
|
||||
this.button1.Location = new System.Drawing.Point(3, 3);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 57);
|
||||
this.button1.TabIndex = 10;
|
||||
this.button1.Text = "电源";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button10
|
||||
//
|
||||
this.button10.ForeColor = System.Drawing.SystemColors.InactiveCaption;
|
||||
this.button10.Location = new System.Drawing.Point(84, 319);
|
||||
this.button10.Name = "button10";
|
||||
this.button10.Size = new System.Drawing.Size(75, 57);
|
||||
this.button10.TabIndex = 9;
|
||||
this.button10.Text = "发送";
|
||||
this.button10.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button9
|
||||
//
|
||||
this.button9.ForeColor = System.Drawing.SystemColors.InactiveCaption;
|
||||
this.button9.Location = new System.Drawing.Point(3, 318);
|
||||
this.button9.Name = "button9";
|
||||
this.button9.Size = new System.Drawing.Size(75, 57);
|
||||
this.button9.TabIndex = 8;
|
||||
this.button9.Text = "语音";
|
||||
this.button9.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_c
|
||||
//
|
||||
this.btn_c.Location = new System.Drawing.Point(84, 255);
|
||||
this.btn_c.Name = "btn_c";
|
||||
this.btn_c.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_c.TabIndex = 7;
|
||||
this.btn_c.Text = "结束 C";
|
||||
this.btn_c.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_r
|
||||
//
|
||||
this.btn_r.Location = new System.Drawing.Point(3, 255);
|
||||
this.btn_r.Name = "btn_r";
|
||||
this.btn_r.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_r.TabIndex = 6;
|
||||
this.btn_r.Text = "响应 R";
|
||||
this.btn_r.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_m
|
||||
//
|
||||
this.btn_m.Location = new System.Drawing.Point(84, 129);
|
||||
this.btn_m.Name = "btn_m";
|
||||
this.btn_m.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_m.TabIndex = 5;
|
||||
this.btn_m.Text = "物料 M";
|
||||
this.btn_m.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_e
|
||||
//
|
||||
this.btn_e.Location = new System.Drawing.Point(3, 129);
|
||||
this.btn_e.Name = "btn_e";
|
||||
this.btn_e.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_e.TabIndex = 4;
|
||||
this.btn_e.Text = "设备 E";
|
||||
this.btn_e.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_q
|
||||
//
|
||||
this.btn_q.Location = new System.Drawing.Point(84, 66);
|
||||
this.btn_q.Name = "btn_q";
|
||||
this.btn_q.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_q.TabIndex = 3;
|
||||
this.btn_q.Text = "质量 Q";
|
||||
this.btn_q.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_s
|
||||
//
|
||||
this.btn_s.Location = new System.Drawing.Point(3, 66);
|
||||
this.btn_s.Name = "btn_s";
|
||||
this.btn_s.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_s.TabIndex = 2;
|
||||
this.btn_s.Text = "安全 S";
|
||||
this.btn_s.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btn_t
|
||||
//
|
||||
this.btn_t.BackColor = System.Drawing.Color.Gainsboro;
|
||||
this.btn_t.Location = new System.Drawing.Point(84, 3);
|
||||
this.btn_t.Name = "btn_t";
|
||||
this.btn_t.Size = new System.Drawing.Size(75, 57);
|
||||
this.btn_t.TabIndex = 1;
|
||||
this.btn_t.Text = "停线 T";
|
||||
this.btn_t.UseVisualStyleBackColor = false;
|
||||
this.btn_t.Click += new System.EventHandler(this.button2_Click);
|
||||
//
|
||||
// FmMqttClient
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
|
||||
this.BackImage = ((System.Drawing.Image)(resources.GetObject("$this.BackImage")));
|
||||
this.BackMaxSize = 130;
|
||||
this.ClientSize = new System.Drawing.Size(640, 556);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.txtSubService);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.btnSubscribe);
|
||||
this.Controls.Add(this.txtMessage);
|
||||
this.Controls.Add(this.txtReceiveMessage);
|
||||
this.Controls.Add(this.txtSubTopic);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.ForeColor = System.Drawing.SystemColors.MenuHighlight;
|
||||
this.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
|
||||
this.Name = "FmMqttClient";
|
||||
this.Padding = new System.Windows.Forms.Padding(23, 70, 23, 23);
|
||||
this.Style = MetroFramework.MetroColorStyle.Magenta;
|
||||
this.Text = " 安灯数据流测试工具";
|
||||
this.Load += new System.EventHandler(this.FmMqttClient_Load);
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtSubTopic;
|
||||
private System.Windows.Forms.TextBox txtReceiveMessage;
|
||||
private System.Windows.Forms.TextBox txtMessage;
|
||||
private System.Windows.Forms.Button btnSubscribe;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox txtSubService;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.Button btn_e;
|
||||
private System.Windows.Forms.Button btn_q;
|
||||
private System.Windows.Forms.Button btn_s;
|
||||
private System.Windows.Forms.Button btn_t;
|
||||
private System.Windows.Forms.Button button10;
|
||||
private System.Windows.Forms.Button button9;
|
||||
private System.Windows.Forms.Button btn_c;
|
||||
private System.Windows.Forms.Button btn_r;
|
||||
private System.Windows.Forms.Button btn_m;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button btn_n;
|
||||
private System.Windows.Forms.Button btn_p;
|
||||
}
|
||||
}
|
||||
|
||||
328
4.测试上位机/VS工程/MqttClientWin/FmMqttClient.cs
Normal file
328
4.测试上位机/VS工程/MqttClientWin/FmMqttClient.cs
Normal file
@@ -0,0 +1,328 @@
|
||||
using MetroFramework.Forms;
|
||||
using MQTTnet;
|
||||
using MQTTnet.Core;
|
||||
using MQTTnet.Core.Client;
|
||||
using MQTTnet.Core.Packets;
|
||||
using MQTTnet.Core.Protocol;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MqttClientWin
|
||||
{
|
||||
public partial class FmMqttClient : MetroForm
|
||||
{
|
||||
private MqttClient mqttClient = null;
|
||||
|
||||
public FmMqttClient()
|
||||
{
|
||||
InitializeComponent();
|
||||
txtSubTopic.Text = "/Uplink";
|
||||
txtSubService.Text = "mqtt.usot.top";
|
||||
txtReceiveMessage.AppendText("Copyright © 2025 路怀帅. All rights reserved." + Environment.NewLine);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// 服务器连接成功
|
||||
// </summary>
|
||||
// <param name="sender"></param>
|
||||
// <param name="e"></param>
|
||||
private void MqttClient_Connected(object sender, EventArgs e)
|
||||
{
|
||||
Invoke((new Action(() =>
|
||||
{
|
||||
txtReceiveMessage.AppendText("已连接到MQTT服务器!" + Environment.NewLine);
|
||||
|
||||
})));
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// 断开服务器连接
|
||||
// </summary>
|
||||
// <param name="sender"></param>
|
||||
// <param name="e"></param>
|
||||
private void MqttClient_Disconnected(object sender, EventArgs e)
|
||||
{
|
||||
Invoke((new Action(() =>
|
||||
{
|
||||
txtReceiveMessage.AppendText("已断开MQTT连接!" + Environment.NewLine);
|
||||
})));
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// 接收到消息
|
||||
// </summary>
|
||||
// <param name="sender"></param>
|
||||
// <param name="e"></param>
|
||||
private void MqttClient_ApplicationMessageReceived(object sender, MqttApplicationMessageReceivedEventArgs e)
|
||||
{
|
||||
Invoke((Action)(() =>
|
||||
{
|
||||
// 原始消息输出到 txtReceiveMessage(保持不变)
|
||||
string payloadStr = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
|
||||
txtReceiveMessage.AppendText($">> {payloadStr}{Environment.NewLine}");
|
||||
txtMessage.Clear();
|
||||
// 结构化解析结果输出到 txtMessage
|
||||
txtMessage.AppendText($"📩 来自主题 {e.ApplicationMessage.Topic} 的消息 [{DateTime.Now:HH:mm:ss}]{Environment.NewLine}");
|
||||
|
||||
try
|
||||
{
|
||||
using (var doc = JsonDocument.Parse(payloadStr))
|
||||
{
|
||||
var root = doc.RootElement;
|
||||
|
||||
// 提取和显示其他信息...
|
||||
string deviceName = root.TryGetProperty("deviceName", out var deviceNameProp) ? deviceNameProp.GetString() : "N/A";
|
||||
string devEUI = root.TryGetProperty("devEUI", out var devEUIProp) ? devEUIProp.GetString() : "N/A";
|
||||
|
||||
string gatewayTimeStr = root.TryGetProperty("gatewayTime", out var gatewayTimeProp) ? gatewayTimeProp.GetString() : "N/A";
|
||||
string localTime = "N/A";
|
||||
if (!string.IsNullOrEmpty(gatewayTimeStr) && gatewayTimeStr != "N/A")
|
||||
{
|
||||
if (DateTimeOffset.TryParse(gatewayTimeStr, out var dto))
|
||||
{
|
||||
localTime = dto.LocalDateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
|
||||
// 提取 rxInfo[0] 中的 rssi 和 loRaSNR
|
||||
string rssi = "N/A";
|
||||
string loRaSNR = "N/A";
|
||||
|
||||
if (root.TryGetProperty("rxInfo", out var rxInfoArray) && rxInfoArray.ValueKind == JsonValueKind.Array && rxInfoArray.GetArrayLength() > 0)
|
||||
{
|
||||
var gatewayInfo = rxInfoArray[0];
|
||||
rssi = gatewayInfo.TryGetProperty("rssi", out var rssiProp) ? rssiProp.GetInt32().ToString() : "N/A";
|
||||
loRaSNR = gatewayInfo.TryGetProperty("loRaSNR", out var snrProp) ? snrProp.GetDouble().ToString("F1") : "N/A";
|
||||
}
|
||||
|
||||
// 显示提取的字段
|
||||
txtMessage.AppendText($"🔧 设备名称: {deviceName}{Environment.NewLine}");
|
||||
txtMessage.AppendText($"📡 设备EUI: {devEUI}{Environment.NewLine}");
|
||||
txtMessage.AppendText($"🕒 网关时间: {localTime}{Environment.NewLine}");
|
||||
txtMessage.AppendText($"📶 信号强度 (RSSI): {rssi} dBm{Environment.NewLine}");
|
||||
txtMessage.AppendText($"⚡ 信噪比 (LoRaSNR): {loRaSNR} dB{Environment.NewLine}");
|
||||
// 处理解码的 data 字段
|
||||
if (root.TryGetProperty("data", out var dataElement))
|
||||
{
|
||||
string base64Data = dataElement.GetString();
|
||||
if (!string.IsNullOrEmpty(base64Data))
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] decodedBytes = Convert.FromBase64String(base64Data);
|
||||
string decodedJson = Encoding.UTF8.GetString(decodedBytes);
|
||||
|
||||
using (var innerDoc = JsonDocument.Parse(decodedJson))
|
||||
{
|
||||
var innerRoot = innerDoc.RootElement;
|
||||
|
||||
// 更新按钮状态
|
||||
UpdateButtonState(innerRoot, "T", btn_t);
|
||||
UpdateButtonState(innerRoot, "R", btn_r);
|
||||
UpdateButtonState(innerRoot, "C", btn_c);
|
||||
|
||||
// 对于E字段,由于其对应多个按钮且条件不同,单独处理
|
||||
if (innerRoot.TryGetProperty("E", out var eProp))
|
||||
{
|
||||
string eStr = eProp.GetString();
|
||||
if (int.TryParse(eStr, out int eValue))
|
||||
{
|
||||
btn_s.BackColor = (eValue == 3) ? Color.Lime : Color.Gainsboro;
|
||||
btn_q.BackColor = (eValue == 4) ? Color.Lime : Color.Gainsboro;
|
||||
btn_e.BackColor = (eValue == 5) ? Color.Lime : Color.Gainsboro;
|
||||
btn_m.BackColor = (eValue == 6) ? Color.Lime : Color.Gainsboro;
|
||||
btn_p.BackColor = (eValue == 7) ? Color.Lime : Color.Gainsboro;
|
||||
btn_n.BackColor = (eValue == 8) ? Color.Lime : Color.Gainsboro;
|
||||
}
|
||||
else
|
||||
{
|
||||
btn_s.BackColor = Color.Gainsboro;
|
||||
btn_q.BackColor = Color.Gainsboro;
|
||||
btn_e.BackColor = Color.Gainsboro;
|
||||
btn_m.BackColor = Color.Gainsboro;
|
||||
btn_p.BackColor = Color.Gainsboro;
|
||||
btn_n.BackColor = Color.Gainsboro;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
string prettyJson = innerRoot.ToString(); // 自动格式化
|
||||
txtMessage.AppendText($"📦 Data解码:{prettyJson}{Environment.NewLine}");
|
||||
}
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
txtMessage.AppendText($"❌ Base64 解码失败: 数据格式错误{Environment.NewLine}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
txtMessage.AppendText($"❌ 解码异常: {ex.Message}{Environment.NewLine}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
txtMessage.AppendText($"📦 Base64 data: (空){Environment.NewLine}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
txtMessage.AppendText($"📦 Base64 data: (未找到字段){Environment.NewLine}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
txtMessage.AppendText($"❌ JSON 解析失败: {ex.Message}{Environment.NewLine}{Environment.NewLine}");
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// 通用按钮状态更新方法
|
||||
private void UpdateButtonState(JsonElement root, string fieldName, Button button)
|
||||
{
|
||||
if (root.TryGetProperty(fieldName, out var fieldProp))
|
||||
{
|
||||
string valueStr = fieldProp.GetString(); // 先作为字符串获取
|
||||
|
||||
if (int.TryParse(valueStr, out int value))
|
||||
{
|
||||
bool isOn = (value == 1);
|
||||
button.BackColor = isOn ? Color.Lime : Color.Gainsboro;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// 订阅消息
|
||||
// </summary>
|
||||
// <param name="sender"></param>
|
||||
// <param name="e"></param>
|
||||
private async void BtnSubscribe_ClickAsync(object sender, EventArgs e)
|
||||
{
|
||||
string broker = txtSubService.Text.Trim();
|
||||
string topic = txtSubTopic.Text.Trim();
|
||||
|
||||
if (string.IsNullOrEmpty(broker))
|
||||
{
|
||||
MessageBox.Show("MQTT 服务器地址不能为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(topic))
|
||||
{
|
||||
MessageBox.Show("订阅主题不能为空!");
|
||||
return;
|
||||
}
|
||||
|
||||
// 断开旧连接(如果已连接)
|
||||
if (mqttClient != null && mqttClient.IsConnected)
|
||||
{
|
||||
await mqttClient.DisconnectAsync();
|
||||
}
|
||||
|
||||
// 初始化客户端(如果尚未创建)
|
||||
if (mqttClient == null)
|
||||
{
|
||||
mqttClient = new MqttClientFactory().CreateMqttClient() as MqttClient;
|
||||
mqttClient.ApplicationMessageReceived += MqttClient_ApplicationMessageReceived;
|
||||
mqttClient.Connected += MqttClient_Connected;
|
||||
mqttClient.Disconnected += MqttClient_Disconnected;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var options = new MqttClientTcpOptions
|
||||
{
|
||||
Server = broker,
|
||||
ClientId = Guid.NewGuid().ToString().Substring(0, 5),
|
||||
UserName = "",
|
||||
Password = "", // 注意:某些版本需要 char[]
|
||||
CleanSession = true,
|
||||
// 可选:设置端口(默认1883)
|
||||
// Port = 1883
|
||||
};
|
||||
|
||||
// 连接服务器
|
||||
await mqttClient.ConnectAsync(options);
|
||||
|
||||
// 连接成功后订阅主题
|
||||
var topicFilter = new TopicFilter(topic, MqttQualityOfServiceLevel.AtMostOnce);
|
||||
await mqttClient.SubscribeAsync(topicFilter);
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
txtReceiveMessage.AppendText($"[订阅] 已连接到 {broker} 并订阅主题: [{topic}]{Environment.NewLine}");
|
||||
btnSubscribe.Enabled = false; // 防止重复点击
|
||||
}));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
txtReceiveMessage.AppendText($"[错误] 连接或订阅失败: {ex.Message}{Environment.NewLine}");
|
||||
MessageBox.Show($"连接失败: {ex.Message}");
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void FmMqttClient_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void txtPubTopic_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void txtSubService_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void label4_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void label5_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void txtReceiveMessage_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
1169
4.测试上位机/VS工程/MqttClientWin/FmMqttClient.resx
Normal file
1169
4.测试上位机/VS工程/MqttClientWin/FmMqttClient.resx
Normal file
File diff suppressed because it is too large
Load Diff
246
4.测试上位机/VS工程/MqttClientWin/MqttClientWin.csproj
Normal file
246
4.测试上位机/VS工程/MqttClientWin/MqttClientWin.csproj
Normal file
@@ -0,0 +1,246 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{FD42B3D4-32D9-4B5E-9227-D94EF239989A}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>MqttClientWin</RootNamespace>
|
||||
<AssemblyName>MqttClientWin</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>C:\Users\Administrator\Desktop\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>6</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>03F3639B9E4CA80F083F66D32568B990CAA1672E</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>MqttClientWin_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetZone>LocalIntranet</TargetZone>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Apache.NMS, Version=1.7.1.3894, Culture=neutral, PublicKeyToken=82756feee3957618, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Apache.NMS.1.7.1\lib\net40\Apache.NMS.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Apache.NMS.ActiveMQ, Version=1.7.2.4108, Culture=neutral, PublicKeyToken=82756feee3957618, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Apache.NMS.ActiveMQ.1.7.2\lib\net40\Apache.NMS.ActiveMQ.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework.Design, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Design.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MetroFramework.Fonts, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.9.0.8\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet, Version=2.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\dll\MQTTnet.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MQTTnet.Core, Version=2.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\dll\MQTTnet.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IO.Pipelines, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.9.0.8\lib\net462\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Security, Version=4.0.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Security.4.3.2\lib\net46\System.Net.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.9.0.8\lib\net462\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Json, Version=9.0.0.8, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Json.9.0.8\lib\net462\System.Text.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FmMqttClient.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FmMqttClient.Designer.cs">
|
||||
<DependentUpon>FmMqttClient.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="FmMqttClient.resx">
|
||||
<DependentUpon>FmMqttClient.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="MqttClientWin_TemporaryKey.pfx" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\app.manifest" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
22
4.测试上位机/VS工程/MqttClientWin/Program.cs
Normal file
22
4.测试上位机/VS工程/MqttClientWin/Program.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace MqttClientWin
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FmMqttClient());
|
||||
}
|
||||
}
|
||||
}
|
||||
32
4.测试上位机/VS工程/MqttClientWin/Properties/AssemblyInfo.cs
Normal file
32
4.测试上位机/VS工程/MqttClientWin/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyTitle("ETRC MQTT测试工具")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("电子创新实验室")]
|
||||
[assembly: AssemblyProduct("MQTT测试工具")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023 路怀帅. All rights reserved.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("fd42b3d4-32d9-4b5e-9227-d94ef239989a")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
|
||||
// 方法是按如下所示使用“*”: :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
63
4.测试上位机/VS工程/MqttClientWin/Properties/Resources.Designer.cs
generated
Normal file
63
4.测试上位机/VS工程/MqttClientWin/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MqttClientWin.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||
/// </summary>
|
||||
// 此类是由 StronglyTypedResourceBuilder
|
||||
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
|
||||
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
|
||||
// (以 /str 作为命令选项),或重新生成 VS 项目。
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MqttClientWin.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
117
4.测试上位机/VS工程/MqttClientWin/Properties/Resources.resx
Normal file
117
4.测试上位机/VS工程/MqttClientWin/Properties/Resources.resx
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
26
4.测试上位机/VS工程/MqttClientWin/Properties/Settings.Designer.cs
generated
Normal file
26
4.测试上位机/VS工程/MqttClientWin/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace MqttClientWin.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
4.测试上位机/VS工程/MqttClientWin/Properties/Settings.settings
Normal file
7
4.测试上位机/VS工程/MqttClientWin/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
72
4.测试上位机/VS工程/MqttClientWin/Properties/app.manifest
Normal file
72
4.测试上位机/VS工程/MqttClientWin/Properties/app.manifest
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC 清单选项
|
||||
如果想要更改 Windows 用户帐户控制级别,请使用
|
||||
以下节点之一替换 requestedExecutionLevel 节点。n
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
|
||||
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
|
||||
元素。
|
||||
-->
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
<applicationRequestMinimum>
|
||||
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
|
||||
<defaultAssemblyRequest permissionSetReference="Custom" />
|
||||
</applicationRequestMinimum>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
|
||||
Windows 版本的列表。取消评论适当的元素,
|
||||
Windows 将自动选择最兼容的环境。 -->
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
</application>
|
||||
</compatibility>
|
||||
<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
|
||||
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
|
||||
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
|
||||
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
|
||||
|
||||
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
</assembly>
|
||||
14
4.测试上位机/VS工程/MqttClientWin/packages.config
Normal file
14
4.测试上位机/VS工程/MqttClientWin/packages.config
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MetroModernUI" version="1.4.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="9.0.8" targetFramework="net48" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
||||
<package id="System.IO.Pipelines" version="9.0.8" targetFramework="net48" />
|
||||
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
|
||||
<package id="System.Text.Encodings.Web" version="9.0.8" targetFramework="net48" />
|
||||
<package id="System.Text.Json" version="9.0.8" targetFramework="net48" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user