Use deviceid and id
This commit is contained in:
@@ -41,20 +41,14 @@ namespace Aperio_Control_Centre.Aadp.Benchmark
|
||||
// new ApplicationTypes.CredentialBlock(Enumerations.CredentialBlockType.ISO14443BUID, new byte[] { 0x11, 0x22, 0x33, 0x44, 0x55 })
|
||||
//},
|
||||
//};
|
||||
credentialnotification = new CredentialNotification("0412F5", Enumerations.DoorSide.BOTH, [
|
||||
credentialnotification = new CredentialNotification(new Id("0412F5"), Enumerations.DoorSide.BOTH, [
|
||||
new CredentialBlock(Enumerations.CredentialBlockType.MIFAREUID, [0x0A, 0x1B, 0x2C, 0x3D]),
|
||||
new CredentialBlock(Enumerations.CredentialBlockType.ISO14443BUID, [0x11, 0x22, 0x33, 0x44, 0x55])
|
||||
]);
|
||||
|
||||
keypadnotification = new KeypadNotification
|
||||
{
|
||||
DeviceGroupId = new Id("0412F5"),
|
||||
DoorSide = Enumerations.DoorSide.BOTH,
|
||||
Keys = "5432"
|
||||
};
|
||||
|
||||
indicationcommand = new IndicationCommand("0361A7", Enumerations.DoorSide.INSIDE, Enumerations.Indication.FIRE_ALARM, 10, Enumerations.TimingMode.TIME);
|
||||
indicationresult = new IndicationResult("0361A7", Enumerations.Status.OK);
|
||||
keypadnotification = new KeypadNotification(new Id("0412F5"), Enumerations.DoorSide.BOTH, "5432");
|
||||
indicationcommand = new IndicationCommand(new Id("0361A7"), Enumerations.DoorSide.INSIDE, Enumerations.Indication.FIRE_ALARM, 10, Enumerations.TimingMode.TIME);
|
||||
indicationresult = new IndicationResult(new Id("0361A7"), Enumerations.Status.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -42,20 +42,14 @@ namespace Aperio_Control_Centre.Aadp.Benchmark
|
||||
// new ApplicationTypes.CredentialBlock(Enumerations.CredentialBlockType.ISO14443BUID, new byte[] { 0x11, 0x22, 0x33, 0x44, 0x55 })
|
||||
//},
|
||||
//};
|
||||
credentialnotification = new CredentialNotification("0412F5", Enumerations.DoorSide.BOTH, [
|
||||
credentialnotification = new CredentialNotification(new Id("0412F5"), Enumerations.DoorSide.BOTH, [
|
||||
new CredentialBlock(Enumerations.CredentialBlockType.MIFAREUID, [0x0A, 0x1B, 0x2C, 0x3D]),
|
||||
new CredentialBlock(Enumerations.CredentialBlockType.ISO14443BUID, [0x11, 0x22, 0x33, 0x44, 0x55])
|
||||
]);
|
||||
|
||||
keypadnotification = new KeypadNotification
|
||||
{
|
||||
DeviceGroupId = new Id("0412F5"),
|
||||
DoorSide = Enumerations.DoorSide.BOTH,
|
||||
Keys = "5432"
|
||||
};
|
||||
|
||||
indicationcommand = new IndicationCommand("0361A7", Enumerations.DoorSide.INSIDE, Enumerations.Indication.FIRE_ALARM, 10, Enumerations.TimingMode.TIME);
|
||||
indicationresult = new IndicationResult("0361A7", Enumerations.Status.OK);
|
||||
keypadnotification = new KeypadNotification(new Id("0412F5"), Enumerations.DoorSide.BOTH, "5432");
|
||||
indicationcommand = new IndicationCommand(new Id("0361A7"), Enumerations.DoorSide.INSIDE, Enumerations.Indication.FIRE_ALARM, 10, Enumerations.TimingMode.TIME);
|
||||
indicationresult = new IndicationResult(new Id("0361A7"), Enumerations.Status.OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
// ******* Id ********
|
||||
[TestMethod]
|
||||
public void Id_Tests()
|
||||
public void Id_Constructor_Array_Tests()
|
||||
{
|
||||
byte[] arr = [0x0B, 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x00, 0x00, 0x04, 0x08, 0x0A, 0x1B, 0x2C, 0x3D];
|
||||
int idx = 0;
|
||||
@@ -151,6 +151,39 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
Assert.AreEqual(" Device-'Hello world'", sb.ToString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Id_Constructor_String_Tests()
|
||||
{
|
||||
Id id = new("Hello world");
|
||||
|
||||
Assert.AreEqual("Hello world", id.Charaters);
|
||||
StringBuilder sb = new();
|
||||
id.LogString(ref sb);
|
||||
Assert.AreEqual(" Device-'Hello world'", sb.ToString());
|
||||
}
|
||||
|
||||
//[TestMethod]
|
||||
//public void Id_Constructor_DeviceId_Tests()
|
||||
//{
|
||||
// Id id = new(new DeviceId("AA11BB"));
|
||||
|
||||
// Assert.AreEqual("AA11BB", id.Charaters);
|
||||
// StringBuilder sb = new();
|
||||
// id.LogString(ref sb);
|
||||
// Assert.AreEqual(" Device-'AA11BB'", sb.ToString());
|
||||
//}
|
||||
|
||||
//[TestMethod]
|
||||
//public void Id_To_DeviceId_Tests()
|
||||
//{
|
||||
// DeviceId deviceId = new("AA11BB");
|
||||
// Id id = new(deviceId);
|
||||
// DeviceId deviceId2 = id.ToDeviceId();
|
||||
|
||||
// CollectionAssert.AreEqual(deviceId.Id, deviceId2.Id);
|
||||
//}
|
||||
|
||||
|
||||
// ******* DeviceId ********
|
||||
[TestMethod]
|
||||
public void DeviceId_Constructor_Array_Tests()
|
||||
@@ -162,6 +195,17 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
deviceId.LogString(ref sb);
|
||||
Assert.AreEqual(" DeviceId-'01 02 03 04 05 06 07 08 09 0A 0B 0C'", sb.ToString());
|
||||
}
|
||||
[TestMethod]
|
||||
public void DeviceId_Constructor_String_Tests()
|
||||
{
|
||||
DeviceId deviceId = new("0412F5");
|
||||
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00 }, deviceId.Id);
|
||||
StringBuilder sb = new();
|
||||
deviceId.LogString(ref sb);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00'", sb.ToString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DeviceId_Tests()
|
||||
{
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.UINTVAR, "test", new VariableLengthQuantity(99)),
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.UINTVAR, "test1", new VariableLengthQuantity(12))
|
||||
];
|
||||
IPduCommand command = new SetDeviceParameterCommand("0412F5", commandBlocks);
|
||||
IPduCommand command = new SetDeviceParameterCommand(new DeviceId("0412F5"), commandBlocks);
|
||||
|
||||
Assert.IsInstanceOfType<SetDeviceParameterCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Parameter-'test' Type-'UINTVAR' Value-'99'" + Environment.NewLine + " Parameter-'test1' Type-'UINTVAR' Value-'12'", command.LogString());
|
||||
@@ -184,7 +184,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.UINTVAR, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -208,7 +208,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.BOOLEAN, "test", true),
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.BOOLEAN, "test1", false)
|
||||
];
|
||||
IPduCommand command = new SetDeviceParameterCommand("0412F5", commandBlocks);
|
||||
IPduCommand command = new SetDeviceParameterCommand(new DeviceId("0412F5"), commandBlocks);
|
||||
|
||||
Assert.IsInstanceOfType<SetDeviceParameterCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Parameter-'test' Type-'BOOLEAN' Value-'True'" + Environment.NewLine + " Parameter-'test1' Type-'BOOLEAN' Value-'False'", command.LogString());
|
||||
@@ -216,7 +216,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.BOOLEAN, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -236,7 +236,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.STRING, "test", "eerste"),
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.STRING, "test1", "tweede")
|
||||
];
|
||||
IPduCommand command = new SetDeviceParameterCommand("0412F5", commandBlocks);
|
||||
IPduCommand command = new SetDeviceParameterCommand(new DeviceId("0412F5"), commandBlocks);
|
||||
|
||||
Assert.IsInstanceOfType<SetDeviceParameterCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Parameter-'test' Type-'STRING' Value-'eerste'" + Environment.NewLine + " Parameter-'test1' Type-'STRING' Value-'tweede'", command.LogString());
|
||||
@@ -244,7 +244,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.STRING, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -264,7 +264,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.SHORT, "test", 1),
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.SHORT, "test1", 42)
|
||||
];
|
||||
IPduCommand command = new SetDeviceParameterCommand("0412F5", commandBlocks);
|
||||
IPduCommand command = new SetDeviceParameterCommand(new DeviceId("0412F5"), commandBlocks);
|
||||
|
||||
Assert.IsInstanceOfType<SetDeviceParameterCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Parameter-'test' Type-'SHORT' Value-'1'" + Environment.NewLine + " Parameter-'test1' Type-'SHORT' Value-'42'", command.LogString());
|
||||
@@ -272,7 +272,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.SHORT, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -292,7 +292,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.BYTE_ARRAY, "test", new byte[] { 0x01, 0x02, 0x03, 0x04 }),
|
||||
new SetDeviceParameterCommandBlock(Enumerations.DeviceParameterType.BYTE_ARRAY, "test1", new byte[] { 0xDE, 0xAD, 0xBE, 0xEF })
|
||||
];
|
||||
IPduCommand command = new SetDeviceParameterCommand("0412F5", commandBlocks);
|
||||
IPduCommand command = new SetDeviceParameterCommand(new DeviceId("0412F5"), commandBlocks);
|
||||
|
||||
Assert.IsInstanceOfType<SetDeviceParameterCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Parameter-'test' Type-'BYTE_ARRAY' Value-'01 02 03 04'" + Environment.NewLine + " Parameter-'test1' Type-'BYTE_ARRAY' Value-'DE AD BE EF'", command.LogString());
|
||||
@@ -300,7 +300,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.BYTE_ARRAY, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -327,7 +327,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.UINTVAR, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -357,7 +357,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.BOOLEAN, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -387,7 +387,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.STRING, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -417,7 +417,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.SHORT, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -445,7 +445,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterCommand parameterCommand = (SetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(parameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterCommand.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("test", parameterCommand.ParameterCommandBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.BYTE_ARRAY, parameterCommand.ParameterCommandBlock[0].Type);
|
||||
@@ -480,7 +480,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterResult parameterResult = (SetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(parameterResult);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterResult.Device.ToIdString());
|
||||
|
||||
Assert.HasCount(3, parameterResult.ParameterResultBlock);
|
||||
|
||||
@@ -512,7 +512,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetDeviceParameterResult parameterResult = (SetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(parameterResult);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterResult.Device.ToIdString());
|
||||
|
||||
Assert.HasCount(3, parameterResult.ParameterResultBlock);
|
||||
|
||||
@@ -539,7 +539,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
DeviceParameterNotification parameterNotification = (DeviceParameterNotification)command;
|
||||
Assert.IsNotNull(parameterNotification);
|
||||
Assert.AreEqual("0412F5", parameterNotification.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterNotification.Device.ToIdString());
|
||||
Assert.HasCount(0, parameterNotification.ParameterNotificationBlock);
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x34, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00 }, PduMessage.Serialize(command));
|
||||
}
|
||||
@@ -560,7 +560,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DeviceParameterNotification parameterNotification = (DeviceParameterNotification)command;
|
||||
Assert.IsNotNull(parameterNotification);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterNotification.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterNotification.Device.ToIdString());
|
||||
|
||||
Assert.HasCount(2, parameterNotification.ParameterNotificationBlock);
|
||||
|
||||
@@ -592,7 +592,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DeviceParameterNotification parameterNotification = (DeviceParameterNotification)command;
|
||||
Assert.IsNotNull(parameterNotification);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterNotification.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterNotification.Device.ToIdString());
|
||||
Assert.HasCount(0, parameterNotification.ParameterNotificationBlock);
|
||||
|
||||
//Debug.WriteLine(Helpers.ByteArrayToStringCodeFormat(PduMessage.Serialize(command)));
|
||||
@@ -613,7 +613,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DeviceParameterNotification parameterNotification = (DeviceParameterNotification)command;
|
||||
Assert.IsNotNull(parameterNotification);
|
||||
|
||||
Assert.AreEqual("0412F5", parameterNotification.Device.ToId());
|
||||
Assert.AreEqual("0412F5", parameterNotification.Device.ToIdString());
|
||||
|
||||
Assert.HasCount(2, parameterNotification.ParameterNotificationBlock);
|
||||
|
||||
@@ -647,7 +647,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterCommand getDeviceParameterCommand = (GetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(getDeviceParameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", getDeviceParameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getDeviceParameterCommand.Device.ToIdString());
|
||||
Assert.AreEqual("billy", getDeviceParameterCommand.Name[0].Name);
|
||||
Assert.AreEqual("test", getDeviceParameterCommand.Name[1].Name);
|
||||
|
||||
@@ -666,7 +666,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetDeviceParameterCommand getDeviceParameterCommand = (GetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(getDeviceParameterCommand);
|
||||
Assert.AreEqual("0412F5", getDeviceParameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getDeviceParameterCommand.Device.ToIdString());
|
||||
Assert.AreEqual("FwVersion", getDeviceParameterCommand.Name[0].Name);
|
||||
|
||||
CollectionAssert.AreEqual(bytes, PduMessage.Serialize(command));
|
||||
@@ -689,7 +689,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterCommand getDeviceParameterCommand = (GetDeviceParameterCommand)command;
|
||||
Assert.IsNotNull(getDeviceParameterCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", getDeviceParameterCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getDeviceParameterCommand.Device.ToIdString());
|
||||
Assert.AreEqual("billy", getDeviceParameterCommand.Name[0].Name);
|
||||
Assert.AreEqual("test", getDeviceParameterCommand.Name[1].Name);
|
||||
|
||||
@@ -710,7 +710,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("Param", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.UINTVAR, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
@@ -733,7 +733,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("Param", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.BOOLEAN, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
@@ -756,7 +756,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("Param", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.STRING, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
@@ -779,7 +779,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("Param", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.SHORT, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
@@ -802,7 +802,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("Param", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.BYTE_ARRAY, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
@@ -827,7 +827,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("FwVersion", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.STRING, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
@@ -849,7 +849,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("OemCode", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.STRING, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
@@ -872,7 +872,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("09599A", getDeviceParameterResult.Device.ToIdString());
|
||||
Assert.AreEqual("LockVersions", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.BYTE_ARRAY, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
@@ -898,7 +898,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("DF8F1D", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("DF8F1D", getDeviceParameterResult.Device.ToIdString());
|
||||
Assert.AreEqual("MainHwVersion", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
|
||||
Assert.HasCount(1, getDeviceParameterResult.ParameterResultBlock);
|
||||
@@ -920,7 +920,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
new DeviceParameterNotificationBlock("test", -42, Enumerations.Status.OK)
|
||||
];
|
||||
|
||||
IPduCommand command = new GetDeviceParameterResult("0412F5", deviceParameters);
|
||||
IPduCommand command = new GetDeviceParameterResult(new DeviceId("0412F5"), deviceParameters);
|
||||
|
||||
Assert.IsInstanceOfType<GetDeviceParameterResult>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Parameter-'bool' Type-'BOOLEAN' Value-'True' Result-'OK'" + Environment.NewLine +
|
||||
@@ -930,7 +930,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
GetDeviceParameterResult getDeviceParameterResult = (GetDeviceParameterResult)command;
|
||||
Assert.IsNotNull(getDeviceParameterResult);
|
||||
|
||||
Assert.AreEqual("0412F5", getDeviceParameterResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getDeviceParameterResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual("bool", getDeviceParameterResult.ParameterResultBlock[0].Name.Name);
|
||||
Assert.AreEqual(Enumerations.DeviceParameterType.BOOLEAN, getDeviceParameterResult.ParameterResultBlock[0].Type);
|
||||
|
||||
@@ -3,6 +3,7 @@ using Aperio_Control_Centre.Aadp.Commands.Configuration;
|
||||
using Aperio_Control_Centre.Aadp.Commands.DeviceStates;
|
||||
using Aperio_Control_Centre.Aadp.Enumerations;
|
||||
using Aperio_Control_Centre.Aadp.Types;
|
||||
using Aperio_Control_Centre.Aadp.Types.ApplicationTypes;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
@@ -30,7 +31,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetDoorStateCommand_DeviceGroup()
|
||||
{
|
||||
IPduCommand command = new GetDoorStateCommand("0634C8");
|
||||
IPduCommand command = new GetDoorStateCommand(new Id("0634C8"));
|
||||
|
||||
Assert.IsInstanceOfType<GetDoorStateCommand>(command);
|
||||
Assert.AreEqual(" Device-'0634C8'", command.LogString());
|
||||
@@ -100,7 +101,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetLockStateCommand_DeviceId()
|
||||
{
|
||||
IPduCommand command = new GetLockStateCommand("0361A7");
|
||||
IPduCommand command = new GetLockStateCommand(new Id("0361A7"));
|
||||
|
||||
Assert.IsInstanceOfType<GetLockStateCommand>(command);
|
||||
Assert.AreEqual(" Device-'0361A7'", command.LogString());
|
||||
@@ -170,7 +171,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetKeyCylinderStateCommand_DeviceId()
|
||||
{
|
||||
IPduCommand command = new GetKeyCylinderStateCommand("0361A7");
|
||||
IPduCommand command = new GetKeyCylinderStateCommand(new Id("0361A7"));
|
||||
|
||||
Assert.IsInstanceOfType<GetKeyCylinderStateCommand>(command);
|
||||
Assert.AreEqual(" Device-'0361A7'", command.LogString());
|
||||
@@ -241,7 +242,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetHandleStateCommand_DeviceId()
|
||||
{
|
||||
IPduCommand command = new GetHandleStateCommand("0361A7");
|
||||
IPduCommand command = new GetHandleStateCommand(new Id("0361A7"));
|
||||
|
||||
Assert.IsInstanceOfType<GetHandleStateCommand>(command);
|
||||
Assert.AreEqual(" Device-'0361A7'", command.LogString());
|
||||
@@ -312,7 +313,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetTamperStateCommand_DeviceId()
|
||||
{
|
||||
IPduCommand command = new GetTamperStateCommand("0361A7");
|
||||
IPduCommand command = new GetTamperStateCommand(new Id("0361A7"));
|
||||
|
||||
Assert.IsInstanceOfType<GetTamperStateCommand>(command);
|
||||
Assert.AreEqual(" Device-'0361A7'", command.LogString());
|
||||
@@ -383,7 +384,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetActivatorStateCommand_DeviceId()
|
||||
{
|
||||
IPduCommand command = new GetActivatorStateCommand("0361A7");
|
||||
IPduCommand command = new GetActivatorStateCommand(new Id("0361A7"));
|
||||
|
||||
Assert.IsInstanceOfType<GetActivatorStateCommand>(command);
|
||||
Assert.AreEqual(" Device-'0361A7'", command.LogString());
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void DoorOpeningCommand_Parameters()
|
||||
{
|
||||
IPduCommand command = new DoorOpeningCommand("0412F5", true, false, 5, Enumerations.TimingMode.TIME);
|
||||
IPduCommand command = new DoorOpeningCommand(new Id("0412F5"), true, false, 5, Enumerations.TimingMode.TIME);
|
||||
|
||||
Assert.IsInstanceOfType<DoorOpeningCommand>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' Open-'True' Indication-'False' Duration( Mode-'TIME' Time-'5')", command.LogString());
|
||||
@@ -72,7 +72,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void DoorOpeningResult_Parameters()
|
||||
{
|
||||
IPduCommand command = new DoorOpeningResult("0412F5", Status.FAIL_PERMISSION);
|
||||
IPduCommand command = new DoorOpeningResult(new Id("0412F5"), Status.FAIL_PERMISSION);
|
||||
|
||||
Assert.IsInstanceOfType<DoorOpeningResult>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' Result-'FAIL_PERMISSION'", command.LogString());
|
||||
@@ -105,7 +105,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetSupportedDoorModesCommand_Parameters()
|
||||
{
|
||||
IPduCommand command = new GetSupportedDoorModesCommand("0412F5");
|
||||
IPduCommand command = new GetSupportedDoorModesCommand(new Id("0412F5"));
|
||||
|
||||
Assert.IsInstanceOfType<GetSupportedDoorModesCommand>(command);
|
||||
Assert.AreEqual(" Device-'0412F5'", command.LogString());
|
||||
@@ -147,7 +147,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DoorMode.INSIDEOUT_LOCKED,
|
||||
DoorMode.INSIDEOUT_SECURED
|
||||
];
|
||||
IPduCommand command = new GetSupportedDoorModesResult("0412F5", doorModes);
|
||||
IPduCommand command = new GetSupportedDoorModesResult(new Id("0412F5"), doorModes);
|
||||
|
||||
Assert.IsInstanceOfType<GetSupportedDoorModesResult>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' - RESTRICTED_LOCKED - RESTRICTED_SECURED - INSIDEOUT_LOCKED - INSIDEOUT_SECURED", command.LogString());
|
||||
@@ -187,7 +187,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void SetDoorModeCommand_Parameters()
|
||||
{
|
||||
IPduCommand command = new SetDoorModeCommand("0412F5", DoorMode.FREE_UNLOCKED, 255, TimingMode.TIME, ExecuteMode.DOORSEQUENCE);
|
||||
IPduCommand command = new SetDoorModeCommand(new Id("0412F5"), DoorMode.FREE_UNLOCKED, 255, TimingMode.TIME, ExecuteMode.DOORSEQUENCE);
|
||||
|
||||
Assert.IsInstanceOfType<SetDoorModeCommand>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' Mode-'FREE_UNLOCKED' Mode-'TIME' Time-'255' ExecuteMode-'DOORSEQUENCE'", command.LogString());
|
||||
@@ -225,7 +225,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void SetDoorModeResult_Parameters()
|
||||
{
|
||||
IPduCommand command = new SetDoorModeResult("0412F5", Status.FAIL);
|
||||
IPduCommand command = new SetDoorModeResult(new Id("0412F5"), Status.FAIL);
|
||||
|
||||
Assert.IsInstanceOfType<SetDoorModeResult>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' Result-'FAIL'", command.LogString());
|
||||
@@ -258,7 +258,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetDoorModeCommand_Parameters()
|
||||
{
|
||||
IPduCommand command = new GetDoorModeCommand("0412F5");
|
||||
IPduCommand command = new GetDoorModeCommand(new Id("0412F5"));
|
||||
|
||||
Assert.IsInstanceOfType<GetDoorModeCommand>(command);
|
||||
Assert.AreEqual(" Device-'0412F5'", command.LogString());
|
||||
@@ -291,7 +291,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetDoorModeResult_Parameters()
|
||||
{
|
||||
IPduCommand command = new GetDoorModeResult("0412F5", DoorMode.FREE_UNLOCKED);
|
||||
IPduCommand command = new GetDoorModeResult(new Id("0412F5"), DoorMode.FREE_UNLOCKED);
|
||||
|
||||
Assert.IsInstanceOfType<GetDoorModeResult>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' Mode-'FREE_UNLOCKED'", command.LogString());
|
||||
@@ -325,7 +325,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void DoorModeNotification_Parameter()
|
||||
{
|
||||
IPduCommand command = new DoorModeNotification("0412F5", DoorMode.FREE_UNLOCKED);
|
||||
IPduCommand command = new DoorModeNotification(new Id("0412F5"), DoorMode.FREE_UNLOCKED);
|
||||
|
||||
Assert.IsInstanceOfType<DoorModeNotification>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' Mode-'FREE_UNLOCKED'", command.LogString());
|
||||
@@ -352,7 +352,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetCredentialCommand? setCredentialCommand = (SetCredentialCommand?)command;
|
||||
|
||||
Assert.IsNotNull(setCredentialCommand);
|
||||
Assert.AreEqual("0412F5", setCredentialCommand.DeviceGroupId?.ToId());
|
||||
Assert.AreEqual("0412F5", setCredentialCommand.DeviceGroupId?.ToIdString());
|
||||
|
||||
Assert.AreEqual((ushort)27241, setCredentialCommand.PacketSequenceNumber?.SequenceNumber);
|
||||
Assert.AreEqual(ExpireType.TIME, setCredentialCommand.CredentialExpireType);
|
||||
@@ -387,7 +387,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetCredentialCommand? setCredentialCommand = (SetCredentialCommand?)command;
|
||||
Assert.IsNotNull(setCredentialCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", setCredentialCommand.DeviceGroupId?.ToId());
|
||||
Assert.AreEqual("0412F5", setCredentialCommand.DeviceGroupId?.ToIdString());
|
||||
|
||||
Assert.AreEqual(ExpireType.TIME, setCredentialCommand.CredentialExpireType);
|
||||
Assert.AreEqual((uint)128, setCredentialCommand.CredentialExpireLimit?.Value);
|
||||
@@ -422,14 +422,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
SetCredentialResult? setCredentialResult = (SetCredentialResult?)command;
|
||||
|
||||
Assert.IsNotNull(setCredentialResult);
|
||||
Assert.AreEqual("0412F5", setCredentialResult.Device?.ToId());
|
||||
Assert.AreEqual("0412F5", setCredentialResult.Device?.ToIdString());
|
||||
Assert.AreEqual(Status.OK, setCredentialResult.Result);
|
||||
CollectionAssert.AreEqual(bytes, PduMessage.Serialize(command));
|
||||
}
|
||||
[TestMethod]
|
||||
public void SetCredentialResult_Parameter()
|
||||
{
|
||||
IPduCommand command = new SetCredentialResult("0412F5", Status.FAIL_TYPE_ERROR);
|
||||
IPduCommand command = new SetCredentialResult(new DeviceId("0412F5"), Status.FAIL_TYPE_ERROR);
|
||||
|
||||
Assert.IsInstanceOfType<SetCredentialResult>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Result-'FAIL_TYPE_ERROR'", command.LogString());
|
||||
@@ -441,7 +441,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
setCredentialResult.Device?.LogString(ref sb);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00'", sb.ToString());
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00 }, setCredentialResult.Device?.Id);
|
||||
Assert.AreEqual("0412F5", setCredentialResult.Device?.ToId());
|
||||
Assert.AreEqual("0412F5", setCredentialResult.Device?.ToIdString());
|
||||
Assert.AreEqual(Status.FAIL_TYPE_ERROR, setCredentialResult.Result);
|
||||
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x38, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x05 }, PduMessage.Serialize(command));
|
||||
@@ -462,7 +462,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DeleteCredentialCommand? deleteCredentialCommand = (DeleteCredentialCommand?)command;
|
||||
Assert.IsNotNull(deleteCredentialCommand);
|
||||
|
||||
Assert.AreEqual("0412F5", deleteCredentialCommand.DeviceGroupId?.ToId());
|
||||
Assert.AreEqual("0412F5", deleteCredentialCommand.DeviceGroupId?.ToIdString());
|
||||
Assert.AreEqual(CredentialDeleteMode.DELETE_SINGLE, deleteCredentialCommand.Mode);
|
||||
Assert.AreEqual((ushort)46723, deleteCredentialCommand.PacketSequenceNumber?.SequenceNumber);
|
||||
|
||||
@@ -494,7 +494,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
Assert.AreEqual(42, deleteCredentialCommand.PacketSequenceNumber.SequenceNumber);
|
||||
|
||||
Assert.AreEqual("0412F5", deleteCredentialCommand.DeviceGroupId?.ToId());
|
||||
Assert.AreEqual("0412F5", deleteCredentialCommand.DeviceGroupId?.ToIdString());
|
||||
Assert.AreEqual(CredentialDeleteMode.DELETE_SINGLE, deleteCredentialCommand.Mode);
|
||||
|
||||
Assert.AreEqual(CredentialBlockType.MIFAREUID, deleteCredentialCommand.Credential?[0].Type);
|
||||
@@ -519,7 +519,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DeleteCredentialCommand? deleteCredentialCommand = (DeleteCredentialCommand?)command;
|
||||
|
||||
Assert.IsNotNull(deleteCredentialCommand);
|
||||
Assert.AreEqual("0412F5", deleteCredentialCommand.DeviceGroupId?.ToId());
|
||||
Assert.AreEqual("0412F5", deleteCredentialCommand.DeviceGroupId?.ToIdString());
|
||||
Assert.AreEqual(CredentialDeleteMode.DELETE_ALL_DYNAMIC_AND_STATIC, deleteCredentialCommand.Mode);
|
||||
Assert.AreEqual(42, deleteCredentialCommand.PacketSequenceNumber.SequenceNumber);
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x10, 0x39, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x04, 0x03 }, PduMessage.Serialize(command));
|
||||
@@ -539,14 +539,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DeleteCredentialResult? deleteCredentialResult = (DeleteCredentialResult?)command;
|
||||
|
||||
Assert.IsNotNull(deleteCredentialResult);
|
||||
Assert.AreEqual("0412F5", deleteCredentialResult.Device?.ToId());
|
||||
Assert.AreEqual("0412F5", deleteCredentialResult.Device?.ToIdString());
|
||||
Assert.AreEqual(Status.FAIL, deleteCredentialResult.Result);
|
||||
CollectionAssert.AreEqual(bytes, PduMessage.Serialize(command));
|
||||
}
|
||||
[TestMethod]
|
||||
public void DeleteCredentialResult_Parameter()
|
||||
{
|
||||
IPduCommand command = new DeleteCredentialResult("0412F5", Status.FAIL_ENUM_ERROR);
|
||||
IPduCommand command = new DeleteCredentialResult(new DeviceId("0412F5"), Status.FAIL_ENUM_ERROR);
|
||||
|
||||
Assert.IsInstanceOfType<DeleteCredentialResult>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Result-'FAIL_ENUM_ERROR'", command.LogString());
|
||||
@@ -554,7 +554,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DeleteCredentialResult? deleteCredentialResult = (DeleteCredentialResult?)command;
|
||||
|
||||
Assert.IsNotNull(deleteCredentialResult);
|
||||
Assert.AreEqual("0412F5", deleteCredentialResult.Device?.ToId());
|
||||
Assert.AreEqual("0412F5", deleteCredentialResult.Device?.ToIdString());
|
||||
Assert.AreEqual(Status.FAIL_ENUM_ERROR, deleteCredentialResult.Result);
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x3A, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x06 }, PduMessage.Serialize(command));
|
||||
}
|
||||
@@ -573,7 +573,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
CredentialManagementNotification credentialManagementNotification = (CredentialManagementNotification)command;
|
||||
|
||||
Assert.IsNotNull(credentialManagementNotification);
|
||||
Assert.AreEqual("0412F5", credentialManagementNotification.DeviceGroupId?.ToId());
|
||||
Assert.AreEqual("0412F5", credentialManagementNotification.DeviceGroupId?.ToIdString());
|
||||
Assert.AreEqual((ushort)59135, credentialManagementNotification.PacketSequenceNumber?.SequenceNumber);
|
||||
Assert.AreEqual(CredentialManagementNotificationType.CREDENTIAL_ADDED, credentialManagementNotification.Notification);
|
||||
CollectionAssert.AreEqual(bytes, PduMessage.Serialize(command));
|
||||
@@ -590,7 +590,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
Assert.IsNotNull(credentialManagementNotification);
|
||||
Assert.AreEqual(42, credentialManagementNotification.PacketSequenceNumber.SequenceNumber);
|
||||
Assert.AreEqual("0412F5", credentialManagementNotification.DeviceGroupId?.ToId());
|
||||
Assert.AreEqual("0412F5", credentialManagementNotification.DeviceGroupId?.ToIdString());
|
||||
Assert.AreEqual(CredentialManagementNotificationType.CREDENTIAL_ADDED, credentialManagementNotification.Notification);
|
||||
|
||||
//Debug.WriteLine(Helpers.ByteArrayToStringCodeFormat(PduMessage.Serialize(command)));
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
new CredentialBlock(CredentialBlockType.MIFAREUID, [0x0A, 0x1B, 0x2C, 0x3D]),
|
||||
new CredentialBlock(CredentialBlockType.ISO14443BUID, [0x11, 0x22, 0x33, 0x44, 0x55])
|
||||
];
|
||||
IPduCommand command = new CredentialNotification("0412F5", DoorSide.BOTH, credentialBlocks);
|
||||
IPduCommand command = new CredentialNotification(new Id("0412F5"), DoorSide.BOTH, credentialBlocks);
|
||||
|
||||
Assert.IsInstanceOfType<CredentialNotification>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' Doorside-'BOTH'" + Environment.NewLine +
|
||||
@@ -140,12 +140,12 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void KeypadNotification_Parameters()
|
||||
{
|
||||
IPduCommand command = new KeypadNotification
|
||||
{
|
||||
DeviceGroupId = new Id("0412F5"),
|
||||
DoorSide = DoorSide.BOTH,
|
||||
Keys = "5432"
|
||||
};
|
||||
IPduCommand command = new KeypadNotification(new Id("0412F5"), DoorSide.BOTH, "5432");
|
||||
//{
|
||||
// DeviceGroupId = new Id("0412F5"),
|
||||
// DoorSide = DoorSide.BOTH,
|
||||
// Keys = "5432"
|
||||
//};
|
||||
|
||||
Assert.IsInstanceOfType<KeypadNotification>(command);
|
||||
Assert.AreEqual(" Device-'0412F5' Doorside-'BOTH' Keys-'5432'", command.LogString());
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
IPduCommand command = new DeviceListResult(list);
|
||||
|
||||
Assert.IsInstanceOfType<DeviceListResult>(command);
|
||||
Assert.IsInstanceOfType<DeviceListResult>(command);
|
||||
Assert.AreEqual(Environment.NewLine +
|
||||
" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Host-'00 17 7A 01 02 04 12 F5 00 00 00 00' DeviceType-'GATEWAY'" + Environment.NewLine +
|
||||
" DeviceId-'00 17 7A 01 02 03 92 BC 00 00 00 00' Host-'00 17 7A 01 02 04 12 F5 00 00 00 00' DeviceType-'LOCK'" + Environment.NewLine +
|
||||
@@ -216,7 +216,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
DtcNotification dtcNotification = (DtcNotification)command;
|
||||
|
||||
Assert.AreEqual("0412F5", dtcNotification.Device.ToId());
|
||||
Assert.AreEqual("0412F5", dtcNotification.Device.ToIdString());
|
||||
Assert.AreEqual(DTCEnumerations.Category.Software, dtcNotification.DTC.DTC.Category);
|
||||
Assert.AreEqual(DTCEnumerations.Type.RESET, dtcNotification.DTC.DTC.Type);
|
||||
Assert.AreEqual(DTCEnumerations.Source.WATCHDOG, dtcNotification.DTC.DTC.Source);
|
||||
@@ -237,7 +237,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
DtcNotification dtcNotification = (DtcNotification)command;
|
||||
|
||||
Assert.AreEqual("01EE01", dtcNotification.Device.ToId());
|
||||
Assert.AreEqual("01EE01", dtcNotification.Device.ToIdString());
|
||||
Assert.AreEqual(DTCEnumerations.Category.Electrical, dtcNotification.DTC.DTC.Category);
|
||||
Assert.AreEqual(DTCEnumerations.Type.VOLTAGE_NEAR_MIN, dtcNotification.DTC.DTC.Type);
|
||||
Assert.AreEqual(DTCEnumerations.Source.BACKUP_BATTERY, dtcNotification.DTC.DTC.Source);
|
||||
@@ -257,7 +257,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
DtcNotification dtcNotification = (DtcNotification)command;
|
||||
|
||||
Assert.AreEqual("01EE01", dtcNotification.Device.ToId());
|
||||
Assert.AreEqual("01EE01", dtcNotification.Device.ToIdString());
|
||||
Assert.AreEqual(DTCEnumerations.Category.Electrical, dtcNotification.DTC.DTC.Category);
|
||||
Assert.AreEqual(DTCEnumerations.Type.VOLTAGE_NEAR_MIN, dtcNotification.DTC.DTC.Type);
|
||||
Assert.AreEqual(DTCEnumerations.Source.BACKUP_BATTERY, dtcNotification.DTC.DTC.Source);
|
||||
@@ -277,7 +277,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
DtcNotification dtcNotification = (DtcNotification)command;
|
||||
|
||||
Assert.AreEqual("01EE01", dtcNotification.Device.ToId());
|
||||
Assert.AreEqual("01EE01", dtcNotification.Device.ToIdString());
|
||||
Assert.AreEqual(DTCEnumerations.Category.Electrical, dtcNotification.DTC.DTC.Category);
|
||||
Assert.AreEqual(DTCEnumerations.Type.VOLTAGE_BELOW_MIN, dtcNotification.DTC.DTC.Type);
|
||||
Assert.AreEqual(DTCEnumerations.Source.BACKUP_BATTERY, dtcNotification.DTC.DTC.Source);
|
||||
@@ -297,7 +297,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetDtcStatusCommand getDtcStatusCommand = (GetDtcStatusCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getDtcStatusCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getDtcStatusCommand.Device.ToIdString());
|
||||
Assert.AreEqual(DtcSelection.ALL, getDtcStatusCommand.Selection);
|
||||
Assert.AreEqual((uint)10, getDtcStatusCommand.MaxDtcs.Value);
|
||||
Assert.AreEqual((uint)0, getDtcStatusCommand.Index.Value);
|
||||
@@ -307,14 +307,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetDtcStatusCommand_Parameters()
|
||||
{
|
||||
IPduCommand command = new GetDtcStatusCommand([0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00], 10, 0);
|
||||
IPduCommand command = new GetDtcStatusCommand(new DeviceId([0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00]), 10, 0);
|
||||
|
||||
Assert.IsInstanceOfType<GetDtcStatusCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' - ALL - 10 - 0", command.LogString());
|
||||
|
||||
GetDtcStatusCommand getDtcStatusCommand = (GetDtcStatusCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getDtcStatusCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getDtcStatusCommand.Device.ToIdString());
|
||||
Assert.AreEqual(DtcSelection.ALL, getDtcStatusCommand.Selection);
|
||||
Assert.AreEqual((uint)10, getDtcStatusCommand.MaxDtcs.Value);
|
||||
Assert.AreEqual((uint)0, getDtcStatusCommand.Index.Value);
|
||||
@@ -335,7 +335,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetDtcStatusResult getDtcStatusResult = (GetDtcStatusResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getDtcStatusResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getDtcStatusResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual(DTCEnumerations.Category.Electrical, getDtcStatusResult.DTCs[0].DTC.Category);
|
||||
Assert.AreEqual(DTCEnumerations.Type.VOLTAGE_NEAR_MIN, getDtcStatusResult.DTCs[0].DTC.Type);
|
||||
@@ -358,7 +358,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
new DtcInfo(new DTC(DTCEnumerations.Type.ACT_STUCK_JAMMED, DTCEnumerations.Source.BOLT_MOTOR, 0), new DtcTime(new DateTime(2019, 4, 13, 13, 30, 0)).Time.Value, true, true, true)
|
||||
];
|
||||
|
||||
IPduCommand command = new GetDtcStatusResult("0412F5", dtcInfos);
|
||||
IPduCommand command = new GetDtcStatusResult(new DeviceId("0412F5"), dtcInfos);
|
||||
|
||||
Assert.IsInstanceOfType<GetDtcStatusResult>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00'" + Environment.NewLine +
|
||||
@@ -367,7 +367,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetDtcStatusResult getDtcStatusResult = (GetDtcStatusResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getDtcStatusResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getDtcStatusResult.Device.ToIdString());
|
||||
|
||||
Assert.AreEqual(DTCEnumerations.Category.Electrical, getDtcStatusResult.DTCs[0].DTC.Category);
|
||||
Assert.AreEqual(DTCEnumerations.Type.VAL_ABOVE_MAX | DTCEnumerations.Type.RES_ABOVE_MAX, getDtcStatusResult.DTCs[0].DTC.Type);
|
||||
@@ -396,7 +396,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
ClearDtcCommand clearDtcCommand = (ClearDtcCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", clearDtcCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", clearDtcCommand.Device.ToIdString());
|
||||
Assert.AreEqual((uint)255, clearDtcCommand.DTCId.Value);
|
||||
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0F, 0x18, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x81, 0x7F }, PduMessage.Serialize(command));
|
||||
@@ -404,14 +404,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void ClearDtcCommand_Parameters_0()
|
||||
{
|
||||
IPduCommand command = new ClearDtcCommand(new DeviceId("0412F5").Id, 0);
|
||||
IPduCommand command = new ClearDtcCommand(new DeviceId("0412F5"), 0);
|
||||
|
||||
Assert.IsInstanceOfType<ClearDtcCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' DTCid-'0'", command.LogString());
|
||||
|
||||
ClearDtcCommand clearDtcCommand = (ClearDtcCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", clearDtcCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", clearDtcCommand.Device.ToIdString());
|
||||
Assert.AreEqual((uint)0, clearDtcCommand.DTCId.Value);
|
||||
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x18, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x00 }, PduMessage.Serialize(command));
|
||||
@@ -419,14 +419,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void ClearDtcCommand_Parameters_42()
|
||||
{
|
||||
IPduCommand command = new ClearDtcCommand(new DeviceId("0412F5").Id, 42);
|
||||
IPduCommand command = new ClearDtcCommand(new DeviceId("0412F5"), 42);
|
||||
|
||||
Assert.IsInstanceOfType<ClearDtcCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' DTCid-'42'", command.LogString());
|
||||
|
||||
ClearDtcCommand clearDtcCommand = (ClearDtcCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", clearDtcCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", clearDtcCommand.Device.ToIdString());
|
||||
Assert.AreEqual((uint)42, clearDtcCommand.DTCId.Value);
|
||||
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x18, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x2A }, PduMessage.Serialize(command));
|
||||
@@ -434,14 +434,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void ClearDtcCommand_Parameters_577843140()
|
||||
{
|
||||
IPduCommand command = new ClearDtcCommand(new DeviceId("0412F5").Id, 577843140);
|
||||
IPduCommand command = new ClearDtcCommand(new DeviceId("0412F5"), 577843140);
|
||||
|
||||
Assert.IsInstanceOfType<ClearDtcCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' DTCid-'577843140'", command.LogString());
|
||||
|
||||
ClearDtcCommand clearDtcCommand = (ClearDtcCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", clearDtcCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", clearDtcCommand.Device.ToIdString());
|
||||
Assert.AreEqual((uint)577843140, clearDtcCommand.DTCId.Value);
|
||||
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x12, 0x18, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x82, 0x93, 0xC4, 0xDF, 0x44 }, PduMessage.Serialize(command));
|
||||
@@ -459,21 +459,21 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
ClearDtcResult clearDtcResult = (ClearDtcResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", clearDtcResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", clearDtcResult.Device.ToIdString());
|
||||
Assert.AreEqual(Status.UNAVAILABLE, clearDtcResult.Result);
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x19, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x04 }, PduMessage.Serialize(command));
|
||||
}
|
||||
[TestMethod]
|
||||
public void ClearDtcResult_Parameters()
|
||||
{
|
||||
IPduCommand command = new ClearDtcResult("0412F5", Enumerations.Status.UNAVAILABLE);
|
||||
IPduCommand command = new ClearDtcResult(new DeviceId("0412F5"), Enumerations.Status.UNAVAILABLE);
|
||||
|
||||
Assert.IsInstanceOfType<ClearDtcResult>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Result-'UNAVAILABLE'", command.LogString());
|
||||
|
||||
ClearDtcResult clearDtcResult = (ClearDtcResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", clearDtcResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", clearDtcResult.Device.ToIdString());
|
||||
Assert.AreEqual(Status.UNAVAILABLE, clearDtcResult.Result);
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x19, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x04 }, PduMessage.Serialize(command));
|
||||
}
|
||||
@@ -489,7 +489,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetAuditTrailCommand getAuditTrailCommand = (GetAuditTrailCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getAuditTrailCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getAuditTrailCommand.Device.ToIdString());
|
||||
Assert.AreEqual(29, getAuditTrailCommand.SequenceNumber.SequenceNumber);
|
||||
Assert.AreEqual(ReadSequence.START_NEW_READ_SEQUENCE, getAuditTrailCommand.ReadSequence);
|
||||
|
||||
@@ -505,7 +505,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetAuditTrailCommand getAuditTrailCommand = (GetAuditTrailCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getAuditTrailCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getAuditTrailCommand.Device.ToIdString());
|
||||
Assert.AreEqual(ReadSequence.START_NEW_READ_SEQUENCE, getAuditTrailCommand.ReadSequence);
|
||||
Assert.AreEqual(42, getAuditTrailCommand.SequenceNumber.SequenceNumber);
|
||||
|
||||
@@ -524,21 +524,21 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetAuditTrailResult getAuditTrailResult = (GetAuditTrailResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getAuditTrailResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getAuditTrailResult.Device.ToIdString());
|
||||
Assert.AreEqual(Status.FAIL_UNKNOWN_ID, getAuditTrailResult.Result);
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x1F, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x07 }, PduMessage.Serialize(command));
|
||||
}
|
||||
[TestMethod]
|
||||
public void GetAuditTrailResult_Parameter()
|
||||
{
|
||||
IPduCommand command = new GetAuditTrailResult("0412F5", Enumerations.Status.FAIL_UNKNOWN_ID);
|
||||
IPduCommand command = new GetAuditTrailResult(new DeviceId("0412F5"), Enumerations.Status.FAIL_UNKNOWN_ID);
|
||||
|
||||
Assert.IsInstanceOfType<GetAuditTrailResult>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Result-'FAIL_UNKNOWN_ID'", command.LogString());
|
||||
|
||||
GetAuditTrailResult getAuditTrailResult = (GetAuditTrailResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getAuditTrailResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getAuditTrailResult.Device.ToIdString());
|
||||
Assert.AreEqual(Status.FAIL_UNKNOWN_ID, getAuditTrailResult.Result);
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x1F, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x07 }, PduMessage.Serialize(command));
|
||||
}
|
||||
@@ -570,7 +570,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
AuditTrailNotification auditTrailNotification = (AuditTrailNotification)command;
|
||||
|
||||
Assert.AreEqual("0412F5", auditTrailNotification.Device.ToId());
|
||||
Assert.AreEqual("0412F5", auditTrailNotification.Device.ToIdString());
|
||||
Assert.AreEqual((uint)128, auditTrailNotification.PacketSequence.SequenceNumber);
|
||||
Assert.AreEqual(AuditTrailMessageType.AUDIT_TRAIL_ITEM, auditTrailNotification.MessageType);
|
||||
Assert.AreEqual((uint)441849624, auditTrailNotification.TimeStamp.Value.Value);
|
||||
@@ -618,7 +618,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
AuditTrailNotification auditTrailNotification = (AuditTrailNotification)command;
|
||||
|
||||
Assert.AreEqual("08B729", auditTrailNotification.Device.ToId());
|
||||
Assert.AreEqual("08B729", auditTrailNotification.Device.ToIdString());
|
||||
Assert.AreEqual((uint)0, auditTrailNotification.PacketSequence.SequenceNumber);
|
||||
Assert.AreEqual(AuditTrailMessageType.AUDIT_TRAIL_ITEMS_ADDED, auditTrailNotification.MessageType);
|
||||
Assert.AreEqual((uint)220924800, auditTrailNotification.TimeStamp.Value.Value);
|
||||
@@ -636,7 +636,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 01 EE 00 00 00 00 00' SequenceNumber-'0' MessageType = AUDIT_TRAIL_ITEMS_ADDED Timestamp = (seconds-'220924800' Date-'01-01-2007 00:00:00') AccessDescision = DENIED", command.LogString());
|
||||
|
||||
AuditTrailNotification auditTrailNotification = (AuditTrailNotification)command;
|
||||
Assert.AreEqual("01EE00", auditTrailNotification.Device.ToId());
|
||||
Assert.AreEqual("01EE00", auditTrailNotification.Device.ToIdString());
|
||||
Assert.AreEqual((uint)0, auditTrailNotification.PacketSequence.SequenceNumber);
|
||||
Assert.AreEqual(AuditTrailMessageType.AUDIT_TRAIL_ITEMS_ADDED, auditTrailNotification.MessageType);
|
||||
Assert.AreEqual((uint)220924800, auditTrailNotification.TimeStamp.Value.Value);
|
||||
@@ -656,7 +656,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Time = Stamp = ( Timestamp = (seconds-'441849624' Date-'01-01-2014 00:00:24') Timezone-'(0) GMT Standard Time')", command.LogString());
|
||||
|
||||
TimeNotification timeNotification = (TimeNotification)command;
|
||||
Assert.AreEqual("0412F5", timeNotification.Device.ToId());
|
||||
Assert.AreEqual("0412F5", timeNotification.Device.ToIdString());
|
||||
Assert.AreEqual((uint)5, timeNotification.Time.Stamp.Value.NumBytes);
|
||||
Assert.AreEqual((uint)441849624, timeNotification.Time.Stamp.Value.Value);
|
||||
Assert.AreEqual(-1, timeNotification.Time.TimeZone);
|
||||
@@ -665,13 +665,13 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void TimeNotification_Parameters()
|
||||
{
|
||||
IPduCommand command = new TimeNotification("0412F5", new DateTime(2019, 1, 30, 23, 59, 30));
|
||||
IPduCommand command = new TimeNotification(new DeviceId("0412F5"), new Time(new DateTime(2019, 1, 30, 23, 59, 30)));
|
||||
|
||||
Assert.IsInstanceOfType<TimeNotification>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Time = Stamp = ( Timestamp = (seconds-'602207970' Date-'30-01-2019 23:59:30') Timezone-'(+1)W. Europe Standard Time')", command.LogString());
|
||||
|
||||
TimeNotification timeNotification = (TimeNotification)command;
|
||||
Assert.AreEqual("0412F5", timeNotification.Device.ToId());
|
||||
Assert.AreEqual("0412F5", timeNotification.Device.ToIdString());
|
||||
Assert.AreEqual((uint)5, timeNotification.Time.Stamp.Value.NumBytes);
|
||||
Assert.AreEqual((uint)602207970, timeNotification.Time.Stamp.Value.Value);
|
||||
Assert.AreEqual(4, timeNotification.Time.TimeZone);
|
||||
@@ -685,14 +685,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
DateTime now = new(2018, 4, 23, 23, 59, 0);
|
||||
uint totalsec = (uint)(now - new DateTime(2000, 1, 1, 0, 0, 0)).TotalSeconds;
|
||||
|
||||
IPduCommand command = new SetTimeCommand([0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00], now);
|
||||
IPduCommand command = new SetTimeCommand(new DeviceId([0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00]), now);
|
||||
|
||||
Assert.IsInstanceOfType<SetTimeCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' - Stamp = ( Timestamp = (seconds-'577843140' Date-'23-04-2018 23:59:00') Timezone-'(+1)W. Europe Standard Time')", command.LogString());
|
||||
|
||||
SetTimeCommand setTimeCommand = (SetTimeCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", setTimeCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", setTimeCommand.Device.ToIdString());
|
||||
Assert.AreEqual(4, setTimeCommand.Time.TimeZone);
|
||||
Assert.AreEqual((uint)577843140, setTimeCommand.Time.Stamp.Value.Value);
|
||||
Assert.AreEqual(totalsec, setTimeCommand.Time.Stamp.Value.Value);
|
||||
@@ -709,7 +709,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
SetTimeCommand setTimeCommand = (SetTimeCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", setTimeCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", setTimeCommand.Device.ToIdString());
|
||||
Assert.AreEqual((uint)5, setTimeCommand.Time.Stamp.Value.NumBytes);
|
||||
Assert.AreEqual((uint)441849624, setTimeCommand.Time.Stamp.Value.Value);
|
||||
Assert.AreEqual(-1, setTimeCommand.Time.TimeZone);
|
||||
@@ -728,7 +728,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
SetTimeResult setTimeResult = (SetTimeResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", setTimeResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", setTimeResult.Device.ToIdString());
|
||||
Assert.AreEqual(Status.OK, setTimeResult.Result);
|
||||
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x2A, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x01 }, PduMessage.Serialize(command));
|
||||
@@ -736,14 +736,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void SetTimeResult_Parameters()
|
||||
{
|
||||
IPduCommand command = new SetTimeResult("0412F5", Status.OK);
|
||||
IPduCommand command = new SetTimeResult(new DeviceId("0412F5"), Status.OK);
|
||||
|
||||
Assert.IsInstanceOfType<SetTimeResult>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' Result-'OK'", command.LogString());
|
||||
|
||||
SetTimeResult setTimeResult = (SetTimeResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", setTimeResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", setTimeResult.Device.ToIdString());
|
||||
Assert.AreEqual(Status.OK, setTimeResult.Result);
|
||||
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0E, 0x2A, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x01 }, PduMessage.Serialize(command));
|
||||
@@ -753,14 +753,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetTimeCommand_Parameters()
|
||||
{
|
||||
IPduCommand command = new GetTimeCommand(new DeviceId("0412F5").Id);
|
||||
IPduCommand command = new GetTimeCommand(new DeviceId("0412F5"));
|
||||
|
||||
Assert.IsInstanceOfType<GetTimeCommand>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00'", command.LogString());
|
||||
|
||||
GetTimeCommand getTimeCommand = (GetTimeCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getTimeCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getTimeCommand.Device.ToIdString());
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0D, 0x2B, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00 }, PduMessage.Serialize(command));
|
||||
}
|
||||
[TestMethod]
|
||||
@@ -773,7 +773,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetTimeCommand getTimeCommand = (GetTimeCommand)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getTimeCommand.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getTimeCommand.Device.ToIdString());
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x0D, 0x2B, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00 }, PduMessage.Serialize(command));
|
||||
}
|
||||
|
||||
@@ -788,7 +788,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
GetTimeResult getTimeResult = (GetTimeResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getTimeResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getTimeResult.Device.ToIdString());
|
||||
Assert.AreEqual((short)2, getTimeResult.Time.TimeZone);
|
||||
Assert.AreEqual((uint)441849624, getTimeResult.Time.Stamp.Value.Value);
|
||||
|
||||
@@ -797,14 +797,14 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void GetTimeResult_Parameter()
|
||||
{
|
||||
IPduCommand command = new GetTimeResult("0412F5", new DateTime(2019, 1, 30, 23, 59, 30));
|
||||
IPduCommand command = new GetTimeResult(new DeviceId("0412F5"), new Time(new DateTime(2019, 1, 30, 23, 59, 30)));
|
||||
|
||||
Assert.IsInstanceOfType<GetTimeResult>(command);
|
||||
Assert.AreEqual(" DeviceId-'00 17 7A 01 02 04 12 F5 00 00 00 00' - Stamp = ( Timestamp = (seconds-'602207970' Date-'30-01-2019 23:59:30') Timezone-'(+1)W. Europe Standard Time')", command.LogString());
|
||||
|
||||
GetTimeResult getTimeResult = (GetTimeResult)command;
|
||||
|
||||
Assert.AreEqual("0412F5", getTimeResult.Device.ToId());
|
||||
Assert.AreEqual("0412F5", getTimeResult.Device.ToIdString());
|
||||
Assert.AreEqual((short)4, getTimeResult.Time.TimeZone);
|
||||
Assert.AreEqual((uint)602207970, getTimeResult.Time.Stamp.Value.Value);
|
||||
CollectionAssert.AreEqual(new byte[] { 0x00, 0x14, 0x2C, 0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00, 0x82, 0x9F, 0x93, 0xED, 0x62, 0x00, 0x04 }, PduMessage.Serialize(command));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Aperio_Control_Centre.Aadp.Commands.OutputToUser;
|
||||
using Aperio_Control_Centre.Aadp.Enumerations;
|
||||
using Aperio_Control_Centre.Aadp.Types;
|
||||
using Aperio_Control_Centre.Aadp.Types.ApplicationTypes;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
@@ -13,7 +14,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void IndicationCommand_Parameters()
|
||||
{
|
||||
IPduCommand command = new IndicationCommand("0361A7", DoorSide.INSIDE, Indication.FIRE_ALARM, 10, TimingMode.TIME);
|
||||
IPduCommand command = new IndicationCommand(new Id("0361A7"), DoorSide.INSIDE, Indication.FIRE_ALARM, 10, TimingMode.TIME);
|
||||
|
||||
Assert.IsInstanceOfType<IndicationCommand>(command);
|
||||
Assert.AreEqual(" Device-'0361A7' Doorside-'INSIDE' Indications-'FIRE_ALARM,' IndicationTime( Mode-'TIME' Time-'10')", command.LogString());
|
||||
@@ -103,7 +104,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
[TestMethod]
|
||||
public void IndicationResult_Parameter()
|
||||
{
|
||||
IPduCommand command = new IndicationResult("0361A7", Status.OK);
|
||||
IPduCommand command = new IndicationResult(new Id("0361A7"), Status.OK);
|
||||
|
||||
Assert.IsInstanceOfType<IndicationResult>(command);
|
||||
Assert.AreEqual(" Device-'0361A7' Result-'OK'", command.LogString());
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Aperio_Control_Centre.Aadp.UnitTest
|
||||
|
||||
LockVersion lockVersion = new(arr);
|
||||
|
||||
Assert.AreEqual("012344", lockVersion.Id.ToId());
|
||||
Assert.AreEqual("012344", lockVersion.Id.ToIdString());
|
||||
Assert.AreEqual(Enumerations.LockVersions.APERIO_V3, lockVersion.Version);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Aperio_Control_Centre.Aadp.Commands
|
||||
{
|
||||
public class CommandDeviceIdBase
|
||||
{
|
||||
public DeviceId Device { get; set; } = new();
|
||||
public DeviceId Device { get; protected set; } = new();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace Aperio_Control_Centre.Aadp.Commands
|
||||
{
|
||||
public class CommandIdBase
|
||||
{
|
||||
public Id DeviceGroupId { get; set; } = new();
|
||||
public Id DeviceGroupId { get; protected set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ namespace Aperio_Control_Centre.Aadp.Commands.Configuration
|
||||
public List<DeviceParameterNotificationBlock> ParameterNotificationBlock { get; } = [];
|
||||
|
||||
public DeviceParameterNotification() { }
|
||||
|
||||
public DeviceParameterNotification(DeviceId id, List<DeviceParameterNotificationBlock> deviceParameters)
|
||||
{
|
||||
Device = id;
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace Aperio_Control_Centre.Aadp.Commands.Configuration
|
||||
public List<DeviceParameterName> Name { get; } = [];
|
||||
|
||||
public GetDeviceParameterCommand() { }
|
||||
public GetDeviceParameterCommand(byte[] deviceId, List<DeviceParameterName> deviceParameters)
|
||||
{
|
||||
Device = new DeviceId(deviceId);
|
||||
Name = deviceParameters;
|
||||
}
|
||||
//public GetDeviceParameterCommand(byte[] deviceId, List<DeviceParameterName> deviceParameters)
|
||||
//{
|
||||
// Device = new DeviceId(deviceId);
|
||||
// Name = deviceParameters;
|
||||
//}
|
||||
public GetDeviceParameterCommand(DeviceId deviceId, List<DeviceParameterName> deviceParameters)
|
||||
{
|
||||
Device = deviceId;
|
||||
@@ -61,7 +61,7 @@ namespace Aperio_Control_Centre.Aadp.Commands.Configuration
|
||||
{
|
||||
name.LogString(ref sb);
|
||||
//sb.Append(Environment.NewLine);
|
||||
if(!name.Equals(Name.Last()))
|
||||
if (!name.Equals(Name.Last()))
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.Configuration
|
||||
public List<DeviceParameterNotificationBlock> ParameterResultBlock { get; } = [];
|
||||
|
||||
public GetDeviceParameterResult() { }
|
||||
public GetDeviceParameterResult(string devId, List<DeviceParameterNotificationBlock> notificationBlocks)
|
||||
//public GetDeviceParameterResult(string devId, List<DeviceParameterNotificationBlock> notificationBlocks)
|
||||
//{
|
||||
// Device = new DeviceId(devId);
|
||||
// ParameterResultBlock = notificationBlocks;
|
||||
//}
|
||||
public GetDeviceParameterResult(DeviceId deviceId, List<DeviceParameterNotificationBlock> notificationBlocks)
|
||||
{
|
||||
Device = new DeviceId(devId);
|
||||
Device = deviceId;
|
||||
ParameterResultBlock = notificationBlocks;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,14 +12,19 @@ namespace Aperio_Control_Centre.Aadp.Commands.Configuration
|
||||
public List<SetDeviceParameterCommandBlock> ParameterCommandBlock { get; } = [];
|
||||
|
||||
public SetDeviceParameterCommand() { }
|
||||
public SetDeviceParameterCommand(byte[] id, List<SetDeviceParameterCommandBlock> commandBlocks)
|
||||
//public SetDeviceParameterCommand(byte[] id, List<SetDeviceParameterCommandBlock> commandBlocks)
|
||||
//{
|
||||
// Device = new DeviceId(id);
|
||||
// ParameterCommandBlock = commandBlocks;
|
||||
//}
|
||||
//public SetDeviceParameterCommand(string id, List<SetDeviceParameterCommandBlock> commandBlocks)
|
||||
//{
|
||||
// Device = new DeviceId(id);
|
||||
// ParameterCommandBlock = commandBlocks;
|
||||
//}
|
||||
public SetDeviceParameterCommand(DeviceId deviceId, List<SetDeviceParameterCommandBlock> commandBlocks)
|
||||
{
|
||||
Device = new DeviceId(id);
|
||||
ParameterCommandBlock = commandBlocks;
|
||||
}
|
||||
public SetDeviceParameterCommand(string id, List<SetDeviceParameterCommandBlock> commandBlocks)
|
||||
{
|
||||
Device = new DeviceId(id);
|
||||
Device = deviceId;
|
||||
ParameterCommandBlock = commandBlocks;
|
||||
}
|
||||
|
||||
@@ -58,8 +63,8 @@ namespace Aperio_Control_Centre.Aadp.Commands.Configuration
|
||||
{
|
||||
foreach (var par in ParameterCommandBlock)
|
||||
{
|
||||
par.LogString(ref sb);
|
||||
if(!par.Equals(ParameterCommandBlock.Last()))
|
||||
par.LogString(ref sb);
|
||||
if (!par.Equals(ParameterCommandBlock.Last()))
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,11 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public ActivatorInfo ActivatorInfo { get; set; } = new();
|
||||
|
||||
public ActivatorStateNotification() { }
|
||||
public ActivatorStateNotification(Id id , ActivatorInfo activatorInfo)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
ActivatorInfo = activatorInfo;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,10 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public List<ActivatorInfo> ActivatorInfo { get; } = [];
|
||||
|
||||
public ActivatorStateResult() { }
|
||||
public ActivatorStateResult(Id id)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.DoorStateNotification;
|
||||
|
||||
public Enumerations.DoorState State { get; set; }
|
||||
public Enumerations.DoorState State { get; private set; }
|
||||
|
||||
public DoorStateNotification() { }
|
||||
public DoorStateNotification(Id id, Enumerations.DoorState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.DoorStateResult;
|
||||
|
||||
public Enumerations.DoorState State { get; set; }
|
||||
public Enumerations.DoorState State { get; private set; }
|
||||
|
||||
public DoorStateResult() { }
|
||||
public DoorStateResult(Id id, Enumerations.DoorState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -9,9 +9,13 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetActivatorStateCommand;
|
||||
|
||||
public GetActivatorStateCommand() { }
|
||||
public GetActivatorStateCommand(string deviceGroupId)
|
||||
//public GetActivatorStateCommand(string deviceGroupId)
|
||||
//{
|
||||
// DeviceGroupId = new Id(deviceGroupId);
|
||||
//}
|
||||
public GetActivatorStateCommand(Id id)
|
||||
{
|
||||
DeviceGroupId = new Id(deviceGroupId);
|
||||
DeviceGroupId = id;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetDoorStateCommand;
|
||||
|
||||
public GetDoorStateCommand() { }
|
||||
public GetDoorStateCommand(string deviceGroupId)
|
||||
{
|
||||
DeviceGroupId = new Id(deviceGroupId);
|
||||
}
|
||||
//public GetDoorStateCommand(string deviceGroupId)
|
||||
//{
|
||||
// DeviceGroupId = new Id(deviceGroupId);
|
||||
//}
|
||||
public GetDoorStateCommand(Id id)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
|
||||
@@ -9,9 +9,13 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetHandleStateCommand;
|
||||
|
||||
public GetHandleStateCommand() { }
|
||||
public GetHandleStateCommand(string deviceGroupId)
|
||||
//public GetHandleStateCommand(string deviceGroupId)
|
||||
//{
|
||||
// DeviceGroupId = new Id(deviceGroupId);
|
||||
//}
|
||||
public GetHandleStateCommand(Id id)
|
||||
{
|
||||
DeviceGroupId = new Id(deviceGroupId);
|
||||
DeviceGroupId = id;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
|
||||
@@ -9,9 +9,13 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetKeyCylinderStateCommand;
|
||||
|
||||
public GetKeyCylinderStateCommand() { }
|
||||
public GetKeyCylinderStateCommand(string deviceGroupId)
|
||||
//public GetKeyCylinderStateCommand(string deviceGroupId)
|
||||
//{
|
||||
// DeviceGroupId = new Id(deviceGroupId);
|
||||
//}
|
||||
public GetKeyCylinderStateCommand(Id id)
|
||||
{
|
||||
DeviceGroupId = new Id(deviceGroupId);
|
||||
DeviceGroupId = id;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetLockStateCommand;
|
||||
|
||||
public GetLockStateCommand() { }
|
||||
public GetLockStateCommand(string deviceGroupId)
|
||||
{
|
||||
DeviceGroupId = new Id(deviceGroupId);
|
||||
}
|
||||
//public GetLockStateCommand(string deviceGroupId)
|
||||
//{
|
||||
// DeviceGroupId = new Id(deviceGroupId);
|
||||
//}
|
||||
public GetLockStateCommand(Id id)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
|
||||
@@ -9,9 +9,13 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetTamperStateCommand;
|
||||
|
||||
public GetTamperStateCommand() { }
|
||||
public GetTamperStateCommand(string deviceGroupId)
|
||||
//public GetTamperStateCommand(string deviceGroupId)
|
||||
//{
|
||||
// DeviceGroupId = new Id(deviceGroupId);
|
||||
//}
|
||||
public GetTamperStateCommand(Id id)
|
||||
{
|
||||
DeviceGroupId = new Id(deviceGroupId);
|
||||
DeviceGroupId = id;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.HandleStateNotification;
|
||||
|
||||
public Enumerations.HandleState State { get; set; }
|
||||
public Enumerations.HandleState State { get; private set; }
|
||||
|
||||
public HandleStateNotification() { }
|
||||
public HandleStateNotification(Id id, Enumerations.HandleState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.HandleStateResult;
|
||||
|
||||
public Enumerations.HandleState State { get; set; }
|
||||
public Enumerations.HandleState State { get; private set; }
|
||||
|
||||
public HandleStateResult() { }
|
||||
public HandleStateResult(Id id, Enumerations.HandleState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.KeyCylinderStateNotification;
|
||||
|
||||
public Enumerations.KeyCylinderState State { get; set; }
|
||||
public Enumerations.KeyCylinderState State { get; private set; }
|
||||
|
||||
public KeyCylinderStateNotification() { }
|
||||
public KeyCylinderStateNotification(Id id, Enumerations.KeyCylinderState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,15 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.KeyCylinderStateResult;
|
||||
|
||||
public Enumerations.KeyCylinderState State { get; set; }
|
||||
public Enumerations.KeyCylinderState State { get; private set; }
|
||||
|
||||
public KeyCylinderStateResult() { }
|
||||
public KeyCylinderStateResult(Id id, Enumerations.KeyCylinderState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,11 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
public Enumerations.LockState State { get; set; }
|
||||
|
||||
public LockStateNotification() { }
|
||||
public LockStateNotification(Id id, Enumerations.LockState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.LockStateResult;
|
||||
|
||||
public Enumerations.LockState State { get; set; }
|
||||
public Enumerations.LockState State { get; private set; }
|
||||
|
||||
public LockStateResult() { }
|
||||
public LockStateResult(Id id, Enumerations.LockState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.TamperStateNotification;
|
||||
|
||||
public Enumerations.TamperState State { get; set; }
|
||||
public Enumerations.TamperState State { get; private set; }
|
||||
|
||||
public TamperStateNotification() { }
|
||||
public TamperStateNotification(Id id, Enumerations.TamperState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,9 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DeviceStates
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.TamperStateResult;
|
||||
|
||||
public Enumerations.TamperState State { get; set; }
|
||||
public Enumerations.TamperState State { get; private set; }
|
||||
|
||||
public TamperStateResult() { }
|
||||
public TamperStateResult(Id id, Enumerations.TamperState state)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
State = state;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -8,12 +8,17 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.DeleteCredentialResult;
|
||||
|
||||
public Enumerations.Status Result { get; set; }
|
||||
public Enumerations.Status Result { get; private set; }
|
||||
|
||||
public DeleteCredentialResult() { }
|
||||
public DeleteCredentialResult(string devId, Enumerations.Status result)
|
||||
//public DeleteCredentialResult(string devId, Enumerations.Status result)
|
||||
//{
|
||||
// Device = new DeviceId(devId);
|
||||
// Result = result;
|
||||
//}
|
||||
public DeleteCredentialResult(DeviceId deviceId, Enumerations.Status result)
|
||||
{
|
||||
Device = new DeviceId(devId);
|
||||
Device = deviceId;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
public Enumerations.DoorMode Mode { get; set; }
|
||||
|
||||
public DoorModeNotification() { }
|
||||
public DoorModeNotification(string devId, Enumerations.DoorMode mode)
|
||||
//public DoorModeNotification(string devId, Enumerations.DoorMode mode)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devId);
|
||||
// Mode = mode;
|
||||
//}
|
||||
public DoorModeNotification(Id id, Enumerations.DoorMode mode)
|
||||
{
|
||||
DeviceGroupId = new Id(devId);
|
||||
DeviceGroupId = id;
|
||||
Mode = mode;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
public Timing Duration { get; set; } = new();
|
||||
|
||||
public DoorOpeningCommand() { }
|
||||
public DoorOpeningCommand(string devid, bool open, bool indication, uint time, Enumerations.TimingMode mode)
|
||||
{
|
||||
DeviceGroupId = new Id(devid);
|
||||
Open = open;
|
||||
StandardIndication = indication;
|
||||
Duration = new Timing(time, mode);
|
||||
}
|
||||
//public DoorOpeningCommand(string devid, bool open, bool indication, uint time, Enumerations.TimingMode mode)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devid);
|
||||
// Open = open;
|
||||
// StandardIndication = indication;
|
||||
// Duration = new Timing(time, mode);
|
||||
//}
|
||||
public DoorOpeningCommand(Id id, bool open, bool indication, uint time, Enumerations.TimingMode mode)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
|
||||
@@ -8,12 +8,17 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.DoorOpeningResult;
|
||||
|
||||
public Enumerations.Status Result { get; set; }
|
||||
public Enumerations.Status Result { get; private set; }
|
||||
|
||||
public DoorOpeningResult() { }
|
||||
public DoorOpeningResult(string devid, Enumerations.Status status)
|
||||
//public DoorOpeningResult(string devid, Enumerations.Status status)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devid);
|
||||
// Result = status;
|
||||
//}
|
||||
public DoorOpeningResult(Id id, Enumerations.Status status)
|
||||
{
|
||||
DeviceGroupId = new Id(devid);
|
||||
DeviceGroupId = id;
|
||||
Result = status;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetDoorModeCommand;
|
||||
|
||||
public GetDoorModeCommand() { }
|
||||
public GetDoorModeCommand(string id)
|
||||
{
|
||||
DeviceGroupId = new Id(id);
|
||||
}
|
||||
//public GetDoorModeCommand(string id)
|
||||
//{
|
||||
// DeviceGroupId = new Id(id);
|
||||
//}
|
||||
public GetDoorModeCommand(Id id)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
|
||||
@@ -8,12 +8,17 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetDoorModeResult;
|
||||
|
||||
public Enumerations.DoorMode Mode { get; set; }
|
||||
public Enumerations.DoorMode Mode { get; private set; }
|
||||
|
||||
public GetDoorModeResult() { }
|
||||
public GetDoorModeResult(string devId, Enumerations.DoorMode doorMode)
|
||||
//public GetDoorModeResult(string devId, Enumerations.DoorMode doorMode)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devId);
|
||||
// Mode = doorMode;
|
||||
//}
|
||||
public GetDoorModeResult(Id id, Enumerations.DoorMode doorMode)
|
||||
{
|
||||
DeviceGroupId = new Id(devId);
|
||||
DeviceGroupId = id;
|
||||
Mode = doorMode;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetSupportedDoorModesCommand;
|
||||
|
||||
public GetSupportedDoorModesCommand() { }
|
||||
public GetSupportedDoorModesCommand(string devId)
|
||||
{
|
||||
DeviceGroupId = new Id(devId);
|
||||
}
|
||||
//public GetSupportedDoorModesCommand(string devId)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devId);
|
||||
//}
|
||||
public GetSupportedDoorModesCommand(Id id)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
|
||||
@@ -11,9 +11,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
public List<Enumerations.DoorMode> DoorModes { get; set; } = [];
|
||||
|
||||
public GetSupportedDoorModesResult() { }
|
||||
public GetSupportedDoorModesResult(string devId, List<Enumerations.DoorMode> doorModes)
|
||||
//public GetSupportedDoorModesResult(string devId, List<Enumerations.DoorMode> doorModes)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devId);
|
||||
// DoorModes = doorModes;
|
||||
//}
|
||||
public GetSupportedDoorModesResult(Id id, List<Enumerations.DoorMode> doorModes)
|
||||
{
|
||||
DeviceGroupId = new Id(devId);
|
||||
DeviceGroupId = id;
|
||||
DoorModes = doorModes;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,17 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.SetCredentialResult;
|
||||
|
||||
public Enumerations.Status Result { get; set; }
|
||||
public Enumerations.Status Result { get; private set; }
|
||||
|
||||
public SetCredentialResult() { }
|
||||
public SetCredentialResult(string devId, Enumerations.Status result)
|
||||
//public SetCredentialResult(string devId, Enumerations.Status result)
|
||||
//{
|
||||
// Device = new DeviceId(devId);
|
||||
// Result = result;
|
||||
//}
|
||||
public SetCredentialResult(DeviceId deviceId, Enumerations.Status result)
|
||||
{
|
||||
Device = new DeviceId(devId);
|
||||
Device = deviceId;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,16 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
public Enumerations.ExecuteMode Exec { get; set; }
|
||||
|
||||
public SetDoorModeCommand() { }
|
||||
public SetDoorModeCommand(string id, Enumerations.DoorMode doorMode, uint time, Enumerations.TimingMode mode, Enumerations.ExecuteMode execute)
|
||||
//public SetDoorModeCommand(string id, Enumerations.DoorMode doorMode, uint time, Enumerations.TimingMode mode, Enumerations.ExecuteMode execute)
|
||||
//{
|
||||
// DeviceGroupId = new Id(id);
|
||||
// Mode = doorMode;
|
||||
// Duration = new Timing(time, mode);
|
||||
// Exec = execute;
|
||||
//}
|
||||
public SetDoorModeCommand(Id id, Enumerations.DoorMode doorMode, uint time, Enumerations.TimingMode mode, Enumerations.ExecuteMode execute)
|
||||
{
|
||||
DeviceGroupId = new Id(id);
|
||||
DeviceGroupId = id;
|
||||
Mode = doorMode;
|
||||
Duration = new Timing(time, mode);
|
||||
Exec = execute;
|
||||
|
||||
@@ -11,9 +11,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.DoorControl
|
||||
public Enumerations.Status Result { get; set; }
|
||||
|
||||
public SetDoorModeResult() { }
|
||||
public SetDoorModeResult(string devId, Enumerations.Status result)
|
||||
//public SetDoorModeResult(string devId, Enumerations.Status result)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devId);
|
||||
// Result = result;
|
||||
//}
|
||||
public SetDoorModeResult(Id id, Enumerations.Status result)
|
||||
{
|
||||
DeviceGroupId = new Id(devId);
|
||||
DeviceGroupId = id;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
{
|
||||
public interface IPduStatusResult
|
||||
{
|
||||
public Enumerations.Status Result { get; set; }
|
||||
public Enumerations.Status Result { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,15 @@ namespace Aperio_Control_Centre.Aadp.Commands.InputFromUser
|
||||
DoorSide = doorSide;
|
||||
Credential = [];
|
||||
}
|
||||
public CredentialNotification(string deviceGroupId, Enumerations.DoorSide doorSide, List<CredentialBlock> Credentials)
|
||||
//public CredentialNotification(string deviceGroupId, Enumerations.DoorSide doorSide, List<CredentialBlock> Credentials)
|
||||
//{
|
||||
// DeviceGroupId = new Id(deviceGroupId);
|
||||
// DoorSide = doorSide;
|
||||
// Credential = Credentials;
|
||||
//}
|
||||
public CredentialNotification(Id id, Enumerations.DoorSide doorSide, List<CredentialBlock> Credentials)
|
||||
{
|
||||
DeviceGroupId = new Id(deviceGroupId);
|
||||
DeviceGroupId = id;
|
||||
DoorSide = doorSide;
|
||||
Credential = Credentials;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,16 @@ namespace Aperio_Control_Centre.Aadp.Commands.InputFromUser
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.KeypadNotification;
|
||||
|
||||
public Enumerations.DoorSide DoorSide { get; set; }
|
||||
public string Keys { get; set; } = string.Empty;
|
||||
public Enumerations.DoorSide DoorSide { get; private set; }
|
||||
public string Keys { get; private set; } = string.Empty;
|
||||
|
||||
public KeypadNotification() { }
|
||||
public KeypadNotification(Id id, Enumerations.DoorSide doorSide, string keys)
|
||||
{
|
||||
DeviceGroupId = id;
|
||||
DoorSide = doorSide;
|
||||
Keys = keys;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Aperio_Control_Centre.Aadp.Types;
|
||||
using Aperio_Control_Centre.Aadp.Enumerations;
|
||||
using Aperio_Control_Centre.Aadp.Types;
|
||||
using Aperio_Control_Centre.Aadp.Types.ApplicationTypes;
|
||||
using System.Text;
|
||||
|
||||
@@ -6,25 +7,35 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
{
|
||||
public class AuditTrailNotification : CommandDeviceIdBase, IPduCommand
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.AuditTrailNotification;
|
||||
public PDUTypes PDUType => PDUTypes.AuditTrailNotification;
|
||||
|
||||
public PacketSequenceNumber PacketSequence { get; set; } = new();
|
||||
private static uint Reserved => 0;
|
||||
public Enumerations.AuditTrailMessageType MessageType { get; set; }
|
||||
public AuditTrailMessageType MessageType { get; set; }
|
||||
public TimeStamp TimeStamp { get; set; } = new();
|
||||
public Enumerations.AccessDecision AccessDecision { get; set; }
|
||||
public AccessDecision AccessDecision { get; set; }
|
||||
public List<CredentialBlock> Credential { get; } = [];
|
||||
|
||||
public AuditTrailNotification() { }
|
||||
public AuditTrailNotification(DeviceId deviceId, PacketSequenceNumber sequenceNumber, AuditTrailMessageType messageType, TimeStamp timeStamp, AccessDecision accessDecision)
|
||||
{
|
||||
Device = deviceId;
|
||||
PacketSequence = sequenceNumber;
|
||||
MessageType = messageType;
|
||||
TimeStamp = timeStamp;
|
||||
AccessDecision = accessDecision;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
Device = new DeviceId(ref arr, ref idx);
|
||||
PacketSequence = new PacketSequenceNumber(ref arr, ref idx);
|
||||
idx += 1; //reserved enum
|
||||
MessageType = (Enumerations.AuditTrailMessageType)PrimitiveType.DeserializeEnum(ref arr, ref idx);
|
||||
MessageType = (AuditTrailMessageType)PrimitiveType.DeserializeEnum(ref arr, ref idx);
|
||||
TimeStamp = new TimeStamp(ref arr, ref idx);
|
||||
AccessDecision = (Enumerations.AccessDecision)PrimitiveType.DeserializeEnum(ref arr, ref idx);
|
||||
AccessDecision = (AccessDecision)PrimitiveType.DeserializeEnum(ref arr, ref idx);
|
||||
VariableLengthQuantity arrlen = new(ref arr, ref idx);
|
||||
//Credential = [];
|
||||
for (int i = 1; i <= arrlen.Value; i++)
|
||||
@@ -61,16 +72,16 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
sb.Append(" MessageType = " + MessageType.ToString());
|
||||
TimeStamp.LogString(ref sb);
|
||||
sb.Append(" AccessDescision = " + AccessDecision.ToString());
|
||||
if(Credential.Count > 0)
|
||||
if (Credential.Count > 0)
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
foreach (var cred in Credential)
|
||||
{
|
||||
cred.LogString(ref sb);
|
||||
if(!cred.Equals(Credential.Last()))
|
||||
if (!cred.Equals(Credential.Last()))
|
||||
{
|
||||
sb.Append(Environment.NewLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
|
||||
@@ -10,11 +10,11 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
public VariableLengthQuantity DTCId { get; set; } = new();
|
||||
|
||||
public ClearDtcCommand() { }
|
||||
public ClearDtcCommand(byte[] devid, uint id)
|
||||
{
|
||||
Device = new DeviceId(devid);
|
||||
DTCId = new VariableLengthQuantity(id);
|
||||
}
|
||||
//public ClearDtcCommand(byte[] devid, uint id)
|
||||
//{
|
||||
// Device = new DeviceId(devid);
|
||||
// DTCId = new VariableLengthQuantity(id);
|
||||
//}
|
||||
public ClearDtcCommand(DeviceId devid, uint id)
|
||||
{
|
||||
Device = devid;
|
||||
|
||||
@@ -8,12 +8,17 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.ClearDtcResult;
|
||||
|
||||
public Enumerations.Status Result { get; set; }
|
||||
public Enumerations.Status Result { get; private set; }
|
||||
|
||||
public ClearDtcResult() { }
|
||||
public ClearDtcResult(string devId, Enumerations.Status result)
|
||||
////public ClearDtcResult(string devId, Enumerations.Status result)
|
||||
////{
|
||||
//// Device = new DeviceId(devId);
|
||||
//// Result = result;
|
||||
////}
|
||||
public ClearDtcResult(DeviceId deviceId, Enumerations.Status result)
|
||||
{
|
||||
Device = new DeviceId(devId);
|
||||
Device = deviceId;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,12 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
|
||||
public DtcNotification() { }
|
||||
|
||||
public DtcNotification(DeviceId deviceId, DtcInfo dtc)
|
||||
{
|
||||
Device = deviceId;
|
||||
DTC = dtc;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
Device = new DeviceId(ref arr, ref idx);
|
||||
|
||||
@@ -13,21 +13,21 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
public Enumerations.ReadSequence ReadSequence { get; set; }
|
||||
|
||||
public GetAuditTrailCommand() { }
|
||||
public GetAuditTrailCommand(byte[] id, Enumerations.ReadSequence sequence)
|
||||
{
|
||||
Device = new DeviceId(id);
|
||||
SequenceNumber = new PacketSequenceNumber();
|
||||
ReadSequence = sequence;
|
||||
}
|
||||
//public GetAuditTrailCommand(byte[] id, Enumerations.ReadSequence sequence)
|
||||
//{
|
||||
// Device = new DeviceId(id);
|
||||
// SequenceNumber = new PacketSequenceNumber();
|
||||
// ReadSequence = sequence;
|
||||
//}
|
||||
public GetAuditTrailCommand(DeviceId id, Enumerations.ReadSequence sequence, ushort sequenceNumber)
|
||||
{
|
||||
Device = id;
|
||||
SequenceNumber = new PacketSequenceNumber(sequenceNumber);
|
||||
ReadSequence = sequence;
|
||||
}
|
||||
public GetAuditTrailCommand(DeviceId id, Enumerations.ReadSequence sequence)
|
||||
public GetAuditTrailCommand(DeviceId deviceId, Enumerations.ReadSequence sequence)
|
||||
{
|
||||
Device = id;
|
||||
Device = deviceId;
|
||||
SequenceNumber = new PacketSequenceNumber();
|
||||
ReadSequence = sequence;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,17 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetAuditTrailResult;
|
||||
|
||||
public Enumerations.Status Result { get; set; }
|
||||
public Enumerations.Status Result { get; private set; }
|
||||
|
||||
public GetAuditTrailResult() { }
|
||||
public GetAuditTrailResult(string devId, Enumerations.Status result)
|
||||
//public GetAuditTrailResult(string devId, Enumerations.Status result)
|
||||
//{
|
||||
// Device = new DeviceId(devId);
|
||||
// Result = result;
|
||||
//}
|
||||
public GetAuditTrailResult(DeviceId deviceId, Enumerations.Status result)
|
||||
{
|
||||
Device = new DeviceId(devId);
|
||||
Device = deviceId;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,13 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
public VariableLengthQuantity Index { get; set; } = new();
|
||||
|
||||
public GetDtcStatusCommand() { }
|
||||
public GetDtcStatusCommand(byte[] devid, uint max, uint idx)
|
||||
{
|
||||
Device = new DeviceId(devid);
|
||||
Selection = Enumerations.DtcSelection.ALL;
|
||||
MaxDtcs = new VariableLengthQuantity(max);
|
||||
Index = new VariableLengthQuantity(idx);
|
||||
}
|
||||
//public GetDtcStatusCommand(byte[] devid, uint max, uint idx)
|
||||
//{
|
||||
// Device = new DeviceId(devid);
|
||||
// Selection = Enumerations.DtcSelection.ALL;
|
||||
// MaxDtcs = new VariableLengthQuantity(max);
|
||||
// Index = new VariableLengthQuantity(idx);
|
||||
//}
|
||||
public GetDtcStatusCommand(DeviceId devid, uint max, uint idx)
|
||||
{
|
||||
Device = devid;
|
||||
@@ -35,6 +35,7 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
Index = new VariableLengthQuantity(idx);
|
||||
}
|
||||
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
Device = new DeviceId(ref arr, ref idx);
|
||||
|
||||
@@ -10,11 +10,20 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
public List<DtcInfo> DTCs { get; } = [];
|
||||
|
||||
public GetDtcStatusResult() { }
|
||||
public GetDtcStatusResult(string devId, List<DtcInfo> dtcInfos)
|
||||
//public GetDtcStatusResult(string devId, List<DtcInfo> dtcInfos)
|
||||
//{
|
||||
// Device = new DeviceId(devId);
|
||||
// DTCs = dtcInfos;
|
||||
//}
|
||||
public GetDtcStatusResult(DeviceId deviceId, List<DtcInfo> dtcInfos)
|
||||
{
|
||||
Device = new DeviceId(devId);
|
||||
Device = deviceId;
|
||||
DTCs = dtcInfos;
|
||||
}
|
||||
public GetDtcStatusResult(DeviceId deviceId)
|
||||
{
|
||||
Device = deviceId;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -10,10 +10,10 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetTimeCommand;
|
||||
|
||||
public GetTimeCommand() { }
|
||||
public GetTimeCommand(byte[] device)
|
||||
{
|
||||
Device = new DeviceId(device);
|
||||
}
|
||||
//public GetTimeCommand(byte[] device)
|
||||
//{
|
||||
// Device = new DeviceId(device);
|
||||
//}
|
||||
public GetTimeCommand(DeviceId device)
|
||||
{
|
||||
Device = device;
|
||||
@@ -42,41 +42,5 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
return PDUType.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public class GetTimeResult : CommandDeviceIdBase, IPduCommand
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetTimeResult;
|
||||
|
||||
public Time Time { get; set; } = new();
|
||||
|
||||
public GetTimeResult() { }
|
||||
public GetTimeResult(string devId, DateTime dateTime)
|
||||
{
|
||||
Device = new DeviceId(devId);
|
||||
Time = new Time(dateTime);
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
Device = new DeviceId(ref arr, ref idx);
|
||||
Time = new Time(ref arr, ref idx);
|
||||
}
|
||||
|
||||
public void Serialize(ref List<byte> arr)
|
||||
{
|
||||
new VariableLengthQuantity((uint)PDUType).Serialize(ref arr);
|
||||
Device.Serialize(ref arr);
|
||||
Time.Serialize(ref arr);
|
||||
}
|
||||
|
||||
public string LogString()
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
Device.LogString(ref sb);
|
||||
sb.Append(" - ");
|
||||
Time.LogString(ref sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using Aperio_Control_Centre.Aadp.Types.ApplicationTypes;
|
||||
using System.Text;
|
||||
|
||||
namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
{
|
||||
public class GetTimeResult : CommandDeviceIdBase, IPduCommand
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.GetTimeResult;
|
||||
|
||||
public Time Time { get; private set; } = new();
|
||||
|
||||
public GetTimeResult() { }
|
||||
//public GetTimeResult(string devId, DateTime dateTime)
|
||||
//{
|
||||
// Device = new DeviceId(devId);
|
||||
// Time = new Time(dateTime);
|
||||
//}
|
||||
public GetTimeResult(DeviceId deviceId, Time time)
|
||||
{
|
||||
Device = deviceId;
|
||||
Time = time;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
Device = new DeviceId(ref arr, ref idx);
|
||||
Time = new Time(ref arr, ref idx);
|
||||
}
|
||||
|
||||
public void Serialize(ref List<byte> arr)
|
||||
{
|
||||
new VariableLengthQuantity((uint)PDUType).Serialize(ref arr);
|
||||
Device.Serialize(ref arr);
|
||||
Time.Serialize(ref arr);
|
||||
}
|
||||
|
||||
public string LogString()
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
Device.LogString(ref sb);
|
||||
sb.Append(" - ");
|
||||
Time.LogString(ref sb);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.SetTimeCommand;
|
||||
|
||||
public Time Time { get; set; } = new();
|
||||
public Time Time { get; private set; } = new();
|
||||
|
||||
public SetTimeCommand() { }
|
||||
public SetTimeCommand(byte[] device, DateTime dateTime)
|
||||
{
|
||||
Device = new DeviceId(device);
|
||||
Time = new Time(dateTime);
|
||||
}
|
||||
//public SetTimeCommand(byte[] device, DateTime dateTime)
|
||||
//{
|
||||
// Device = new DeviceId(device);
|
||||
// Time = new Time(dateTime);
|
||||
//}
|
||||
public SetTimeCommand(DeviceId device, DateTime dateTime)
|
||||
{
|
||||
Device = device;
|
||||
|
||||
@@ -8,12 +8,17 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.SetTimeResult;
|
||||
|
||||
public Enumerations.Status Result { get; set; }
|
||||
public Enumerations.Status Result { get; private set; }
|
||||
|
||||
public SetTimeResult() { }
|
||||
public SetTimeResult(string devId, Enumerations.Status result)
|
||||
//public SetTimeResult(string devId, Enumerations.Status result)
|
||||
//{
|
||||
// Device = new DeviceId(devId);
|
||||
// Result = result;
|
||||
//}
|
||||
public SetTimeResult(DeviceId deviceId, Enumerations.Status result)
|
||||
{
|
||||
Device = new DeviceId(devId);
|
||||
Device = deviceId;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,18 @@ namespace Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.TimeNotification;
|
||||
|
||||
public Time Time { get; set; } = new();
|
||||
public Time Time { get; private set; } = new();
|
||||
|
||||
public TimeNotification() { }
|
||||
public TimeNotification(string devid, DateTime dateTime)
|
||||
//public TimeNotification(string devid, DateTime dateTime)
|
||||
//{
|
||||
// Device = new DeviceId(devid);
|
||||
// Time = new Time(dateTime);
|
||||
//}
|
||||
public TimeNotification(DeviceId deviceId, Time time)
|
||||
{
|
||||
Device = new DeviceId(devid);
|
||||
Time = new Time(dateTime);
|
||||
Device = deviceId;
|
||||
Time = time;
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
|
||||
@@ -13,9 +13,19 @@ namespace Aperio_Control_Centre.Aadp.Commands.OutputToUser
|
||||
public Timing IndicationTime { get; set; } = new();
|
||||
|
||||
public IndicationCommand() { }
|
||||
public IndicationCommand(string devid, Enumerations.DoorSide doorside, Enumerations.Indication indication, uint time, Enumerations.TimingMode mode)
|
||||
//public IndicationCommand(string devid, Enumerations.DoorSide doorside, Enumerations.Indication indication, uint time, Enumerations.TimingMode mode)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devid);
|
||||
// DoorSide = doorside;
|
||||
// Indications =
|
||||
// [
|
||||
// indication
|
||||
// ];
|
||||
// IndicationTime = new Timing(time, mode);
|
||||
//}
|
||||
public IndicationCommand(Id id, Enumerations.DoorSide doorside, Enumerations.Indication indication, uint time, Enumerations.TimingMode mode)
|
||||
{
|
||||
DeviceGroupId = new Id(devid);
|
||||
DeviceGroupId = id;
|
||||
DoorSide = doorside;
|
||||
Indications =
|
||||
[
|
||||
|
||||
@@ -8,12 +8,17 @@ namespace Aperio_Control_Centre.Aadp.Commands.OutputToUser
|
||||
{
|
||||
public Enumerations.PDUTypes PDUType => Enumerations.PDUTypes.IndicationResult;
|
||||
|
||||
public Enumerations.Status Result { get; set; }
|
||||
public Enumerations.Status Result { get; private set; }
|
||||
|
||||
public IndicationResult() { }
|
||||
public IndicationResult(string devid, Enumerations.Status result)
|
||||
//public IndicationResult(string devid, Enumerations.Status result)
|
||||
//{
|
||||
// DeviceGroupId = new Id(devid);
|
||||
// Result = result;
|
||||
//}
|
||||
public IndicationResult(Id id, Enumerations.Status result)
|
||||
{
|
||||
DeviceGroupId = new Id(devid);
|
||||
DeviceGroupId = id;
|
||||
Result = result;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@ namespace Aperio_Control_Centre.Aadp.Types.ApplicationTypes
|
||||
public class DeviceId : IPduType
|
||||
{
|
||||
//Byte array with 12 bytes "0x00, 0x17, 0x7A, 0x01, 0x02, 0x04, 0x12, 0xF5, 0x00, 0x00, 0x00, 0x00,"
|
||||
|
||||
// A DeviceID is the unique identity of a device attached to a door.
|
||||
// The DeviceID is represented as 12 bytes.
|
||||
|
||||
public static int Length => 12;
|
||||
|
||||
public byte[] Id = new byte[12];
|
||||
@@ -13,9 +17,12 @@ namespace Aperio_Control_Centre.Aadp.Types.ApplicationTypes
|
||||
public DeviceId(string id)
|
||||
{
|
||||
Id = [0x00, 0x17, 0x7A, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,];
|
||||
Id[5] = Convert.ToByte(id.Substring(0, 2), 16);
|
||||
Id[6] = Convert.ToByte(id.Substring(2, 2), 16);
|
||||
Id[7] = Convert.ToByte(id.Substring(4, 2), 16);
|
||||
if (id.Length == 6)
|
||||
{
|
||||
Id[5] = Convert.ToByte(id.Substring(0, 2), 16);
|
||||
Id[6] = Convert.ToByte(id.Substring(2, 2), 16);
|
||||
Id[7] = Convert.ToByte(id.Substring(4, 2), 16);
|
||||
}
|
||||
}
|
||||
public DeviceId(byte[] arr)
|
||||
{
|
||||
@@ -32,12 +39,16 @@ namespace Aperio_Control_Centre.Aadp.Types.ApplicationTypes
|
||||
{
|
||||
Deserialize(ref arr, ref idx);
|
||||
}
|
||||
public string ToId()
|
||||
public string ToIdString()
|
||||
{
|
||||
byte[] id = new byte[3];
|
||||
Array.Copy(Id, 5, id, 0, 3);
|
||||
return Helpers.ByteArrayToStringWithoutSpaces(id);
|
||||
}
|
||||
public Id ToId()
|
||||
{
|
||||
return new Id(ToIdString());
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
using System.Text;
|
||||
using Aperio_Control_Centre.Aadp.Enumerations;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Aperio_Control_Centre.Aadp.Types.ApplicationTypes
|
||||
{
|
||||
public class Id : IPduType
|
||||
{
|
||||
//String with 6 chars "0412F5"
|
||||
|
||||
// An ID is a sequence of characters.
|
||||
// The representation uses ASCII as the encoding of the characters.
|
||||
// ASCII is the first 127 characters in a UTF-8 table.
|
||||
// The sequence of characters is preceded by a length indicator encoded as a UintVar.
|
||||
// The maximum length of an ID is 15
|
||||
|
||||
public string Charaters { get; set; } = string.Empty;
|
||||
|
||||
public Id() { }
|
||||
@@ -17,12 +26,6 @@ namespace Aperio_Control_Centre.Aadp.Types.ApplicationTypes
|
||||
Charaters = data;
|
||||
}
|
||||
|
||||
|
||||
public DeviceId ToDeviceId()
|
||||
{
|
||||
return new DeviceId(Charaters);
|
||||
}
|
||||
|
||||
public void Deserialize(ref byte[] arr, ref int idx)
|
||||
{
|
||||
Charaters = PrimitiveType.DeserializeString(ref arr, ref idx);
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Aperio_Control_Centre.Aadp.Types
|
||||
Id = new(arr);
|
||||
Version = (LockVersions)arr[12];
|
||||
}
|
||||
Debug.WriteLine($"Id:{Id.ToId()} - Version:{Version}");
|
||||
Debug.WriteLine($"Id:{Id.ToIdString()} - Version:{Version}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
private void SetTimeCommandAction(SetTimeCommand cmd)
|
||||
{
|
||||
WriteToDisplay($"RX = {cmd} {cmd.LogString()}");
|
||||
SetTimeResult setTimeResult = new(HubId, Status.OK);
|
||||
SetTimeResult setTimeResult = new(new DeviceId(HubId), Status.OK);
|
||||
AperioConnection.WriteToServer(PduMessage.Serialize(setTimeResult));
|
||||
WriteToDisplay($"TX = {setTimeResult.PDUType} {setTimeResult.LogString()}");
|
||||
}
|
||||
@@ -257,7 +257,7 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
List<DeviceParameterNotificationBlock> parameterResultBlock = [];
|
||||
if (item.Name == "FwVersion")
|
||||
{
|
||||
parameterResultBlock.Add(new DeviceParameterNotificationBlock("FwVersion", "TEST", Status.OK));
|
||||
parameterResultBlock.Add(new DeviceParameterNotificationBlock("FwVersion", "TEST", Status.OK));
|
||||
}
|
||||
else if (item.Name == "MainHwVersion")
|
||||
{
|
||||
@@ -279,7 +279,7 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
}
|
||||
}
|
||||
|
||||
GetDeviceParameterResult deviceParameterResult = new(HubId, parameterResultBlock);
|
||||
GetDeviceParameterResult deviceParameterResult = new(new DeviceId(HubId), parameterResultBlock);
|
||||
AperioConnection.WriteToServer(PduMessage.Serialize(deviceParameterResult));
|
||||
WriteToDisplay($"TX = {deviceParameterResult.PDUType} {deviceParameterResult.LogString()}");
|
||||
}
|
||||
@@ -288,12 +288,12 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
private void GetTamperStateCommandAction(GetTamperStateCommand cmd)
|
||||
{
|
||||
WriteToDisplay($"RX = {cmd} {cmd.LogString()}");
|
||||
TamperStateResult result = new()
|
||||
{
|
||||
DeviceGroupId = new(HubId),
|
||||
//State = RandomData.GetRandomEnumValue<Enumerations.TamperState>()
|
||||
State = TamperState.NO_TAMPER
|
||||
};
|
||||
TamperStateResult result = new(new(HubId), TamperState.NO_TAMPER);
|
||||
//{
|
||||
// DeviceGroupId = new(HubId),
|
||||
// //State = RandomData.GetRandomEnumValue<Enumerations.TamperState>()
|
||||
// State = TamperState.NO_TAMPER
|
||||
//};
|
||||
AperioConnection.WriteToServer(PduMessage.Serialize(result));
|
||||
WriteToDisplay($"TX = {result.PDUType} {result.LogString()}");
|
||||
}
|
||||
@@ -302,19 +302,19 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
{
|
||||
WriteToDisplay($"RX = {cmd} {cmd.LogString()}");
|
||||
|
||||
if (cmd.Device.ToId() == HubId)
|
||||
if (cmd.Device.ToIdString() == HubId)
|
||||
{
|
||||
GetDtcStatusResult getDtc = new()
|
||||
{
|
||||
Device = new(HubId),
|
||||
//DTCs = new List<DtcInfo>()
|
||||
//{
|
||||
// new DtcInfo()
|
||||
// {
|
||||
// c
|
||||
// }
|
||||
//}
|
||||
};
|
||||
GetDtcStatusResult getDtc = new(new DeviceId(HubId));
|
||||
//{
|
||||
// Device = new(HubId),
|
||||
// //DTCs = new List<DtcInfo>()
|
||||
// //{
|
||||
// // new DtcInfo()
|
||||
// // {
|
||||
// // c
|
||||
// // }
|
||||
// //}
|
||||
//};
|
||||
AperioConnection.WriteToServer(PduMessage.Serialize(getDtc));
|
||||
WriteToDisplay($"TX = {getDtc.PDUType} {getDtc.LogString()}");
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
{
|
||||
WriteDisplayLogEvent?.Invoke(this, $"RX = {indicationCommand} {indicationCommand.LogString()}");
|
||||
//WriteDisplayLogEvent?.Invoke(this, $"IndicationCommand {indicationCommand.DeviceGroupId.Charaters} Time : {time} milliseconden");
|
||||
IndicationResult indicationResult = new(indicationCommand.DeviceGroupId.Charaters, Status.OK);
|
||||
IndicationResult indicationResult = new(new Id(indicationCommand.DeviceGroupId.Charaters), Status.OK);
|
||||
SendData?.Invoke(this, PduMessage.Serialize(indicationResult));
|
||||
WriteDisplayLogEvent?.Invoke(this, $"TX = {indicationResult.PDUType} {indicationResult.LogString()}");
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
{
|
||||
WriteDisplayLogEvent?.Invoke(this, $"RX = {doorOpeningCommand} {doorOpeningCommand.LogString()}");
|
||||
//WriteDisplayLogEvent?.Invoke(this, $"DoorOpeningCommand {doorOpeningCommand.DeviceGroupId.Charaters} Time : {time} milliseconden");
|
||||
DoorOpeningResult doorOpeningResult = new(doorOpeningCommand.DeviceGroupId.Charaters, Status.OK);
|
||||
DoorOpeningResult doorOpeningResult = new(new Id(doorOpeningCommand.DeviceGroupId.Charaters), Status.OK);
|
||||
SendData?.Invoke(this, PduMessage.Serialize(doorOpeningResult));
|
||||
WriteDisplayLogEvent?.Invoke(this, $"TX = {doorOpeningResult.PDUType} {doorOpeningResult.LogString()}");
|
||||
}
|
||||
@@ -79,12 +79,12 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
public void GetDoorStateCommandAction(GetDoorStateCommand doorstate)
|
||||
{
|
||||
WriteDisplayLogEvent?.Invoke(this, $"RX = {doorstate} {doorstate.LogString()}");
|
||||
DoorStateResult result = new()
|
||||
{
|
||||
DeviceGroupId = new(DeviceID),
|
||||
//State = RandomData.GetRandomEnumValue<Enumerations.DoorState>()
|
||||
State = DoorState.CLOSED
|
||||
};
|
||||
DoorStateResult result = new(new(DeviceID), DoorState.CLOSED);
|
||||
//{
|
||||
// DeviceGroupId = new(DeviceID),
|
||||
// //State = RandomData.GetRandomEnumValue<Enumerations.DoorState>()
|
||||
// State = DoorState.CLOSED
|
||||
//};
|
||||
SendData?.Invoke(this, PduMessage.Serialize(result));
|
||||
WriteDisplayLogEvent?.Invoke(this, $"TX = {result.PDUType} {result.LogString()}");
|
||||
}
|
||||
@@ -92,12 +92,12 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
public void GetLockStateCommandAction(GetLockStateCommand lockstate)
|
||||
{
|
||||
WriteDisplayLogEvent?.Invoke(this, $"RX = {lockstate} {lockstate.LogString()}");
|
||||
LockStateResult result = new()
|
||||
{
|
||||
DeviceGroupId = new(DeviceID),
|
||||
//State = RandomData.GetRandomEnumValue<Enumerations.LockState>()
|
||||
State = LockState.LOCKED
|
||||
};
|
||||
LockStateResult result = new(new(DeviceID), LockState.LOCKED);
|
||||
//{
|
||||
// DeviceGroupId = new(DeviceID),
|
||||
// //State = RandomData.GetRandomEnumValue<Enumerations.LockState>()
|
||||
// State = LockState.LOCKED
|
||||
//};
|
||||
SendData?.Invoke(this, PduMessage.Serialize(result));
|
||||
WriteDisplayLogEvent?.Invoke(this, $"TX = {result.PDUType} {result.LogString()}");
|
||||
}
|
||||
@@ -105,12 +105,12 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
public void GetHandleStateCommandAction(GetHandleStateCommand handlestate)
|
||||
{
|
||||
WriteDisplayLogEvent?.Invoke(this, $"RX = {handlestate} {handlestate.LogString()}");
|
||||
HandleStateResult result = new()
|
||||
{
|
||||
DeviceGroupId = new(DeviceID),
|
||||
//State = RandomData.GetRandomEnumValue<Enumerations.HandleState>()
|
||||
State = HandleState.NOT_USED
|
||||
};
|
||||
HandleStateResult result = new(new(DeviceID), HandleState.NOT_USED);
|
||||
//{
|
||||
// DeviceGroupId = new(DeviceID),
|
||||
// //State = RandomData.GetRandomEnumValue<Enumerations.HandleState>()
|
||||
// State = HandleState.NOT_USED
|
||||
//};
|
||||
SendData?.Invoke(this, PduMessage.Serialize(result));
|
||||
WriteDisplayLogEvent?.Invoke(this, $"TX = {result.PDUType} {result.LogString()}");
|
||||
}
|
||||
@@ -118,12 +118,12 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
public void GetKeyCylinderStateCommandAction(GetKeyCylinderStateCommand state)
|
||||
{
|
||||
WriteDisplayLogEvent?.Invoke(this, $"RX = {state} {state.LogString()}");
|
||||
KeyCylinderStateResult result = new()
|
||||
{
|
||||
DeviceGroupId = new(DeviceID),
|
||||
//State = RandomData.GetRandomEnumValue<Enumerations.KeyCylinderState>()
|
||||
State = KeyCylinderState.NOT_USED
|
||||
};
|
||||
KeyCylinderStateResult result = new(new(DeviceID), KeyCylinderState.NOT_USED);
|
||||
//{
|
||||
// DeviceGroupId = new(DeviceID),
|
||||
// //State = RandomData.GetRandomEnumValue<Enumerations.KeyCylinderState>()
|
||||
// State = KeyCylinderState.NOT_USED
|
||||
//};
|
||||
SendData?.Invoke(this, PduMessage.Serialize(result));
|
||||
WriteDisplayLogEvent?.Invoke(this, $"TX = {result.PDUType} {result.LogString()}");
|
||||
}
|
||||
@@ -139,12 +139,12 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
public void GetDoorModeCommandAction(GetDoorModeCommand cmd)
|
||||
{
|
||||
WriteDisplayLogEvent?.Invoke(this, $"RX = {cmd} {cmd.LogString()}");
|
||||
GetDoorModeResult result = new()
|
||||
{
|
||||
DeviceGroupId = new(DeviceID),
|
||||
//Mode = RandomData.GetRandomEnumValue<Enumerations.DoorMode>()
|
||||
Mode = DoorMode.INSIDEOUT_LOCKED
|
||||
};
|
||||
GetDoorModeResult result = new(new Id(DeviceID), DoorMode.INSIDEOUT_LOCKED);
|
||||
//{
|
||||
// DeviceGroupId = new(DeviceID),
|
||||
// //Mode = RandomData.GetRandomEnumValue<Enumerations.DoorMode>()
|
||||
// Mode = DoorMode.INSIDEOUT_LOCKED
|
||||
//};
|
||||
SendData?.Invoke(this, PduMessage.Serialize(result));
|
||||
WriteDisplayLogEvent?.Invoke(this, $"TX = {result.PDUType} {result.LogString()}");
|
||||
}
|
||||
@@ -158,6 +158,6 @@ namespace Aperio_Control_Centre.ConnectionTester.Aperio
|
||||
(byte)LockVersions.APERIO_V3,
|
||||
];
|
||||
return lockversion.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,11 +224,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new TamperStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = TamperState.TAMPER
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new TamperStateNotification()
|
||||
//{
|
||||
// DeviceGroupId = new("AA11BB"),
|
||||
// State = TamperState.TAMPER
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new TamperStateNotification(new Id("AA11BB"), TamperState.TAMPER), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -261,11 +262,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new TamperStateResult()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = TamperState.TAMPER
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new TamperStateResult(new Id("AA11BB"), TamperState.TAMPER), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -463,11 +460,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new DtcNotification()
|
||||
{
|
||||
Device = new("AA11BB"),
|
||||
DTC = new DtcInfo(new DTC(DTCEnumerations.Type.VOLTAGE_BELOW_MIN, DTCEnumerations.Source.BACKUP_BATTERY, 10), 35689, true, false, true)
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new DtcNotification()
|
||||
//{
|
||||
// Device = new("AA11BB"),
|
||||
// DTC = new DtcInfo(new DTC(DTCEnumerations.Type.VOLTAGE_BELOW_MIN, DTCEnumerations.Source.BACKUP_BATTERY, 10), 35689, true, false, true)
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new DtcNotification(new("AA11BB"), new DtcInfo(new DTC(DTCEnumerations.Type.VOLTAGE_BELOW_MIN, DTCEnumerations.Source.BACKUP_BATTERY, 10), 35689, true, false, true)), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
@@ -492,10 +490,11 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
|
||||
var dtc = new GetDtcStatusResult()
|
||||
{
|
||||
Device = new("AA11BB"),
|
||||
};
|
||||
//var dtc = new GetDtcStatusResult()
|
||||
//{
|
||||
// Device = new("AA11BB"),
|
||||
//};
|
||||
GetDtcStatusResult dtc = new(new("AA11BB"));
|
||||
dtc.DTCs.Add(new DtcInfo(new DTC(DTCEnumerations.Type.VOLTAGE_BELOW_MIN, DTCEnumerations.Source.BACKUP_BATTERY, 10), 35689, true, false, true));
|
||||
|
||||
device.HandleMessage(dtc, _token).Wait();
|
||||
@@ -525,11 +524,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new ClearDtcResult()
|
||||
{
|
||||
Device = new("AA11BB"),
|
||||
Result = Status.OK
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new ClearDtcResult()
|
||||
//{
|
||||
// Device = new("AA11BB"),
|
||||
// Result = Status.OK
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new ClearDtcResult(new DeviceId("AA11BB"), Status.OK), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
|
||||
@@ -121,11 +121,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new DoorStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = DoorState.CLOSED
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new DoorStateNotification(new("AA11BB"), DoorState.CLOSED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -157,11 +153,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new LockStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = LockState.JAMMED
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new LockStateNotification(new("AA11BB"), LockState.JAMMED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -201,11 +193,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new DoorModeNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
Mode = DoorMode.INSIDEOUT_LOCKED
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new DoorModeNotification(new("AA11BB"), DoorMode.INSIDEOUT_LOCKED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
@@ -227,11 +215,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new GetSupportedDoorModesResult()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
DoorModes = modes
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new GetSupportedDoorModesResult(new("AA11BB"), modes), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
@@ -424,11 +408,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new DoorStateResult()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = DoorState.OPEN
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new DoorStateResult(new("AA11BB"), DoorState.OPEN), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -460,11 +440,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new DoorStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = DoorState.CLOSED
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new DoorStateNotification(new("AA11BB"), DoorState.CLOSED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -498,11 +474,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new LockStateResult()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = LockState.LOCKED
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new LockStateResult(new("AA11BB"), LockState.LOCKED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -535,11 +507,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new LockStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = LockState.JAMMED
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new LockStateNotification(new("AA11BB"), LockState.JAMMED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
Assert.AreEqual("System - Device AA99BB - Connection changed to ABDCEDFG", _screenLogging.Messages[0]);
|
||||
_screenLogging.Messages.Clear();
|
||||
|
||||
Assert.HasCount(1,_statusBroadcast.Messages);
|
||||
Assert.HasCount(1, _statusBroadcast.Messages);
|
||||
Assert.AreEqual("SendDeviceAdded AA99BB", _statusBroadcast.Messages[0]);
|
||||
_statusBroadcast.Messages.Clear();
|
||||
|
||||
@@ -79,11 +79,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new TimeNotification()
|
||||
{
|
||||
Device = new("AA11BB"),
|
||||
Time = new Time(new DateTime(2025, 9, 1)),
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new TimeNotification()
|
||||
//{
|
||||
// Device = new("AA11BB"),
|
||||
// Time = new Time(new DateTime(2025, 9, 1)),
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new TimeNotification(new DeviceId("AA11BB"), new Time(new DateTime(2025, 9, 1))), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
@@ -109,11 +110,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new SetTimeResult()
|
||||
{
|
||||
Device = new("AA11BB"),
|
||||
Result = Status.FAIL_PERMISSION
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new SetTimeResult()
|
||||
//{
|
||||
// Device = new("AA11BB"),
|
||||
// Result = Status.FAIL_PERMISSION
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new SetTimeResult(new DeviceId("AA11BB"), Status.FAIL_PERMISSION), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
@@ -141,11 +143,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new GetTimeResult()
|
||||
{
|
||||
Device = new("AA11BB"),
|
||||
Time = new Time(new DateTime(2025, 9, 1))
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new GetTimeResult()
|
||||
//{
|
||||
// Device = new("AA11BB"),
|
||||
// Time = new Time(new DateTime(2025, 9, 1))
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new GetTimeResult(new DeviceId("AA11BB"), new Time(new DateTime(2025, 9, 1))), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Aperio_Control_Centre.Aadp.Commands.DeviceStates;
|
||||
using Aperio_Control_Centre.Aadp.Commands.OperationAndMaintenance;
|
||||
using Aperio_Control_Centre.Aadp.Enumerations;
|
||||
using Aperio_Control_Centre.Aadp.Types.ApplicationTypes;
|
||||
using Aperio_Control_Centre.ACSDatabase;
|
||||
using Aperio_Control_Centre.ACSDatabase.Models;
|
||||
using Aperio_Control_Centre.ACSDatabase.Types;
|
||||
@@ -30,7 +31,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
lockDevice.SetDevice(new("AA1234"), new("445566"), _aperioConnectionContext, _token).Wait();
|
||||
|
||||
Assert.AreEqual("AA1234", lockDevice.Id);
|
||||
Assert.AreEqual("445566", lockDevice.HubDeviceId.ToId());
|
||||
Assert.AreEqual("445566", lockDevice.HubDeviceId.ToIdString());
|
||||
Assert.AreNotEqual(0, lockDevice.LastData.Ticks);
|
||||
Assert.IsNotNull(lockDevice.Connection);
|
||||
Assert.AreEqual("64.226.1.0", lockDevice.IPAddress);
|
||||
@@ -132,7 +133,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
{
|
||||
AperioLockDevice device = CreateAperioLockDevice();
|
||||
|
||||
Assert.AreEqual("445566", device.HubDeviceId.ToId());
|
||||
Assert.AreEqual("445566", device.HubDeviceId.ToIdString());
|
||||
Assert.IsNotNull(device.Connection);
|
||||
Assert.AreEqual("64.226.1.0", device.IPAddress);
|
||||
Assert.AreEqual(ConnectionStates.Offline, device.ConnectionState);
|
||||
@@ -154,13 +155,13 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
Assert.IsNotNull(_screenLogging);
|
||||
Assert.IsNotNull(_statusBroadcast);
|
||||
Assert.IsNotNull(_aperioConnectionContext);
|
||||
|
||||
|
||||
device = new(_screenLogging, _statusBroadcast, _dbContextFactory, CreateAperioServerOptions());
|
||||
device.SetDevice(new("AA11BB"), new("FFEECC"), _aperioConnectionContext, _token).Wait();
|
||||
|
||||
Assert.IsNotNull(device.Connection);
|
||||
|
||||
Assert.AreEqual("FFEECC", device.HubDeviceId.ToId());
|
||||
Assert.AreEqual("FFEECC", device.HubDeviceId.ToIdString());
|
||||
|
||||
Assert.IsEmpty(_statusBroadcast.Messages);
|
||||
|
||||
@@ -260,11 +261,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new KeyCylinderStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = KeyCylinderState.USED
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new KeyCylinderStateNotification()
|
||||
//{
|
||||
// DeviceGroupId = new("AA11BB"),
|
||||
// State = KeyCylinderState.USED
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new KeyCylinderStateNotification(new Id("AA11BB"), KeyCylinderState.USED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -298,11 +300,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new HandleStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
State = HandleState.BOTH_USED
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new HandleStateNotification()
|
||||
//{
|
||||
// DeviceGroupId = new("AA11BB"),
|
||||
// State = HandleState.BOTH_USED
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new HandleStateNotification(new Id("AA11BB"), HandleState.BOTH_USED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -336,11 +339,12 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new GetAuditTrailResult()
|
||||
{
|
||||
Device = new("AA11BB"),
|
||||
Result = Status.OK
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new GetAuditTrailResult()
|
||||
//{
|
||||
// Device = new("AA11BB"),
|
||||
// Result = Status.OK
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new GetAuditTrailResult(new DeviceId("AA11BB"), Status.OK), _token).Wait();
|
||||
|
||||
Assert.AreEqual(1, eventFired);
|
||||
|
||||
@@ -372,15 +376,16 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
|
||||
int eventFired = 0;
|
||||
device.DeviceChanged += (s, e) => { eventFired++; };
|
||||
device.HandleMessage(new AuditTrailNotification()
|
||||
{
|
||||
Device = new("AA11BB"),
|
||||
TimeStamp = new(0),
|
||||
AccessDecision = AccessDecision.DENIED,
|
||||
MessageType = AuditTrailMessageType.AUDIT_TRAIL_ITEM,
|
||||
//Credential = [new(CredentialBlockType.MIFAREUID, [0x00, 0x01, 0x02])],
|
||||
PacketSequence = new()
|
||||
}, _token).Wait();
|
||||
//device.HandleMessage(new AuditTrailNotification()
|
||||
//{
|
||||
// Device = new("AA11BB"),
|
||||
// TimeStamp = new(0),
|
||||
// AccessDecision = AccessDecision.DENIED,
|
||||
// MessageType = AuditTrailMessageType.AUDIT_TRAIL_ITEM,
|
||||
// //Credential = [new(CredentialBlockType.MIFAREUID, [0x00, 0x01, 0x02])],
|
||||
// PacketSequence = new()
|
||||
//}, _token).Wait();
|
||||
device.HandleMessage(new AuditTrailNotification(new DeviceId("AA11BB"), new PacketSequenceNumber(), AuditTrailMessageType.AUDIT_TRAIL_ITEM, new TimeStamp(), AccessDecision.DENIED), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
|
||||
@@ -151,11 +151,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
{
|
||||
eventFired++;
|
||||
};
|
||||
device.HandleMessage(new ActivatorStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
ActivatorInfo = activatorInfo,
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new ActivatorStateNotification(new("AA11BB"), activatorInfo), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
@@ -203,11 +199,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
{
|
||||
eventFired++;
|
||||
};
|
||||
device.HandleMessage(new ActivatorStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
ActivatorInfo = activatorInfo,
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new ActivatorStateNotification(new("AA11BB"), activatorInfo), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
@@ -254,11 +246,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer
|
||||
{
|
||||
eventFired++;
|
||||
};
|
||||
device.HandleMessage(new ActivatorStateNotification()
|
||||
{
|
||||
DeviceGroupId = new("AA11BB"),
|
||||
ActivatorInfo = activatorInfo,
|
||||
}, _token).Wait();
|
||||
device.HandleMessage(new ActivatorStateNotification(new("AA11BB"), activatorInfo), _token).Wait();
|
||||
|
||||
Assert.AreEqual(0, eventFired);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer.Setups
|
||||
|
||||
public IAperioTimeoutFeature TimeoutFeature => new TestingAperioTimeoutFeature();
|
||||
|
||||
public string Id => _deviceId.ToId();
|
||||
public string Id => _deviceId.ToIdString();
|
||||
|
||||
public string Name => throw new NotImplementedException();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer.Setups
|
||||
|
||||
public IAperioTimeoutFeature TimeoutFeature => new TestingAperioTimeoutFeature();
|
||||
|
||||
public string Id => _deviceId.ToId();
|
||||
public string Id => _deviceId.ToIdString();
|
||||
|
||||
public string Name => throw new NotImplementedException();
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Aperio_Control_Centre.UnitTest.AperioServer.Setups
|
||||
|
||||
public IAperioTimeoutFeature TimeoutFeature => new TestingAperioTimeoutFeature();
|
||||
|
||||
public string Id => _deviceId.ToId();
|
||||
public string Id => _deviceId.ToIdString();
|
||||
|
||||
public string Name => throw new NotImplementedException();
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ namespace Aperio_Control_Centre.AperioServer
|
||||
|
||||
if (pducommand is CommandDeviceIdBase deviceid)
|
||||
{
|
||||
Debug.WriteLine($"----> CommandDeviceIdBase - {pducommand.PDUType} - {deviceid.Device.ToId()}");
|
||||
Debug.WriteLine($"----> CommandDeviceIdBase - {pducommand.PDUType} - {deviceid.Device.ToIdString()}");
|
||||
|
||||
|
||||
IAperioBase? device = _devicesList.GetDevice(deviceid.Device);
|
||||
@@ -328,7 +328,7 @@ namespace Aperio_Control_Centre.AperioServer
|
||||
{
|
||||
foreach (DeviceDefinition device in deviceListResult.Devices)
|
||||
{
|
||||
Debug.WriteLine($"GetDeviceListResult Device - {device.DeviceIdentity.ToId()} - {device.DeviceType} - {device.Host.ToId()}");
|
||||
Debug.WriteLine($"GetDeviceListResult Device - {device.DeviceIdentity.ToIdString()} - {device.DeviceType} - {device.Host.ToIdString()}");
|
||||
await _devicesList.AddOrUpdateDevice(device, this, token);
|
||||
}
|
||||
}
|
||||
@@ -396,7 +396,7 @@ namespace Aperio_Control_Centre.AperioServer
|
||||
//}
|
||||
else
|
||||
{
|
||||
Logger.LogInformation(_logger, $"Unknown device parameter device:{devId.ToId()} name:{block.Name.Name} value:{(string)block.Value.Value}");
|
||||
Logger.LogInformation(_logger, $"Unknown device parameter device:{devId.ToIdString()} name:{block.Name.Name} value:{(string)block.Value.Value}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,14 +52,14 @@ namespace Aperio_Control_Centre.AperioServer
|
||||
}
|
||||
public IAperioBase? GetDevice(DeviceId deviceId)
|
||||
{
|
||||
return GetDevice(deviceId.ToId());
|
||||
return GetDevice(deviceId.ToIdString());
|
||||
}
|
||||
|
||||
|
||||
//----------------------------- Add Device -----------------------------------------------------------------------------
|
||||
public async Task AddOrUpdateDevice(DeviceDefinition definition, IAperioConnectionContext conn, CancellationToken token)
|
||||
{
|
||||
string deviceId = definition?.DeviceIdentity.ToId() ?? string.Empty;
|
||||
string deviceId = definition?.DeviceIdentity.ToIdString() ?? string.Empty;
|
||||
|
||||
if (!_deviceDictionary.TryGetValue(deviceId, out IAperioBase? aperioDevice))
|
||||
{
|
||||
|
||||
@@ -13,7 +13,6 @@ using Aperio_Control_Centre.ScreenLogging;
|
||||
using Aperio_Control_Centre.StatusBroadcast;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
using OfficeOpenXml.FormulaParsing.LexicalAnalysis;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
await SetConnection(conn, token);
|
||||
}
|
||||
|
||||
protected async Task WriteToDevice(IPduCommand command, CancellationToken token)
|
||||
private protected async Task WriteToDevice(IPduCommand command, CancellationToken token)
|
||||
{
|
||||
if (Connection != null)
|
||||
{
|
||||
@@ -61,11 +60,9 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
}
|
||||
}
|
||||
|
||||
protected private DeviceId? _deviceId;
|
||||
public string Id
|
||||
{
|
||||
get => _deviceId != null ? _deviceId.ToId() : string.Empty;
|
||||
}
|
||||
private protected DeviceId _deviceId = new();
|
||||
|
||||
public string Id => _deviceId.ToIdString();
|
||||
|
||||
public string Name { get; private set; } = string.Empty;
|
||||
|
||||
@@ -78,7 +75,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
{
|
||||
return await db.Devices.FindAsync([DataBaseDeviceID], token);
|
||||
}
|
||||
Device? device = await db.Devices.GetDeviceFromString(Id, token);
|
||||
Device? device = await db.Devices.GetDeviceFromString(_deviceId.ToIdString(), token);
|
||||
if (device != null)
|
||||
{
|
||||
DataBaseDeviceID = device.Id;
|
||||
@@ -109,7 +106,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
public string IPAddress => Connection?.Address.ToIpString() ?? "??";
|
||||
public async Task SetConnection(IAperioConnectionContext conn, CancellationToken token)
|
||||
{
|
||||
Debug.WriteLine($"SetConnection - {Id} - {Connection?.ConnectionId} - {conn?.ConnectionId}");
|
||||
Debug.WriteLine($"SetConnection - {_deviceId.ToIdString()} - {Connection?.ConnectionId} - {conn?.ConnectionId}");
|
||||
if (Connection != conn)
|
||||
{
|
||||
Connection = conn;
|
||||
@@ -118,7 +115,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - Connection changed to {Connection?.ConnectionId}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - Connection changed to {Connection?.ConnectionId}"
|
||||
});
|
||||
|
||||
using ACSDatabaseContext db = await _contextFactory.CreateDbContextAsync(token);
|
||||
@@ -134,7 +131,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - Ip address changed to {IPAddress}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - Ip address changed to {IPAddress}"
|
||||
});
|
||||
RaiseDeviceChanged();
|
||||
}
|
||||
@@ -143,7 +140,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
}
|
||||
public void RemoveConnection()
|
||||
{
|
||||
Debug.WriteLine($"RemoveConnection - {Id} - {Connection?.ConnectionId}");
|
||||
Debug.WriteLine($"RemoveConnection - {_deviceId.ToIdString()} - {Connection?.ConnectionId}");
|
||||
|
||||
if (Connection != null)
|
||||
{
|
||||
@@ -180,11 +177,11 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
await db.SaveChangesAsync(token);
|
||||
}
|
||||
}
|
||||
await _statusBroadcast.SendConnectionStatus(Id, ConnectionState, db, token);
|
||||
await _statusBroadcast.SendConnectionStatus(_deviceId.ToIdString(), ConnectionState, db, token);
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - {ConnectionState}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - {ConnectionState}"
|
||||
});
|
||||
RaiseDeviceChanged();
|
||||
}
|
||||
@@ -209,7 +206,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - Device status = {DeviceStatus}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - Device status = {DeviceStatus}"
|
||||
});
|
||||
RaiseDeviceChanged();
|
||||
}
|
||||
@@ -218,7 +215,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
//------------ Tamper state ----------------
|
||||
public async Task GetTamperStateFromDevice(CancellationToken token)
|
||||
{
|
||||
await WriteToDevice(new GetTamperStateCommand(Id), token);
|
||||
await WriteToDevice(new GetTamperStateCommand(_deviceId.ToId()), token);
|
||||
}
|
||||
public TamperState TamperState { get; protected private set; }
|
||||
private async Task SetTamperState(TamperState tamperState, CancellationToken token)
|
||||
@@ -239,11 +236,11 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
await db.SaveChangesAsync(token);
|
||||
}
|
||||
}
|
||||
await _statusBroadcast.SendTamperStatus(Id, TamperState, db, token);
|
||||
await _statusBroadcast.SendTamperStatus(_deviceId.ToIdString(), TamperState, db, token);
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - Tamper = {tamperState}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - Tamper = {tamperState}"
|
||||
});
|
||||
RaiseDeviceChanged();
|
||||
}
|
||||
@@ -286,14 +283,14 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
//Device 0A7B3B - DTC = Category - 'Communication' Type - 'HBEAT_MISSING' Source - 'REMOTE_DEV' ENUM - '0' DtcTime - '20-10-2022 08:57:47' HasFailed TestCompleted
|
||||
//Device 0A7B3B - DTC = Category - 'Electrical' Type - 'VOLTAGE_NEAR_MIN' Source - 'BACKUP_BATTERY' ENUM - '0' DtcTime - '20-10-2022 08:19:54' TestCompleted
|
||||
|
||||
Debug.WriteLine($"{device.ToId()} Id={dtc.DTC.ToValue()} Time={dtc.DtcTime.GetDateTime().ToACSLocalTime()} IsFailling={dtc.IsFailling} HasFailed={dtc.HasFailed} TestCompleted={dtc.TestCompleted} - Source={dtc.DTC.Source} Type={dtc.DTC.Type} Category={dtc.DTC.Category} DTCenum={dtc.DTC.DTCenum}");
|
||||
Debug.WriteLine($"{device.ToIdString()} Id={dtc.DTC.ToValue()} Time={dtc.DtcTime.GetDateTime().ToACSLocalTime()} IsFailling={dtc.IsFailling} HasFailed={dtc.HasFailed} TestCompleted={dtc.TestCompleted} - Source={dtc.DTC.Source} Type={dtc.DTC.Type} Category={dtc.DTC.Category} DTCenum={dtc.DTC.DTCenum}");
|
||||
|
||||
StringBuilder sb = new();
|
||||
dtc.LogString(ref sb);
|
||||
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
Message = $"Device {device.ToId()} - {sb}",
|
||||
Message = $"Device {device.ToIdString()} - {sb}",
|
||||
IPAddress = Connection?.Address,
|
||||
});
|
||||
|
||||
@@ -447,7 +444,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - FirmwareVersion Changed to {_firmwareVersion}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - FirmwareVersion Changed to {_firmwareVersion}"
|
||||
});
|
||||
RaiseDeviceChanged();
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
|
||||
public async Task GetSupportedDoorModesFromDevice(CancellationToken token)
|
||||
{
|
||||
await WriteToDevice(new GetSupportedDoorModesCommand(Id), token);
|
||||
await WriteToDevice(new GetSupportedDoorModesCommand(_deviceId.ToId()), token);
|
||||
}
|
||||
private async Task UpdateDoormodes(List<DoorMode> modes, CancellationToken token)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
|
||||
public async Task GetDoorModeFromDevice(CancellationToken token)
|
||||
{
|
||||
await WriteToDevice(new GetDoorModeCommand(Id), token);
|
||||
await WriteToDevice(new GetDoorModeCommand(_deviceId.ToId()), token);
|
||||
}
|
||||
public DoorMode GetDoorMode()
|
||||
{
|
||||
@@ -67,7 +67,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
//----------------- Door state -----------------------------------------------------
|
||||
public async Task GetDoorStateFromDevice(CancellationToken token)
|
||||
{
|
||||
await WriteToDevice(new GetDoorStateCommand(Id), token);
|
||||
await WriteToDevice(new GetDoorStateCommand(_deviceId.ToId()), token);
|
||||
}
|
||||
public DoorState DoorState { get; private set; }
|
||||
private async Task SetDoorState(DoorState doorState, CancellationToken token)
|
||||
@@ -92,7 +92,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
// ------------------ Lock State ----------------------------------
|
||||
public async Task GetLockStateFromDevice(CancellationToken token)
|
||||
{
|
||||
await WriteToDevice(new GetLockStateCommand(Id), token);
|
||||
await WriteToDevice(new GetLockStateCommand(_deviceId.ToId()), token);
|
||||
}
|
||||
public LockState LockState { get; private set; }
|
||||
private async Task SetLockState(LockState lockState, CancellationToken token)
|
||||
@@ -129,7 +129,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
{
|
||||
if (_deviceId != null)
|
||||
{
|
||||
await WriteToDevice(new DoorOpeningCommand(_deviceId.ToId(), true, true, time, TimingMode.TIME), token);
|
||||
await WriteToDevice(new DoorOpeningCommand(new Id(_deviceId.ToIdString()), true, true, time, TimingMode.TIME), token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
{
|
||||
if (_deviceId != null)
|
||||
{
|
||||
await WriteToDevice(new IndicationCommand(_deviceId.ToId(), DoorSide.BOTH, Indication.DENIED, 10, TimingMode.TIME), token);
|
||||
await WriteToDevice(new IndicationCommand(new Id(_deviceId.ToIdString()), DoorSide.BOTH, Indication.DENIED, 10, TimingMode.TIME), token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
CredentialChecker checker = new(Connection.Address, _screenLogger, db);
|
||||
|
||||
//Check device
|
||||
if (!await checker.CheckDevice(_deviceId.ToId(), token))
|
||||
if (!await checker.CheckDevice(_deviceId.ToIdString(), token))
|
||||
{
|
||||
await DoorDenied(token);
|
||||
return;
|
||||
@@ -242,11 +242,11 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
{
|
||||
if (checker.Device.DoorModes.Where(m => m.DoorMode is DoorMode.FREE_OPEN).Any())
|
||||
{
|
||||
await WriteToDevice(new SetDoorModeCommand(_deviceId.ToId(), DoorMode.FREE_OPEN, checker.Device!.OpenTimeFromNowDeciseconds(), TimingMode.TIME, ExecuteMode.ASAP), token);
|
||||
await WriteToDevice(new SetDoorModeCommand(new Id(_deviceId.ToIdString()), DoorMode.FREE_OPEN, checker.Device!.OpenTimeFromNowDeciseconds(), TimingMode.TIME, ExecuteMode.ASAP), token);
|
||||
}
|
||||
else if (checker.Device.DoorModes.Where(m => m.DoorMode is DoorMode.FREE_UNLOCKED).Any())
|
||||
{
|
||||
await WriteToDevice(new SetDoorModeCommand(_deviceId.ToId(), DoorMode.FREE_UNLOCKED, checker.Device!.OpenTimeFromNowDeciseconds(), TimingMode.TIME, ExecuteMode.ASAP), token);
|
||||
await WriteToDevice(new SetDoorModeCommand(new Id(_deviceId.ToIdString()), DoorMode.FREE_UNLOCKED, checker.Device!.OpenTimeFromNowDeciseconds(), TimingMode.TIME, ExecuteMode.ASAP), token);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
{
|
||||
Ipaddress = ipaddress,
|
||||
Active = ActiveStates.Active,
|
||||
DeviceId = Id,
|
||||
Name = Id,
|
||||
DeviceId = _deviceId.ToIdString(),
|
||||
Name = _deviceId.ToIdString(),
|
||||
LastChanged = DateTime.UtcNow,
|
||||
ProductClass = ProductClass.GATEWAY,
|
||||
};
|
||||
@@ -124,7 +124,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
TimeSpan diff = DateTime.Now.Subtract(time.Stamp.GetDateTime());
|
||||
if (diff.TotalSeconds > 10 || diff.TotalSeconds < -10)
|
||||
{
|
||||
SetTimeCommand setTime = new(deviceId.Id, DateTime.Now);
|
||||
SetTimeCommand setTime = new(deviceId, DateTime.Now);
|
||||
await WriteToDevice(setTime, token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,17 +44,17 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
{
|
||||
Ipaddress = ipaddress,
|
||||
Active = ActiveStates.Active,
|
||||
DeviceId = Id,
|
||||
Name = Id,
|
||||
DeviceId = _deviceId.ToIdString(),
|
||||
Name = _deviceId.ToIdString(),
|
||||
LastChanged = DateTime.UtcNow,
|
||||
UnlockTime = 5,
|
||||
ProductClass = ProductClass.LOCK,
|
||||
HubId = HubDeviceId.ToId(),
|
||||
HubId = HubDeviceId.ToIdString(),
|
||||
};
|
||||
|
||||
Device? hub = await db.Devices
|
||||
.Where(d => d.ProductClass == ProductClass.GATEWAY)
|
||||
.Where(d => d.DeviceId == HubDeviceId.ToId())
|
||||
.Where(d => d.DeviceId == HubDeviceId.ToIdString())
|
||||
.Where(d => d.Active != ActiveStates.Deleted)
|
||||
.Include(l => l.Location)
|
||||
.SingleOrDefaultAsync(token);
|
||||
@@ -75,7 +75,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
//Update device
|
||||
Device? hub = await db.Devices
|
||||
.Where(d => d.ProductClass == ProductClass.GATEWAY)
|
||||
.Where(d => d.DeviceId == HubDeviceId.ToId())
|
||||
.Where(d => d.DeviceId == HubDeviceId.ToIdString())
|
||||
.Where(d => d.Active != ActiveStates.Deleted)
|
||||
.Include(l => l.Location)
|
||||
.SingleOrDefaultAsync(token);
|
||||
@@ -134,13 +134,13 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
await db.Loggings.AddLogAsync(dbDevice, BatteryState, token);
|
||||
await db.SaveChangesAsync(token);
|
||||
|
||||
await _statusBroadcast.SendBatteryStatus(Id, BatteryState, db, token);
|
||||
await _statusBroadcast.SendBatteryStatus(_deviceId.ToIdString(), BatteryState, db, token);
|
||||
}
|
||||
}
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - Battery state = {batteryState}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - Battery state = {batteryState}"
|
||||
});
|
||||
RaiseDeviceChanged();
|
||||
}
|
||||
@@ -150,7 +150,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
|
||||
public async Task GetKeyCylinderStateFromDevice(CancellationToken token)
|
||||
{
|
||||
await WriteToDevice(new GetKeyCylinderStateCommand(Id), token);
|
||||
await WriteToDevice(new GetKeyCylinderStateCommand(_deviceId.ToId()), token);
|
||||
}
|
||||
public KeyCylinderState KeyCylinderState { get; private set; }
|
||||
private async Task SetKeyCylinderState(KeyCylinderState keyCylinderState, CancellationToken token)
|
||||
@@ -171,7 +171,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - KeyCylinder state = {keyCylinderState}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - KeyCylinder state = {keyCylinderState}"
|
||||
});
|
||||
RaiseDeviceChanged();
|
||||
}
|
||||
@@ -181,7 +181,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
|
||||
public async Task GetHandleStateFromDevice(CancellationToken token)
|
||||
{
|
||||
await WriteToDevice(new GetHandleStateCommand(Id), token);
|
||||
await WriteToDevice(new GetHandleStateCommand(_deviceId.ToId()), token);
|
||||
}
|
||||
public HandleState HandleState { get; private set; }
|
||||
private async Task SetHandleState(HandleState handleState, CancellationToken token)
|
||||
@@ -202,7 +202,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - Handle state = {handleState}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - Handle state = {handleState}"
|
||||
});
|
||||
RaiseDeviceChanged();
|
||||
}
|
||||
@@ -265,7 +265,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
_screenLogger.AddScreenlog(new ACSScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"{Id} - {Name} - (AuditTrail){mifareCheck.ErrorText}",
|
||||
Message = $"{_deviceId.ToIdString()} - {Name} - (AuditTrail){mifareCheck.ErrorText}",
|
||||
});
|
||||
await WriteToDeviceLog($"(AuditTrail){mifareCheck.ErrorText}", LogTypes.Device, token);
|
||||
return;
|
||||
@@ -304,7 +304,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
_screenLogger.AddScreenlog(new ACSScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"{Id} - {Name} - {user.Name} - {user.PassNumber} - {logmessage}",
|
||||
Message = $"{_deviceId.ToIdString()} - {Name} - {user.Name} - {user.PassNumber} - {logmessage}",
|
||||
});
|
||||
|
||||
await db.Loggings.AddAsync(new()
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
{
|
||||
Ipaddress = ipaddress,
|
||||
Active = ActiveStates.Active,
|
||||
DeviceId = Id,
|
||||
Name = Id,
|
||||
DeviceId = _deviceId.ToIdString(),
|
||||
Name = _deviceId.ToIdString(),
|
||||
LastChanged = DateTime.UtcNow,
|
||||
UnlockTime = 5,
|
||||
ProductClass = ProductClass.OPTA_V1
|
||||
@@ -71,7 +71,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
|
||||
public async Task GetActivatorStateFromDevice(CancellationToken token)
|
||||
{
|
||||
await WriteToDevice(new GetActivatorStateCommand(Id), token);
|
||||
await WriteToDevice(new GetActivatorStateCommand(_deviceId.ToId()), token);
|
||||
}
|
||||
|
||||
public ActivatorState ManualOpenState { get; set; }
|
||||
@@ -88,7 +88,7 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
using ACSDatabaseContext db = await _contextFactory.CreateDbContextAsync(token);
|
||||
CredentialChecker checker = new(Connection.Address, _screenLogger, db);
|
||||
|
||||
if (!await checker.CheckDevice(_deviceId.ToId(), token))
|
||||
if (!await checker.CheckDevice(_deviceId.ToIdString(), token))
|
||||
{
|
||||
await DoorDenied(token);
|
||||
}
|
||||
@@ -133,12 +133,12 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
await db.Loggings.AddLogAsync(dbDevice, ActivatorTypes.EmergencyInside, EmergencyInsideState, token);
|
||||
await db.SaveChangesAsync(token);
|
||||
|
||||
await _statusBroadcast.SendEmergencyStatus(Id, ActivatorTypes.EmergencyInside, EmergencyInsideState, db, token);
|
||||
await _statusBroadcast.SendEmergencyStatus(_deviceId.ToIdString(), ActivatorTypes.EmergencyInside, EmergencyInsideState, db, token);
|
||||
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - {ActivatorTypes.EmergencyInside} {EmergencyInsideState}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - {ActivatorTypes.EmergencyInside} {EmergencyInsideState}"
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -161,12 +161,12 @@ namespace Aperio_Control_Centre.AperioServer.Devices
|
||||
await db.Loggings.AddLogAsync(dbDevice, ActivatorTypes.EmergencyOutside, EmergencyOutsideState, token);
|
||||
await db.SaveChangesAsync(token);
|
||||
|
||||
await _statusBroadcast.SendEmergencyStatus(Id, ActivatorTypes.EmergencyOutside, EmergencyOutsideState, db, token);
|
||||
await _statusBroadcast.SendEmergencyStatus(_deviceId.ToIdString(), ActivatorTypes.EmergencyOutside, EmergencyOutsideState, db, token);
|
||||
|
||||
_screenLogger.AddScreenlog(new SystemScreenLog()
|
||||
{
|
||||
IPAddress = Connection?.Address,
|
||||
Message = $"Device {Id} - {ActivatorTypes.EmergencyOutside} {EmergencyOutsideState}"
|
||||
Message = $"Device {_deviceId.ToIdString()} - {ActivatorTypes.EmergencyOutside} {EmergencyOutsideState}"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<TemplateColumn Title="Hub device id">
|
||||
@if (context is IAperioWireless dev)
|
||||
{
|
||||
@dev.HubDeviceId.ToId()
|
||||
@dev.HubDeviceId.ToIdString()
|
||||
}
|
||||
</TemplateColumn>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user