Skip to content

Commit

Permalink
Merge pull request #17 from luca-domenichini/develop
Browse files Browse the repository at this point in the history
Fix for AggregatingConnectorEventQueue
  • Loading branch information
luca-domenichini authored Jan 11, 2024
2 parents c6d46b2 + 1b61e81 commit 607222b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/dotnet-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: .NET Prerelease

on:
push:
branches: [ "prerelease" ]
tags:
- '[0-9]+\.[0-9]+\.[0-9]+\-beta'

env:
VERSION_MAJOR: 0
VERSION_MINOR: 4
VERSION_MINOR: 5
VERSION_SUFFIX: "-beta"

jobs:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/dotnet-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ name: .NET Release

on:
push:
branches: [ "release" ]
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'

env:
VERSION_MAJOR: 0
VERSION_MINOR: 4
VERSION_MINOR: 5
VERSION_SUFFIX: ""

jobs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SmartIOT.Connector.Core.Events;
using ProtoBuf;
using SmartIOT.Connector.Core.Events;

namespace SmartIOT.Connector.Core.Connector;

Expand Down Expand Up @@ -33,7 +34,7 @@ public class AggregatingConnectorEventQueue : AggregatingQueue<CompositeConnecto

if (e1.Tag == e2.Tag)
{
if (e1.Data != null && e2.Data != null)
if (e1.Data != null && e2.Data != null && e1.Data.Length > 0 && e2.Data.Length > 0)
{
int startOffset = Math.Min(e1.StartOffset, e2.StartOffset);
int endOffset = Math.Max(e1.StartOffset + e1.Data.Length, e2.StartOffset + e2.Data.Length);
Expand Down Expand Up @@ -67,7 +68,7 @@ public class AggregatingConnectorEventQueue : AggregatingQueue<CompositeConnecto
var e1 = item1.TagScheduleEvent;
var e2 = item2.TagScheduleEvent;

if (e1.Tag == e2.Tag && e1.Data != null && e2.Data != null)
if (e1.Tag == e2.Tag && e1.Data != null && e2.Data != null && e1.Data.Length > 0 && e2.Data.Length > 0)
{
int startOffset = Math.Min(e1.StartOffset, e2.StartOffset);
int endOffset = Math.Max(e1.StartOffset + e1.Data.Length, e2.StartOffset + e2.Data.Length);
Expand Down
2 changes: 1 addition & 1 deletion Core/SmartIOT.Connector.Core/Events/TagScheduleEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static TagScheduleEvent BuildTagData(Device device, Tag tag, int startOff

public static TagScheduleEvent BuildEmptyTagData(Device device, Tag tag, bool isErrorNumberChanged)
{
return new TagScheduleEvent(device, tag, -1, Array.Empty<byte>(), isErrorNumberChanged);
return new TagScheduleEvent(device, tag, tag.ByteOffset, Array.Empty<byte>(), isErrorNumberChanged);
}

public static TagScheduleEvent BuildTagStatus(Device device, Tag tag, int errorNumber, string description, bool isErrorNumberChanged)
Expand Down

0 comments on commit 607222b

Please sign in to comment.