Skip to content

Commit

Permalink
Merge pull request #70 from osmanhadzic/astarte-packet-id
Browse files Browse the repository at this point in the history
Implement  Managed Client MQTTnet extension
  • Loading branch information
harlem88 authored Apr 26, 2024
2 parents 50ce0b6 + 5bbbcc1 commit bf3ba84
Show file tree
Hide file tree
Showing 22 changed files with 538 additions and 488 deletions.
1 change: 1 addition & 0 deletions AstarteDeviceSDKCSharp/AstarteDeviceSDKCSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ SPDX-License-Identifier: Apache-2.0 -->
</PackageReference>
<PackageReference Include="JWT" Version="9.0.3" />
<PackageReference Include="MQTTnet" Version="4.1.4.563" />
<PackageReference Include="MQTTnet.Extensions.ManagedClient" Version="4.1.4.563" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json.Bson" Version="1.0.2" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.25.1" />
Expand Down
15 changes: 13 additions & 2 deletions AstarteDeviceSDKCSharp/Data/AstarteFailedMessageEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace AstarteDeviceSDKCSharp.Data
{
[Index(nameof(Guid), Name = "Index_Guid")]
public class AstarteFailedMessageEntry : IAstarteFailedMessage
{
[Key]
Expand All @@ -38,19 +40,24 @@ public class AstarteFailedMessageEntry : IAstarteFailedMessage
[Column("absolute_expiry")]
[Required]
public long AbsoluteExpiry { get; set; }
[Required]
[Column("guid")]
public Guid Guid { get; set; }


public AstarteFailedMessageEntry(int qos, byte[] payload, string topic)
public AstarteFailedMessageEntry(int qos, byte[] payload, string topic, Guid guid)
{
Guid = guid;
Qos = qos;
Payload = payload;
Topic = topic;
AbsoluteExpiry = 0;
}

public AstarteFailedMessageEntry(int qos, byte[] payload, string topic,
public AstarteFailedMessageEntry(int qos, byte[] payload, string topic, Guid guid,
int relativeExpiry)
{
Guid = guid;
Qos = qos;
Payload = payload;
Topic = topic;
Expand All @@ -77,5 +84,9 @@ public long GetExpiry()
return AbsoluteExpiry;
}

public Guid GetGuid()
{
return Guid;
}
}
}
Loading

0 comments on commit bf3ba84

Please sign in to comment.