/// <summary> /// Reads up to the specified number of characters from the serial buffer /// </summary> /// <param name="charsToRead">The (maximum) number of characters to read on call and the number /// of characters actually read after the function call</param> /// <returns>The read string from the serial port</returns> public string SerialRead(ref uint charsToRead) { StringBuilder sb = new StringBuilder((int)charsToRead); NIImaq.CheckError(NIImaq.imgSessionSerialRead(_sid, sb, ref charsToRead, 1000)); return(sb.ToString()); }