protected void InternalConnect( ) { try { this.gpib = new GpibDriver(this.settings.GpibAddress); GpibIdentity id = gpib.GetIdentity( ); if (id != null) { string strId = id.serialNumber; } } catch { throw new Exception("Error connecting instrument."); } }
/// <summary> /// Read instrument ID: Manufacturer, Model #, Serial #, FW revision /// </summary> /// <returns></returns> public GpibIdentity GetIdentity( ) { this.Write("*IDN?"); answer_ = Read( ); GpibIdentity id = new GpibIdentity( ); string idString = answer_; int length = idString.Length; int start, stop; start = 0; while (idString[start] == ',') { start++; } ; if ((start >= 0) && (start < length)) { stop = idString.IndexOf(",", start); if ((stop < 0) || (stop > length)) { stop = length; } id.manufacturer = idString.Substring(start, stop - start); start = idString.IndexOf(",", stop) + 1; } if ((start >= 0) && (start < length)) { stop = idString.IndexOf(",", start); if ((stop < 0) || (stop > length)) { stop = length; } id.model = idString.Substring(start, stop - start); start = stop - 1; while (idString[start] == ',') { start++; } ; } if ((start >= 0) && (start < length)) { stop = idString.IndexOf(",", start); if ((stop < 0) || (stop > length)) { stop = length; } id.serialNumber = idString.Substring(start, stop - start); start = stop - 1; while (idString[start] == ',') { start++; } ; } if ((start >= 0) && (start < length)) { stop = idString.IndexOf(",", start); if ((stop < 0) || (stop > length)) { stop = length; } id.firmwareVersion = idString.Substring(start, stop - start); } return(id); }