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

Software-Update (08 10): Assignment-number parameter #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Portalum.Zvt.ControlPanel/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ private async Task SoftwareUpdateAsync()
this.AddCommandInfo("SoftwareUpdate (08 10)");

this.ButtonSoftwareUpdate.IsEnabled = false;
var commandResponse = await this._zvtClient.SoftwareUpdateAsync(this._cancellationTokenSource.Token);
var commandResponse = await this._zvtClient.SoftwareUpdateAsync(assignmentNumber: null, this._cancellationTokenSource.Token);
this.ProcessCommandRespone(commandResponse);
this.ButtonSoftwareUpdate.IsEnabled = true;
}
Expand Down
14 changes: 11 additions & 3 deletions src/Portalum.Zvt/ZvtClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -632,14 +632,22 @@ public async Task<CommandResponse> DiagnosisAsync(CancellationToken cancellation
/// <summary>
/// Software-Update (08 10)
/// </summary>
/// <param name="assignmentNumber">An assignment-number can be given to the PT, which enables further sequence-control
/// during the call from PT to TCS</param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public async Task<CommandResponse> SoftwareUpdateAsync(CancellationToken cancellationToken = default)
public async Task<CommandResponse> SoftwareUpdateAsync(byte[] assignmentNumber = default, CancellationToken cancellationToken = default)
{
this._logger.LogInformation($"{nameof(SoftwareUpdateAsync)} - Execute");

var package = Array.Empty<byte>();

var package = assignmentNumber == null
? Array.Empty<byte>()
: new byte[] {
0x06, //TLV Indicator
(byte)(2 + assignmentNumber.Length), //TLV Length
0x0F, //TLV tag for assignment-number
(byte)assignmentNumber.Length //Content length
}.Concat(assignmentNumber).ToArray();
var fullPackage = PackageHelper.Create(new byte[] { 0x08, 0x10 }, package);
return await this.SendCommandAsync(fullPackage, cancellationToken: cancellationToken);
}
Expand Down