From c3a95652adf4c681fb60f36449e2ee3b894e84d6 Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Thu, 26 Oct 2023 07:56:54 +1300 Subject: [PATCH] Update parameters in getRadioParameters (#1409) Signed-off-by: Chris Jackson --- .../ember/EmberConsoleNcpStateCommand.java | 2 +- .../ember/autocode/CommandGenerator.java | 4 +-- .../src/main/resources/ezsp_protocol.xml | 6 ++--- .../zigbee/dongle/ember/EmberNcp.java | 5 ++-- .../zigbee/dongle/ember/ZigBeeDongleEzsp.java | 4 +-- .../zigbee/dongle/ember/ezsp/EzspFrame.java | 4 +-- .../EzspGetRadioParametersRequest.java | 26 +++++++++---------- .../EzspGetRadioParametersResponse.java | 6 ++--- 8 files changed, 29 insertions(+), 28 deletions(-) diff --git a/com.zsmartsystems.zigbee.console.ember/src/main/java/com/zsmartsystems/zigbee/console/ember/EmberConsoleNcpStateCommand.java b/com.zsmartsystems.zigbee.console.ember/src/main/java/com/zsmartsystems/zigbee/console/ember/EmberConsoleNcpStateCommand.java index fbd892626d..2fb8f51870 100644 --- a/com.zsmartsystems.zigbee.console.ember/src/main/java/com/zsmartsystems/zigbee/console/ember/EmberConsoleNcpStateCommand.java +++ b/com.zsmartsystems.zigbee.console.ember/src/main/java/com/zsmartsystems/zigbee/console/ember/EmberConsoleNcpStateCommand.java @@ -92,7 +92,7 @@ private void ncpState(ZigBeeNetworkManager networkManager, PrintStream out) { int nwkAddress = ncp.getNwkAddress(); EzspGetNetworkParametersResponse nwkParameterResponse = ncp.getNetworkParameters(); EmberNetworkParameters nwkParameters = nwkParameterResponse.getParameters(); - EzspGetRadioParametersResponse radioParametersResponse = ncp.getRadioParameters(); + EzspGetRadioParametersResponse radioParametersResponse = ncp.getRadioParameters(0); EmberMultiPhyRadioParameters radioParameters = radioParametersResponse.getParameters(); String mfgName = ncp.getMfgName(); diff --git a/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/ember/autocode/CommandGenerator.java b/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/ember/autocode/CommandGenerator.java index 7854c34d2a..a6e1887051 100644 --- a/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/ember/autocode/CommandGenerator.java +++ b/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/java/com/zsmartsystems/zigbee/dongle/ember/autocode/CommandGenerator.java @@ -973,12 +973,12 @@ private void createEmberFrame(Protocol protocol) throws FileNotFoundException, U out.println(" /**"); out.println(" * The minimum supported version of EZSP"); out.println(" */"); - out.println(" private static final int EZSP_MIN_VERSION = 4;"); + out.println(" public static final int EZSP_MIN_VERSION = 4;"); out.println(); out.println(" /**"); out.println(" * The maximum supported version of EZSP"); out.println(" */"); - out.println(" private static final int EZSP_MAX_VERSION = 11;"); + out.println(" public static final int EZSP_MAX_VERSION = 11;"); out.println(); out.println(" /**"); out.println(" * The network ID bit shift"); diff --git a/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/resources/ezsp_protocol.xml b/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/resources/ezsp_protocol.xml index 92e8d2657f..c524199a8c 100644 --- a/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/resources/ezsp_protocol.xml +++ b/com.zsmartsystems.zigbee.dongle.ember.autocode/src/main/resources/ezsp_protocol.xml @@ -3706,15 +3706,15 @@ uint8_t - childCount - The number of children the node currently has. + phyIndex + The physical radio to query. EmberStatus status - The result of the CBKE operation. + The result of the operation. EmberMultiPhyRadioParameters diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/EmberNcp.java b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/EmberNcp.java index 08d8b6b052..aacedcb7d7 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/EmberNcp.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/EmberNcp.java @@ -302,11 +302,12 @@ public EzspGetNetworkParametersResponse getNetworkParameters() { /** * Gets the current radio parameters, or an empty parameters class if there's an error * + * @param phyIndex the physical radio index * @return {@link EzspGetRadioParametersResponse} or null on error */ - public EzspGetRadioParametersResponse getRadioParameters() { + public EzspGetRadioParametersResponse getRadioParameters(int phyIndex) { EzspGetRadioParametersRequest request = new EzspGetRadioParametersRequest(); - request.setChildCount(1); + request.setPhyIndex(phyIndex); EzspTransaction transaction = protocolHandler.sendEzspTransaction( new EzspSingleResponseTransaction(request, EzspGetRadioParametersResponse.class)); return (EzspGetRadioParametersResponse) transaction.getResponse(); diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ZigBeeDongleEzsp.java b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ZigBeeDongleEzsp.java index d4fcfb5d99..c06a1f9520 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ZigBeeDongleEzsp.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ZigBeeDongleEzsp.java @@ -1328,8 +1328,8 @@ private boolean initialiseEzspProtocol() { if (ezspVersion.getProtocolVersion() != EzspFrame.getEzspVersion()) { // The device supports a different version that we current have set if (!EzspFrame.setEzspVersion(ezspVersion.getProtocolVersion())) { - logger.error("EZSP Dongle: NCP requires unsupported version of EZSP (required = V{}, supported = V{})", - ezspVersion.getProtocolVersion(), EzspFrame.getEzspVersion()); + logger.error("EZSP Dongle: NCP requires unsupported version of EZSP (NCP = V{}, supported = V{}-V{})", + ezspVersion.getProtocolVersion(), EzspFrame.EZSP_MIN_VERSION, EzspFrame.EZSP_MAX_VERSION); return false; } diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/EzspFrame.java b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/EzspFrame.java index 0ecf51aa8d..3353b0b24e 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/EzspFrame.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/EzspFrame.java @@ -53,12 +53,12 @@ public abstract class EzspFrame { /** * The minimum supported version of EZSP */ - private static final int EZSP_MIN_VERSION = 4; + public static final int EZSP_MIN_VERSION = 4; /** * The maximum supported version of EZSP */ - private static final int EZSP_MAX_VERSION = 11; + public static final int EZSP_MAX_VERSION = 11; /** * The network ID bit shift diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/command/EzspGetRadioParametersRequest.java b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/command/EzspGetRadioParametersRequest.java index b8b5e142d5..0ad494d346 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/command/EzspGetRadioParametersRequest.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/command/EzspGetRadioParametersRequest.java @@ -25,11 +25,11 @@ public class EzspGetRadioParametersRequest extends EzspFrameRequest { public static final int FRAME_ID = 0xFD; /** - * The number of children the node currently has. + * The physical radio to query. *

* EZSP type is uint8_t - Java type is {@link int} */ - private int childCount; + private int phyIndex; /** * Serialiser used to serialise to binary line data @@ -45,23 +45,23 @@ public EzspGetRadioParametersRequest() { } /** - * The number of children the node currently has. + * The physical radio to query. *

* EZSP type is uint8_t - Java type is {@link int} * - * @return the current childCount as {@link int} + * @return the current phyIndex as {@link int} */ - public int getChildCount() { - return childCount; + public int getPhyIndex() { + return phyIndex; } /** - * The number of children the node currently has. + * The physical radio to query. * - * @param childCount the childCount to set as {@link int} + * @param phyIndex the phyIndex to set as {@link int} */ - public void setChildCount(int childCount) { - this.childCount = childCount; + public void setPhyIndex(int phyIndex) { + this.phyIndex = phyIndex; } @Override @@ -70,7 +70,7 @@ public int[] serialize() { serializeHeader(serializer); // Serialize the fields - serializer.serializeUInt8(childCount); + serializer.serializeUInt8(phyIndex); return serializer.getPayload(); } @@ -79,8 +79,8 @@ public String toString() { final StringBuilder builder = new StringBuilder(82); builder.append("EzspGetRadioParametersRequest [networkId="); builder.append(networkId); - builder.append(", childCount="); - builder.append(childCount); + builder.append(", phyIndex="); + builder.append(phyIndex); builder.append(']'); return builder.toString(); } diff --git a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/command/EzspGetRadioParametersResponse.java b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/command/EzspGetRadioParametersResponse.java index cb32ef97ef..0b33f0bc30 100644 --- a/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/command/EzspGetRadioParametersResponse.java +++ b/com.zsmartsystems.zigbee.dongle.ember/src/main/java/com/zsmartsystems/zigbee/dongle/ember/ezsp/command/EzspGetRadioParametersResponse.java @@ -26,7 +26,7 @@ public class EzspGetRadioParametersResponse extends EzspFrameResponse { public static final int FRAME_ID = 0xFD; /** - * The result of the CBKE operation. + * The result of the operation. *

* EZSP type is EmberStatus - Java type is {@link EmberStatus} */ @@ -52,7 +52,7 @@ public EzspGetRadioParametersResponse(int[] inputBuffer) { } /** - * The result of the CBKE operation. + * The result of the operation. *

* EZSP type is EmberStatus - Java type is {@link EmberStatus} * @@ -63,7 +63,7 @@ public EmberStatus getStatus() { } /** - * The result of the CBKE operation. + * The result of the operation. * * @param status the status to set as {@link EmberStatus} */