Iterator ii = js.keySet().iterator();
try {
while (ii.hasNext()) {
String _key = ii.next().toString();
String _val = js.get(_key).toString();
final responseCommand rc = new responseCommand(parent, _key, _val);
switch (_key) {
case (MnemonicManager.MNEMONIC_SYSTEM_BAUDRATE):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_HARDWARD_PLATFORM):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
TinygDriver.getInstance().hardwarePlatformManager.setHardwarePlatformByVersionNumber(Integer.valueOf(rc.getSettingValue()));
break;
case (MnemonicManager.MNEMONIC_SYSTEM_HARDWARE_VERSION):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
if(Integer.valueOf(rc.getSettingValue()) == 8 ){
//We do this because there is no $hp in TinyG v8 in builds sub 380.08
TinygDriver.getInstance().hardwarePlatformManager.setHardwarePlatformByVersionNumber(Integer.valueOf(rc.getSettingValue()));
}
TinygDriver.getInstance().machine.setHardwareVersion(rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_ENABLE_ECHO):
TinygDriver.getInstance().machine.setEnable_echo(Boolean.valueOf(rc.getSettingValue()));
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_ENABLE_JSON_MODE):
//TinygDriver.getInstance().m(Float.valueOf(rc.getSettingValue()));
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_ENABLE_XON):
TinygDriver.getInstance().machine.setEnable_xon_xoff(Boolean.valueOf(rc.getSettingValue()));
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_FIRMWARE_BUILD):
TinygDriver.getInstance().machine.setFirmwareBuild(Double.valueOf(rc.getSettingValue()));
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_FIRMWARE_VERSION):
TinygDriver.getInstance().machine.setFirmwareVersion(rc.getSettingValue());
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_DEFAULT_GCODE_COORDINATE_SYSTEM):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_DEFAULT_GCODE_DISTANCE_MODE):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
TinygDriver.getInstance().machine.setGcodeDistanceMode(rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_DEFAULT_GCODE_PATH_CONTROL):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
TinygDriver.getInstance().machine.setGcodePathControl(rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_DEFAULT_GCODE_PLANE):
//TinygDriver.getInstance().m.setGcodeSelectPlane(Float.valueOf(rc.getSettingValue()));
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
TinygDriver.getInstance().machine.setGcodeSelectPlane(rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_JSON_VOBERSITY):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_JUNCTION_ACCELERATION):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_MIN_ARC_SEGMENT):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_MIN_LINE_SEGMENT):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_MIN_TIME_SEGMENT):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_QUEUE_REPORTS):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_STATUS_REPORT_INTERVAL):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_SWITCH_TYPE):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
TinygDriver.getInstance().machine.setSwitchType(Integer.valueOf(rc.getSettingValue()));
String[] message = new String[2];
message[0] = "MACHINE_UPDATE";
message[1] = null;
TinygDriver.getInstance().resParse.set_Changed();
TinygDriver.getInstance().resParse.notifyObservers(message);
break;
case (MnemonicManager.MNEMONIC_SYSTEM_TEXT_VOBERSITY):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
break;
case (MnemonicManager.MNEMONIC_SYSTEM_TINYG_ID_VERSION):
logger.info("[APPLIED:" + rc.getSettingParent() + " " + rc.getSettingKey() + ":" + rc.getSettingValue());
this.setHardwareId(rc.getSettingValue());
break;
}
}
} catch (JSONException | NumberFormatException ex) {
logger.error("Error in ApplyJsonSystemSetting in Machine:SYS group");