示例#1
0
        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());
            }
        }
示例#2
0
        private void btnSetGeneralCalib_Click(object sender, EventArgs e)
        {
            GeneralCalibrationTable tbl = new GeneralCalibrationTable();

            foreach (DataGridViewRow row in gridGeneralCalib.Rows)
            {
                FieldInfo valueField = typeof(GeneralCalibrationTable).GetField(row.Cells["Key"].Value.ToString(), BindingFlags.Public | BindingFlags.Instance);
                valueField.SetValue(tbl, Convert.ToUInt16(row.Cells["Value"].Value));
            }

            Scenario.ScenarioResult r = new SingleMessageSingleDeviceScenario("Set General Calibration Data", new SetCalibrationTableMessage(tbl, CalibrationTable.TableType.General), 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());
            }
        }
        bool HandleCommandWithNoRetData(
            InterfaceCommand command, byte[] commandData)
        {
            bool commandHandledSuccessfully = false;

            lock (m_PortLocker)
            {
                byte[] responseData;
                SendCmdMessage(command, commandData);
                Thread.Sleep(B2B_RETURN_ACK_TIMEOUT_MSEC);
                if (Helper.GetDeviceCmdResponse(m_CommunicationPort, out responseData) &&
                    Response.CheckDataPacket(responseData) &&
                    AckResponse.CheckData(responseData)
                    )
                {
                    //SendAckMessage();
                    //GetAckMessage();
                    commandHandledSuccessfully = true;
                }
            }
            return(commandHandledSuccessfully);
        }