Skip to content

Commit 8daca8d

Browse files
authoredMay 4, 2024··
Merge pull request #76 from meshtastic/wip
Protobufs and add optional DTR and Handshake args to serial connection
2 parents 093b3d7 + 496a995 commit 8daca8d

File tree

9 files changed

+444
-167
lines changed

9 files changed

+444
-167
lines changed
 

‎Meshtastic/Connections/SerialConnection.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,24 @@ namespace Meshtastic.Connections;
1010
public class SerialConnection : DeviceConnection
1111
{
1212
private readonly SerialPort serialPort;
13+
private const Handshake DEFAULT_HANDSHAKE = Handshake.None;
14+
private const bool DEFAULT_DTR_ENABLE = true;
1315

1416
public SerialConnection(ILogger logger, string port, int baudRate = Resources.DEFAULT_BAUD_RATE) : base(logger)
1517
{
1618
serialPort = new SerialPort(port, baudRate)
1719
{
18-
DtrEnable = true,
19-
Handshake = Handshake.XOnXOff,
20-
WriteBufferSize = 8,
20+
DtrEnable = DEFAULT_DTR_ENABLE,
21+
Handshake = DEFAULT_HANDSHAKE,
22+
WriteBufferSize = 256,
2123
};
2224
}
2325

2426
public SerialConnection(ILogger logger,
2527
string port,
2628
DeviceStateContainer container,
27-
bool dtrEnable = true,
28-
Handshake handshake = Handshake.XOnXOff,
29+
bool dtrEnable = DEFAULT_DTR_ENABLE,
30+
Handshake handshake = DEFAULT_HANDSHAKE,
2931
int baudRate = Resources.DEFAULT_BAUD_RATE) : base(logger)
3032
{
3133
serialPort = new SerialPort(port, baudRate)

‎Meshtastic/Generated/Admin.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ public uint RemoveFavoriteNode {
775775
public const int RemoveFixedPositionFieldNumber = 42;
776776
/// <summary>
777777
///
778-
/// Clear fixed position coordinates and then set position.fixed_position = false
778+
/// Clear fixed position coordinates and then set position.fixed_position = false
779779
/// </summary>
780780
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
781781
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]

‎Meshtastic/Generated/Atak.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public enum MemberRole {
197197
#region Messages
198198
/// <summary>
199199
///
200-
/// Packets for the official ATAK Plugin
200+
/// Packets for the official ATAK Plugin
201201
/// </summary>
202202
public sealed partial class TAKPacket : pb::IMessage<TAKPacket>
203203
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE

‎Meshtastic/Generated/Channel.cs

+51-9
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ static ChannelReflection() {
2929
"GAIgASgMEgwKBG5hbWUYAyABKAkSCgoCaWQYBCABKAcSFgoOdXBsaW5rX2Vu",
3030
"YWJsZWQYBSABKAgSGAoQZG93bmxpbmtfZW5hYmxlZBgGIAEoCBIzCg9tb2R1",
3131
"bGVfc2V0dGluZ3MYByABKAsyGi5tZXNodGFzdGljLk1vZHVsZVNldHRpbmdz",
32-
"IiwKDk1vZHVsZVNldHRpbmdzEhoKEnBvc2l0aW9uX3ByZWNpc2lvbhgBIAEo",
33-
"DSKhAQoHQ2hhbm5lbBINCgVpbmRleBgBIAEoBRItCghzZXR0aW5ncxgCIAEo",
34-
"CzIbLm1lc2h0YXN0aWMuQ2hhbm5lbFNldHRpbmdzEiYKBHJvbGUYAyABKA4y",
35-
"GC5tZXNodGFzdGljLkNoYW5uZWwuUm9sZSIwCgRSb2xlEgwKCERJU0FCTEVE",
36-
"EAASCwoHUFJJTUFSWRABEg0KCVNFQ09OREFSWRACQmIKE2NvbS5nZWVrc3Zp",
37-
"bGxlLm1lc2hCDUNoYW5uZWxQcm90b3NaImdpdGh1Yi5jb20vbWVzaHRhc3Rp",
38-
"Yy9nby9nZW5lcmF0ZWSqAhRNZXNodGFzdGljLlByb3RvYnVmc7oCAGIGcHJv",
39-
"dG8z"));
32+
"IkUKDk1vZHVsZVNldHRpbmdzEhoKEnBvc2l0aW9uX3ByZWNpc2lvbhgBIAEo",
33+
"DRIXCg9pc19jbGllbnRfbXV0ZWQYAiABKAgioQEKB0NoYW5uZWwSDQoFaW5k",
34+
"ZXgYASABKAUSLQoIc2V0dGluZ3MYAiABKAsyGy5tZXNodGFzdGljLkNoYW5u",
35+
"ZWxTZXR0aW5ncxImCgRyb2xlGAMgASgOMhgubWVzaHRhc3RpYy5DaGFubmVs",
36+
"LlJvbGUiMAoEUm9sZRIMCghESVNBQkxFRBAAEgsKB1BSSU1BUlkQARINCglT",
37+
"RUNPTkRBUlkQAkJiChNjb20uZ2Vla3N2aWxsZS5tZXNoQg1DaGFubmVsUHJv",
38+
"dG9zWiJnaXRodWIuY29tL21lc2h0YXN0aWMvZ28vZ2VuZXJhdGVkqgIUTWVz",
39+
"aHRhc3RpYy5Qcm90b2J1ZnO6AgBiBnByb3RvMw=="));
4040
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
4141
new pbr::FileDescriptor[] { },
4242
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
4343
new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ChannelSettings), global::Meshtastic.Protobufs.ChannelSettings.Parser, new[]{ "ChannelNum", "Psk", "Name", "Id", "UplinkEnabled", "DownlinkEnabled", "ModuleSettings" }, null, null, null, null),
44-
new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleSettings), global::Meshtastic.Protobufs.ModuleSettings.Parser, new[]{ "PositionPrecision" }, null, null, null, null),
44+
new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.ModuleSettings), global::Meshtastic.Protobufs.ModuleSettings.Parser, new[]{ "PositionPrecision", "IsClientMuted" }, null, null, null, null),
4545
new pbr::GeneratedClrTypeInfo(typeof(global::Meshtastic.Protobufs.Channel), global::Meshtastic.Protobufs.Channel.Parser, new[]{ "Index", "Settings", "Role" }, null, new[]{ typeof(global::Meshtastic.Protobufs.Channel.Types.Role) }, null, null)
4646
}));
4747
}
@@ -581,6 +581,7 @@ public ModuleSettings() {
581581
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
582582
public ModuleSettings(ModuleSettings other) : this() {
583583
positionPrecision_ = other.positionPrecision_;
584+
isClientMuted_ = other.isClientMuted_;
584585
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
585586
}
586587

@@ -606,6 +607,23 @@ public uint PositionPrecision {
606607
}
607608
}
608609

610+
/// <summary>Field number for the "is_client_muted" field.</summary>
611+
public const int IsClientMutedFieldNumber = 2;
612+
private bool isClientMuted_;
613+
/// <summary>
614+
///
615+
/// Controls whether or not the phone / clients should mute the current channel
616+
/// Useful for noisy public channels you don't necessarily want to disable
617+
/// </summary>
618+
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
619+
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
620+
public bool IsClientMuted {
621+
get { return isClientMuted_; }
622+
set {
623+
isClientMuted_ = value;
624+
}
625+
}
626+
609627
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
610628
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
611629
public override bool Equals(object other) {
@@ -622,6 +640,7 @@ public bool Equals(ModuleSettings other) {
622640
return true;
623641
}
624642
if (PositionPrecision != other.PositionPrecision) return false;
643+
if (IsClientMuted != other.IsClientMuted) return false;
625644
return Equals(_unknownFields, other._unknownFields);
626645
}
627646

@@ -630,6 +649,7 @@ public bool Equals(ModuleSettings other) {
630649
public override int GetHashCode() {
631650
int hash = 1;
632651
if (PositionPrecision != 0) hash ^= PositionPrecision.GetHashCode();
652+
if (IsClientMuted != false) hash ^= IsClientMuted.GetHashCode();
633653
if (_unknownFields != null) {
634654
hash ^= _unknownFields.GetHashCode();
635655
}
@@ -652,6 +672,10 @@ public void WriteTo(pb::CodedOutputStream output) {
652672
output.WriteRawTag(8);
653673
output.WriteUInt32(PositionPrecision);
654674
}
675+
if (IsClientMuted != false) {
676+
output.WriteRawTag(16);
677+
output.WriteBool(IsClientMuted);
678+
}
655679
if (_unknownFields != null) {
656680
_unknownFields.WriteTo(output);
657681
}
@@ -666,6 +690,10 @@ public void WriteTo(pb::CodedOutputStream output) {
666690
output.WriteRawTag(8);
667691
output.WriteUInt32(PositionPrecision);
668692
}
693+
if (IsClientMuted != false) {
694+
output.WriteRawTag(16);
695+
output.WriteBool(IsClientMuted);
696+
}
669697
if (_unknownFields != null) {
670698
_unknownFields.WriteTo(ref output);
671699
}
@@ -679,6 +707,9 @@ public int CalculateSize() {
679707
if (PositionPrecision != 0) {
680708
size += 1 + pb::CodedOutputStream.ComputeUInt32Size(PositionPrecision);
681709
}
710+
if (IsClientMuted != false) {
711+
size += 1 + 1;
712+
}
682713
if (_unknownFields != null) {
683714
size += _unknownFields.CalculateSize();
684715
}
@@ -694,6 +725,9 @@ public void MergeFrom(ModuleSettings other) {
694725
if (other.PositionPrecision != 0) {
695726
PositionPrecision = other.PositionPrecision;
696727
}
728+
if (other.IsClientMuted != false) {
729+
IsClientMuted = other.IsClientMuted;
730+
}
697731
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
698732
}
699733

@@ -713,6 +747,10 @@ public void MergeFrom(pb::CodedInputStream input) {
713747
PositionPrecision = input.ReadUInt32();
714748
break;
715749
}
750+
case 16: {
751+
IsClientMuted = input.ReadBool();
752+
break;
753+
}
716754
}
717755
}
718756
#endif
@@ -732,6 +770,10 @@ public void MergeFrom(pb::CodedInputStream input) {
732770
PositionPrecision = input.ReadUInt32();
733771
break;
734772
}
773+
case 16: {
774+
IsClientMuted = input.ReadBool();
775+
break;
776+
}
735777
}
736778
}
737779
}

0 commit comments

Comments
 (0)
Please sign in to comment.