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

Improve UpdateConfiguration command #234

Merged
merged 1 commit into from
Mar 12, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,10 @@ public class Monitor_UpdateConfiguration
{
public uint Configuration;
public uint BlockIndex;
public uint Length = 0;
public uint Offset = 0;
public byte[] Data = null;
public uint Length;
public uint Offset;
public uint Done;
public byte[] Data;

public class Reply
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3589,6 +3589,19 @@ public bool UpdateDeviceConfiguration(DeviceConfiguration configuration)
// get packet length, either the maximum allowed size or whatever is still available to TX
int packetLength = Math.Min((int)WireProtocolPacketSize, count);

// check if this is the last chunk
if(count <= packetLength &&
packetLength <= WireProtocolPacketSize)
{
// yes, signal that by setting the Done field
cmd.Done = 1;
}
else
{
// no, more data is coming after this one
cmd.Done = 0;
}

cmd.PrepareForSend(configurationSerialized, packetLength, position);

IncomingMessage reply = PerformSyncRequest(Commands.c_Monitor_UpdateConfiguration, 0, cmd);
Expand Down