Skip to content

Commit

Permalink
Update parameters in getRadioParameters (#1409)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Jackson <[email protected]>
  • Loading branch information
cdjackson committed Oct 25, 2023
1 parent 936abf6 commit c3a9565
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3706,15 +3706,15 @@
<command_parameters>
<parameter>
<data_type>uint8_t</data_type>
<name>childCount</name>
<description>The number of children the node currently has.</description>
<name>phyIndex</name>
<description>The physical radio to query.</description>
</parameter>
</command_parameters>
<response_parameters>
<parameter>
<data_type>EmberStatus</data_type>
<name>status</name>
<description>The result of the CBKE operation.</description>
<description>The result of the operation.</description>
</parameter>
<parameter>
<data_type>EmberMultiPhyRadioParameters</data_type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* EZSP type is <i>uint8_t</i> - Java type is {@link int}
*/
private int childCount;
private int phyIndex;

/**
* Serialiser used to serialise to binary line data
Expand All @@ -45,23 +45,23 @@ public EzspGetRadioParametersRequest() {
}

/**
* The number of children the node currently has.
* The physical radio to query.
* <p>
* EZSP type is <i>uint8_t</i> - 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
Expand All @@ -70,7 +70,7 @@ public int[] serialize() {
serializeHeader(serializer);

// Serialize the fields
serializer.serializeUInt8(childCount);
serializer.serializeUInt8(phyIndex);
return serializer.getPayload();
}

Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* EZSP type is <i>EmberStatus</i> - Java type is {@link EmberStatus}
*/
Expand All @@ -52,7 +52,7 @@ public EzspGetRadioParametersResponse(int[] inputBuffer) {
}

/**
* The result of the CBKE operation.
* The result of the operation.
* <p>
* EZSP type is <i>EmberStatus</i> - Java type is {@link EmberStatus}
*
Expand All @@ -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}
*/
Expand Down

0 comments on commit c3a9565

Please sign in to comment.