Skip to content

Commit

Permalink
Merge pull request #153 from bytedreamer/develop
Browse files Browse the repository at this point in the history
v5.0.0 Beta Release
  • Loading branch information
bytedreamer authored Feb 19, 2024
2 parents 4e8ed58 + e75cac6 commit 4367075
Show file tree
Hide file tree
Showing 125 changed files with 3,321 additions and 2,740 deletions.
8 changes: 4 additions & 4 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
major: 4
minor: 1
patch: 7
major: 5
minor: 0
patch: 0
AssemblyVersion: $(major).$(minor).$(patch)
NugetVersion: $(major).$(minor).$(patch)
NugetVersion: $(major).$(minor).$(patch)-beta

steps:
- task: UseDotNet@2
Expand Down
14 changes: 7 additions & 7 deletions docs/powershell.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ You don't have to be a developer to make use of the OSDP.Net library. Commands c
# Install Nuget packages and assemblies if needed
if (([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object FullName -like '*Microsoft.Extensions.Logging.Abstractions*') -eq $null)
{
Install-Package -Name Microsoft.Extensions.Logging.Abstractions -ProviderName NuGet -Scope CurrentUser -RequiredVersion 5.0.0 -SkipDependencies -Destination . -Force
Add-Type -Path ./Microsoft.Extensions.Logging.Abstractions.5.0.0/lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll
Install-Package -Name Microsoft.Extensions.Logging.Abstractions -ProviderName NuGet -Scope CurrentUser -RequiredVersion 8.0.0 -SkipDependencies -Destination . -Force
Add-Type -Path ./Microsoft.Extensions.Logging.Abstractions.8.0.0/lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll
}
if (([AppDomain]::CurrentDomain.GetAssemblies() | Where-Object FullName -like '*OSDP.Net*') -eq $null)
{
Install-Package -Name OSDP.Net -ProviderName NuGet -Scope CurrentUser -RequiredVersion 2.0.14 -SkipDependencies -Destination . -Force
Add-Type -Path ./OSDP.Net.2.0.14/lib/netstandard2.0/OSDP.Net.dll
Install-Package -Name OSDP.Net -ProviderName NuGet -Scope CurrentUser -RequiredVersion 4.1.7 -SkipDependencies -Destination . -Force
Add-Type -Path ./OSDP.Net.4.1.7/lib/netstandard2.0/OSDP.Net.dll
}
# Settings
$serialPortName = "COM1"
$serialPortName = "COM3"
$serialPortSpeed = 9600
$deviceAddress = 0
$secureChannel = $true
Expand Down Expand Up @@ -51,7 +51,7 @@ while($true)
{
L
{
$panel.ReaderLedControl($id, 1, [OSDP.Net.Model.CommandData.ReaderLedControls]::new(
$panel.ReaderLedControl($id, $deviceAddress, [OSDP.Net.Model.CommandData.ReaderLedControls]::new(
[OSDP.Net.Model.CommandData.ReaderLedControl[]]@([OSDP.Net.Model.CommandData.ReaderLedControl]::new(
0,
0,
Expand Down Expand Up @@ -101,4 +101,4 @@ The sample code file above has been tested on Windows 10. Here are the steps to
## Documentation of Commands
The documentation of the OSDP commands is the same as for developers. It can be found [here](supported_commands.md).
The documentation of the OSDP commands is the same as for developers. It can be found [here](supported_commands.md).
40 changes: 20 additions & 20 deletions docs/supported_commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
| Name | Value | Support | Description | Documentation |
|:------------------|:------|:-------:|:------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------|
| osdp_POLL | 0x60 | Yes | Poll | None |
| osdp_ID | 0x61 | Yes | ID Report Request | [IdReport](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.IdReport.htm) |
| osdp_CAP | 0x62 | Yes | PD Capabilities Request | [DeviceCapabilities](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.DeviceCapabilities.htm) |
| osdp_LSTAT | 0x64 | Yes | Local Status Report Request | [LocalStatus](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.LocalStatus.htm) |
| osdp_ISTAT | 0x65 | Yes | Input Status Report Request | [InputStatus](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.InputStatus.htm) |
| osdp_OSTAT | 0x66 | Yes | Output Status Report Request | [OutputStatus](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.OutputStatus.htm) |
| osdp_RSTAT | 0x67 | Yes | Reader Status Report Request | [ReaderStatus](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.ReaderStatus.htm) |
| osdp_OUT | 0x68 | Yes | Output Control Command | [OutputControl](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.OutputControl.htm) |
| osdp_LED | 0x69 | Yes | Reader Led Control Command | [ReaderLedControl](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.ReaderLedControl.htm) |
| osdp_BUZ | 0x6A | Yes | Reader Buzzer Control Command | [ReaderBuzzerControl](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.ReaderBuzzerControl.htm) |
| osdp_TEXT | 0x6B | Yes | Text Output Command | [ReaderTextOutput](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.ReaderTextOutput.htm) |
| osdp_COMSET | 0x6E | Yes | PD Communication Configuration Command | [CommunicationConfiguration](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.CommunicationConfiguration.htm) |
| osdp_BIOREAD | 0x73 | Yes | Scan and Send Biometric Data | [ScanAndSendBiometricData](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.ScanAndSendBiometricData.htm) |
| osdp_BIOMATCH | 0x74 | Yes | Scan and Match Biometric Template | [ScanAndMatchBiometricTemplate](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.ScanAndMatchBiometricTemplate.htm) |
| osdp_KEYSET | 0x75 | Yes | Encryption Key Set Command | [EncryptionKeySet](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.EncryptionKeySet.htm) |
| osdp_ID | 0x61 | Yes | ID Report Request | [IdReport](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a7865680fcbac04393f1a1a7c5c370afd) |
| osdp_CAP | 0x62 | Yes | PD Capabilities Request | [DeviceCapabilities](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a41e7c5b63296041c4e1d72f9f4baa254) |
| osdp_LSTAT | 0x64 | Yes | Local Status Report Request | [LocalStatus](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a5b7cb91c77afe8a0cca9a1337339f31a) |
| osdp_ISTAT | 0x65 | Yes | Input Status Report Request | [InputStatus](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a4a73c880d9bfb1aa378bcffc3df7c32e) |
| osdp_OSTAT | 0x66 | Yes | Output Status Report Request | [OutputStatus](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#ab459d6daf76c9341c9e919374c8cac2c) |
| osdp_RSTAT | 0x67 | Yes | Reader Status Report Request | [ReaderStatus](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a0d96daa673649ffd04c7940cbaef5d3e) |
| osdp_OUT | 0x68 | Yes | Output Control Command | [OutputControl](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a7873756acf04433f4970e199a6ed48f2) |
| osdp_LED | 0x69 | Yes | Reader Led Control Command | [ReaderLedControl](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a94cc1940da2728e1c18f3826d14f8ac6) |
| osdp_BUZ | 0x6A | Yes | Reader Buzzer Control Command | [ReaderBuzzerControl](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#ac0a0d1e03e3620ec7ca23dea3dd5a203) |
| osdp_TEXT | 0x6B | Yes | Text Output Command | [ReaderTextOutput](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a67de66c4e0967ba1f09c0e6ea3fc0837) |
| osdp_COMSET | 0x6E | Yes | PD Communication Configuration Command | [CommunicationConfiguration](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a53faf3b1199473a6379e1e71d3acd106) |
| osdp_BIOREAD | 0x73 | Yes | Scan and Send Biometric Data | [ScanAndSendBiometricData](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#aae3fadbf6f0315d1c2f532a4ba408f25) |
| osdp_BIOMATCH | 0x74 | Yes | Scan and Match Biometric Template | [ScanAndMatchBiometricTemplate](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#ad0db25a12532cfb05352cff7cbd1dfb4) |
| osdp_KEYSET | 0x75 | Yes | Encryption Key Set Command | [EncryptionKeySet](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#ab45b2ba6b402becb067aff0cf1d959d5) |
| osdp_CHLNG | 0x76 | Yes | Challenge and Secure Session Initialization Rq. | None |
| osdp_SCRYPT | 0x77 | Yes | Server Cryptogram | None |
| osdp_ACURXSIZE | 0x7B | Yes | Max ACU receive size | [ACUReceivedSize](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.ACUReceivedSize.htm) |
| osdp_FILETRANSFER | 0x7C | Yes | Send data file to PD | [FileTransfer](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.FileTransfer.htm) |
| osdp_MFG | 0x80 | Yes | Manufacturer Specific Command | [ManufacturerSpecificCommand](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.ManufacturerSpecificCommand.htm) |
| osdp_ACURXSIZE | 0x7B | Yes | Max ACU receive size | [ACUReceivedSize](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a1e8c17b747b63b7c45627ea189396507) |
| osdp_FILETRANSFER | 0x7C | Yes | Send data file to PD | [FileTransfer](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a1d4d142a780f6bae84984502a801014b) |
| osdp_MFG | 0x80 | Yes | Manufacturer Specific Command | [ManufacturerSpecificCommand](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a18b1165f7b562af5d94fabb065c17ef0) |
| osdp_XWR | 0XA1 | No | Extended write data | |
| osdp_ABORT | 0XA2 | Yes | Abort PD operation | [AbortCurrentOperation](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.AbortCurrentOperation.htm) |
| osdp_PIVDATA | 0XA3 | Yes | Get PIV Data | [GetPIVData](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.GetPIVData.htm) |
| osdp_ABORT | 0XA2 | Yes | Abort PD operation | [AbortCurrentOperation](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#af1cbb6ccf221da5866d00d36d12de9b9) |
| osdp_PIVDATA | 0XA3 | Yes | Get PIV Data | [GetPIVData](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#a4f2f2690ee7d466e10be19533ca66410) |
| osdp_GENAUTH | 0XA4 | No | Request Authenticate | |
| osdp_CRAUTH | 0XA5 | No | Request Crypto Response | |
| osdp_KEEPACTIVE | 0XA7 | Yes | PD read activation | [KeeprReaderActive](https://z-bitco.com/downloads/OSDP.Net/docs/html/M-OSDP.Net.ControlPanel.KeepReaderActive.htm) |
| osdp_KEEPACTIVE | 0XA7 | Yes | PD read activation | [KeeprReaderActive](https://z-bitco.com/downloads/OSDP.Net/docs/class_o_s_d_p_1_1_net_1_1_control_panel.html#ab631e428cb7c926ab6d8a95039fb1c16) |

## Replies
| Name | Value | Support | Description | Documentation |
Expand Down
36 changes: 14 additions & 22 deletions src/Console/Commands/InvalidCommand.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
using System;
using OSDP.Net.Messages.ACU;
using OSDP.Net.Messages;
using OSDP.Net.Messages.SecureChannel;
using OSDP.Net.Model.CommandData;

namespace Console.Commands
{
/// <summary>
///
/// </summary>
public class InvalidCommand : Command
public class InvalidCommand : CommandData
{
public InvalidCommand(byte address)
{
Address = address;
}

protected override byte CommandCode => 0x59;

protected override ReadOnlySpan<byte> SecurityControlBlock()
{
return new byte[]
{
0x02,
0x15
};
}
/// <inheritdoc />
public override byte Code => 0x59;

/// <inheritdoc />
public override CommandType CommandType => CommandType.Poll;

protected override void CustomCommandUpdate(Span<byte> commandBuffer)
{
}
/// <inheritdoc />
public override ReadOnlySpan<byte> SecurityControlBlock() => SecurityBlock.CommandMessageWithNoDataSecurity;

protected override ReadOnlySpan<byte> Data()
/// <inheritdoc />
public override byte[] BuildData()
{
return ReadOnlySpan<byte>.Empty;
return Array.Empty<byte>();
}
}
}
35 changes: 16 additions & 19 deletions src/Console/Commands/InvalidCrcPollCommand.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
using System;
using OSDP.Net.Messages.ACU;
using OSDP.Net.Messages;
using OSDP.Net.Messages.SecureChannel;
using OSDP.Net.Model.CommandData;

namespace Console.Commands
{
/// <summary>
/// Change the CRC on a poll command
/// </summary>
public class InvalidCrcPollCommand : Command
public class InvalidCrcPollCommand : CommandData
{
public InvalidCrcPollCommand(byte address)
{
Address = address;
}

protected override byte CommandCode => 0x60;
/// <inheritdoc />
public override byte Code => (byte)CommandType;

/// <inheritdoc />
public override CommandType CommandType => CommandType.Poll;

protected override ReadOnlySpan<byte> SecurityControlBlock()
{
return new byte[]
{
0x02,
0x15
};
}
/// <inheritdoc />
public override ReadOnlySpan<byte> SecurityControlBlock() => SecurityBlock.CommandMessageWithNoDataSecurity;

protected override void CustomCommandUpdate(Span<byte> commandBuffer)
/// <inheritdoc />
public override void CustomMessageUpdate(Span<byte> commandBuffer)
{
commandBuffer[^1] = (byte)(commandBuffer[^1] + 1);
}

protected override ReadOnlySpan<byte> Data()
/// <inheritdoc />
public override byte[] BuildData()
{
return ReadOnlySpan<byte>.Empty;
return Array.Empty<byte>();
}
}
}
36 changes: 17 additions & 19 deletions src/Console/Commands/InvalidLengthPollCommand.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
using System;
using OSDP.Net.Messages.ACU;
using OSDP.Net.Messages;
using OSDP.Net.Messages.SecureChannel;
using OSDP.Net.Model.CommandData;

namespace Console.Commands
{
/// <summary>
/// Change the length on a poll command
/// </summary>
public class InvalidLengthPollCommand : Command
public class InvalidLengthPollCommand : CommandData
{
public InvalidLengthPollCommand(byte address)
{
Address = address;
}

protected override byte CommandCode => 0x60;
/// <inheritdoc />
public override byte Code => (byte)CommandType;

/// <inheritdoc />
public override CommandType CommandType => CommandType.Poll;

protected override ReadOnlySpan<byte> SecurityControlBlock()
{
return new byte[]
{
0x02,
0x15
};
}
/// <inheritdoc />
public override ReadOnlySpan<byte> SecurityControlBlock() => SecurityBlock.CommandMessageWithNoDataSecurity;

protected override void CustomCommandUpdate(Span<byte> commandBuffer)
/// <inheritdoc />
public override void CustomMessageUpdate(Span<byte> commandBuffer)
{
commandBuffer[2] = (byte)(commandBuffer[2] + 1);
}

protected override ReadOnlySpan<byte> Data()
/// <inheritdoc />
public override byte[] BuildData()
{
return new byte[] { 0x01 };
return Array.Empty<byte>();
}
}
}
4 changes: 2 additions & 2 deletions src/Console/Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>default</LangVersion>
</PropertyGroup>

Expand All @@ -26,7 +26,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Terminal.Gui" Version="1.14.1" />
<PackageReference Include="Terminal.Gui" Version="1.13.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 4367075

Please sign in to comment.