static public GPIO_Tool ParseConfig(JsonValue config)
        {
            GPIO_Tool tool = new GPIO_Tool
            {
                gpio = config["gpio"],
                name = config["name"],
            };

            return(tool);
        }
        public static MachineParameters ParseConfig(JsonValue config)
        {
            MachineParameters machineConfig = new MachineParameters
            {
                X_axis            = Axis.ParseConfig(config["axises"]["x"]),
                Y_axis            = Axis.ParseConfig(config["axises"]["y"]),
                Z_axis            = Axis.ParseConfig(config["axises"]["z"]),
                fastfeed          = config["movement"]["fastfeed"],
                slowfeed          = config["movement"]["slowfeed"],
                basefeed          = config["movement"]["basefeed"],
                max_movement_leap = config["movement"]["max_movement_leap"],
                tools             = new Dictionary <int, IToolDriver>(),
            };

            foreach (KeyValuePair <string, JsonValue> tool in config["tools"])
            {
                string    ids = tool.Key;
                JsonValue val = tool.Value;
                if (ids == "default")
                {
                    machineConfig.deftool_id = val;
                }
                else
                {
                    int    id     = int.Parse(ids);
                    string driver = val["driver"];
                    switch (driver)
                    {
                    case "n700e":
                    {
                        machineConfig.tools.Add(id, N700E_Tool.ParseConfig(val));
                        break;
                    }

                    case "modbus":
                    {
                        machineConfig.tools.Add(id, RawModbus_Tool.ParseConfig(val));
                        break;
                    }

                    case "gpio":
                    {
                        machineConfig.tools.Add(id, GPIO_Tool.ParseConfig(val));
                        break;
                    }

                    case "dummy":
                    {
                        machineConfig.tools.Add(id, Dummy_Tool.ParseConfig(val));
                        break;
                    }

                    default:
                    {
                        throw new NotSupportedException("Unknown driver: " + driver);
                    }
                    }
                }
            }
            if (machineConfig.deftool_id == -1)
            {
                machineConfig.deftool = null;
            }
            else
            {
                machineConfig.deftool = machineConfig.tools[machineConfig.deftool_id];
            }

            machineConfig.state_refresh_timeout  = config["control"]["state_refresh_timeout"];
            machineConfig.state_refresh_update   = config["control"]["state_refresh_update"];
            machineConfig.state_refresh_maxretry = config["control"]["state_refresh_maxretry"];

            return(machineConfig);
        }