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

Fix wrong operator #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Pelco/D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public byte[] RemoteReset(uint deviceAddress)

public byte[] Zone(uint deviceAddress, byte zone, Action action)
{
if ((zone < 0x01) & (zone > 0x08))
if ((zone < 0x01) || (zone > 0x08))
throw new Exception("Zone should be between 0x01 and 0x08");
var mAction = action == Action.Start ? (byte) 0x11 : (byte) 0x13;

Expand Down Expand Up @@ -169,7 +169,7 @@ public struct Message

public static byte[] GetMessage(uint address, byte command1, byte command2, byte data1, byte data2)
{
if ((address < 1) & (address > 256))
if ((address < 1) || (address > 256))
throw new Exception("Pelco D protocol supports 256 devices only");

Address = byte.Parse(address.ToString(CultureInfo.InvariantCulture));
Expand Down
2 changes: 1 addition & 1 deletion Pelco/P.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public byte[] RemoteReset(uint deviceAddress)

public byte[] Zone(uint deviceAddress, byte zone, Action action)
{
if ((zone < 0x01) & (zone > 0x08))
if ((zone < 0x01) || (zone > 0x08))
throw new Exception("Zone value should be between 0x01 and 0x08 include");
byte mAction;
if (action == Action.Start)
Expand Down