Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade MQTTnet to latest version #108

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageVersion Include="NUnit" Version="4.3.2" />
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.6.0" />
<PackageVersion Include="MQTTnet" Version="4.3.7.1207" />
<PackageVersion Include="MQTTnet" Version="5.0.1.1416" />
<PackageVersion Include="QRCoder" Version="1.6.0" />
<PackageVersion Include="SimpleExec" Version="12.0.0" />
<PackageVersion Include="Spectre.Console" Version="0.49.1" />
Expand Down
6 changes: 3 additions & 3 deletions Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using Meshtastic.Data.MessageFactories;
using MQTTnet;
using Meshtastic.Protobufs;
using MQTTnet.Client;
using Microsoft.Extensions.Logging;
using System.Buffers;

namespace Meshtastic.Cli.CommandHandlers;

Expand All @@ -22,7 +22,7 @@ public async Task<DeviceStateContainer> Handle()
public override async Task OnCompleted(FromRadio packet, DeviceStateContainer container)
{
// connect to mqtt server with mqttnet
var factory = new MqttFactory();
var factory = new MqttClientFactory();
using var mqttClient = factory.CreateMqttClient();
MqttClientOptions options = GetMqttClientOptions(container);
await mqttClient.ConnectAsync(options, CancellationToken.None);
Expand All @@ -45,7 +45,7 @@ await mqttClient.SubscribeAsync(new MqttTopicFilterBuilder()

// Get bytes from utf8 string
var toRadio = new ToRadioMessageFactory()
.CreateMqttClientProxyMessage(e.ApplicationMessage.Topic, e.ApplicationMessage.PayloadSegment.ToArray(), e.ApplicationMessage.Retain);
.CreateMqttClientProxyMessage(e.ApplicationMessage.Topic, e.ApplicationMessage.Payload.ToArray(), e.ApplicationMessage.Retain);
Logger.LogDebug(toRadio.ToString());
await Connection.WriteToRadio(toRadio);
};
Expand Down
Loading