public double[] DoQueryNumbers(string strQuery) { // Send the query. m_IoObject.WriteString(strQuery, true); // Get the result numbers. double[] fResultsArray; fResultsArray = (double[])m_IoObject.ReadList( IEEEASCIIType.ASCIIType_R8, ",;"); // Check for inst errors. CheckInstrumentErrors(strQuery); // Return result numbers. return(fResultsArray); }
protected dynamic ReadList(IEEEASCIIType type = IEEEASCIIType.ASCIIType_Any, string listSeparator = ",;") { if (DriverIsReady) { try { return(_driver.ReadList(type, listSeparator)); } catch (Exception ex) { Close(); throw ex; } } else { throw new System.InvalidOperationException("Cannot execute ReadList(...). Driver not initialized or is closed."); } }
/// <summary> /// To Read the measurement readings /// </summary> private void ReadData() { // Once the Event is detected, this routine will get the data from the meter double[] readings; try { System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; if (m_iNumOfReadings > 0) { readings = new double[m_iNumOfReadings]; ioDmm.WriteString("Fetch?", true); // Query for the data in memory readings = (double[])ioDmm.ReadList(IEEEASCIIType.ASCIIType_R8, ","); //get the data and parse into the array //Insert data into text box string sTemp = ""; sTemp = txtData.Text; for (int iIndex = 0; iIndex < readings.Length; iIndex++) { sTemp = sTemp + readings[iIndex].ToString() + " Vdc \r\n"; } txtData.Text = ""; txtData.Text = sTemp; } else { txtData.Text = ""; } System.Windows.Forms.Cursor.Current = Cursors.Default; //enable the button btnStartReading.Enabled = true; } catch (SystemException ex) { MessageBox.Show("Error reading data from the meter. " + this.txtAddress.Text + " " + ex.Source + " " + ex.Message, "SRQEvent", MessageBoxButtons.OK, MessageBoxIcon.Error); } }