Skip to content

Commit

Permalink
Add machine readable console argument definition
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Jackson <[email protected]>
  • Loading branch information
cdjackson committed Oct 6, 2019
1 parent d87cf7d commit b936006
Show file tree
Hide file tree
Showing 47 changed files with 573 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package com.zsmartsystems.zigbee.console.ember;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleCommand;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleAbstractCommand;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp;

Expand All @@ -17,7 +17,7 @@
* @author Chris Jackson - Initial Contribution
*
*/
public abstract class EmberConsoleAbstractCommand implements ZigBeeConsoleCommand {
public abstract class EmberConsoleAbstractCommand extends ZigBeeConsoleAbstractCommand {

protected EmberNcp getEmberNcp(ZigBeeNetworkManager networkManager)
throws IllegalArgumentException, IllegalStateException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.PrintStream;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EmberAesMmoHashContext;

Expand All @@ -20,6 +21,11 @@
*
*/
public class EmberConsoleMmoHashCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpmmohash";
Expand All @@ -30,11 +36,6 @@ public String getDescription() {
return "Passes an install code to the NCP and receives the MMO hash key";
}

@Override
public String getSyntax() {
return "INSTALLCODE";
}

@Override
public String getHelp() {
return "";
Expand Down Expand Up @@ -76,4 +77,10 @@ private String arrayToString(int[] data) {

return builder.toString();
}

@Override
public ZigBeeConsoleArgument getArguments() {
// TODO Auto-generated method stub
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.PrintStream;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspGetChildDataResponse;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspGetParentChildParametersResponse;
Expand All @@ -20,6 +21,11 @@
*
*/
public class EmberConsoleNcpChildrenCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpchildren";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.TreeMap;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EzspConfigId;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EzspValueId;
Expand All @@ -24,6 +25,11 @@
*
*/
public class EmberConsoleNcpConfigurationCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpconfig";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.PrintStream;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EmberCounterType;

Expand All @@ -19,6 +20,11 @@
*
*/
public class EmberConsoleNcpCountersCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpcounters";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.PrintStream;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EzspValueId;

Expand All @@ -27,6 +28,12 @@ public String getCommand() {
return "ncphandler";
}

@Override
protected ZigBeeConsoleArgument initializeArguments() {
// TODO Auto-generated method stub
return null;
}

@Override
public String getDescription() {
return "Configure the NCP handler";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.PrintStream;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberMfglib;
import com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp;

Expand All @@ -19,6 +20,11 @@
*
*/
public class EmberConsoleNcpMfglibCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpmfglib";
Expand Down Expand Up @@ -118,4 +124,5 @@ private EmberMfglib getMfglib(ZigBeeNetworkManager networkManager) {

return mfglib;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.zsmartsystems.zigbee.ExtendedPanId;
import com.zsmartsystems.zigbee.ZigBeeChannelMask;
import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspEnergyScanResultHandler;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspNetworkFoundHandler;
Expand All @@ -25,6 +26,11 @@
*
*/
public class EmberConsoleNcpScanCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpscan";
Expand Down Expand Up @@ -88,4 +94,5 @@ private void outputChannelEnergy(PrintStream out, List<EzspEnergyScanResultHandl
out.println(String.format("%-2d %d", channel.getChannel(), channel.getMaxRssiValue()));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import com.zsmartsystems.zigbee.IeeeAddress;
import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspGetNetworkParametersResponse;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspVersionResponse;
Expand All @@ -24,6 +25,11 @@
*
*/
public class EmberConsoleNcpStateCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpstate";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.TreeMap;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EzspStatus;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EzspValueId;
Expand All @@ -25,6 +26,11 @@
*
*/
public class EmberConsoleNcpValueCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpvalue";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.PrintStream;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.EzspFrame;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.command.EzspVersionResponse;
Expand All @@ -20,6 +21,11 @@
*
*/
public class EmberConsoleNcpVersionCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpversion";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.List;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EmberCertificate283k1Data;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EmberCertificateData;
Expand All @@ -35,6 +36,11 @@
*
*/
public class EmberConsoleSecurityStateCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpsecuritystate";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import com.zsmartsystems.zigbee.IeeeAddress;
import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.ember.EmberNcp;
import com.zsmartsystems.zigbee.dongle.ember.ezsp.structure.EmberStatus;
import com.zsmartsystems.zigbee.security.ZigBeeKey;
Expand All @@ -22,6 +23,11 @@
*
*/
public class EmberConsoleTransientKeyCommand extends EmberConsoleAbstractCommand {
@Override
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncptransientkey";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package com.zsmartsystems.zigbee.console.telegesis;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleCommand;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleAbstractCommand;
import com.zsmartsystems.zigbee.dongle.telegesis.TelegesisNcp;
import com.zsmartsystems.zigbee.dongle.telegesis.ZigBeeDongleTelegesis;

Expand All @@ -17,12 +17,12 @@
* @author Chris Jackson - Initial Contribution
*
*/
public abstract class TelegesisConsoleAbstractCommand implements ZigBeeConsoleCommand {
public abstract class TelegesisConsoleAbstractCommand extends ZigBeeConsoleAbstractCommand {

protected TelegesisNcp getTelegesisNcp(ZigBeeNetworkManager networkManager)
throws IllegalArgumentException, IllegalStateException {
if (!(networkManager.getZigBeeTransport() instanceof ZigBeeDongleTelegesis)) {
throw new IllegalArgumentException("Dongle is not an Ember NCP.");
throw new IllegalArgumentException("Dongle is not an Telegesis NCP.");
}
ZigBeeDongleTelegesis dongle = (ZigBeeDongleTelegesis) networkManager.getZigBeeTransport();
if (dongle == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.PrintStream;

import com.zsmartsystems.zigbee.ZigBeeNetworkManager;
import com.zsmartsystems.zigbee.console.ZigBeeConsoleArgument;
import com.zsmartsystems.zigbee.dongle.telegesis.TelegesisNcp;

/**
Expand All @@ -19,6 +20,10 @@
*
*/
public class TelegesisConsoleSecurityStateCommand extends TelegesisConsoleAbstractCommand {
protected ZigBeeConsoleArgument initializeArguments() {
return null;
}

@Override
public String getCommand() {
return "ncpsecuritystate";
Expand Down
Loading

0 comments on commit b936006

Please sign in to comment.