Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Removed obsolete property CycleTime #64

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DbcParserLib.Tests/PropertiesLineParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ public void MsgCycleTimePropertyIsParsedTest()

var dbc = builder.Build();
Assert.AreEqual(true, dbc.Messages.First().CycleTime(out var cycleTime));
Assert.AreEqual(100, dbc.Messages.First().CycleTime);
Assert.AreEqual(100, cycleTime);
}

Expand Down
16 changes: 5 additions & 11 deletions DbcParserLib/Model/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ internal class ImmutableMessage

internal ImmutableMessage(Message message, IReadOnlyList<ImmutableSignal> signals)
{
message.CycleTime(out var cycleTime);

ID = message.ID;
IsExtID = message.IsExtID;
Name = message.Name;
DLC = message.DLC;
Transmitter = message.Transmitter;
Comment = message.Comment;
CycleTime= message.CycleTime;
CycleTime = cycleTime;
Signals = signals;

//TODO: remove explicit cast (CustomProperty in Message class should be Dictionary instead IDictionary)
CustomProperties = (IReadOnlyDictionary<string, CustomProperty>)message.CustomProperties;
}
Expand All @@ -38,16 +41,7 @@ public class Message
public ushort DLC;
public string Transmitter;
public string Comment;
[Obsolete("Please use CycleTime(out int cycleTime) instead. CycleTime property will be removed and will be accessible only through extension method")]
public int CycleTime
{
get
{
this.CycleTime(out var cycleTime);
return cycleTime;
}
}


public List<Signal> Signals = new List<Signal>();
public IDictionary<string, CustomProperty> CustomProperties = new Dictionary<string, CustomProperty>();

Expand Down
3 changes: 2 additions & 1 deletion Demo/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ public void PopulateView(Dbc dbc)
dtMessages.Columns.Add("CycleTime");
foreach (var msg in dbc.Messages)
{
dtMessages.Rows.Add("0x" + msg.ID.ToString("X"), msg.Name, msg.DLC, msg.Transmitter, msg.CycleTime);
msg.CycleTime(out var cycleTime);
dtMessages.Rows.Add("0x" + msg.ID.ToString("X"), msg.Name, msg.DLC, msg.Transmitter, cycleTime);
}

// Signals
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ Below you can find a list of obsolete stuff that are going to be removed in the
| Signal | IsSigned | v1.3.0 | **v1.5.0** | `ValueType` | Byte property replaced by `DbcValueType` property which provides <br> more informations about signal type |
| Signal | ValueTable | v1.3.0 | **v1.5.0** | `ValueTableMap` | String property replaced by a `IDictionary<int,string>` property |
| Signal | ToPairs() | v1.3.0 | **v1.4.2** | - | Extension method used to convert ValueTable into ValueTableMap |
| Message | CycleTime | v1.4.2 | planned in **1.6.0** | `bool CycleTime(out int cycleTime)` | CycleTime is no more a message property (replaced by an extension method) |
| Message | CycleTime | v1.4.2 | **1.6.0** | `bool CycleTime(out int cycleTime)` | CycleTime is no more a message property (replaced by an extension method) |

<br>

Expand Down
Loading