Skip to content

Commit

Permalink
Merge pull request #96 from meshtastic/wip
Browse files Browse the repository at this point in the history
Obsolete method and hex string
  • Loading branch information
thebentern authored Oct 30, 2024
2 parents 4955972 + 2148ea7 commit 31a5c9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Meshtastic.Cli/CommandHandlers/MqttProxyCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private static MqttClientOptions GetMqttClientOptions(DeviceStateContainer conta

if (container.LocalModuleConfig.Mqtt.TlsEnabled)
{
builder = builder.WithTls()
builder = builder.WithTlsOptions(options => { })
.WithTcpServer(host, Int32.Parse(port ?? "8883"));
}
else {
Expand Down
11 changes: 8 additions & 3 deletions Meshtastic/Extensions/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ public static IEnumerable<PropertyInfo> GetProperties(this object instance)
.Where(p => !Exclusions.Contains(p.Name));
}

public static string GetSettingValue(this PropertyInfo property, object instance) =>
(property.GetValue(instance)?.ToString() ?? string.Empty).Replace("[", string.Empty).Replace("]", string.Empty);

public static string GetSettingValue(this PropertyInfo property, object instance)
{
if (property.PropertyType == typeof(ByteString)) {
var byteString = (ByteString)property.GetValue(instance)!;
return Convert.ToHexString(byteString.ToByteArray());
}
return (property.GetValue(instance)?.ToString() ?? string.Empty).Replace("[", string.Empty).Replace("]", string.Empty);
}
}

0 comments on commit 31a5c9c

Please sign in to comment.