feat: 更新接口

This commit is contained in:
GukSang.Jin
2026-03-03 16:49:57 +08:00
parent 2a312e798f
commit 874ed80fe0
18 changed files with 376 additions and 367 deletions

View File

@@ -2,13 +2,16 @@ namespace PetWashControl.Services;
public class ConfigurationService
{
public string ApiBaseUrl { get; set; } = "https://localhost:7203/";
public string MqttBrokerHost { get; set; } = "localhost";
// https://localhost:7203/ 本地
public string ApiBaseUrl { get; set; } = "http://localhost:5000/";
public string MqttBrokerHost { get; set; } = "101.132.182.216";
public int MqttBrokerPort { get; set; } = 1883;
public string MqttApiKey { get; set; } = "dc240ab5ec";
public string MqttId { get; set; } = "13064";
public string MqttClientId { get; set; } = "PetWashControl";
// Modbus TCP 配置
public string ModbusIpAddress { get; set; } = "192.168.1.10";
public string ModbusIpAddress { get; set; } = "127.0.0.1";
public int ModbusPort { get; set; } = 502;
public byte ModbusSlaveId { get; set; } = 1;
public int ModbusConnectTimeoutMs { get; set; } = 5000;

View File

@@ -24,6 +24,7 @@ public class MqttClientService
_options = new MqttClientOptionsBuilder()
.WithTcpServer(_config.MqttBrokerHost, _config.MqttBrokerPort)
.WithClientId(_config.MqttClientId)
//.WithCredentials(_config.MqttId, _config.MqttApiKey)
.WithCleanSession()
.Build();

View File

@@ -761,7 +761,7 @@ public partial class MainViewModel : ObservableObject
_logger.LogInfo($"关门并开始洗护订单ID: {CurrentOrder.Id}");
// 触发 Modbus M80 复归型按钮
await _modbusService.TriggerStartWashAsync();
// await _modbusService.TriggerStartWashAsync();
// 通过MQTT发送关门状态
await _mqttService.PublishAsync("device/status", new