Exemple #1
0
        public DUT_Str read(string path)
        {
            string temp;
            DUT_Str dut = new DUT_Str();
            dut.RawCountX = new List<string>();
            dut.NoiseX = new List<string>();
            dut.StdDevX = new List<string>();
            dut.RawCountY = new List<string>();
            dut.NoiseY = new List<string>();
            dut.StdDevY = new List<string>();
            dut.IDAC = new List<string>();
            dut.IDACGain = new List<string>();
            dut.Global_IDAC = new List<string>();
            dut.Local_IDAC = new List<string>();
            dut.SignalX = new List<string>();
            dut.SNRX = new List<string>();

            XmlTextReader reader;
            try
            {
                reader = new XmlTextReader(path);

                reader.MoveToContent();
                reader.ReadStartElement("Trackpad");

                    reader.ReadStartElement("Serial_Number");
                    temp = reader.ReadString();
                    dut.SerailNumber = temp;
                    dut.PartType = temp.Substring(0, 8);
                    //Console.WriteLine("The Serial_Number is: {0}", temp);
                    reader.ReadEndElement();

                    reader.ReadStartElement("Test_Station");
                    temp = reader.ReadString();
                    dut.TestStation = temp;
                    //Console.WriteLine("The Test_Station is: {0}", temp);
                    reader.ReadEndElement();

                    reader.ReadStartElement("Error_Code");
                    temp = reader.ReadString();
                    dut.ErrorCode = temp;
                    //Console.WriteLine("The Error_Code is: {0}", temp);
                    reader.ReadEndElement();

                    reader.ReadStartElement("Test_Time");
                    temp = reader.ReadString().Substring(0, 19);
                    dut.TestTime = temp;
                    //Console.WriteLine("The Test_Time is: {0}", temp);
                    reader.ReadEndElement();

                    reader.ReadStartElement("IDD_Value");
                    temp = reader.ReadString();
                    dut.IDDValue = temp;
                    //Console.WriteLine("The IDD_Value is: {0}", temp);
                    reader.ReadEndElement();

                    reader.ReadStartElement("Firmware_Revision");
                    temp = reader.ReadString();
                    dut.FwRev = temp;
                    //Console.WriteLine("The Firmware_Revision is: {0}", temp);
                    reader.ReadEndElement();

                    //reader.ReadStartElement("IDD_Sleep1_Value");
                    //temp = reader.ReadString();
                    //dut.IDDValueSleep1 = temp;
                    ////Console.WriteLine("The IDD_Value is: {0}", temp);
                    //reader.ReadEndElement();

                    //reader.ReadStartElement("IDD_Deep_Sleep_Value");
                    //temp = reader.ReadString();
                    //dut.IDDValueDeepSleep = temp;
                    ////Console.WriteLine("The Firmware_Revision is: {0}", temp);
                    //reader.ReadEndElement();

                    reader.ReadStartElement("Raw_Count_Averages");
                    int i = 1;
                    while (reader.ReadToNextSibling("D" + i.ToString()))
                    {
                        temp = reader.ReadString();
                        dut.RawCountX.Add(temp);
                        //Console.WriteLine("Raw_Count_Averages" + i.ToString() + ": {0}", temp);
                        i++;
                    }
                    reader.ReadEndElement();

                    reader.ReadStartElement("Raw_Count_Noise");
                    i = 1;
                    while (reader.ReadToNextSibling("D" + i.ToString()))
                    {
                        temp = reader.ReadString();
                        dut.NoiseX.Add(temp);
                        //Console.WriteLine("Raw_Count_Noise" + i.ToString() + ": {0}", temp);
                        i++;
                    }
                    reader.ReadEndElement();

                    reader.ReadStartElement("IDAC_Value");
                    i = 1;
                    while (reader.ReadToNextSibling("D" + i.ToString()))
                    {
                        temp = reader.ReadString();
                        dut.IDAC.Add(temp);
                        //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                        i++;
                    }
                    reader.ReadEndElement();

                    reader.ReadStartElement("IDAC_Gain_Value");
                    i = 1;
                    while (reader.ReadToNextSibling("D" + i.ToString()))
                    {
                        temp = reader.ReadString();
                        dut.IDACGain.Add(temp);
                        //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                        i++;
                    }
                    reader.ReadEndElement();

                    reader.ReadStartElement("Local_IDAC_Value");
                    i = 1;
                    while (reader.ReadToNextSibling("D" + i.ToString()))
                    {
                        temp = reader.ReadString();
                        dut.Local_IDAC.Add(temp);
                        //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                        i++;
                    }
                    reader.ReadEndElement();

                    reader.ReadStartElement("Signal_Data");
                    i = 1;
                    while (reader.ReadToNextSibling("D" + i.ToString()))
                    {
                        temp = reader.ReadString();
                        dut.SignalX.Add(temp);
                        //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                        i++;
                    }
                    reader.ReadEndElement();

                    reader.ReadStartElement("SNR_Data");
                    i = 1;
                    while (reader.ReadToNextSibling("D" + i.ToString()))
                    {
                        temp = reader.ReadString();
                        dut.SNRX.Add(temp);
                        //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                        i++;
                    }
                    reader.ReadEndElement();

                reader.ReadEndElement();

                reader.Close();
            }
            catch
            { }

            return dut;
        }
Exemple #2
0
        public bool insert_into_table(DUT_Str dut)
        {
            try
            {
                MySql.Data.MySqlClient.MySqlDataReader myData;
                string dut_id = "0";

                //get dut_id from serial_number and test_time.
                bool dataExist = false;
                cmd.CommandText = string.Format("SELECT Id FROM dut WHERE SerialNumber='{0}' AND TestTime='{1}'", dut.SerailNumber, dut.TestTime);
                myData = cmd.ExecuteReader();
                while (myData.Read())
                {
                    //Trace.WriteLine("DUT ID: ", myData[0].ToString());
                    dut_id = myData[0].ToString();
                    dataExist = true;
                }
                myData.Close();

                if (dataExist)
                {
                    LastError = "DUT already exists";
                    return false;
                }

                //foreach (string rawCount in dut.RawCountX)
                //{
                //    string SQL_insert_query = string.Format("INSERT INTO rawcountaverage (DUTID, ValueIndex, RawCountAverage) VALUES ({0},{1},{2})", dut_id, index, rawCount);
                //    index++;
                //    cmd.CommandText = SQL_insert_query;
                //    cmd.ExecuteNonQuery();
                //}

                //index = 1;
                //foreach (string noise in dut.NoiseX)
                //{
                //    string SQL_insert_query = string.Format("INSERT INTO rawcountnoise (DUTID, ValueIndex, RawCountNoise) VALUES ({0},{1},{2})", dut_id, index, noise);
                //    index++;
                //    cmd.CommandText = SQL_insert_query;
                //    cmd.ExecuteNonQuery();
                //}

                //index = 1;
                //foreach (string idac in dut.IDAC)
                //{
                //    string SQL_insert_query = string.Format("INSERT INTO idacvalue (DUTID, ValueIndex, IDACValue) VALUES ({0},{1},{2})", dut_id, index, idac);
                //    index++;
                //    cmd.CommandText = SQL_insert_query;
                //    cmd.ExecuteNonQuery();
                //}

                //insert into dut table.
                string SQL_insert_query_dut = "INSERT INTO dut (SerialNumber,TestStation,PartType,ErrorCode,IDDValue,FirmwareVersion,TestTime) ";
                SQL_insert_query_dut += "VALUES ('" + dut.SerailNumber + "'," + "'" + dut.TestStation + "'," + "'" + dut.PartType + "'," + dut.ErrorCode + "," + dut.IDDValue + "," + dut.FwRev + ",'" + dut.TestTime + "')";

                cmd.CommandText = SQL_insert_query_dut;
                cmd.ExecuteNonQuery();

                //get DUTid from current record
                cmd.CommandText = string.Format("SELECT Id FROM dut WHERE SerialNumber='{0}' AND TestTime='{1}'", dut.SerailNumber, dut.TestTime);
                myData = cmd.ExecuteReader();
                while (myData.Read())
                {
                    //Trace.WriteLine("DUT ID: ", myData[0].ToString());
                    dut_id = myData[0].ToString();
                }
                myData.Close();

                int index;
                //insert RawCount Value
                if (dut.RawCountX.Capacity > 0)
                {
                    index = 1;
                    string SQL_insert_query_rawcount = "INSERT INTO rawcountaverage (DUTID, ValueIndex, RawCountAverage) VALUES ";
                    foreach (string rawcount in dut.RawCountX)
                    {
                        SQL_insert_query_rawcount += "(" + dut_id + "," + index.ToString() + "," + rawcount + "),";
                        index++;
                    }
                    SQL_insert_query_rawcount = SQL_insert_query_rawcount.Substring(0, SQL_insert_query_rawcount.Length - 1);
                    SQL_insert_query_rawcount += ";";

                    //Trace.WriteLine(SQL_insert_query_rawcount);

                    cmd.CommandText = SQL_insert_query_rawcount;
                    cmd.ExecuteNonQuery();
                }

                //insert Noise Value
                if (dut.NoiseX.Capacity > 0)
                {
                    index = 1;
                    string SQL_insert_query_noise = "INSERT INTO rawcountnoise (DUTID, ValueIndex, RawCountNoise) VALUES ";
                    foreach (string noise in dut.NoiseX)
                    {
                        SQL_insert_query_noise += "(" + dut_id + "," + index.ToString() + "," + noise + "),";
                        index++;
                    }
                    SQL_insert_query_noise = SQL_insert_query_noise.Substring(0, SQL_insert_query_noise.Length - 1);
                    SQL_insert_query_noise += ";";

                    //Trace.WriteLine(SQL_insert_query_noise);

                    cmd.CommandText = SQL_insert_query_noise;
                    cmd.ExecuteNonQuery();
                }

                //insert IDAC Value
                if (dut.IDAC.Capacity > 0)
                {
                    index = 1;
                    string SQL_insert_query_idac = "INSERT INTO idacvalue (DUTID, ValueIndex, IDACValue) VALUES ";
                    foreach (string idac in dut.IDAC)
                    {
                        SQL_insert_query_idac += "(" + dut_id + "," + index.ToString() + "," + idac + "),";
                        index++;
                    }
                    SQL_insert_query_idac = SQL_insert_query_idac.Substring(0, SQL_insert_query_idac.Length - 1);
                    SQL_insert_query_idac += ";";

                    //Trace.WriteLine(SQL_insert_query_idac);

                    cmd.CommandText = SQL_insert_query_idac;
                    cmd.ExecuteNonQuery();
                }

                return true;
            }
            catch (Exception ex)
            {
                LastError = ex.Message;
                Trace.WriteLine(ex.Message);
                return false;
            }
        }
Exemple #3
0
        public DUT_Str read(string path)
        {
            string  temp;
            DUT_Str dut = new DUT_Str();

            dut.RawCountX   = new List <string>();
            dut.NoiseX      = new List <string>();
            dut.StdDevX     = new List <string>();
            dut.RawCountY   = new List <string>();
            dut.NoiseY      = new List <string>();
            dut.StdDevY     = new List <string>();
            dut.IDAC        = new List <string>();
            dut.IDACGain    = new List <string>();
            dut.Global_IDAC = new List <string>();
            dut.Local_IDAC  = new List <string>();
            dut.SignalX     = new List <string>();
            dut.SNRX        = new List <string>();

            XmlTextReader reader;

            try
            {
                reader = new XmlTextReader(path);

                reader.MoveToContent();
                reader.ReadStartElement("Trackpad");

                reader.ReadStartElement("Serial_Number");
                temp             = reader.ReadString();
                dut.SerailNumber = temp;
                dut.PartType     = temp.Substring(0, 8);
                //Console.WriteLine("The Serial_Number is: {0}", temp);
                reader.ReadEndElement();

                reader.ReadStartElement("Test_Station");
                temp            = reader.ReadString();
                dut.TestStation = temp;
                //Console.WriteLine("The Test_Station is: {0}", temp);
                reader.ReadEndElement();

                reader.ReadStartElement("Error_Code");
                temp          = reader.ReadString();
                dut.ErrorCode = temp;
                //Console.WriteLine("The Error_Code is: {0}", temp);
                reader.ReadEndElement();

                reader.ReadStartElement("Test_Time");
                temp         = reader.ReadString().Substring(0, 19);
                dut.TestTime = temp;
                //Console.WriteLine("The Test_Time is: {0}", temp);
                reader.ReadEndElement();

                reader.ReadStartElement("IDD_Value");
                temp         = reader.ReadString();
                dut.IDDValue = temp;
                //Console.WriteLine("The IDD_Value is: {0}", temp);
                reader.ReadEndElement();

                reader.ReadStartElement("Firmware_Revision");
                temp      = reader.ReadString();
                dut.FwRev = temp;
                //Console.WriteLine("The Firmware_Revision is: {0}", temp);
                reader.ReadEndElement();


                //reader.ReadStartElement("IDD_Sleep1_Value");
                //temp = reader.ReadString();
                //dut.IDDValueSleep1 = temp;
                ////Console.WriteLine("The IDD_Value is: {0}", temp);
                //reader.ReadEndElement();

                //reader.ReadStartElement("IDD_Deep_Sleep_Value");
                //temp = reader.ReadString();
                //dut.IDDValueDeepSleep = temp;
                ////Console.WriteLine("The Firmware_Revision is: {0}", temp);
                //reader.ReadEndElement();

                reader.ReadStartElement("Raw_Count_Averages");
                int i = 1;
                while (reader.ReadToNextSibling("D" + i.ToString()))
                {
                    temp = reader.ReadString();
                    dut.RawCountX.Add(temp);
                    //Console.WriteLine("Raw_Count_Averages" + i.ToString() + ": {0}", temp);
                    i++;
                }
                reader.ReadEndElement();

                reader.ReadStartElement("Raw_Count_Noise");
                i = 1;
                while (reader.ReadToNextSibling("D" + i.ToString()))
                {
                    temp = reader.ReadString();
                    dut.NoiseX.Add(temp);
                    //Console.WriteLine("Raw_Count_Noise" + i.ToString() + ": {0}", temp);
                    i++;
                }
                reader.ReadEndElement();

                reader.ReadStartElement("IDAC_Value");
                i = 1;
                while (reader.ReadToNextSibling("D" + i.ToString()))
                {
                    temp = reader.ReadString();
                    dut.IDAC.Add(temp);
                    //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                    i++;
                }
                reader.ReadEndElement();

                reader.ReadStartElement("IDAC_Gain_Value");
                i = 1;
                while (reader.ReadToNextSibling("D" + i.ToString()))
                {
                    temp = reader.ReadString();
                    dut.IDACGain.Add(temp);
                    //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                    i++;
                }
                reader.ReadEndElement();

                reader.ReadStartElement("Local_IDAC_Value");
                i = 1;
                while (reader.ReadToNextSibling("D" + i.ToString()))
                {
                    temp = reader.ReadString();
                    dut.Local_IDAC.Add(temp);
                    //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                    i++;
                }
                reader.ReadEndElement();

                reader.ReadStartElement("Signal_Data");
                i = 1;
                while (reader.ReadToNextSibling("D" + i.ToString()))
                {
                    temp = reader.ReadString();
                    dut.SignalX.Add(temp);
                    //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                    i++;
                }
                reader.ReadEndElement();

                reader.ReadStartElement("SNR_Data");
                i = 1;
                while (reader.ReadToNextSibling("D" + i.ToString()))
                {
                    temp = reader.ReadString();
                    dut.SNRX.Add(temp);
                    //Console.WriteLine("IDAC_Value" + i.ToString() + ": {0}", temp);
                    i++;
                }
                reader.ReadEndElement();

                reader.ReadEndElement();

                reader.Close();
            }
            catch
            { }


            return(dut);
        }