private void ProcessServerCommand(CommandType command) { switch (command.Funtion) { case (byte)FuntionCode.ServerSetDAQ: if (command.NumArgs < 2) { formProcess.closeDiablog(false); configItemServer.setMessage("Write Error!", ConfigMessageIconEnum.Error); break; } configItemServer.setText1(command.Args[0].ToString()); configItemServer.setText2(UserApp.ConvertByte2String(command.Args, 1, command.NumArgs - 1)); formProcess.closeDiablog(true); configItemServer.setMessage("Write OK!", ConfigMessageIconEnum.Ok); configItemServer.setButtonWriteEnable(false); break; case (byte)FuntionCode.ServerGetDAQ: if (command.NumArgs < 2) { formProcess.closeDiablog(false); configItemServer.setMessage("Read Error!", ConfigMessageIconEnum.Error); break; } configItemServer.setText1(command.Args[0].ToString()); configItemServer.setText2(UserApp.ConvertByte2String(command.Args, 1, command.NumArgs - 1)); formProcess.closeDiablog(true); configItemServer.setMessage("Read OK!", ConfigMessageIconEnum.Ok); configItemServer.setButtonWriteEnable(false); break; default: break; } }
private void ProcessConfigcommand(CommandType command) { if (command.Error != 0) { switch (command.Funtion) { case (byte)FuntionCode.ConfigEnter: break; case (byte)FuntionCode.ConfigExit: break; case (byte)FuntionCode.ConfigSetSamplingSendingRate: //configItemSamplingSendding.MessageText = formProcess.closeDiablog(false); configItemSamplingSendding.setMessage("Write Error!", ConfigMessageIconEnum.Error); break; case (byte)FuntionCode.ConfigGetSamplingSendingRate: formProcess.closeDiablog(false); configItemSamplingSendding.setMessage("Read Error!", ConfigMessageIconEnum.Error); break; case (byte)FuntionCode.ConfigSetSerialID: formProcess.closeDiablog(false); configItemSerialID.setMessage("Write Error!", ConfigMessageIconEnum.Error); break; case (byte)FuntionCode.ConfigGetSerialID: formProcess.closeDiablog(false); configItemSerialID.setMessage("Read Error!", ConfigMessageIconEnum.Error); break; case (byte)FuntionCode.ConfigSetDeviceID: formProcess.closeDiablog(false); configItemDeviceID.setMessage("Write Error!", ConfigMessageIconEnum.Error); break; case (byte)FuntionCode.ConfigGetDeviceID: formProcess.closeDiablog(false); configItemDeviceID.setMessage("Read Error!", ConfigMessageIconEnum.Error); break; case (byte)FuntionCode.ConfigSetLoggingMode: formProcess.closeDiablog(false); configItemLogging.setMessage("Write Error!", ConfigMessageIconEnum.Error); break; case (byte)FuntionCode.ConfigGetLoggingMode: formProcess.closeDiablog(false); configItemLogging.setMessage("Read Error!", ConfigMessageIconEnum.Error); break; case (byte)FuntionCode.ConfigGetAllSetting: break; default: break; } return; } switch (command.Funtion) { case (byte)FuntionCode.ConfigEnter: formProcess.closeDiablog(true); break; case (byte)FuntionCode.ConfigExit: formProcess.closeDiablog(true); break; case (byte)FuntionCode.ConfigSetSamplingSendingRate: configItemSamplingSendding.setText1(command.Args[0].ToString()); configItemSamplingSendding.setText2(command.Args[1].ToString()); formProcess.closeDiablog(true); configItemSamplingSendding.setMessage("Write OK!", ConfigMessageIconEnum.Ok); configItemSamplingSendding.setButtonWriteEnable(false); saveFlash = false; break; case (byte)FuntionCode.ConfigGetSamplingSendingRate: configItemSamplingSendding.setText1(command.Args[0].ToString()); configItemSamplingSendding.setText2(command.Args[1].ToString()); //configItemSamplingSendding.Text1 = command.Args[0].ToString(); //configItemSamplingSendding.Text2 = command.Args[2].ToString(); formProcess.closeDiablog(true); configItemSamplingSendding.setMessage("Read OK!", ConfigMessageIconEnum.Ok); configItemSamplingSendding.setButtonWriteEnable(false); break; case (byte)FuntionCode.ConfigSetSerialID: configItemSerialID.setText1(UserApp.ConvertByte2String(command.Args, 0, 2)); formProcess.closeDiablog(true); configItemSerialID.setMessage("Write OK!", ConfigMessageIconEnum.Ok); configItemSerialID.setButtonWriteEnable(false); saveFlash = false; break; case (byte)FuntionCode.ConfigGetSerialID: configItemSerialID.setText1(UserApp.ConvertByte2String(command.Args, 0, 2)); formProcess.closeDiablog(true); configItemSerialID.setMessage("Read OK!", ConfigMessageIconEnum.Ok); configItemSerialID.setButtonWriteEnable(false); break; case (byte)FuntionCode.ConfigSetDeviceID: formProcess.closeDiablog(true); configItemDeviceID.setText1(UserApp.ConvertByte2String(command.Args, 0, 3)); configItemDeviceID.setMessage("Write OK!", ConfigMessageIconEnum.Ok); configItemDeviceID.setButtonWriteEnable(false); saveFlash = false; break; case (byte)FuntionCode.ConfigGetDeviceID: formProcess.closeDiablog(true); configItemDeviceID.setText1(UserApp.ConvertByte2String(command.Args, 0, 3)); configItemDeviceID.setMessage("Read OK!", ConfigMessageIconEnum.Ok); configItemDeviceID.setButtonWriteEnable(false); break; case (byte)FuntionCode.ConfigSetLoggingMode: formProcess.closeDiablog(true); if (command.Args[0] == 'E') { configItemLogging.setText("Enable"); } else if (command.Args[0] == 'D') { configItemLogging.setText("Disable"); } configItemLogging.setMessage("Write OK!", ConfigMessageIconEnum.Ok); configItemLogging.setButtonWriteEnable(false); saveFlash = false; break; case (byte)FuntionCode.ConfigGetLoggingMode: formProcess.closeDiablog(true); if (command.Args[0] == 'E') { configItemLogging.setText("Enable"); } else if (command.Args[0] == 'D') { configItemLogging.setText("Disable"); } configItemLogging.setMessage("Read OK!", ConfigMessageIconEnum.Ok); configItemLogging.setButtonWriteEnable(false); break; case (byte)FuntionCode.ConfigGetAllSetting: formProcess.closeDiablog(true); break; default: break; } }