Skip to content

Commit

Permalink
Merge pull request #134 from bytedreamer/develop
Browse files Browse the repository at this point in the history
4.1.1 Release
  • Loading branch information
bytedreamer authored Aug 28, 2023
2 parents 7291f2e + 973c7c9 commit a680883
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ Be sure to save configuration before exiting.
## Contributing

The current goal is to properly support all the commands and replies outlined the OSDP v2.2 standard.
The document that outlines the specific of the standard can be found on the [SIA website](https://mysia.securityindustry.org/ProductCatalog/Product.aspx?ID=16773). DM me on Twitter [![Follow NUnit](https://img.shields.io/twitter/follow/bytedreamer.svg?style=social)](https://twitter.com/bytedreamer) if you are interesting in helping.
The document that outlines the specific of the standard can be found on the [SIA website](https://mysia.securityindustry.org/ProductCatalog/Product.aspx?ID=16773). Contact me through my consulting company [Z-bit System, LLC](https://z-bitco.com), if interested in further collaboration with the OSDP.Net library.
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ variables:
buildConfiguration: 'Release'
major: 4
minor: 1
patch: 0
patch: 1
AssemblyVersion: $(major).$(minor).$(patch)
NugetVersion: $(major).$(minor).$(patch)

Expand Down
4 changes: 2 additions & 2 deletions src/Console/Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<ItemGroup>
<PackageReference Include="apache.log4net.Extensions.Logging" Version="2.0.0.12" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.0" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Terminal.Gui" Version="1.9.0" />
<PackageReference Include="Terminal.Gui" Version="1.13.5" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/OSDP.Net.Tests/OSDP.Net.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<ItemGroup>
<PackageReference Include="apache.log4net.Extensions.Logging" Version="2.0.0.12" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="System.IO.Pipelines" Version="7.0.0" />
</ItemGroup>

Expand Down
23 changes: 23 additions & 0 deletions src/OSDP.Net.Tests/Tracing/PacketDecodingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,29 @@ public void ParseMessage_Command()
Assert.That(actual.RawData.ToArray(), Is.EqualTo(testData));
}

[Test]
public void ParseMessage_Spaces()
{
// Arrange
var testData = BinaryUtils.HexToBytes("53 00 0D 00 06 6A 00 02 02 02 01 59 92").ToArray();

// Act
var actual = PacketDecoding.ParseMessage(testData.ToArray());

// Assert
Assert.That(actual.Address, Is.EqualTo(0));
Assert.That(actual.Sequence, Is.EqualTo(2));
Assert.That(actual.IsUsingCrc, Is.EqualTo(true));
Assert.That(actual.CommandType, Is.EqualTo(CommandType.BuzzerControl));
Assert.That(actual.ReplyType, Is.Null);

var testDataObject = actual.ParsePayloadData() as ReaderBuzzerControl;
Assert.That(testDataObject, Is.Not.Null);

Assert.That(actual.RawPayloadData.ToArray(), Is.EqualTo(testData.Skip(6).Take(5)));
Assert.That(actual.RawData.ToArray(), Is.EqualTo(testData));
}

[Test]
public void ParseMessage_Reply()
{
Expand Down
6 changes: 3 additions & 3 deletions src/OSDP.Net/OSDP.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageIcon>icon.png</PackageIcon>
<LangVersion>default</LangVersion>
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net6.0;netstandard2.0;net7.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

Expand All @@ -22,11 +22,11 @@

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.IO.Ports" Version="7.0.0" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
<PackageReference Include="System.Text.Json" Version="7.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/OSDP.Net/Utilities/BinaryUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static IEnumerable<byte> HexToBytes(IEnumerable<char> seq)

while (enumerator.MoveNext())
{
if (enumerator.Current == '-')
if (enumerator.Current is '-' or ' ')
{
if (!enumerator.MoveNext()) throw new InvalidOperationException("Not a valid hex string");
}
Expand Down

0 comments on commit a680883

Please sign in to comment.