private void setPowerCalibTable(DataGridView grid, CalibrationTable.TableType tableType) { PowerCalibrationTable tbl = new PowerCalibrationTable(); int i = 0; foreach (DataGridViewRow row in grid.Rows) { tbl.PA_GAIN_VALUES[i++] = Convert.ToUInt16(row.Cells["Value"].Value); } Scenario.ScenarioResult r = new SingleMessageSingleDeviceScenario("Set " + tableType.ToString() + " Calibration Data", new SetCalibrationTableMessage(tbl, tableType), true, false, device).run(); if (r != null && r.result == Scenario.ScenarioResult.RunResult.Pass) { AckResponse resp = (AckResponse)r.resultObj; log.Info("got an ack response opcode: " + resp.opcode.ToString()); } }
private void getPowerCalibTable(DataGridView grid, CalibrationTable.TableType tableType) { Scenario.ScenarioResult r = new SingleMessageSingleDeviceScenario("Get " + tableType.ToString() + " Calibration Data", new GetCalibrationTableMessage(tableType), true, false, device).run(); if (r != null && r.result == Scenario.ScenarioResult.RunResult.Pass) { GetCalibrationTableResponse resp = (GetCalibrationTableResponse)r.resultObj; PowerCalibrationTable tbl = (PowerCalibrationTable)resp.table; try { grid.Rows.Clear(); for (int i = 0; i < tbl.PA_GAIN_VALUES.Length; i++) { grid.Rows.Add(i.ToString(), tbl.PA_GAIN_VALUES[i]); } } catch (Exception ex) { log.Error("Could not load calibration data!", ex); } } }
public GetCalibrationTableMessage(CalibrationTable.TableType tableType) : base(OPCODE.GET_CALIBRATION_TABLE) { this.tableType = tableType; }