From 258f80d4c909327b3eb0adfd743ece122bf16196 Mon Sep 17 00:00:00 2001 From: Daniel Dugger Date: Sun, 17 May 2020 20:57:10 -0400 Subject: [PATCH] SW: Cleanup contributed code; fixes #9 --- README.md | 12 +- .../ManualRekey/ManualRekeyApplication.cs | 129 +++--------------- 2 files changed, 30 insertions(+), 111 deletions(-) diff --git a/README.md b/README.md index 8b7ddb0..44432b4 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,20 @@ Features The KFDtool software supports KFD features through the KFDtool hardware adapter (TWI/3WI/Three Wire Interface), as well as through a IP (UDP) connection (DLI/Data Link Independent interface). -Supported Manual Rekeying Features (TIA-102.AACD-A section 2.3) +Supported Manual Rekeying Features (TIA-102.AACD-A) * 2.3.1 Keyload * 2.3.2 Key Erase * 2.3.3 Erase All Keys * 2.3.4 View Key Info +* 2.3.5 View Individual RSI +* 2.3.6 Load Individual RSI +* 2.3.7 View KMF RSI +* 2.3.8 Load KMF RSI +* 2.3.9 View MNP +* 2.3.10 Load MNP +* 2.3.11 View Keyset Info +* 2.3.12 Activate Keyset Motorola refers to the P25 standard 3 wire interface (3WI) keyload protocol as ASTRO 25 mode or CKR mode. @@ -54,7 +62,7 @@ Key validators/generators are available for the following algorithms: The KFDtool software only supports MR Emulator features through the KFDtool hardware adapter (TWI/3WI/Three Wire Interface) at this time. -Supported Manual Rekeying Features (TIA-102.AACD-A section 2.3) +Supported Manual Rekeying Features (TIA-102.AACD-A) * 2.3.1 Keyload diff --git a/sw/control/KFDtool.P25/ManualRekey/ManualRekeyApplication.cs b/sw/control/KFDtool.P25/ManualRekey/ManualRekeyApplication.cs index d9bb9a3..922391c 100644 --- a/sw/control/KFDtool.P25/ManualRekey/ManualRekeyApplication.cs +++ b/sw/control/KFDtool.P25/ManualRekey/ManualRekeyApplication.cs @@ -63,7 +63,6 @@ namespace KFDtool.P25.ManualRekey DeviceProtocol.EndSession(); } - /* TIA 102.AACD-A 3.8.1 */ public void Keyload(List keyItems) { List> keyGroups = KeyPartitioner.PartitionKeys(keyItems); @@ -196,33 +195,6 @@ namespace KFDtool.P25.ManualRekey End(); } - /* TIA 102.AACD-A 3.8.2 */ - public void LoadIndividualRsi() - { - //cg - // This is implemented with ChangeRSI() - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.8.3 */ - public void LoadKmfRsi() - { - //cg - // This command is actually LoadConfig - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.8.4 */ - public void LoadMnp() - { - //cg - // This process actually takes two commands: - // List KMF RSI - // Load Config, with RSI and new MNP - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.8.5 */ public void EraseKeys(List keyItems) { List> keyGroups = KeyPartitioner.PartitionKeys(keyItems); @@ -355,7 +327,6 @@ namespace KFDtool.P25.ManualRekey End(); } - /* TIA 102.AACD-A 3.8.6 */ public void EraseAllKeys() { Begin(); @@ -393,7 +364,6 @@ namespace KFDtool.P25.ManualRekey End(); } - /* TIA 102.AACD-A 3.8.7 */ public List ViewKeyInfo() { List result = new List(); @@ -474,16 +444,8 @@ namespace KFDtool.P25.ManualRekey return result; } - /* TIA 102.AACD-A 3.8.8 */ - public void ViewIndividualRsi() - { - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.7.2.15 */ public int ViewKmfRsi() { - //cg int result = new int(); Begin(); @@ -527,10 +489,8 @@ namespace KFDtool.P25.ManualRekey return result; } - /* TIA 102.AACD-A 3.7.2.13 */ public int ViewMnp() { - //cg int result = new int(); Begin(); @@ -574,46 +534,8 @@ namespace KFDtool.P25.ManualRekey return result; } - /* TIA 102.AACD-A 3.8.11 */ - public void ViewKeysetInfo() - { - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.8.12 */ - public void ActivateKeyset() - { - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.8.13 */ - public void LoadAuthenticationKey() - { - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.8.14 */ - public void DeleteAuthenticationKey() - { - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.8.15 */ - public void ViewSuidInfo() - { - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.8.16 */ - public void ViewActiveSuidInfo() - { - throw new NotImplementedException(); - } - - /* TIA 102.AACD-A 3.7.2.22 */ public RspRsiInfo LoadConfig(int kmfRsi, int mnp) { - //cg RspRsiInfo result = new RspRsiInfo(); Begin(); @@ -630,7 +552,6 @@ namespace KFDtool.P25.ManualRekey result.RSI = kmm.RSI; result.MN = kmm.MN; result.Status = kmm.Status; - //Console.WriteLine("response status: {0}", kmm.Status); } else if (rspKmmBody is NegativeAcknowledgment) { @@ -657,10 +578,8 @@ namespace KFDtool.P25.ManualRekey return result; } - /* TIA 102.AACD-A 3.7.2.1 */ public RspRsiInfo ChangeRsi(int rsiOld, int rsiNew, int mnp) { - //cg RspRsiInfo result = new RspRsiInfo(); Begin(); @@ -671,11 +590,12 @@ namespace KFDtool.P25.ManualRekey cmdKmmBody.RsiOld = rsiOld; cmdKmmBody.RsiNew = rsiNew; cmdKmmBody.MessageNumber = mnp; + KmmBody rspKmmBody = TxRxKmm(cmdKmmBody); + if (rspKmmBody is ChangeRsiResponse) { ChangeRsiResponse kmm = rspKmmBody as ChangeRsiResponse; - //Console.WriteLine("response status: {0}", kmm.Status); result.RSI = rsiNew; result.MN = mnp; result.Status = kmm.Status; @@ -705,10 +625,8 @@ namespace KFDtool.P25.ManualRekey return result; } - /* TIA 102.AACD-A 3.7.2.7 */ public List ViewRsiItems() { - //cg List result = new List(); Begin(); @@ -721,8 +639,6 @@ namespace KFDtool.P25.ManualRekey while (more) { InventoryCommandListRsiItems commandKmmBody = new InventoryCommandListRsiItems(); - //commandKmmBody.InventoryMarker = marker; - //commandKmmBody.MaxKeysRequested = 78; KmmBody responseKmmBody = TxRxKmm(commandKmmBody); @@ -730,8 +646,6 @@ namespace KFDtool.P25.ManualRekey { InventoryResponseListRsiItems kmm = responseKmmBody as InventoryResponseListRsiItems; - //marker = kmm.InventoryMarker; - Logger.Debug("inventory marker: {0}", marker); if (marker == 0) @@ -783,10 +697,8 @@ namespace KFDtool.P25.ManualRekey return result; } - /* TIA 102.AACD-A 3.7.2.9 */ public List ViewKeysetTaggingInfo() { - //cg List result = new List(); Begin(); @@ -843,10 +755,8 @@ namespace KFDtool.P25.ManualRekey return result; } - /* TIA 102.AACD-A 3.7.2.3 */ public RspChangeoverInfo ActivateKeyset(int keysetSuperseded, int keysetActivated) { - //cg RspChangeoverInfo result = new RspChangeoverInfo(); Begin(); @@ -857,29 +767,13 @@ namespace KFDtool.P25.ManualRekey cmdKmmBody.KeysetIdSuperseded = keysetSuperseded; cmdKmmBody.KeysetIdActivated = keysetActivated; KmmBody rspKmmBody = TxRxKmm(cmdKmmBody); + if (rspKmmBody is ChangeoverResponse) { ChangeoverResponse kmm = rspKmmBody as ChangeoverResponse; - /* - for (int i = 0; i < kmm.KeysetItems.Count; i++) - { - KeysetItem item = kmm.KeysetItems[i]; - - RspKeysetInfo res = new RspKeysetInfo(); - - res.KeysetId = item.KeysetId; - res.KeysetName = item.KeysetName; - res.KeysetType = item.KeysetType; - res.ActivationDateTime = item.ActivationDateTime; - res.ReservedField = item.ReservedField; - - result.Add(res); - } - */ result.KeysetIdSuperseded = kmm.KeysetIdSuperseded; result.KeysetIdActivated = kmm.KeysetIdActivated; - //Console.WriteLine("response status: {0}", kmm.Status); } else if (rspKmmBody is NegativeAcknowledgment) { @@ -906,7 +800,24 @@ namespace KFDtool.P25.ManualRekey return result; } + public void LoadAuthenticationKey() + { + throw new NotImplementedException(); + } + public void DeleteAuthenticationKey() + { + throw new NotImplementedException(); + } + public void ViewSuidInfo() + { + throw new NotImplementedException(); + } + + public void ViewActiveSuidInfo() + { + throw new NotImplementedException(); + } } }