From b61bd5f1e139cda834a4a56019c3dafaea3661c1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sat, 1 Jul 2023 20:52:01 -0500 Subject: [PATCH 1/8] Mqtt proxy command --- .../MqttProxyCommandHandler.cs | 36 ++ Meshtastic.Cli/Commands/MqttProxyCommand.cs | 20 + Meshtastic.Cli/Program.cs | 1 + Meshtastic/Generated/Deviceonly.cs | 2 +- Meshtastic/Generated/Mesh.cs | 527 ++++++++++++++++-- Meshtastic/Generated/ModuleConfig.cs | 178 +++--- Meshtastic/Generated/Portnums.cs | 26 +- Meshtastic/Generated/Telemetry.cs | 188 +++---- protobufs | 2 +- 9 files changed, 750 insertions(+), 230 deletions(-) create mode 100644 Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs create mode 100644 Meshtastic.Cli/Commands/MqttProxyCommand.cs diff --git a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs new file mode 100644 index 0000000..6b0dc80 --- /dev/null +++ b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs @@ -0,0 +1,36 @@ +using Meshtastic.Data; +using Meshtastic.Data.MessageFactories; +using Meshtastic.Display; +using Meshtastic.Protobufs; + +namespace Meshtastic.Cli.CommandHandlers; + +public class MqttProxyCommandHandler : DeviceCommandHandler +{ + public MqttProxyCommandHandler(DeviceConnectionContext context, CommandContext commandContext) : base(context, commandContext) { } + + public async Task Handle() + { + var wantConfig = new ToRadioMessageFactory().CreateWantConfigMessage(); + var container = await Connection.WriteToRadio(wantConfig, CompleteOnConfigReceived); + Connection.Disconnect(); + return container; + } + + public override async Task OnCompleted(FromRadio packet, DeviceStateContainer container) + { + await Connection.ReadFromRadio((fromRadio, container) => + { + if (fromRadio?.PayloadVariantCase == FromRadio.PayloadVariantOneofCase.MqttClientProxyMessage && + fromRadio.MqttClientProxyMessage is not null) + { + var message = fromRadio.MqttClientProxyMessage; + var topic = message.Topic; + AnsiConsole.MarkupLine($"[green]Topic:[/] {topic}"); + AnsiConsole.MarkupLine($"[green]Text:[/] {message.Text}"); + AnsiConsole.MarkupLine($"[green]Data:[/] {ServiceEnvelope.Parser.ParseFrom(message.Data)}"); + } + return Task.FromResult(false); + }); + } +} diff --git a/Meshtastic.Cli/Commands/MqttProxyCommand.cs b/Meshtastic.Cli/Commands/MqttProxyCommand.cs new file mode 100644 index 0000000..16a4a0d --- /dev/null +++ b/Meshtastic.Cli/Commands/MqttProxyCommand.cs @@ -0,0 +1,20 @@ +using Meshtastic.Cli.Binders; +using Meshtastic.Cli.CommandHandlers; +using Meshtastic.Cli.Enums; +using Microsoft.Extensions.Logging; + +namespace Meshtastic.Cli.Commands; +public class MqttProxyCommand : Command +{ + public MqttProxyCommand(string name, string description, Option port, Option host, + Option output, Option log) : base(name, description) + { + this.SetHandler(async (context, commandContext) => + { + var handler = new MqttProxyCommandHandler(context, commandContext); + await handler.Handle(); + }, + new DeviceConnectionBinder(port, host), + new CommandContextBinder(log, output, new Option("dest") { }, new Option("select-dest") { })); + } +} diff --git a/Meshtastic.Cli/Program.cs b/Meshtastic.Cli/Program.cs index 11357ae..33b6a27 100644 --- a/Meshtastic.Cli/Program.cs +++ b/Meshtastic.Cli/Program.cs @@ -60,6 +60,7 @@ root.AddCommand(new UpdateCommand("update", "Update the firmware of the serial connected device", port, host, output, log)); root.AddCommand(new ExportCommand("export", "Export the profile of the connected device as yaml", port, host, output, log)); root.AddCommand(new ImportCommand("import", "Import the profile export from a yaml file and set the connected device", port, host, output, log)); +root.AddCommand(new MqttProxyCommand("mqtt-proxy", "Proxy to the MQTT server referenced in the MQTT module config of the connected device", port, host, output, log)); var parser = new CommandLineBuilder(root) .UseExceptionHandler((ex, context) => diff --git a/Meshtastic/Generated/Deviceonly.cs b/Meshtastic/Generated/Deviceonly.cs index bb4128a..342030a 100644 --- a/Meshtastic/Generated/Deviceonly.cs +++ b/Meshtastic/Generated/Deviceonly.cs @@ -335,7 +335,7 @@ public bool DidGpsReset { private readonly pbc::RepeatedField nodeDbLite_ = new pbc::RepeatedField(); /// /// - /// New lite version of NodeDB to decrease + /// New lite version of NodeDB to decrease memory footprint /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] diff --git a/Meshtastic/Generated/Mesh.cs b/Meshtastic/Generated/Mesh.cs index 1ff16c5..a7b0f40 100644 --- a/Meshtastic/Generated/Mesh.cs +++ b/Meshtastic/Generated/Mesh.cs @@ -64,50 +64,54 @@ static MeshReflection() { "CgoCaWQYASABKA0SEgoKbGF0aXR1ZGVfaRgCIAEoDxITCgtsb25naXR1ZGVf", "aRgDIAEoDxIOCgZleHBpcmUYBCABKA0SEQoJbG9ja2VkX3RvGAUgASgNEgwK", "BG5hbWUYBiABKAkSEwoLZGVzY3JpcHRpb24YByABKAkSDAoEaWNvbhgIIAEo", - "ByLsAwoKTWVzaFBhY2tldBIMCgRmcm9tGAEgASgHEgoKAnRvGAIgASgHEg8K", - "B2NoYW5uZWwYAyABKA0SIwoHZGVjb2RlZBgEIAEoCzIQLm1lc2h0YXN0aWMu", - "RGF0YUgAEhMKCWVuY3J5cHRlZBgFIAEoDEgAEgoKAmlkGAYgASgHEg8KB3J4", - "X3RpbWUYByABKAcSDgoGcnhfc25yGAggASgCEhEKCWhvcF9saW1pdBgJIAEo", - "DRIQCgh3YW50X2FjaxgKIAEoCBIxCghwcmlvcml0eRgLIAEoDjIfLm1lc2h0", - "YXN0aWMuTWVzaFBhY2tldC5Qcmlvcml0eRIPCgdyeF9yc3NpGAwgASgFEi8K", - "B2RlbGF5ZWQYDSABKA4yHi5tZXNodGFzdGljLk1lc2hQYWNrZXQuRGVsYXll", - "ZCJbCghQcmlvcml0eRIJCgVVTlNFVBAAEgcKA01JThABEg4KCkJBQ0tHUk9V", - "TkQQChILCgdERUZBVUxUEEASDAoIUkVMSUFCTEUQRhIHCgNBQ0sQeBIHCgNN", - "QVgQfyJCCgdEZWxheWVkEgwKCE5PX0RFTEFZEAASFQoRREVMQVlFRF9CUk9B", - "RENBU1QQARISCg5ERUxBWUVEX0RJUkVDVBACQhEKD3BheWxvYWRfdmFyaWFu", - "dCLEAQoITm9kZUluZm8SCwoDbnVtGAEgASgNEh4KBHVzZXIYAiABKAsyEC5t", - "ZXNodGFzdGljLlVzZXISJgoIcG9zaXRpb24YAyABKAsyFC5tZXNodGFzdGlj", - "LlBvc2l0aW9uEgsKA3NuchgEIAEoAhISCgpsYXN0X2hlYXJkGAUgASgHEjEK", - "DmRldmljZV9tZXRyaWNzGAYgASgLMhkubWVzaHRhc3RpYy5EZXZpY2VNZXRy", - "aWNzEg8KB2NoYW5uZWwYByABKA0ixQMKCk15Tm9kZUluZm8SEwoLbXlfbm9k", - "ZV9udW0YASABKA0SEwoHaGFzX2dwcxgCIAEoCEICGAESGAoMbWF4X2NoYW5u", - "ZWxzGAMgASgNQgIYARIcChBmaXJtd2FyZV92ZXJzaW9uGAQgASgJQgIYARI1", - "CgplcnJvcl9jb2RlGAUgASgOMh0ubWVzaHRhc3RpYy5Dcml0aWNhbEVycm9y", - "Q29kZUICGAESGQoNZXJyb3JfYWRkcmVzcxgGIAEoDUICGAESFwoLZXJyb3Jf", - "Y291bnQYByABKA1CAhgBEhQKDHJlYm9vdF9jb3VudBgIIAEoDRITCgdiaXRy", - "YXRlGAkgASgCQgIYARIgChRtZXNzYWdlX3RpbWVvdXRfbXNlYxgKIAEoDUIC", - "GAESFwoPbWluX2FwcF92ZXJzaW9uGAsgASgNEhkKDWFpcl9wZXJpb2RfdHgY", - "DCADKA1CAhgBEhkKDWFpcl9wZXJpb2RfcngYDSADKA1CAhgBEhQKCGhhc193", - "aWZpGA4gASgIQgIYARIfChNjaGFubmVsX3V0aWxpemF0aW9uGA8gASgCQgIY", - "ARIXCgthaXJfdXRpbF90eBgQIAEoAkICGAEiwAEKCUxvZ1JlY29yZBIPCgdt", - "ZXNzYWdlGAEgASgJEgwKBHRpbWUYAiABKAcSDgoGc291cmNlGAMgASgJEioK", - "BWxldmVsGAQgASgOMhsubWVzaHRhc3RpYy5Mb2dSZWNvcmQuTGV2ZWwiWAoF", - "TGV2ZWwSCQoFVU5TRVQQABIMCghDUklUSUNBTBAyEgkKBUVSUk9SECgSCwoH", - "V0FSTklORxAeEggKBElORk8QFBIJCgVERUJVRxAKEgkKBVRSQUNFEAUiUAoL", - "UXVldWVTdGF0dXMSCwoDcmVzGAEgASgFEgwKBGZyZWUYAiABKA0SDgoGbWF4", - "bGVuGAMgASgNEhYKDm1lc2hfcGFja2V0X2lkGAQgASgNIpUECglGcm9tUmFk", - "aW8SCgoCaWQYASABKA0SKAoGcGFja2V0GAIgASgLMhYubWVzaHRhc3RpYy5N", - "ZXNoUGFja2V0SAASKQoHbXlfaW5mbxgDIAEoCzIWLm1lc2h0YXN0aWMuTXlO", - "b2RlSW5mb0gAEikKCW5vZGVfaW5mbxgEIAEoCzIULm1lc2h0YXN0aWMuTm9k", - "ZUluZm9IABIkCgZjb25maWcYBSABKAsyEi5tZXNodGFzdGljLkNvbmZpZ0gA", - "EisKCmxvZ19yZWNvcmQYBiABKAsyFS5tZXNodGFzdGljLkxvZ1JlY29yZEgA", - "EhwKEmNvbmZpZ19jb21wbGV0ZV9pZBgHIAEoDUgAEhIKCHJlYm9vdGVkGAgg", - "ASgISAASMAoMbW9kdWxlQ29uZmlnGAkgASgLMhgubWVzaHRhc3RpYy5Nb2R1", - "bGVDb25maWdIABImCgdjaGFubmVsGAogASgLMhMubWVzaHRhc3RpYy5DaGFu", - "bmVsSAASLgoLcXVldWVTdGF0dXMYCyABKAsyFy5tZXNodGFzdGljLlF1ZXVl", - "U3RhdHVzSAASKgoMeG1vZGVtUGFja2V0GAwgASgLMhIubWVzaHRhc3RpYy5Y", - "TW9kZW1IABIuCghtZXRhZGF0YRgNIAEoCzIaLm1lc2h0YXN0aWMuRGV2aWNl", - "TWV0YWRhdGFIAEIRCg9wYXlsb2FkX3ZhcmlhbnQiogEKB1RvUmFkaW8SKAoG", + "ByJsChZNcXR0Q2xpZW50UHJveHlNZXNzYWdlEg0KBXRvcGljGAEgASgJEg4K", + "BGRhdGEYAiABKAxIABIOCgR0ZXh0GAMgASgJSAASEAoIcmV0YWluZWQYBCAB", + "KAhCEQoPcGF5bG9hZF92YXJpYW50IuwDCgpNZXNoUGFja2V0EgwKBGZyb20Y", + "ASABKAcSCgoCdG8YAiABKAcSDwoHY2hhbm5lbBgDIAEoDRIjCgdkZWNvZGVk", + "GAQgASgLMhAubWVzaHRhc3RpYy5EYXRhSAASEwoJZW5jcnlwdGVkGAUgASgM", + "SAASCgoCaWQYBiABKAcSDwoHcnhfdGltZRgHIAEoBxIOCgZyeF9zbnIYCCAB", + "KAISEQoJaG9wX2xpbWl0GAkgASgNEhAKCHdhbnRfYWNrGAogASgIEjEKCHBy", + "aW9yaXR5GAsgASgOMh8ubWVzaHRhc3RpYy5NZXNoUGFja2V0LlByaW9yaXR5", + "Eg8KB3J4X3Jzc2kYDCABKAUSLwoHZGVsYXllZBgNIAEoDjIeLm1lc2h0YXN0", + "aWMuTWVzaFBhY2tldC5EZWxheWVkIlsKCFByaW9yaXR5EgkKBVVOU0VUEAAS", + "BwoDTUlOEAESDgoKQkFDS0dST1VORBAKEgsKB0RFRkFVTFQQQBIMCghSRUxJ", + "QUJMRRBGEgcKA0FDSxB4EgcKA01BWBB/IkIKB0RlbGF5ZWQSDAoITk9fREVM", + "QVkQABIVChFERUxBWUVEX0JST0FEQ0FTVBABEhIKDkRFTEFZRURfRElSRUNU", + "EAJCEQoPcGF5bG9hZF92YXJpYW50IsQBCghOb2RlSW5mbxILCgNudW0YASAB", + "KA0SHgoEdXNlchgCIAEoCzIQLm1lc2h0YXN0aWMuVXNlchImCghwb3NpdGlv", + "bhgDIAEoCzIULm1lc2h0YXN0aWMuUG9zaXRpb24SCwoDc25yGAQgASgCEhIK", + "Cmxhc3RfaGVhcmQYBSABKAcSMQoOZGV2aWNlX21ldHJpY3MYBiABKAsyGS5t", + "ZXNodGFzdGljLkRldmljZU1ldHJpY3MSDwoHY2hhbm5lbBgHIAEoDSLFAwoK", + "TXlOb2RlSW5mbxITCgtteV9ub2RlX251bRgBIAEoDRITCgdoYXNfZ3BzGAIg", + "ASgIQgIYARIYCgxtYXhfY2hhbm5lbHMYAyABKA1CAhgBEhwKEGZpcm13YXJl", + "X3ZlcnNpb24YBCABKAlCAhgBEjUKCmVycm9yX2NvZGUYBSABKA4yHS5tZXNo", + "dGFzdGljLkNyaXRpY2FsRXJyb3JDb2RlQgIYARIZCg1lcnJvcl9hZGRyZXNz", + "GAYgASgNQgIYARIXCgtlcnJvcl9jb3VudBgHIAEoDUICGAESFAoMcmVib290", + "X2NvdW50GAggASgNEhMKB2JpdHJhdGUYCSABKAJCAhgBEiAKFG1lc3NhZ2Vf", + "dGltZW91dF9tc2VjGAogASgNQgIYARIXCg9taW5fYXBwX3ZlcnNpb24YCyAB", + "KA0SGQoNYWlyX3BlcmlvZF90eBgMIAMoDUICGAESGQoNYWlyX3BlcmlvZF9y", + "eBgNIAMoDUICGAESFAoIaGFzX3dpZmkYDiABKAhCAhgBEh8KE2NoYW5uZWxf", + "dXRpbGl6YXRpb24YDyABKAJCAhgBEhcKC2Fpcl91dGlsX3R4GBAgASgCQgIY", + "ASLAAQoJTG9nUmVjb3JkEg8KB21lc3NhZ2UYASABKAkSDAoEdGltZRgCIAEo", + "BxIOCgZzb3VyY2UYAyABKAkSKgoFbGV2ZWwYBCABKA4yGy5tZXNodGFzdGlj", + "LkxvZ1JlY29yZC5MZXZlbCJYCgVMZXZlbBIJCgVVTlNFVBAAEgwKCENSSVRJ", + "Q0FMEDISCQoFRVJST1IQKBILCgdXQVJOSU5HEB4SCAoESU5GTxAUEgkKBURF", + "QlVHEAoSCQoFVFJBQ0UQBSJQCgtRdWV1ZVN0YXR1cxILCgNyZXMYASABKAUS", + "DAoEZnJlZRgCIAEoDRIOCgZtYXhsZW4YAyABKA0SFgoObWVzaF9wYWNrZXRf", +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,12 +159,13 @@ static MeshReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.Routing), global::Meshtastic.Protobufs.Routing.Parser, new[]{ "RouteRequest", "RouteReply", "ErrorReason" }, new[]{ "Variant" }, new[]{ typeof(global::Meshtastic.Protobufs.Routing.Types.Error) }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.Data), global::Meshtastic.Protobufs.Data.Parser, new[]{ "Portnum", "Payload", "WantResponse", "Dest", "Source", "RequestId", "ReplyId", "Emoji" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.Waypoint), global::Meshtastic.Protobufs.Waypoint.Parser, new[]{ "Id", "LatitudeI", "LongitudeI", "Expire", "LockedTo", "Name", "Description", "Icon" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.MqttClientProxyMessage), global::Meshtastic.Protobufs.MqttClientProxyMessage.Parser, new[]{ "Topic", "Data", "Text", "Retained" }, new[]{ "PayloadVariant" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.MeshPacket), global::Meshtastic.Protobufs.MeshPacket.Parser, new[]{ "From", "To", "Channel", "Decoded", "Encrypted", "Id", "RxTime", "RxSnr", "HopLimit", "WantAck", "Priority", "RxRssi", "Delayed" }, new[]{ "PayloadVariant" }, new[]{ typeof(global::Meshtastic.Protobufs.MeshPacket.Types.Priority), typeof(global::Meshtastic.Protobufs.MeshPacket.Types.Delayed) }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.NodeInfo), global::Meshtastic.Protobufs.NodeInfo.Parser, new[]{ "Num", "User", "Position", "Snr", "LastHeard", "DeviceMetrics", "Channel" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.MyNodeInfo), global::Meshtastic.Protobufs.MyNodeInfo.Parser, new[]{ "MyNodeNum", "HasGps", "MaxChannels", "FirmwareVersion", "ErrorCode", "ErrorAddress", "ErrorCount", "RebootCount", "Bitrate", "MessageTimeoutMsec", "MinAppVersion", "AirPeriodTx", "AirPeriodRx", "HasWifi", "ChannelUtilization", "AirUtilTx" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.LogRecord), global::Meshtastic.Protobufs.LogRecord.Parser, new[]{ "Message", "Time", "Source", "Level" }, null, new[]{ typeof(global::Meshtastic.Protobufs.LogRecord.Types.Level) }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.QueueStatus), global::Meshtastic.Protobufs.QueueStatus.Parser, new[]{ "Res", "Free", "Maxlen", "MeshPacketId" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.FromRadio), global::Meshtastic.Protobufs.FromRadio.Parser, new[]{ "Id", "Packet", "MyInfo", "NodeInfo", "Config", "LogRecord", "ConfigCompleteId", "Rebooted", "ModuleConfig", "Channel", "QueueStatus", "XmodemPacket", "Metadata" }, new[]{ "PayloadVariant" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.FromRadio), global::Meshtastic.Protobufs.FromRadio.Parser, new[]{ "Id", "Packet", "MyInfo", "NodeInfo", "Config", "LogRecord", "ConfigCompleteId", "Rebooted", "ModuleConfig", "Channel", "QueueStatus", "XmodemPacket", "Metadata", "MqttClientProxyMessage" }, new[]{ "PayloadVariant" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ToRadio), global::Meshtastic.Protobufs.ToRadio.Parser, new[]{ "Packet", "WantConfigId", "Disconnect", "XmodemPacket" }, new[]{ "PayloadVariant" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.Compressed), global::Meshtastic.Protobufs.Compressed.Parser, new[]{ "Portnum", "Data" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.NeighborInfo), global::Meshtastic.Protobufs.NeighborInfo.Parser, new[]{ "NodeId", "LastSentById", "Neighbors" }, null, null, null, null), @@ -3638,6 +3643,359 @@ public void MergeFrom(pb::CodedInputStream input) { } + /// + /// + /// This message will be proxied over the PhoneAPI for client to deliver to the MQTT server + /// + public sealed partial class MqttClientProxyMessage : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new MqttClientProxyMessage()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[6]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MqttClientProxyMessage() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MqttClientProxyMessage(MqttClientProxyMessage other) : this() { + topic_ = other.topic_; + retained_ = other.retained_; + switch (other.PayloadVariantCase) { + case PayloadVariantOneofCase.Data: + Data = other.Data; + break; + case PayloadVariantOneofCase.Text: + Text = other.Text; + break; + } + + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public MqttClientProxyMessage Clone() { + return new MqttClientProxyMessage(this); + } + + /// Field number for the "topic" field. + public const int TopicFieldNumber = 1; + private string topic_ = ""; + /// + /// + /// The MQTT topic this message will be sent /received on + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Topic { + get { return topic_; } + set { + topic_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "data" field. + public const int DataFieldNumber = 2; + /// + /// + /// Bytes + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public pb::ByteString Data { + get { return payloadVariantCase_ == PayloadVariantOneofCase.Data ? (pb::ByteString) payloadVariant_ : pb::ByteString.Empty; } + set { + payloadVariant_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + payloadVariantCase_ = PayloadVariantOneofCase.Data; + } + } + + /// Field number for the "text" field. + public const int TextFieldNumber = 3; + /// + /// + /// Text + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public string Text { + get { return payloadVariantCase_ == PayloadVariantOneofCase.Text ? (string) payloadVariant_ : ""; } + set { + payloadVariant_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + payloadVariantCase_ = PayloadVariantOneofCase.Text; + } + } + + /// Field number for the "retained" field. + public const int RetainedFieldNumber = 4; + private bool retained_; + /// + /// + /// Whether the message should be retained (or not) + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Retained { + get { return retained_; } + set { + retained_ = value; + } + } + + private object payloadVariant_; + /// Enum of possible cases for the "payload_variant" oneof. + public enum PayloadVariantOneofCase { + None = 0, + Data = 2, + Text = 3, + } + private PayloadVariantOneofCase payloadVariantCase_ = PayloadVariantOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public PayloadVariantOneofCase PayloadVariantCase { + get { return payloadVariantCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void ClearPayloadVariant() { + payloadVariantCase_ = PayloadVariantOneofCase.None; + payloadVariant_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as MqttClientProxyMessage); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(MqttClientProxyMessage other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Topic != other.Topic) return false; + if (Data != other.Data) return false; + if (Text != other.Text) return false; + if (Retained != other.Retained) return false; + if (PayloadVariantCase != other.PayloadVariantCase) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (Topic.Length != 0) hash ^= Topic.GetHashCode(); + if (payloadVariantCase_ == PayloadVariantOneofCase.Data) hash ^= Data.GetHashCode(); + if (payloadVariantCase_ == PayloadVariantOneofCase.Text) hash ^= Text.GetHashCode(); + if (Retained != false) hash ^= Retained.GetHashCode(); + hash ^= (int) payloadVariantCase_; + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (Topic.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Topic); + } + if (payloadVariantCase_ == PayloadVariantOneofCase.Data) { + output.WriteRawTag(18); + output.WriteBytes(Data); + } + if (payloadVariantCase_ == PayloadVariantOneofCase.Text) { + output.WriteRawTag(26); + output.WriteString(Text); + } + if (Retained != false) { + output.WriteRawTag(32); + output.WriteBool(Retained); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (Topic.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Topic); + } + if (payloadVariantCase_ == PayloadVariantOneofCase.Data) { + output.WriteRawTag(18); + output.WriteBytes(Data); + } + if (payloadVariantCase_ == PayloadVariantOneofCase.Text) { + output.WriteRawTag(26); + output.WriteString(Text); + } + if (Retained != false) { + output.WriteRawTag(32); + output.WriteBool(Retained); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (Topic.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Topic); + } + if (payloadVariantCase_ == PayloadVariantOneofCase.Data) { + size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data); + } + if (payloadVariantCase_ == PayloadVariantOneofCase.Text) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Text); + } + if (Retained != false) { + size += 1 + 1; + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(MqttClientProxyMessage other) { + if (other == null) { + return; + } + if (other.Topic.Length != 0) { + Topic = other.Topic; + } + if (other.Retained != false) { + Retained = other.Retained; + } + switch (other.PayloadVariantCase) { + case PayloadVariantOneofCase.Data: + Data = other.Data; + break; + case PayloadVariantOneofCase.Text: + Text = other.Text; + break; + } + + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + Topic = input.ReadString(); + break; + } + case 18: { + Data = input.ReadBytes(); + break; + } + case 26: { + Text = input.ReadString(); + break; + } + case 32: { + Retained = input.ReadBool(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + Topic = input.ReadString(); + break; + } + case 18: { + Data = input.ReadBytes(); + break; + } + case 26: { + Text = input.ReadString(); + break; + } + case 32: { + Retained = input.ReadBool(); + break; + } + } + } + } + #endif + + } + /// /// /// A packet envelope sent/received over the mesh @@ -3658,7 +4016,7 @@ public sealed partial class MeshPacket : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[6]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -4536,7 +4894,7 @@ public sealed partial class NodeInfo : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[7]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5010,7 +5368,7 @@ public sealed partial class MyNodeInfo : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[8]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -5844,7 +6202,7 @@ public sealed partial class LogRecord : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[9]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6210,7 +6568,7 @@ public sealed partial class QueueStatus : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[10]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6529,7 +6887,7 @@ public sealed partial class FromRadio : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[11]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6587,6 +6945,9 @@ public FromRadio(FromRadio other) : this() { case PayloadVariantOneofCase.Metadata: Metadata = other.Metadata.Clone(); break; + case PayloadVariantOneofCase.MqttClientProxyMessage: + MqttClientProxyMessage = other.MqttClientProxyMessage.Clone(); + break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -6815,6 +7176,22 @@ public bool Rebooted { } } + /// Field number for the "mqttClientProxyMessage" field. + public const int MqttClientProxyMessageFieldNumber = 14; + /// + /// + /// MQTT Client Proxy Message + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Meshtastic.Protobufs.MqttClientProxyMessage MqttClientProxyMessage { + get { return payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage ? (global::Meshtastic.Protobufs.MqttClientProxyMessage) payloadVariant_ : null; } + set { + payloadVariant_ = value; + payloadVariantCase_ = value == null ? PayloadVariantOneofCase.None : PayloadVariantOneofCase.MqttClientProxyMessage; + } + } + private object payloadVariant_; /// Enum of possible cases for the "payload_variant" oneof. public enum PayloadVariantOneofCase { @@ -6831,6 +7208,7 @@ public enum PayloadVariantOneofCase { QueueStatus = 11, XmodemPacket = 12, Metadata = 13, + MqttClientProxyMessage = 14, } private PayloadVariantOneofCase payloadVariantCase_ = PayloadVariantOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -6874,6 +7252,7 @@ public bool Equals(FromRadio other) { if (!object.Equals(QueueStatus, other.QueueStatus)) return false; if (!object.Equals(XmodemPacket, other.XmodemPacket)) return false; if (!object.Equals(Metadata, other.Metadata)) return false; + if (!object.Equals(MqttClientProxyMessage, other.MqttClientProxyMessage)) return false; if (PayloadVariantCase != other.PayloadVariantCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -6895,6 +7274,7 @@ public override int GetHashCode() { if (payloadVariantCase_ == PayloadVariantOneofCase.QueueStatus) hash ^= QueueStatus.GetHashCode(); if (payloadVariantCase_ == PayloadVariantOneofCase.XmodemPacket) hash ^= XmodemPacket.GetHashCode(); if (payloadVariantCase_ == PayloadVariantOneofCase.Metadata) hash ^= Metadata.GetHashCode(); + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) hash ^= MqttClientProxyMessage.GetHashCode(); hash ^= (int) payloadVariantCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -6966,6 +7346,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(106); output.WriteMessage(Metadata); } + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + output.WriteRawTag(114); + output.WriteMessage(MqttClientProxyMessage); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -7028,6 +7412,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(106); output.WriteMessage(Metadata); } + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + output.WriteRawTag(114); + output.WriteMessage(MqttClientProxyMessage); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -7077,6 +7465,9 @@ public int CalculateSize() { if (payloadVariantCase_ == PayloadVariantOneofCase.Metadata) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Metadata); } + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(MqttClientProxyMessage); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -7159,6 +7550,12 @@ public void MergeFrom(FromRadio other) { } Metadata.MergeFrom(other.Metadata); break; + case PayloadVariantOneofCase.MqttClientProxyMessage: + if (MqttClientProxyMessage == null) { + MqttClientProxyMessage = new global::Meshtastic.Protobufs.MqttClientProxyMessage(); + } + MqttClientProxyMessage.MergeFrom(other.MqttClientProxyMessage); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -7278,6 +7675,15 @@ public void MergeFrom(pb::CodedInputStream input) { Metadata = subBuilder; break; } + case 114: { + global::Meshtastic.Protobufs.MqttClientProxyMessage subBuilder = new global::Meshtastic.Protobufs.MqttClientProxyMessage(); + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + subBuilder.MergeFrom(MqttClientProxyMessage); + } + input.ReadMessage(subBuilder); + MqttClientProxyMessage = subBuilder; + break; + } } } #endif @@ -7395,6 +7801,15 @@ public void MergeFrom(pb::CodedInputStream input) { Metadata = subBuilder; break; } + case 114: { + global::Meshtastic.Protobufs.MqttClientProxyMessage subBuilder = new global::Meshtastic.Protobufs.MqttClientProxyMessage(); + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + subBuilder.MergeFrom(MqttClientProxyMessage); + } + input.ReadMessage(subBuilder); + MqttClientProxyMessage = subBuilder; + break; + } } } } @@ -7421,7 +7836,7 @@ public sealed partial class ToRadio : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[12]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -7811,7 +8226,7 @@ public sealed partial class Compressed : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[13]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -8049,7 +8464,7 @@ public sealed partial class NeighborInfo : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[14]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[15]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -8317,7 +8732,7 @@ public sealed partial class Neighbor : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[15]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[16]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -8555,7 +8970,7 @@ public sealed partial class DeviceMetadata : pb::IMessage [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public static pbr::MessageDescriptor Descriptor { - get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[16]; } + get { return global::Meshtastic.Protobufs.MeshReflection.Descriptor.MessageTypes[17]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] diff --git a/Meshtastic/Generated/ModuleConfig.cs b/Meshtastic/Generated/ModuleConfig.cs index 8230734..f8c91dd 100644 --- a/Meshtastic/Generated/ModuleConfig.cs +++ b/Meshtastic/Generated/ModuleConfig.cs @@ -25,7 +25,7 @@ static ModuleConfigReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch5tZXNodGFzdGljL21vZHVsZV9jb25maWcucHJvdG8SCm1lc2h0YXN0aWMi", - "8hoKDE1vZHVsZUNvbmZpZxIzCgRtcXR0GAEgASgLMiMubWVzaHRhc3RpYy5N", + "kxsKDE1vZHVsZUNvbmZpZxIzCgRtcXR0GAEgASgLMiMubWVzaHRhc3RpYy5N", "b2R1bGVDb25maWcuTVFUVENvbmZpZ0gAEjcKBnNlcmlhbBgCIAEoCzIlLm1l", "c2h0YXN0aWMuTW9kdWxlQ29uZmlnLlNlcmlhbENvbmZpZ0gAElQKFWV4dGVy", "bmFsX25vdGlmaWNhdGlvbhgDIAEoCzIzLm1lc2h0YXN0aWMuTW9kdWxlQ29u", @@ -40,78 +40,79 @@ static ModuleConfigReflection() { "cmVtb3RlX2hhcmR3YXJlGAkgASgLMi0ubWVzaHRhc3RpYy5Nb2R1bGVDb25m", "aWcuUmVtb3RlSGFyZHdhcmVDb25maWdIABJECg1uZWlnaGJvcl9pbmZvGAog", "ASgLMisubWVzaHRhc3RpYy5Nb2R1bGVDb25maWcuTmVpZ2hib3JJbmZvQ29u", - "ZmlnSAAapwEKCk1RVFRDb25maWcSDwoHZW5hYmxlZBgBIAEoCBIPCgdhZGRy", + "ZmlnSAAayAEKCk1RVFRDb25maWcSDwoHZW5hYmxlZBgBIAEoCBIPCgdhZGRy", "ZXNzGAIgASgJEhAKCHVzZXJuYW1lGAMgASgJEhAKCHBhc3N3b3JkGAQgASgJ", "EhoKEmVuY3J5cHRpb25fZW5hYmxlZBgFIAEoCBIUCgxqc29uX2VuYWJsZWQY", - "BiABKAgSEwoLdGxzX2VuYWJsZWQYByABKAgSDAoEcm9vdBgIIAEoCRqCAQoU", - "UmVtb3RlSGFyZHdhcmVDb25maWcSDwoHZW5hYmxlZBgBIAEoCBIiChphbGxv", - "d191bmRlZmluZWRfcGluX2FjY2VzcxgCIAEoCBI1Cg5hdmFpbGFibGVfcGlu", - "cxgDIAMoCzIdLm1lc2h0YXN0aWMuUmVtb3RlSGFyZHd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RF82MDAQAxINCglCQVVEXzEyMDAQ", - "BBINCglCQVVEXzI0MDAQBRINCglCQVVEXzQ4MDAQBhINCglCQVVEXzk2MDAQ", - "BxIOCgpCQVVEXzE5MjAwEAgSDgoKQkFVRF8zODQwMBAJEg4KCkJBVURfNTc2", - "MDAQChIPCgtCQVVEXzExNTIwMBALEg8KC0JBVURfMjMwNDAwEAwSDwoLQkFV", - "RF80NjA4MDAQDRIPCgtCQVVEXzU3NjAwMBAOEg8KC0JBVURfOTIxNjAwEA8i", - "VQoLU2VyaWFsX01vZGUSCwoHREVGQVVMVBAAEgoKBlNJTVBMRRABEgkKBVBS", - "T1RPEAISCwoHVEVYVE1TRxADEggKBE5NRUEQBBILCgdDQUxUT1BPEAUazgIK", - "GkV4dGVybmFsTm90aWZpY2F0aW9uQ29uZmlnEg8KB2VuYWJsZWQYASABKAgS", - "EQoJb3V0cHV0X21zGAIgASgNEg4KBm91dHB1dBgDIAEoDRIUCgxvdXRwdXRf", - "dmlicmEYCCABKA0SFQoNb3V0cHV0X2J1enplchgJIAEoDRIOCgZhY3RpdmUY", - "BCABKAgSFQoNYWxlcnRfbWVzc2FnZRgFIAEoCBIbChNhbGVydF9tZXNzYWdl", - "X3ZpYnJhGAogASgIEhwKFGFsZXJ0X21lc3NhZ2VfYnV6emVyGAsgASgIEhIK", - "CmFsZXJ0X2JlbGwYBiABKAgSGAoQYWxlcnRfYmVsbF92aWJyYRgMIAEoCBIZ", - "ChFhbGVydF9iZWxsX2J1enplchgNIAEoCBIPCgd1c2VfcHdtGAcgASgIEhMK", - "C25hZ190aW1lb3V0GA4gASgNGoQBChJTdG9yZUZvcndhcmRDb25maWcSDwoH", - "ZW5hYmxlZBgBIAEoCBIRCgloZWFydGJlYXQYAiABKAgSDwoHcmVjb3JkcxgD", - "IAEoDRIaChJoaXN0b3J5X3JldHVybl9tYXgYBCABKA0SHQoVaGlzdG9yeV9y", - "ZXR1cm5fd2luZG93GAUgASgNGkAKD1JhbmdlVGVzdENvb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2MDAQChIPCgtCQVVE", + "XzExNTIwMBALEg8KC0JBVURfMjMwNDAwEAwSDwoLQkFVRF80NjA4MDAQDRIP", + "CgtCQVVEXzU3NjAwMBAOEg8KC0JBVURfOTIxNjAwEA8iVQoLU2VyaWFsX01v", + "ZGUSCwoHREVGQVVMVBAAEgoKBlNJTVBMRRABEgkKBVBST1RPEAISCwoHVEVY", + "VE1TRxADEggKBE5NRUEQBBILCgdDQUxUT1BPEAUazgIKGkV4dGVybmFsTm90", + "aWZpY2F0aW9uQ29uZmlnEg8KB2VuYWJsZWQYASABKAgSEQoJb3V0cHV0X21z", + "GAIgASgNEg4KBm91dHB1dBgDIAEoDRIUCgxvdXRwdXRfdmlicmEYCCABKA0S", + "FQoNb3V0cHV0X2J1enplchgJIAEoDRIOCgZhY3RpdmUYBCABKAgSFQoNYWxl", + "cnRfbWVzc2FnZRgFIAEoCBIbChNhbGVydF9tZXNzYWdlX3ZpYnJhGAogASgI", + "EhwKFGFsZXJ0X21lc3NhZ2VfYnV6emVyGAsgASgIEhIKCmFsZXJ0X2JlbGwY", + "BiABKAgSGAoQYWxlcnRfYmVsbF92aWJyYRgMIAEoCBIZChFhbGVydF9iZWxs", + "X2J1enplchgNIAEoCBIPCgd1c2VfcHdtGAcgASgIEhMKC25hZ190aW1lb3V0", + "GA4gASgNGoQBChJTdG9yZUZvcndhcmRDb25maWcSDwoHZW5hYmxlZBgBIAEo", + "CBIRCgloZWFydGJlYXQYAiABKAgSDwoHcmVjb3JkcxgDIAEoDRIaChJoaXN0", + "b3J5X3JldHVybl9tYXgYBCABKA0SHQoVaGlzdG9yeV9yZXR1cm5fd2luZG93", + "GAUgASgNGkAKD1JhbmdlVGVzdENvbmZpZxIPCgdlbmFibGVkGAEgASgIEg4K", + "BnNlbmRlchgCIAEoDRIMCgRzYXZlGAMgASgIGoYCCg9UZWxlbWV0cnlDb25m", + "aWcSHgoWZGV2aWNlX3VwZGF0ZV9pbnRlcnZhbBgBIAEoDRIjChtlbnZpc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klH", + "SFQQFBIKCgZTRUxFQ1QQChIICgRCQUNLEBsSCgoGQ0FOQ0VMEBhCEQoPcGF5", + "bG9hZF92YXJpYW50ImQKEVJlbW90ZUhhcmR3YXJlUGluEhAKCGdwaW9fcGlu", + "GAEgASgNEgwKBG5hbWUYAiABKAkSLwoEdHlwZRgDIAEoDjIhLm1lc2h0YXN0", + "aWMuUmVtb3RlSGFyZHdhcmVQaW5UeXBlKkkKFVJlbW90ZUhhcmR3YXJlUGlu", + "VHlwZRILCgdVTktOT1dOEAASEAoMRElHSVRBTF9SRUFEEAESEQoNRElHSVRB", + "TF9XUklURRACQmcKE2NvbS5nZWVrc3ZpbGxlLm1lc2hCEk1vZHVsZUNvbmZp", + "Z1Byb3Rvc1oiZ2l0aHViLmNvbS9tZXNodGFzdGljL2dvL2dlbmVyYXRlZKoC", + "FE1lc2h0YXN0aWMuUHJvdG9idWZzugIAYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Meshtastic.Protobufs.RemoteHardwarePinType), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig), global::Meshtastic.Protobufs.ModuleConfig.Parser, new[]{ "Mqtt", "Serial", "ExternalNotification", "StoreForward", "RangeTest", "Telemetry", "CannedMessage", "Audio", "RemoteHardware", "NeighborInfo" }, new[]{ "PayloadVariant" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.MQTTConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.MQTTConfig.Parser, new[]{ "Enabled", "Address", "Username", "Password", "EncryptionEnabled", "JsonEnabled", "TlsEnabled", "Root" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig), global::Meshtastic.Protobufs.ModuleConfig.Parser, new[]{ "Mqtt", "Serial", "ExternalNotification", "StoreForward", "RangeTest", "Telemetry", "CannedMessage", "Audio", "RemoteHardware", "NeighborInfo" }, new[]{ "PayloadVariant" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.MQTTConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.MQTTConfig.Parser, new[]{ "Enabled", "Address", "Username", "Password", "EncryptionEnabled", "JsonEnabled", "TlsEnabled", "Root", "ProxyToClientEnabled" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.RemoteHardwareConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.RemoteHardwareConfig.Parser, new[]{ "Enabled", "AllowUndefinedPinAccess", "AvailablePins" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.NeighborInfoConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.NeighborInfoConfig.Parser, new[]{ "Enabled", "UpdateInterval" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.AudioConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.AudioConfig.Parser, new[]{ "Codec2Enabled", "PttPin", "Bitrate", "I2SWs", "I2SSd", "I2SDin", "I2SSck" }, null, new[]{ typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.AudioConfig.Types.Audio_Baud) }, null, null), @@ -951,6 +952,7 @@ public MQTTConfig(MQTTConfig other) : this() { jsonEnabled_ = other.jsonEnabled_; tlsEnabled_ = other.tlsEnabled_; root_ = other.root_; + proxyToClientEnabled_ = other.proxyToClientEnabled_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } @@ -1098,6 +1100,22 @@ public string Root { } } + /// Field number for the "proxy_to_client_enabled" field. + public const int ProxyToClientEnabledFieldNumber = 9; + private bool proxyToClientEnabled_; + /// + /// + /// If true, we can use the connected phone / client to proxy messages to MQTT instead of a direct connection + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool ProxyToClientEnabled { + get { return proxyToClientEnabled_; } + set { + proxyToClientEnabled_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] public override bool Equals(object other) { @@ -1121,6 +1139,7 @@ public bool Equals(MQTTConfig other) { if (JsonEnabled != other.JsonEnabled) return false; if (TlsEnabled != other.TlsEnabled) return false; if (Root != other.Root) return false; + if (ProxyToClientEnabled != other.ProxyToClientEnabled) return false; return Equals(_unknownFields, other._unknownFields); } @@ -1136,6 +1155,7 @@ public override int GetHashCode() { if (JsonEnabled != false) hash ^= JsonEnabled.GetHashCode(); if (TlsEnabled != false) hash ^= TlsEnabled.GetHashCode(); if (Root.Length != 0) hash ^= Root.GetHashCode(); + if (ProxyToClientEnabled != false) hash ^= ProxyToClientEnabled.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } @@ -1186,6 +1206,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(66); output.WriteString(Root); } + if (ProxyToClientEnabled != false) { + output.WriteRawTag(72); + output.WriteBool(ProxyToClientEnabled); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -1228,6 +1252,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(66); output.WriteString(Root); } + if (ProxyToClientEnabled != false) { + output.WriteRawTag(72); + output.WriteBool(ProxyToClientEnabled); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -1262,6 +1290,9 @@ public int CalculateSize() { if (Root.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Root); } + if (ProxyToClientEnabled != false) { + size += 1 + 1; + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -1298,6 +1329,9 @@ public void MergeFrom(MQTTConfig other) { if (other.Root.Length != 0) { Root = other.Root; } + if (other.ProxyToClientEnabled != false) { + ProxyToClientEnabled = other.ProxyToClientEnabled; + } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } @@ -1345,6 +1379,10 @@ public void MergeFrom(pb::CodedInputStream input) { Root = input.ReadString(); break; } + case 72: { + ProxyToClientEnabled = input.ReadBool(); + break; + } } } #endif @@ -1392,6 +1430,10 @@ public void MergeFrom(pb::CodedInputStream input) { Root = input.ReadString(); break; } + case 72: { + ProxyToClientEnabled = input.ReadBool(); + break; + } } } } diff --git a/Meshtastic/Generated/Portnums.cs b/Meshtastic/Generated/Portnums.cs index b183c58..3c92459 100644 --- a/Meshtastic/Generated/Portnums.cs +++ b/Meshtastic/Generated/Portnums.cs @@ -24,20 +24,20 @@ public static partial class PortnumsReflection { static PortnumsReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChltZXNodGFzdGljL3BvcnRudW1zLnByb3RvEgptZXNodGFzdGljKroDCgdQ", + "ChltZXNodGFzdGljL3BvcnRudW1zLnByb3RvEgptZXNodGFzdGljKtUDCgdQ", "b3J0TnVtEg8KC1VOS05PV05fQVBQEAASFAoQVEVYVF9NRVNTQUdFX0FQUBAB", "EhcKE1JFTU9URV9IQVJEV0FSRV9BUFAQAhIQCgxQT1NJVElPTl9BUFAQAxIQ", "CgxOT0RFSU5GT19BUFAQBBIPCgtST1VUSU5HX0FQUBAFEg0KCUFETUlOX0FQ", "UBAGEh8KG1RFWFRfTUVTU0FHRV9DT01QUkVTU0VEX0FQUBAHEhAKDFdBWVBP", - "SU5UX0FQUBAIEg0KCUFVRElPX0FQUBAJEg0KCVJFUExZX0FQUBAgEhEKDUlQ", - "X1RVTk5FTF9BUFAQIRIOCgpTRVJJQUxfQVBQEEASFQoRU1RPUkVfRk9SV0FS", - "RF9BUFAQQRISCg5SQU5HRV9URVNUX0FQUBBCEhEKDVRFTEVNRVRSWV9BUFAQ", - "QxILCgdaUFNfQVBQEEQSEQoNU0lNVUxBVE9SX0FQUBBFEhIKDlRSQUNFUk9V", - "VEVfQVBQEEYSFAoQTkVJR0hCT1JJTkZPX0FQUBBHEhAKC1BSSVZBVEVfQVBQ", - "EIACEhMKDkFUQUtfRk9SV0FSREVSEIECEggKA01BWBD/A0JdChNjb20uZ2Vl", - "a3N2aWxsZS5tZXNoQghQb3J0bnVtc1oiZ2l0aHViLmNvbS9tZXNodGFzdGlj", - "L2dvL2dlbmVyYXRlZKoCFE1lc2h0YXN0aWMuUHJvdG9idWZzugIAYgZwcm90", - "bzM=")); + "SU5UX0FQUBAIEg0KCUFVRElPX0FQUBAJEhkKFU1RVFRfQ0xJRU5UX1BST1hZ", + "X0FQUBAKEg0KCVJFUExZX0FQUBAgEhEKDUlQX1RVTk5FTF9BUFAQIRIOCgpT", + "RVJJQUxfQVBQEEASFQoRU1RPUkVfRk9SV0FSRF9BUFAQQRISCg5SQU5HRV9U", + "RVNUX0FQUBBCEhEKDVRFTEVNRVRSWV9BUFAQQxILCgdaUFNfQVBQEEQSEQoN", + "U0lNVUxBVE9SX0FQUBBFEhIKDlRSQUNFUk9VVEVfQVBQEEYSFAoQTkVJR0hC", + "T1JJTkZPX0FQUBBHEhAKC1BSSVZBVEVfQVBQEIACEhMKDkFUQUtfRk9SV0FS", + "REVSEIECEggKA01BWBD/A0JdChNjb20uZ2Vla3N2aWxsZS5tZXNoQghQb3J0", + "bnVtc1oiZ2l0aHViLmNvbS9tZXNodGFzdGljL2dvL2dlbmVyYXRlZKoCFE1l", + "c2h0YXN0aWMuUHJvdG9idWZzugIAYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Meshtastic.Protobufs.PortNum), }, null, null)); @@ -118,12 +118,18 @@ public enum PortNum { /// [pbr::OriginalName("WAYPOINT_APP")] WaypointApp = 8, /// + /// /// Audio Payloads. /// Encapsulated codec2 packets. On 2.4 GHZ Bandwidths only for now /// [pbr::OriginalName("AUDIO_APP")] AudioApp = 9, /// /// + /// Payloads for clients with a network connection proxying MQTT pub/sub to the device + /// + [pbr::OriginalName("MQTT_CLIENT_PROXY_APP")] MqttClientProxyApp = 10, + /// + /// /// Provides a 'ping' service that replies to any packet it receives. /// Also serves as a small example module. /// diff --git a/Meshtastic/Generated/Telemetry.cs b/Meshtastic/Generated/Telemetry.cs index 6ef98b1..d96e294 100644 --- a/Meshtastic/Generated/Telemetry.cs +++ b/Meshtastic/Generated/Telemetry.cs @@ -64,78 +64,78 @@ static TelemetryReflection() { } #region Enums /// - /// - /// Supported I2C Sensors for telemetry in Meshtastic + /// + /// Supported I2C Sensors for telemetry in Meshtastic /// public enum TelemetrySensorType { /// - /// - /// No external telemetry sensor explicitly set + /// + /// No external telemetry sensor explicitly set /// [pbr::OriginalName("SENSOR_UNSET")] SensorUnset = 0, /// - /// - /// High accuracy temperature, pressure, humidity + /// + /// High accuracy temperature, pressure, humidity /// [pbr::OriginalName("BME280")] Bme280 = 1, /// - /// - /// High accuracy temperature, pressure, humidity, and air resistance + /// + /// High accuracy temperature, pressure, humidity, and air resistance /// [pbr::OriginalName("BME680")] Bme680 = 2, /// - /// - /// Very high accuracy temperature + /// + /// Very high accuracy temperature /// [pbr::OriginalName("MCP9808")] Mcp9808 = 3, /// - /// - /// Moderate accuracy current and voltage + /// + /// Moderate accuracy current and voltage /// [pbr::OriginalName("INA260")] Ina260 = 4, /// - /// - /// Moderate accuracy current and voltage + /// + /// Moderate accuracy current and voltage /// [pbr::OriginalName("INA219")] Ina219 = 5, /// - /// - /// High accuracy temperature and pressure + /// + /// High accuracy temperature and pressure /// [pbr::OriginalName("BMP280")] Bmp280 = 6, /// - /// - /// High accuracy temperature and humidity + /// + /// High accuracy temperature and humidity /// [pbr::OriginalName("SHTC3")] Shtc3 = 7, /// - /// - /// High accuracy pressure + /// + /// High accuracy pressure /// [pbr::OriginalName("LPS22")] Lps22 = 8, /// - /// - /// 3-Axis magnetic sensor + /// + /// 3-Axis magnetic sensor /// [pbr::OriginalName("QMC6310")] Qmc6310 = 9, /// - /// - /// 6-Axis inertial measurement sensor + /// + /// 6-Axis inertial measurement sensor /// [pbr::OriginalName("QMI8658")] Qmi8658 = 10, /// - /// - /// 3-Axis magnetic sensor + /// + /// 3-Axis magnetic sensor /// [pbr::OriginalName("QMC5883L")] Qmc5883L = 11, /// - /// - /// High accuracy temperature and humidity + /// + /// High accuracy temperature and humidity /// [pbr::OriginalName("SHT31")] Sht31 = 12, /// - /// - /// PM2.5 air quality sensor + /// + /// PM2.5 air quality sensor /// [pbr::OriginalName("PMSA003I")] Pmsa003I = 13, } @@ -144,8 +144,8 @@ public enum TelemetrySensorType { #region Messages /// - /// - /// Key native device metrics such as battery level + /// + /// Key native device metrics such as battery level /// public sealed partial class DeviceMetrics : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -198,8 +198,8 @@ public DeviceMetrics Clone() { public const int BatteryLevelFieldNumber = 1; private uint batteryLevel_; /// - /// - /// 0-100 (>100 means powered) + /// + /// 0-100 (>100 means powered) /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -214,8 +214,8 @@ public uint BatteryLevel { public const int VoltageFieldNumber = 2; private float voltage_; /// - /// - /// Voltage measured + /// + /// Voltage measured /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -230,8 +230,8 @@ public float Voltage { public const int ChannelUtilizationFieldNumber = 3; private float channelUtilization_; /// - /// - /// Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). + /// + /// Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise). /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -246,8 +246,8 @@ public float ChannelUtilization { public const int AirUtilTxFieldNumber = 4; private float airUtilTx_; /// - /// - /// Percent of airtime for transmission used within the last hour. + /// + /// Percent of airtime for transmission used within the last hour. /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -464,8 +464,8 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// - /// Weather station or other environmental metrics + /// + /// Weather station or other environmental metrics /// public sealed partial class EnvironmentMetrics : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -520,8 +520,8 @@ public EnvironmentMetrics Clone() { public const int TemperatureFieldNumber = 1; private float temperature_; /// - /// - /// Temperature measured + /// + /// Temperature measured /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -536,8 +536,8 @@ public float Temperature { public const int RelativeHumidityFieldNumber = 2; private float relativeHumidity_; /// - /// - /// Relative humidity percent measured + /// + /// Relative humidity percent measured /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -552,8 +552,8 @@ public float RelativeHumidity { public const int BarometricPressureFieldNumber = 3; private float barometricPressure_; /// - /// - /// Barometric pressure in hPA measured + /// + /// Barometric pressure in hPA measured /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -568,8 +568,8 @@ public float BarometricPressure { public const int GasResistanceFieldNumber = 4; private float gasResistance_; /// - /// - /// Gas resistance in mOhm measured + /// + /// Gas resistance in mOhm measured /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -584,8 +584,8 @@ public float GasResistance { public const int VoltageFieldNumber = 5; private float voltage_; /// - /// - /// Voltage measured + /// + /// Voltage measured /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -600,8 +600,8 @@ public float Voltage { public const int CurrentFieldNumber = 6; private float current_; /// - /// - /// Current measured + /// + /// Current measured /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -866,8 +866,8 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// - /// Air quality metrics + /// + /// Air quality metrics /// public sealed partial class AirQualityMetrics : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -928,8 +928,8 @@ public AirQualityMetrics Clone() { public const int Pm10StandardFieldNumber = 1; private uint pm10Standard_; /// - /// - /// Concentration Units Standard PM1.0 + /// + /// Concentration Units Standard PM1.0 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -944,8 +944,8 @@ public uint Pm10Standard { public const int Pm25StandardFieldNumber = 2; private uint pm25Standard_; /// - /// - /// Concentration Units Standard PM2.5 + /// + /// Concentration Units Standard PM2.5 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -960,8 +960,8 @@ public uint Pm25Standard { public const int Pm100StandardFieldNumber = 3; private uint pm100Standard_; /// - /// - /// Concentration Units Standard PM10.0 + /// + /// Concentration Units Standard PM10.0 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -976,8 +976,8 @@ public uint Pm100Standard { public const int Pm10EnvironmentalFieldNumber = 4; private uint pm10Environmental_; /// - /// - /// Concentration Units Environmental PM1.0 + /// + /// Concentration Units Environmental PM1.0 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -992,8 +992,8 @@ public uint Pm10Environmental { public const int Pm25EnvironmentalFieldNumber = 5; private uint pm25Environmental_; /// - /// - /// Concentration Units Environmental PM2.5 + /// + /// Concentration Units Environmental PM2.5 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1008,8 +1008,8 @@ public uint Pm25Environmental { public const int Pm100EnvironmentalFieldNumber = 6; private uint pm100Environmental_; /// - /// - /// Concentration Units Environmental PM10.0 + /// + /// Concentration Units Environmental PM10.0 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1024,8 +1024,8 @@ public uint Pm100Environmental { public const int Particles03UmFieldNumber = 7; private uint particles03Um_; /// - /// - /// 0.3um Particle Count + /// + /// 0.3um Particle Count /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1040,8 +1040,8 @@ public uint Particles03Um { public const int Particles05UmFieldNumber = 8; private uint particles05Um_; /// - /// - /// 0.5um Particle Count + /// + /// 0.5um Particle Count /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1056,8 +1056,8 @@ public uint Particles05Um { public const int Particles10UmFieldNumber = 9; private uint particles10Um_; /// - /// - /// 1.0um Particle Count + /// + /// 1.0um Particle Count /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1072,8 +1072,8 @@ public uint Particles10Um { public const int Particles25UmFieldNumber = 10; private uint particles25Um_; /// - /// - /// 2.5um Particle Count + /// + /// 2.5um Particle Count /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1088,8 +1088,8 @@ public uint Particles25Um { public const int Particles50UmFieldNumber = 11; private uint particles50Um_; /// - /// - /// 5.0um Particle Count + /// + /// 5.0um Particle Count /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1104,8 +1104,8 @@ public uint Particles50Um { public const int Particles100UmFieldNumber = 12; private uint particles100Um_; /// - /// - /// 10.0um Particle Count + /// + /// 10.0um Particle Count /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1514,8 +1514,8 @@ public void MergeFrom(pb::CodedInputStream input) { } /// - /// - /// Types of Measurements the telemetry module is equipped to handle + /// + /// Types of Measurements the telemetry module is equipped to handle /// public sealed partial class Telemetry : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE @@ -1577,12 +1577,12 @@ public Telemetry Clone() { public const int TimeFieldNumber = 1; private uint time_; /// - /// - /// This is usually not sent over the mesh (to save space), but it is sent - /// from the phone so that the local device can set its RTC If it is sent over - /// the mesh (because there are devices on the mesh without GPS), it will only - /// be sent by devices which has a hardware GPS clock (IE Mobile Phone). - /// seconds since 1970 + /// + /// This is usually not sent over the mesh (to save space), but it is sent + /// from the phone so that the local device can set its RTC If it is sent over + /// the mesh (because there are devices on the mesh without GPS), it will only + /// be sent by devices which has a hardware GPS clock (IE Mobile Phone). + /// seconds since 1970 /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1596,8 +1596,8 @@ public uint Time { /// Field number for the "device_metrics" field. public const int DeviceMetricsFieldNumber = 2; /// - /// - /// Key native device metrics such as battery level + /// + /// Key native device metrics such as battery level /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1612,8 +1612,8 @@ public uint Time { /// Field number for the "environment_metrics" field. public const int EnvironmentMetricsFieldNumber = 3; /// - /// - /// Weather station or other environmental metrics + /// + /// Weather station or other environmental metrics /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] @@ -1628,8 +1628,8 @@ public uint Time { /// Field number for the "air_quality_metrics" field. public const int AirQualityMetricsFieldNumber = 4; /// - /// - /// Air quality metrics + /// + /// Air quality metrics /// [global::System.Diagnostics.DebuggerNonUserCodeAttribute] [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] diff --git a/protobufs b/protobufs index 5f3daac..74f3c56 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 5f3daac5fabdfe2a0561395fed0ba11a38ba3e7e +Subproject commit 74f3c56c9b59149d7bbbdd053e062aa95a4f0fe4 From 428e5075c45331118c2a8d03f9a7a84a830968f1 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 3 Jul 2023 07:48:44 -0500 Subject: [PATCH 2/8] Mqtt client proxy --- .../MqttProxyCommandHandler.cs | 72 +++++++++- Meshtastic.Cli/Meshtastic.Cli.csproj | 1 + Meshtastic.Cli/Properties/launchSettings.json | 4 + .../MessageFactories/ToRadioMessageFactory.cs | 11 ++ Meshtastic/Generated/Mesh.cs | 134 +++++++++++++----- protobufs | 2 +- 6 files changed, 178 insertions(+), 46 deletions(-) diff --git a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs index 6b0dc80..66e5556 100644 --- a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs +++ b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs @@ -1,7 +1,9 @@ using Meshtastic.Data; using Meshtastic.Data.MessageFactories; -using Meshtastic.Display; +using MQTTnet; using Meshtastic.Protobufs; +using MQTTnet.Client; +using Microsoft.Extensions.Logging; namespace Meshtastic.Cli.CommandHandlers; @@ -19,18 +21,74 @@ public async Task Handle() public override async Task OnCompleted(FromRadio packet, DeviceStateContainer container) { - await Connection.ReadFromRadio((fromRadio, container) => + // connect to mqtt server with mqttnet + var factory = new MqttFactory(); + using var mqttClient = factory.CreateMqttClient(); + MqttClientOptions options = GetMqttClientOptions(container); + await mqttClient.ConnectAsync(options, CancellationToken.None); + var root = container.LocalModuleConfig.Mqtt.Root ?? "msh"; + await mqttClient.SubscribeAsync(new MqttTopicFilterBuilder() + .WithTopic($"{root}/{container.Metadata.FirmwareVersion.First()}/#") + .Build()); + + mqttClient.ApplicationMessageReceivedAsync += async e => + { + Logger.LogInformation($"Received MQTT from host on topic: {e.ApplicationMessage.Topic}"); + // Get bytes from utf8 string + var bytes = System.Text.Encoding.UTF8.GetBytes(e.ApplicationMessage.ConvertPayloadToString()); + var toRadio = new ToRadioMessageFactory().CreateMqttClientProxyMessage(e.ApplicationMessage.Topic, bytes); + await Connection.WriteToRadio(toRadio); + }; + + await Connection.ReadFromRadio(async (fromRadio, container) => { if (fromRadio?.PayloadVariantCase == FromRadio.PayloadVariantOneofCase.MqttClientProxyMessage && fromRadio.MqttClientProxyMessage is not null) { var message = fromRadio.MqttClientProxyMessage; - var topic = message.Topic; - AnsiConsole.MarkupLine($"[green]Topic:[/] {topic}"); - AnsiConsole.MarkupLine($"[green]Text:[/] {message.Text}"); - AnsiConsole.MarkupLine($"[green]Data:[/] {ServiceEnvelope.Parser.ParseFrom(message.Data)}"); + Logger.LogInformation($"Received MQTT message from device to proxy on topic: {message.Topic}"); + if (message.PayloadVariantCase == MqttClientProxyMessage.PayloadVariantOneofCase.Data) + { + Logger.LogDebug(ServiceEnvelope.Parser.ParseFrom(message.Data).ToString()); + await mqttClient.PublishAsync(new MqttApplicationMessageBuilder() + .WithTopic(message.Topic) + .WithPayload(message.Data.ToByteArray()) + .Build()); + } + else if (message.PayloadVariantCase == MqttClientProxyMessage.PayloadVariantOneofCase.Text) + { + Logger.LogDebug(message.Text); + await mqttClient.PublishAsync(new MqttApplicationMessageBuilder() + .WithTopic(message.Topic) + .WithPayload(message.Text) + .Build()); + } } - return Task.FromResult(false); + return false; }); } + + private MqttClientOptions GetMqttClientOptions(DeviceStateContainer container) + { + var builder = new MqttClientOptionsBuilder() + .WithClientId(container.GetDeviceNodeInfo()?.User?.Id ?? container.MyNodeInfo.MyNodeNum.ToString()); + + var address = container.LocalModuleConfig.Mqtt.Address; + var host = address.Split(':').FirstOrDefault() ?? container.LocalModuleConfig.Mqtt.Address; + var port = address.Contains(":") ? address.Split(':').LastOrDefault() : null; + + if (container.LocalModuleConfig.Mqtt.TlsEnabled) + { + builder = builder.WithTls() + .WithTcpServer(host, Int32.Parse(port ?? "8883")); + } + else { + builder = builder.WithTcpServer(host, Int32.Parse(port ?? "1883")); + } + + if (container.LocalModuleConfig.Mqtt.Username is not null) + builder = builder.WithCredentials(container.LocalModuleConfig.Mqtt.Username, container.LocalModuleConfig.Mqtt.Password); + + return builder.Build(); + } } diff --git a/Meshtastic.Cli/Meshtastic.Cli.csproj b/Meshtastic.Cli/Meshtastic.Cli.csproj index 7a44308..f15a2eb 100644 --- a/Meshtastic.Cli/Meshtastic.Cli.csproj +++ b/Meshtastic.Cli/Meshtastic.Cli.csproj @@ -40,6 +40,7 @@ + diff --git a/Meshtastic.Cli/Properties/launchSettings.json b/Meshtastic.Cli/Properties/launchSettings.json index df6c255..d2818ee 100644 --- a/Meshtastic.Cli/Properties/launchSettings.json +++ b/Meshtastic.Cli/Properties/launchSettings.json @@ -139,6 +139,10 @@ "import": { "commandName": "Project", "commandLineArgs": "import" + }, + "mqtt": { + "commandName": "Project", + "commandLineArgs": "mqtt-proxy" } } } diff --git a/Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs b/Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs index feaa219..1dbb2cc 100644 --- a/Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs +++ b/Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs @@ -1,3 +1,4 @@ +using Google.Protobuf; using Meshtastic.Protobufs; using static Meshtastic.Protobufs.XModem.Types; @@ -29,4 +30,14 @@ public ToRadio CreateXmodemPacketMessage(Control control = XModem.Types.Control. Control = control } }; + + public ToRadio CreateMqttClientProxyMessage(string topic, byte[] payload) => + new() + { + MqttClientProxyMessage = new MqttClientProxyMessage() + { + Topic = topic, + Data = ByteString.CopyFrom(payload) + } + }; } \ No newline at end of file diff --git a/Meshtastic/Generated/Mesh.cs b/Meshtastic/Generated/Mesh.cs index a7b0f40..9fa8bd1 100644 --- a/Meshtastic/Generated/Mesh.cs +++ b/Meshtastic/Generated/Mesh.cs @@ -111,45 +111,46 @@ static MeshReflection() { "DCABKAsyEi5tZXNodGFzdGljLlhNb2RlbUgAEi4KCG1ldGFkYXRhGA0gASgL", "MhoubWVzaHRhc3RpYy5EZXZpY2VNZXRhZGF0YUgAEkQKFm1xdHRDbGllbnRQ", "cm94eU1lc3NhZ2UYDiABKAsyIi5tZXNodGFzdGljLk1xdHRDbGllbnRQcm94", - "eU1lc3NhZ2VIAEIRCg9wYXlsb2FkX3ZhcmlhbnQiogEKB1RvUmFkaW8SKAoG", + "eU1lc3NhZ2VIAEIRCg9wYXlsb2FkX3ZhcmlhbnQi6AEKB1RvUmFkaW8SKAoG", "cGFja2V0GAEgASgLMhYubWVzaHRhc3RpYy5NZXNoUGFja2V0SAASGAoOd2Fu", "dF9jb25maWdfaWQYAyABKA1IABIUCgpkaXNjb25uZWN0GAQgASgISAASKgoM", - "eG1vZGVtUGFja2V0GAUgASgLMhIubWVzaHRhc3RpYy5YTW9kZW1IAEIRCg9w", - "YXlsb2FkX3ZhcmlhbnQiQAoKQ29tcHJlc3NlZBIkCgdwb3J0bnVtGAEgASgO", - "MhMubWVzaHRhc3RpYy5Qb3J0TnVtEgwKBGRhdGEYAiABKAwiYQoMTmVpZ2hi", - "b3JJbmZvEg8KB25vZGVfaWQYASABKA0SFwoPbGFzdF9zZW50X2J5X2lkGAIg", - "ASgNEicKCW5laWdoYm9ycxgDIAMoCzIULm1lc2h0YXN0aWMuTmVpZ2hib3Ii", - "KAoITmVpZ2hib3ISDwoHbm9kZV9pZBgBIAEoDRILCgNzbnIYAiABKAIirQIK", - "DkRldmljZU1ldGFkYXRhEhgKEGZpcm13YXJlX3ZlcnNpb24Y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WECkSCwoHTTVTVEFDSxAq", - "Eg0KCUhFTFRFQ19WMxArEhEKDUhFTFRFQ19XU0xfVjMQLBITCg9CRVRBRlBW", - "XzI0MDBfVFgQLRIXChNCRVRBRlBWXzkwMF9OQU5PX1RYEC4SDAoIUlBJX1BJ", - "Q08QLxIPCgpQUklWQVRFX0hXEP8BKiwKCUNvbnN0YW50cxIICgRaRVJPEAAS", - "FQoQREFUQV9QQVlMT0FEX0xFThDtASruAQoRQ3JpdGljYWxFcnJvckNvZGUS", - "CAoETk9ORRAAEg8KC1RYX1dBVENIRE9HEAESFAoQU0xFRVBfRU5URVJfV0FJ", - "VBACEgwKCE5PX1JBRElPEAMSDwoLVU5TUEVDSUZJRUQQBBIVChFVQkxPWF9V", - "TklUX0ZBSUxFRBAFEg0KCU5PX0FYUDE5MhAGEhkKFUlOVkFMSURfUkFESU9f", - "U0VUVElORxAHEhMKD1RSQU5TTUlUX0ZBSUxFRBAIEgwKCEJST1dOT1VUEAkS", - "EgoOU1gxMjYyX0ZBSUxVUkUQChIRCg1SQURJT19TUElfQlVHEAtCXwoTY29t", - "LmdlZWtzdmlsbGUubWVzaEIKTWVzaFByb3Rvc1oiZ2l0aHViLmNvbS9tZXNo", - "dGFzdGljL2dvL2dlbmVyYXRlZKoCFE1lc2h0YXN0aWMuUHJvdG9idWZzugIA", - "YgZwcm90bzM=")); + "eG1vZGVtUGFja2V0GAUgASgLMhIubWVzaHRhc3RpYy5YTW9kZW1IABJEChZt", + "cXR0Q2xpZW50UHJveHlNZXNzYWdlGAYgASgLMiIubWVzaHRhc3RpYy5NcXR0", + "Q2xpZW50UHJveHlNZXNzYWdlSABCEQoPcGF5bG9hZF92YXJpYW50IkAKCkNv", + "bXByZXNzZWQSJAoHcG9ydG51bRgBIAEoDjITLm1lc2h0YXN0aWMuUG9ydE51", + "bRIMCgRkYXRhGAIgASgMImEKDE5laWdoYm9ySW5mbxIPCgdub2RlX2lkGAEg", + "ASgNEhcKD2xhc3Rfc2VudF9ie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MERLECESBwoDUFBSECISDwoLR0VOSUVCTE9D", + "S1MQIxIRCg1OUkY1Ml9VTktOT1dOECQSDQoJUE9SVERVSU5PECUSDwoLQU5E", + "Uk9JRF9TSU0QJhIKCgZESVlfVjEQJxIVChFOUkY1Mjg0MF9QQ0ExMDA1ORAo", + "EgoKBkRSX0RFVhApEgsKB001U1RBQ0sQKhINCglIRUxURUNfVjMQKxIRCg1I", + "RUxURUNfV1NMX1YzECwSEwoPQkVUQUZQVl8yNDAwX1RYEC0SFwoTQkVUQUZQ", + "Vl85MDBfTkFOT19UWBAuEgwKCFJQSV9QSUNPEC8SDwoKUFJJVkFURV9IVxD/", + "ASosCglDb25zdGFudHMSCAoEWkVSTxAAEhUKEERBVEFfUEFZTE9BRF9MRU4Q", + "7QEq7gEKEUNyaXRpY2FsRXJyb3JDb2RlEggKBE5PTkUQABIPCgtUWF9XQVRD", + "SERPRxABEhQKEFNMRUVQX0VOVEVSX1dBSVQQAhIMCghOT19SQURJTxADEg8K", + "C1VOU1BFQ0lGSUVEEAQSFQoRVUJMT1hfVU5JVF9GQUlMRUQQBRINCglOT19B", + "WFAxOTIQBhIZChVJTlZBTElEX1JBRElPX1NFVFRJTkcQBxITCg9UUkFOU01J", + "VF9GQUlMRUQQCBIMCghCUk9XTk9VVBAJEhIKDlNYMTI2Ml9GQUlMVVJFEAoS", + "EQoNUkFESU9fU1BJX0JVRxALQl8KE2NvbS5nZWVrc3ZpbGxlLm1lc2hCCk1l", + "c2hQcm90b3NaImdpdGh1Yi5jb20vbWVzaHRhc3RpYy9nby9nZW5lcmF0ZWSq", + "AhRNZXNodGFzdGljLlByb3RvYnVmc7oCAGIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Meshtastic.Protobufs.ChannelReflection.Descriptor, global::Meshtastic.Protobufs.ConfigReflection.Descriptor, global::Meshtastic.Protobufs.ModuleConfigReflection.Descriptor, global::Meshtastic.Protobufs.PortnumsReflection.Descriptor, global::Meshtastic.Protobufs.TelemetryReflection.Descriptor, global::Meshtastic.Protobufs.XmodemReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Meshtastic.Protobufs.HardwareModel), typeof(global::Meshtastic.Protobufs.Constants), typeof(global::Meshtastic.Protobufs.CriticalErrorCode), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -166,7 +167,7 @@ static MeshReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.LogRecord), global::Meshtastic.Protobufs.LogRecord.Parser, new[]{ "Message", "Time", "Source", "Level" }, null, new[]{ typeof(global::Meshtastic.Protobufs.LogRecord.Types.Level) }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.QueueStatus), global::Meshtastic.Protobufs.QueueStatus.Parser, new[]{ "Res", "Free", "Maxlen", "MeshPacketId" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.FromRadio), global::Meshtastic.Protobufs.FromRadio.Parser, new[]{ "Id", "Packet", "MyInfo", "NodeInfo", "Config", "LogRecord", "ConfigCompleteId", "Rebooted", "ModuleConfig", "Channel", "QueueStatus", "XmodemPacket", "Metadata", "MqttClientProxyMessage" }, new[]{ "PayloadVariant" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ToRadio), global::Meshtastic.Protobufs.ToRadio.Parser, new[]{ "Packet", "WantConfigId", "Disconnect", "XmodemPacket" }, new[]{ "PayloadVariant" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ToRadio), global::Meshtastic.Protobufs.ToRadio.Parser, new[]{ "Packet", "WantConfigId", "Disconnect", "XmodemPacket", "MqttClientProxyMessage" }, new[]{ "PayloadVariant" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.Compressed), global::Meshtastic.Protobufs.Compressed.Parser, new[]{ "Portnum", "Data" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.NeighborInfo), global::Meshtastic.Protobufs.NeighborInfo.Parser, new[]{ "NodeId", "LastSentById", "Neighbors" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.Neighbor), global::Meshtastic.Protobufs.Neighbor.Parser, new[]{ "NodeId", "Snr" }, null, null, null, null), @@ -7869,6 +7870,9 @@ public ToRadio(ToRadio other) : this() { case PayloadVariantOneofCase.XmodemPacket: XmodemPacket = other.XmodemPacket.Clone(); break; + case PayloadVariantOneofCase.MqttClientProxyMessage: + MqttClientProxyMessage = other.MqttClientProxyMessage.Clone(); + break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -7949,6 +7953,22 @@ public bool Disconnect { } } + /// Field number for the "mqttClientProxyMessage" field. + public const int MqttClientProxyMessageFieldNumber = 6; + /// + /// + /// MQTT Client Proxy Message + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Meshtastic.Protobufs.MqttClientProxyMessage MqttClientProxyMessage { + get { return payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage ? (global::Meshtastic.Protobufs.MqttClientProxyMessage) payloadVariant_ : null; } + set { + payloadVariant_ = value; + payloadVariantCase_ = value == null ? PayloadVariantOneofCase.None : PayloadVariantOneofCase.MqttClientProxyMessage; + } + } + private object payloadVariant_; /// Enum of possible cases for the "payload_variant" oneof. public enum PayloadVariantOneofCase { @@ -7957,6 +7977,7 @@ public enum PayloadVariantOneofCase { WantConfigId = 3, Disconnect = 4, XmodemPacket = 5, + MqttClientProxyMessage = 6, } private PayloadVariantOneofCase payloadVariantCase_ = PayloadVariantOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -7991,6 +8012,7 @@ public bool Equals(ToRadio other) { if (WantConfigId != other.WantConfigId) return false; if (Disconnect != other.Disconnect) return false; if (!object.Equals(XmodemPacket, other.XmodemPacket)) return false; + if (!object.Equals(MqttClientProxyMessage, other.MqttClientProxyMessage)) return false; if (PayloadVariantCase != other.PayloadVariantCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -8003,6 +8025,7 @@ public override int GetHashCode() { if (payloadVariantCase_ == PayloadVariantOneofCase.WantConfigId) hash ^= WantConfigId.GetHashCode(); if (payloadVariantCase_ == PayloadVariantOneofCase.Disconnect) hash ^= Disconnect.GetHashCode(); if (payloadVariantCase_ == PayloadVariantOneofCase.XmodemPacket) hash ^= XmodemPacket.GetHashCode(); + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) hash ^= MqttClientProxyMessage.GetHashCode(); hash ^= (int) payloadVariantCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -8038,6 +8061,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(42); output.WriteMessage(XmodemPacket); } + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + output.WriteRawTag(50); + output.WriteMessage(MqttClientProxyMessage); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -8064,6 +8091,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(42); output.WriteMessage(XmodemPacket); } + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + output.WriteRawTag(50); + output.WriteMessage(MqttClientProxyMessage); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -8086,6 +8117,9 @@ public int CalculateSize() { if (payloadVariantCase_ == PayloadVariantOneofCase.XmodemPacket) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(XmodemPacket); } + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(MqttClientProxyMessage); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -8117,6 +8151,12 @@ public void MergeFrom(ToRadio other) { } XmodemPacket.MergeFrom(other.XmodemPacket); break; + case PayloadVariantOneofCase.MqttClientProxyMessage: + if (MqttClientProxyMessage == null) { + MqttClientProxyMessage = new global::Meshtastic.Protobufs.MqttClientProxyMessage(); + } + MqttClientProxyMessage.MergeFrom(other.MqttClientProxyMessage); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -8160,6 +8200,15 @@ public void MergeFrom(pb::CodedInputStream input) { XmodemPacket = subBuilder; break; } + case 50: { + global::Meshtastic.Protobufs.MqttClientProxyMessage subBuilder = new global::Meshtastic.Protobufs.MqttClientProxyMessage(); + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + subBuilder.MergeFrom(MqttClientProxyMessage); + } + input.ReadMessage(subBuilder); + MqttClientProxyMessage = subBuilder; + break; + } } } #endif @@ -8201,6 +8250,15 @@ public void MergeFrom(pb::CodedInputStream input) { XmodemPacket = subBuilder; break; } + case 50: { + global::Meshtastic.Protobufs.MqttClientProxyMessage subBuilder = new global::Meshtastic.Protobufs.MqttClientProxyMessage(); + if (payloadVariantCase_ == PayloadVariantOneofCase.MqttClientProxyMessage) { + subBuilder.MergeFrom(MqttClientProxyMessage); + } + input.ReadMessage(subBuilder); + MqttClientProxyMessage = subBuilder; + break; + } } } } diff --git a/protobufs b/protobufs index 74f3c56..c8b90c7 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 74f3c56c9b59149d7bbbdd053e062aa95a4f0fe4 +Subproject commit c8b90c700607ddbab0d99322635f6a73abb64259 From 763e36ead18ee5ab9201b9d4bcd55e253e126ca7 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Mon, 3 Jul 2023 19:17:31 -0500 Subject: [PATCH 3/8] C# develop --- .vscode/settings.json | 3 +++ Meshtastic.Cli/.vscode/settings.json | 3 +++ Meshtastic.Cli/Meshtastic.Cli.sln | 25 +++++++++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 Meshtastic.Cli/.vscode/settings.json create mode 100644 Meshtastic.Cli/Meshtastic.Cli.sln diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7284e44 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dotnet.defaultSolution": "Meshtastic.sln" +} \ No newline at end of file diff --git a/Meshtastic.Cli/.vscode/settings.json b/Meshtastic.Cli/.vscode/settings.json new file mode 100644 index 0000000..d979ce6 --- /dev/null +++ b/Meshtastic.Cli/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dotnet.defaultSolution": "Meshtastic.Cli.sln" +} \ No newline at end of file diff --git a/Meshtastic.Cli/Meshtastic.Cli.sln b/Meshtastic.Cli/Meshtastic.Cli.sln new file mode 100644 index 0000000..3430100 --- /dev/null +++ b/Meshtastic.Cli/Meshtastic.Cli.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.001.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meshtastic.Cli", "Meshtastic.Cli.csproj", "{A3FB32D2-954E-4D1D-B789-1E14AA5B2CB6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A3FB32D2-954E-4D1D-B789-1E14AA5B2CB6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A3FB32D2-954E-4D1D-B789-1E14AA5B2CB6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A3FB32D2-954E-4D1D-B789-1E14AA5B2CB6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A3FB32D2-954E-4D1D-B789-1E14AA5B2CB6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {CF056994-0472-486E-8D07-0D470536C40D} + EndGlobalSection +EndGlobal From 7b31136d75bc6573e09d152e0141101395e36b30 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 6 Jul 2023 12:49:06 -0500 Subject: [PATCH 4/8] Fixed subscription --- Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs index 66e5556..5247a0d 100644 --- a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs +++ b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs @@ -26,9 +26,11 @@ public override async Task OnCompleted(FromRadio packet, DeviceStateContainer co using var mqttClient = factory.CreateMqttClient(); MqttClientOptions options = GetMqttClientOptions(container); await mqttClient.ConnectAsync(options, CancellationToken.None); - var root = container.LocalModuleConfig.Mqtt.Root ?? "msh"; + var root = String.IsNullOrWhiteSpace(container.LocalModuleConfig.Mqtt.Root) ? "msh" : container.LocalModuleConfig.Mqtt.Root; + var subscriptionTopic = $"{root}/{container.Metadata.FirmwareVersion.First()}/#"; + Logger.LogInformation($"Subscribing to topic: {subscriptionTopic}"); await mqttClient.SubscribeAsync(new MqttTopicFilterBuilder() - .WithTopic($"{root}/{container.Metadata.FirmwareVersion.First()}/#") + .WithTopic(subscriptionTopic) .Build()); mqttClient.ApplicationMessageReceivedAsync += async e => From 7106d29011392291291b68eec2fce6170292a191 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Thu, 6 Jul 2023 21:58:15 -0500 Subject: [PATCH 5/8] Fix bytes and ignore /stat topic --- .../CommandHandlers/MqttProxyCommandHandler.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs index 5247a0d..35d4f38 100644 --- a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs +++ b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs @@ -27,7 +27,8 @@ public override async Task OnCompleted(FromRadio packet, DeviceStateContainer co MqttClientOptions options = GetMqttClientOptions(container); await mqttClient.ConnectAsync(options, CancellationToken.None); var root = String.IsNullOrWhiteSpace(container.LocalModuleConfig.Mqtt.Root) ? "msh" : container.LocalModuleConfig.Mqtt.Root; - var subscriptionTopic = $"{root}/{container.Metadata.FirmwareVersion.First()}/#"; + var prefix = $"{root}/{container.Metadata.FirmwareVersion.First()}"; + var subscriptionTopic = $"{prefix}/#"; Logger.LogInformation($"Subscribing to topic: {subscriptionTopic}"); await mqttClient.SubscribeAsync(new MqttTopicFilterBuilder() .WithTopic(subscriptionTopic) @@ -35,10 +36,13 @@ await mqttClient.SubscribeAsync(new MqttTopicFilterBuilder() mqttClient.ApplicationMessageReceivedAsync += async e => { + if (e.ApplicationMessage.Topic.StartsWith($"{prefix}/stat/")) + return; + Logger.LogInformation($"Received MQTT from host on topic: {e.ApplicationMessage.Topic}"); // Get bytes from utf8 string - var bytes = System.Text.Encoding.UTF8.GetBytes(e.ApplicationMessage.ConvertPayloadToString()); - var toRadio = new ToRadioMessageFactory().CreateMqttClientProxyMessage(e.ApplicationMessage.Topic, bytes); + var toRadio = new ToRadioMessageFactory().CreateMqttClientProxyMessage(e.ApplicationMessage.Topic, e.ApplicationMessage.PayloadSegment.ToArray()); + Logger.LogDebug(toRadio.ToString()); await Connection.WriteToRadio(toRadio); }; From b052f207a0c2b20830734b6e3e2af7cc14132745 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Fri, 7 Jul 2023 19:47:15 -0500 Subject: [PATCH 6/8] Whitespace --- Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs index 35d4f38..d13abf0 100644 --- a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs +++ b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs @@ -26,9 +26,11 @@ public override async Task OnCompleted(FromRadio packet, DeviceStateContainer co using var mqttClient = factory.CreateMqttClient(); MqttClientOptions options = GetMqttClientOptions(container); await mqttClient.ConnectAsync(options, CancellationToken.None); + var root = String.IsNullOrWhiteSpace(container.LocalModuleConfig.Mqtt.Root) ? "msh" : container.LocalModuleConfig.Mqtt.Root; var prefix = $"{root}/{container.Metadata.FirmwareVersion.First()}"; var subscriptionTopic = $"{prefix}/#"; + Logger.LogInformation($"Subscribing to topic: {subscriptionTopic}"); await mqttClient.SubscribeAsync(new MqttTopicFilterBuilder() .WithTopic(subscriptionTopic) From 6d5a5b8c96d7039cfe01824dccd87df90759bf99 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 9 Jul 2023 06:31:33 -0500 Subject: [PATCH 7/8] Update protos --- Meshtastic/Generated/Mesh.cs | 46 ++- Meshtastic/Generated/ModuleConfig.cs | 562 +++++++++++++++++++++++---- protobufs | 2 +- 3 files changed, 525 insertions(+), 85 deletions(-) diff --git a/Meshtastic/Generated/Mesh.cs b/Meshtastic/Generated/Mesh.cs index 9fa8bd1..5cc3cc5 100644 --- a/Meshtastic/Generated/Mesh.cs +++ b/Meshtastic/Generated/Mesh.cs @@ -128,7 +128,7 @@ static MeshReflection() { "BHJvbGUYByABKA4yJC5tZXNodGFzdGljLkNvbmZpZy5EZXZpY2VDb25maWcu", "Um9sZRIWCg5wb3NpdGlvbl9mbGFncxgIIAEoDRIrCghod19tb2RlbBgJIAEo", "DjIZLm1lc2h0YXN0aWMuSGFyZHdhcmVNb2RlbBIZChFoYXNSZW1vdGVIYXJk", - "d2FyZRgKIAEo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9nby9nZW5lcmF0ZWSq", - "AhRNZXNodGFzdGljLlByb3RvYnVmc7oCAGIGcHJvdG8z")); + "Vl85MDBfTkFOT19UWBAuEgwKCFJQSV9QSUNPEC8SGwoXSEVMVEVDX1dJUkVM", + "RVNTX1RSQUNLRVIQMBIZChVIRUxURUNfV0lSRUxFU1NfUEFQRVIQMRIKCgZU", + "X0RFQ0sQMhIOCgpUX1dBVENIX1MzEDMSDwoKUFJJVkFURV9IVxD/ASosCglD", + "b25zdGFudHMSCAoEWkVSTxAAEhUKEERBVEFfUEFZTE9BRF9MRU4Q7QEq7gEK", + "EUNyaXRpY2FsRXJyb3JDb2RlEggKBE5PTkUQABIPCgtUWF9XQVRDSERPRxAB", + "EhQKEFNMRUVQX0VOVEVSX1dBSVQQAhIMCghOT19SQURJTxADEg8KC1VOU1BF", + "Q0lGSUVEEAQSFQoRVUJMT1hfVU5JVF9GQUlMRUQQBRINCglOT19BWFAxOTIQ", + "BhIZChVJTlZBTElEX1JBRElPX1NFVFRJTkcQBxITCg9UUkFOU01JVF9GQUlM", + "RUQQCBIMCghCUk9XTk9VVBAJEhIKDlNYMTI2Ml9GQUlMVVJFEAoSEQoNUkFE", + "SU9fU1BJX0JVRxALQl8KE2NvbS5nZWVrc3ZpbGxlLm1lc2hCCk1lc2hQcm90", + "b3NaImdpdGh1Yi5jb20vbWVzaHRhc3RpYy9nby9nZW5lcmF0ZWSqAhRNZXNo", + "dGFzdGljLlByb3RvYnVmc7oCAGIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Meshtastic.Protobufs.ChannelReflection.Descriptor, global::Meshtastic.Protobufs.ConfigReflection.Descriptor, global::Meshtastic.Protobufs.ModuleConfigReflection.Descriptor, global::Meshtastic.Protobufs.PortnumsReflection.Descriptor, global::Meshtastic.Protobufs.TelemetryReflection.Descriptor, global::Meshtastic.Protobufs.XmodemReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Meshtastic.Protobufs.HardwareModel), typeof(global::Meshtastic.Protobufs.Constants), typeof(global::Meshtastic.Protobufs.CriticalErrorCode), }, null, new pbr::GeneratedClrTypeInfo[] { @@ -372,6 +374,26 @@ public enum HardwareModel { [pbr::OriginalName("RPI_PICO")] RpiPico = 47, /// /// + /// Heltec Wireless Tracker with ESP32-S3 CPU, built-in GPS, and TFT + /// + [pbr::OriginalName("HELTEC_WIRELESS_TRACKER")] HeltecWirelessTracker = 48, + /// + /// + /// Heltec Wireless Paper with ESP32-S3 CPU and E-Ink display + /// + [pbr::OriginalName("HELTEC_WIRELESS_PAPER")] HeltecWirelessPaper = 49, + /// + /// + /// LilyGo T-Deck with ESP32-S3 CPU, Keyboard, and IPS display + /// + [pbr::OriginalName("T_DECK")] TDeck = 50, + /// + /// + /// LilyGo T-Watch S3 with ESP32-S3 CPU and IPS display + /// + [pbr::OriginalName("T_WATCH_S3")] TWatchS3 = 51, + /// + /// /// ------------------------------------------------------------------------------------------------------------------------------------------ /// Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. /// ------------------------------------------------------------------------------------------------------------------------------------------ @@ -3646,7 +3668,7 @@ public void MergeFrom(pb::CodedInputStream input) { /// /// - /// This message will be proxied over the PhoneAPI for client to deliver to the MQTT server + /// This message will be proxied over the PhoneAPI for the client to deliver to the MQTT server /// public sealed partial class MqttClientProxyMessage : pb::IMessage #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE diff --git a/Meshtastic/Generated/ModuleConfig.cs b/Meshtastic/Generated/ModuleConfig.cs index f8c91dd..aa5428f 100644 --- a/Meshtastic/Generated/ModuleConfig.cs +++ b/Meshtastic/Generated/ModuleConfig.cs @@ -25,7 +25,7 @@ static ModuleConfigReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "Ch5tZXNodGFzdGljL21vZHVsZV9jb25maWcucHJvdG8SCm1lc2h0YXN0aWMi", - "kxsKDE1vZHVsZUNvbmZpZxIzCgRtcXR0GAEgASgLMiMubWVzaHRhc3RpYy5N", + "xhwKDE1vZHVsZUNvbmZpZxIzCgRtcXR0GAEgASgLMiMubWVzaHRhc3RpYy5N", "b2R1bGVDb25maWcuTVFUVENvbmZpZ0gAEjcKBnNlcmlhbBgCIAEoCzIlLm1l", "c2h0YXN0aWMuTW9kdWxlQ29uZmlnLlNlcmlhbENvbmZpZ0gAElQKFWV4dGVy", "bmFsX25vdGlmaWNhdGlvbhgDIAEoCzIzLm1lc2h0YXN0aWMuTW9kdWxlQ29u", @@ -40,79 +40,83 @@ static ModuleConfigReflection() { "cmVtb3RlX2hhcmR3YXJlGAkgASgLMi0ubWVzaHRhc3RpYy5Nb2R1bGVDb25m", "aWcuUmVtb3RlSGFyZHdhcmVDb25maWdIABJECg1uZWlnaGJvcl9pbmZvGAog", "ASgLMisubWVzaHRhc3RpYy5Nb2R1bGVDb25maWcuTmVpZ2hib3JJbmZvQ29u", - "ZmlnSAAayAEKCk1RVFRDb25maWcSDwoHZW5hYmxlZBgBIAEoCBIPCgdhZGRy", - "ZXNzGAIgASgJEhAKCHVzZXJuYW1lGAMgASgJEhAKCHBhc3N3b3JkGAQgASgJ", - "EhoKEmVuY3J5cHRpb25fZW5hYmxlZBgFIAEoCBIUCgxqc29uX2VuYWJsZWQY", - "BiABKAgSEwoLdGxzX2VuYWJsZWQYByABKAgSDAoEcm9vdBgIIAEoCRIfChdw", - "cm94eV90b19jbGllbnRfZW5hYmxlZBgJIAEoCBqCAQoUUmVtb3RlSGFyZHdh", - "cmVDb25maWcSDwoHZW5hYmxlZBgBIAEoCBIiChphbGxvd191bmRlZmluZWRf", - "cGluX2FjY2VzcxgCIAEoCBI1Cg5hdmFpbGFibGVfcGlucxgDIAMoCzIdLm1l", - "c2h0YXN0aWMuUmVtb3RlSGFyZHdhcmVQaW4aPgoSTmVpZ2hib3JJbmZvQ29u", - "ZmlnEg8KB2VuYWJsZWQYASABKAgSFwoPdXBkYXRlX2ludGV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IOCgpCQVVEXzE5", - "MjAwEAgSDgoKQkFVRF8zODQwMBAJEg4KCkJBVURfNTc2MDAQChIPCgtCQVVE", - "XzExNTIwMBALEg8KC0JBVURfMjMwNDAwEAwSDwoLQkFVRF80NjA4MDAQDRIP", - "CgtCQVVEXzU3NjAwMBAOEg8KC0JBVURfOTIxNjAwEA8iVQoLU2VyaWFsX01v", - "ZGUSCwoHREVGQVVMVBAAEgoKBlNJTVBMRRABEgkKBVBST1RPEAISCwoHVEVY", - "VE1TRxADEggKBE5NRUEQBBILCgdDQUxUT1BPEAUazgIKGkV4dGVybmFsTm90", - "aWZpY2F0aW9uQ29uZmlnEg8KB2VuYWJsZWQYASABKAgSEQoJb3V0cHV0X21z", - "GAIgASgNEg4KBm91dHB1dBgDIAEoDRIUCgxvdXRwdXRfdmlicmEYCCABKA0S", - "FQoNb3V0cHV0X2J1enplchgJIAEoDRIOCgZhY3RpdmUYBCABKAgSFQoNYWxl", - "cnRfbWVzc2FnZRgFIAEoCBIbChNhbGVydF9tZXNzYWdlX3ZpYnJhGAogASgI", - "EhwKFGFsZXJ0X21lc3NhZ2VfYnV6emVyGAsgASgIEhIKCmFsZXJ0X2JlbGwY", - "BiABKAgSGAoQYWxlcnRfYmVsbF92aWJyYRgMIAEoCBIZChFhbGVydF9iZWxs", - "X2J1enplchgNIAEoCBIPCgd1c2VfcHdtGAcgASgIEhMKC25hZ190aW1lb3V0", - "GA4gASgNGoQBChJTdG9yZUZvcndhcmRDb25maWcSDwoHZW5hYmxlZBgBIAEo", - "CBIRCgloZWFydGJlYXQYAiABKAgSDwoHcmVjb3JkcxgDIAEoDRIaChJoaXN0", - "b3J5X3JldHVybl9tYXgYBCABKA0SHQoVaGlzdG9yeV9yZXR1cm5fd2luZG93", - "GAUgASgNGkAKD1JhbmdlVGVzdENvbmZpZxIPCgdlbmFibGVkGAEgASgIEg4K", - "BnNlbmRlchgCIAEoDRIMCgRzYXZlGAMgASgIGoYCCg9UZWxlbWV0cnlDb25m", -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kNhbm5lZE1lc3NhZ2VDb25maWcu", + "SW5wdXRFdmVudENoYXISFwoPdXBkb3duMV9lbmFibGVkGAggASgIEg8KB2Vu", + "YWJsZWQYCSABKAgSGgoSYWxsb3dfaW5wdXRfc291cmNlGAogASgJEhEKCXNl", + "bmRfYmVsbBgLIAEoCCJjCg5JbnB1dEV2ZW50Q2hhchIICgROT05FEAASBgoC", + "VVAQERIICgRET1dOEBISCAoETEVGVBATEgkKBVJJR0hUEBQSCgoGU0VMRUNU", + "EAoSCAoEQkFDSxAbEgoKBkNBTkNFTBAYGmUKFUFtYmllbnRMaWdodGluZ0Nv", + "bmZpZxIRCglsZWRfc3RhdGUYASABKAgSDwoHY3VycmVudBgCIAEoDRILCgNy", + "ZWQYAyABKA0SDQoFZ3JlZW4YBCABKA0SDAoEYmx1ZRgFIAEoDUIRCg9wYXls", + "b2FkX3ZhcmlhbnQiZAoRUmVtb3RlSGFyZHdhcmVQaW4SEAoIZ3Bpb19waW4Y", + "ASABKA0SDAoEbmFtZRgCIAEoCRIvCgR0eXBlGAMgASgOMiEubWVzaHRhc3Rp", + "Yy5SZW1vdGVIYXJkd2FyZVBpblR5cGUqSQoVUmVtb3RlSGFyZHdhcmVQaW5U", + "eXBlEgsKB1VOS05PV04QABIQCgxESUdJVEFMX1JFQUQQARIRCg1ESUdJVEFM", + "X1dSSVRFEAJCZwoTY29tLmdlZWtzdmlsbGUubWVzaEISTW9kdWxlQ29uZmln", + "UHJvdG9zWiJnaXRodWIuY29tL21lc2h0YXN0aWMvZ28vZ2VuZXJhdGVkqgIU", + "TWVzaHRhc3RpYy5Qcm90b2J1ZnO6AgBiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Meshtastic.Protobufs.RemoteHardwarePinType), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig), global::Meshtastic.Protobufs.ModuleConfig.Parser, new[]{ "Mqtt", "Serial", "ExternalNotification", "StoreForward", "RangeTest", "Telemetry", "CannedMessage", "Audio", "RemoteHardware", "NeighborInfo" }, new[]{ "PayloadVariant" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.MQTTConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.MQTTConfig.Parser, new[]{ "Enabled", "Address", "Username", "Password", "EncryptionEnabled", "JsonEnabled", "TlsEnabled", "Root", "ProxyToClientEnabled" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig), global::Meshtastic.Protobufs.ModuleConfig.Parser, new[]{ "Mqtt", "Serial", "ExternalNotification", "StoreForward", "RangeTest", "Telemetry", "CannedMessage", "Audio", "RemoteHardware", "NeighborInfo", "AmbientLighting" }, new[]{ "PayloadVariant" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.MQTTConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.MQTTConfig.Parser, new[]{ "Enabled", "Address", "Username", "Password", "EncryptionEnabled", "JsonEnabled", "TlsEnabled", "Root", "ProxyToClientEnabled" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.RemoteHardwareConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.RemoteHardwareConfig.Parser, new[]{ "Enabled", "AllowUndefinedPinAccess", "AvailablePins" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.NeighborInfoConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.NeighborInfoConfig.Parser, new[]{ "Enabled", "UpdateInterval" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.AudioConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.AudioConfig.Parser, new[]{ "Codec2Enabled", "PttPin", "Bitrate", "I2SWs", "I2SSd", "I2SDin", "I2SSck" }, null, new[]{ typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.AudioConfig.Types.Audio_Baud) }, null, null), @@ -121,7 +125,8 @@ static ModuleConfigReflection() { new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.StoreForwardConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.StoreForwardConfig.Parser, new[]{ "Enabled", "Heartbeat", "Records", "HistoryReturnMax", "HistoryReturnWindow" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.RangeTestConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.RangeTestConfig.Parser, new[]{ "Enabled", "Sender", "Save" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.TelemetryConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.TelemetryConfig.Parser, new[]{ "DeviceUpdateInterval", "EnvironmentUpdateInterval", "EnvironmentMeasurementEnabled", "EnvironmentScreenEnabled", "EnvironmentDisplayFahrenheit", "AirQualityEnabled", "AirQualityInterval" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.CannedMessageConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.CannedMessageConfig.Parser, new[]{ "Rotary1Enabled", "InputbrokerPinA", "InputbrokerPinB", "InputbrokerPinPress", "InputbrokerEventCw", "InputbrokerEventCcw", "InputbrokerEventPress", "Updown1Enabled", "Enabled", "AllowInputSource", "SendBell" }, null, new[]{ typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.CannedMessageConfig.Types.InputEventChar) }, null, null)}), + new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.CannedMessageConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.CannedMessageConfig.Parser, new[]{ "Rotary1Enabled", "InputbrokerPinA", "InputbrokerPinB", "InputbrokerPinPress", "InputbrokerEventCw", "InputbrokerEventCcw", "InputbrokerEventPress", "Updown1Enabled", "Enabled", "AllowInputSource", "SendBell" }, null, new[]{ typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.CannedMessageConfig.Types.InputEventChar) }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig), global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig.Parser, new[]{ "LedState", "Current", "Red", "Green", "Blue" }, null, null, null, null)}), new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.RemoteHardwarePin), global::Meshtastic.Protobufs.RemoteHardwarePin.Parser, new[]{ "GpioPin", "Name", "Type" }, null, null, null, null) })); } @@ -219,6 +224,9 @@ public ModuleConfig(ModuleConfig other) : this() { case PayloadVariantOneofCase.NeighborInfo: NeighborInfo = other.NeighborInfo.Clone(); break; + case PayloadVariantOneofCase.AmbientLighting: + AmbientLighting = other.AmbientLighting.Clone(); + break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); @@ -390,6 +398,22 @@ public ModuleConfig Clone() { } } + /// Field number for the "ambient_lighting" field. + public const int AmbientLightingFieldNumber = 11; + /// + /// + /// TODO: REPLACE + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig AmbientLighting { + get { return payloadVariantCase_ == PayloadVariantOneofCase.AmbientLighting ? (global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig) payloadVariant_ : null; } + set { + payloadVariant_ = value; + payloadVariantCase_ = value == null ? PayloadVariantOneofCase.None : PayloadVariantOneofCase.AmbientLighting; + } + } + private object payloadVariant_; /// Enum of possible cases for the "payload_variant" oneof. public enum PayloadVariantOneofCase { @@ -404,6 +428,7 @@ public enum PayloadVariantOneofCase { Audio = 8, RemoteHardware = 9, NeighborInfo = 10, + AmbientLighting = 11, } private PayloadVariantOneofCase payloadVariantCase_ = PayloadVariantOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -444,6 +469,7 @@ public bool Equals(ModuleConfig other) { if (!object.Equals(Audio, other.Audio)) return false; if (!object.Equals(RemoteHardware, other.RemoteHardware)) return false; if (!object.Equals(NeighborInfo, other.NeighborInfo)) return false; + if (!object.Equals(AmbientLighting, other.AmbientLighting)) return false; if (PayloadVariantCase != other.PayloadVariantCase) return false; return Equals(_unknownFields, other._unknownFields); } @@ -462,6 +488,7 @@ public override int GetHashCode() { if (payloadVariantCase_ == PayloadVariantOneofCase.Audio) hash ^= Audio.GetHashCode(); if (payloadVariantCase_ == PayloadVariantOneofCase.RemoteHardware) hash ^= RemoteHardware.GetHashCode(); if (payloadVariantCase_ == PayloadVariantOneofCase.NeighborInfo) hash ^= NeighborInfo.GetHashCode(); + if (payloadVariantCase_ == PayloadVariantOneofCase.AmbientLighting) hash ^= AmbientLighting.GetHashCode(); hash ^= (int) payloadVariantCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); @@ -521,6 +548,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(82); output.WriteMessage(NeighborInfo); } + if (payloadVariantCase_ == PayloadVariantOneofCase.AmbientLighting) { + output.WriteRawTag(90); + output.WriteMessage(AmbientLighting); + } if (_unknownFields != null) { _unknownFields.WriteTo(output); } @@ -571,6 +602,10 @@ public void WriteTo(pb::CodedOutputStream output) { output.WriteRawTag(82); output.WriteMessage(NeighborInfo); } + if (payloadVariantCase_ == PayloadVariantOneofCase.AmbientLighting) { + output.WriteRawTag(90); + output.WriteMessage(AmbientLighting); + } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } @@ -611,6 +646,9 @@ public int CalculateSize() { if (payloadVariantCase_ == PayloadVariantOneofCase.NeighborInfo) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(NeighborInfo); } + if (payloadVariantCase_ == PayloadVariantOneofCase.AmbientLighting) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(AmbientLighting); + } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } @@ -684,6 +722,12 @@ public void MergeFrom(ModuleConfig other) { } NeighborInfo.MergeFrom(other.NeighborInfo); break; + case PayloadVariantOneofCase.AmbientLighting: + if (AmbientLighting == null) { + AmbientLighting = new global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig(); + } + AmbientLighting.MergeFrom(other.AmbientLighting); + break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); @@ -791,6 +835,15 @@ public void MergeFrom(pb::CodedInputStream input) { NeighborInfo = subBuilder; break; } + case 90: { + global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig subBuilder = new global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig(); + if (payloadVariantCase_ == PayloadVariantOneofCase.AmbientLighting) { + subBuilder.MergeFrom(AmbientLighting); + } + input.ReadMessage(subBuilder); + AmbientLighting = subBuilder; + break; + } } } #endif @@ -896,6 +949,15 @@ public void MergeFrom(pb::CodedInputStream input) { NeighborInfo = subBuilder; break; } + case 90: { + global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig subBuilder = new global::Meshtastic.Protobufs.ModuleConfig.Types.AmbientLightingConfig(); + if (payloadVariantCase_ == PayloadVariantOneofCase.AmbientLighting) { + subBuilder.MergeFrom(AmbientLighting); + } + input.ReadMessage(subBuilder); + AmbientLighting = subBuilder; + break; + } } } } @@ -5436,6 +5498,362 @@ public enum InputEventChar { } + /// + ///Ambient Lighting Module - Settings for control of onboard LEDs to allow users to adjust the brightness levels and respective color levels. + ///Initially created for the RAK14001 RGB LED module. + /// + public sealed partial class AmbientLightingConfig : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AmbientLightingConfig()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Meshtastic.Protobufs.ModuleConfig.Descriptor.NestedTypes[10]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AmbientLightingConfig() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AmbientLightingConfig(AmbientLightingConfig other) : this() { + ledState_ = other.ledState_; + current_ = other.current_; + red_ = other.red_; + green_ = other.green_; + blue_ = other.blue_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public AmbientLightingConfig Clone() { + return new AmbientLightingConfig(this); + } + + /// Field number for the "led_state" field. + public const int LedStateFieldNumber = 1; + private bool ledState_; + /// + ///Sets LED to on or off. + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool LedState { + get { return ledState_; } + set { + ledState_ = value; + } + } + + /// Field number for the "current" field. + public const int CurrentFieldNumber = 2; + private uint current_; + /// + ///Sets the overall current for the LED, firmware side range for the RAK14001 is 1-31, but users should be given a range of 0-100% + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Current { + get { return current_; } + set { + current_ = value; + } + } + + /// Field number for the "red" field. + public const int RedFieldNumber = 3; + private uint red_; + /// + /// Red level + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Red { + get { return red_; } + set { + red_ = value; + } + } + + /// Field number for the "green" field. + public const int GreenFieldNumber = 4; + private uint green_; + /// + ///Sets the green level of the LED, firmware side values are 0-255, but users should be given a range of 0-100% + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Green { + get { return green_; } + set { + green_ = value; + } + } + + /// Field number for the "blue" field. + public const int BlueFieldNumber = 5; + private uint blue_; + /// + ///Sets the blue level of the LED, firmware side values are 0-255, but users should be given a range of 0-100% + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public uint Blue { + get { return blue_; } + set { + blue_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as AmbientLightingConfig); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(AmbientLightingConfig other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (LedState != other.LedState) return false; + if (Current != other.Current) return false; + if (Red != other.Red) return false; + if (Green != other.Green) return false; + if (Blue != other.Blue) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (LedState != false) hash ^= LedState.GetHashCode(); + if (Current != 0) hash ^= Current.GetHashCode(); + if (Red != 0) hash ^= Red.GetHashCode(); + if (Green != 0) hash ^= Green.GetHashCode(); + if (Blue != 0) hash ^= Blue.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (LedState != false) { + output.WriteRawTag(8); + output.WriteBool(LedState); + } + if (Current != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Current); + } + if (Red != 0) { + output.WriteRawTag(24); + output.WriteUInt32(Red); + } + if (Green != 0) { + output.WriteRawTag(32); + output.WriteUInt32(Green); + } + if (Blue != 0) { + output.WriteRawTag(40); + output.WriteUInt32(Blue); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (LedState != false) { + output.WriteRawTag(8); + output.WriteBool(LedState); + } + if (Current != 0) { + output.WriteRawTag(16); + output.WriteUInt32(Current); + } + if (Red != 0) { + output.WriteRawTag(24); + output.WriteUInt32(Red); + } + if (Green != 0) { + output.WriteRawTag(32); + output.WriteUInt32(Green); + } + if (Blue != 0) { + output.WriteRawTag(40); + output.WriteUInt32(Blue); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (LedState != false) { + size += 1 + 1; + } + if (Current != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Current); + } + if (Red != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Red); + } + if (Green != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Green); + } + if (Blue != 0) { + size += 1 + pb::CodedOutputStream.ComputeUInt32Size(Blue); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(AmbientLightingConfig other) { + if (other == null) { + return; + } + if (other.LedState != false) { + LedState = other.LedState; + } + if (other.Current != 0) { + Current = other.Current; + } + if (other.Red != 0) { + Red = other.Red; + } + if (other.Green != 0) { + Green = other.Green; + } + if (other.Blue != 0) { + Blue = other.Blue; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 8: { + LedState = input.ReadBool(); + break; + } + case 16: { + Current = input.ReadUInt32(); + break; + } + case 24: { + Red = input.ReadUInt32(); + break; + } + case 32: { + Green = input.ReadUInt32(); + break; + } + case 40: { + Blue = input.ReadUInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 8: { + LedState = input.ReadBool(); + break; + } + case 16: { + Current = input.ReadUInt32(); + break; + } + case 24: { + Red = input.ReadUInt32(); + break; + } + case 32: { + Green = input.ReadUInt32(); + break; + } + case 40: { + Blue = input.ReadUInt32(); + break; + } + } + } + } + #endif + + } + } #endregion diff --git a/protobufs b/protobufs index c8b90c7..e0b136f 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit c8b90c700607ddbab0d99322635f6a73abb64259 +Subproject commit e0b136f5f8e26094d02c28d1fdcacd61e087298c From 68c31f3cb440611454879ea8530fd6e283fef0e9 Mon Sep 17 00:00:00 2001 From: Ben Meadors Date: Sun, 9 Jul 2023 06:40:34 -0500 Subject: [PATCH 8/8] Add retained --- Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs | 6 +++++- Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs index d13abf0..43e1c38 100644 --- a/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs +++ b/Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs @@ -42,8 +42,10 @@ await mqttClient.SubscribeAsync(new MqttTopicFilterBuilder() return; Logger.LogInformation($"Received MQTT from host on topic: {e.ApplicationMessage.Topic}"); + // Get bytes from utf8 string - var toRadio = new ToRadioMessageFactory().CreateMqttClientProxyMessage(e.ApplicationMessage.Topic, e.ApplicationMessage.PayloadSegment.ToArray()); + var toRadio = new ToRadioMessageFactory() + .CreateMqttClientProxyMessage(e.ApplicationMessage.Topic, e.ApplicationMessage.PayloadSegment.ToArray(), e.ApplicationMessage.Retain); Logger.LogDebug(toRadio.ToString()); await Connection.WriteToRadio(toRadio); }; @@ -61,6 +63,7 @@ await Connection.ReadFromRadio(async (fromRadio, container) => await mqttClient.PublishAsync(new MqttApplicationMessageBuilder() .WithTopic(message.Topic) .WithPayload(message.Data.ToByteArray()) + .WithRetainFlag(message.Retained) .Build()); } else if (message.PayloadVariantCase == MqttClientProxyMessage.PayloadVariantOneofCase.Text) @@ -69,6 +72,7 @@ await mqttClient.PublishAsync(new MqttApplicationMessageBuilder() await mqttClient.PublishAsync(new MqttApplicationMessageBuilder() .WithTopic(message.Topic) .WithPayload(message.Text) + .WithRetainFlag(message.Retained) .Build()); } } diff --git a/Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs b/Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs index 1dbb2cc..117d49f 100644 --- a/Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs +++ b/Meshtastic/Data/MessageFactories/ToRadioMessageFactory.cs @@ -31,13 +31,14 @@ public ToRadio CreateXmodemPacketMessage(Control control = XModem.Types.Control. } }; - public ToRadio CreateMqttClientProxyMessage(string topic, byte[] payload) => + public ToRadio CreateMqttClientProxyMessage(string topic, byte[] payload, bool retain = false) => new() { MqttClientProxyMessage = new MqttClientProxyMessage() { Topic = topic, - Data = ByteString.CopyFrom(payload) + Data = ByteString.CopyFrom(payload), + Retained = retain, } }; } \ No newline at end of file