예제 #1
0
        private void setupReaderConfiguration()
        {
            String PARAM_STR_REGION   = "/reader/region/id";
            String PARAM_STR_SESSION  = "/reader/gen2/session";
            String PARAM_STR_READPLAN = "/reader/read/plan";

            //Set the region to NA
            if (Reader.Region.UNSPEC == (Reader.Region)reader.ParamGet(PARAM_STR_REGION))
            {
                Reader.Region[] supportedRegions = (Reader.Region[])reader.ParamGet("/reader/region/supportedRegions");
                if (supportedRegions.Length < 1)
                {
                    throw new FAULT_INVALID_REGION_Exception();
                }
                else
                {
                    reader.ParamSet(PARAM_STR_REGION, supportedRegions[0]);
                }
            }
            //Set the session to session 0
            reader.ParamSet(PARAM_STR_SESSION, Gen2.Session.S0);

            //Get the region
            Reader.Region region = (Reader.Region)reader.ParamGet(PARAM_STR_REGION);
            Console.WriteLine("The current region is " + region);

            //Get the session
            Gen2.Session session = (Gen2.Session)reader.ParamGet(PARAM_STR_SESSION);
            Console.WriteLine("The current session is " + session);

            //Get the read plan
            ReadPlan rp = (ReadPlan)reader.ParamGet(PARAM_STR_READPLAN);

            Console.WriteLine("Read plan: " + rp);
        }
예제 #2
0
        private void setupReaderConfiguration()
        {
            String PARAM_STR_REGION   = "/reader/region/id";
            String PARAM_STR_SESSION  = "/reader/gen2/session";
            String PARAM_STR_READPLAN = "/reader/read/plan";

            //Set the region to NA
            if (Reader.Region.UNSPEC == (Reader.Region)reader.ParamGet(PARAM_STR_REGION))
            {
                Reader.Region[] supportedRegions = (Reader.Region[])reader.ParamGet("/reader/region/supportedRegions");
                if (supportedRegions.Length < 1)
                {
                    throw new FAULT_INVALID_REGION_Exception();
                }
                reader.ParamSet(PARAM_STR_REGION, supportedRegions[0]);
            }
            string model = reader.ParamGet("/reader/version/model").ToString();

            if ((model.Equals("M6e Micro") || model.Equals("M6e Nano") || model.Equals("Sargas")) && antennaList == null)
            {
                Console.WriteLine("Module doesn't has antenna detection support please provide antenna list");
                Usage();
            }
            //Use first antenna for operation
            if (antennaList != null)
            {
                reader.ParamSet("/reader/tagop/antenna", antennaList[0]);
            }

            //Set the session to session 0
            reader.ParamSet(PARAM_STR_SESSION, Gen2.Session.S0);

            //Get the region
            Reader.Region region = (Reader.Region)reader.ParamGet(PARAM_STR_REGION);
            Console.WriteLine("The current region is " + region);

            //Get the session
            Gen2.Session session = (Gen2.Session)reader.ParamGet(PARAM_STR_SESSION);
            Console.WriteLine("The current session is " + session);

            //Get the read plan
            ReadPlan rp = (ReadPlan)reader.ParamGet(PARAM_STR_READPLAN);

            Console.WriteLine("Read plan: " + rp);
        }
예제 #3
0
        private void run(String reader_uri)
        {
            try
            {
                String PARAM_STR_REGION   = "/reader/region/id";
                String PARAM_STR_SESSION  = "/reader/gen2/session";
                String PARAM_STR_READPLAN = "/reader/read/plan";

                Console.WriteLine(String.Format("Connecting to {0}", reader_uri));
                //Create the reader
                reader = Reader.Create(reader_uri);

                try
                {
                    //Uncomment this line to add default transport listener.
                    //reader.Transport += reader.SimpleTransportListener;

                    //Connect to the reader
                    reader.Connect();

                    //Set the region to NA
                    if (Reader.Region.UNSPEC == (Reader.Region)reader.ParamGet(PARAM_STR_REGION))
                    {
                        Reader.Region[] supportedRegions = (Reader.Region[])reader.ParamGet("/reader/region/supportedRegions");
                        if (supportedRegions.Length < 1)
                        {
                            throw new FAULT_INVALID_REGION_Exception();
                        }
                        else
                        {
                            reader.ParamSet(PARAM_STR_REGION, supportedRegions[0]);
                        }
                    }
                    string model = reader.ParamGet("/reader/version/model").ToString();
                    if ((model.Equals("M6e Micro") || model.Equals("M6e Nano") || model.Equals("Sargas")) && antennaList == null)
                    {
                        Console.WriteLine("Module doesn't has antenna detection support please provide antenna list");
                        Usage();
                    }
                    //Use first antenna for operation
                    if (antennaList != null)
                    {
                        reader.ParamSet("/reader/tagop/antenna", antennaList[0]);
                    }


                    //Set the session to session 0
                    reader.ParamSet(PARAM_STR_SESSION, Gen2.Session.S0);

                    //Get the region
                    Reader.Region region = (Reader.Region)reader.ParamGet(PARAM_STR_REGION);
                    Console.WriteLine("The current region is " + region);

                    //Get the session
                    Gen2.Session session = (Gen2.Session)reader.ParamGet(PARAM_STR_SESSION);
                    Console.WriteLine("The current session is " + session);

                    //Get the read plan
                    ReadPlan rp = (ReadPlan)reader.ParamGet(PARAM_STR_READPLAN);
                    Console.WriteLine("The current Read Plan is: " + rp);

                    //Create the Get Calibration Data tag operation
                    Gen2.IDS.SL900A.GetCalibrationData getCal_tagop = new Gen2.IDS.SL900A.GetCalibrationData();

                    //Use the Get Calibration Data (and SFE Parameters) tag op
                    Gen2.IDS.SL900A.CalSfe calSfe = (Gen2.IDS.SL900A.CalSfe)reader.ExecuteTagOp(getCal_tagop, null);

                    //Save the current Sfe to restore it to the tag after the test
                    Gen2.IDS.SL900A.SfeParameters restore_sfe = (Gen2.IDS.SL900A.SfeParameters)calSfe.Sfe;

                    //Display the Calibration (and SFE Parameters) Data
                    Console.WriteLine("Detected Calibration: " + calSfe);

                    //Set the Sfe Parameters to 0xBEEF (16 bits)
                    byte[] test_sfe_byte_array = new byte[2] {
                        0xBE, 0xEF
                    };

                    Gen2.IDS.SL900A.SfeParameters test_sfe = new Gen2.IDS.SL900A.SfeParameters(test_sfe_byte_array, 0);

                    //Execute the Set Calibration Data command with test_cal to change its value
                    reader.ExecuteTagOp(new Gen2.IDS.SL900A.SetSfeParameters(test_sfe), null);

                    //Use Get Calibration Data to retrieve the new Calibration (and SFE Parameters) from the tag
                    Gen2.IDS.SL900A.CalSfe verification_calSfe = (Gen2.IDS.SL900A.CalSfe)reader.ExecuteTagOp(getCal_tagop, null);

                    //Get the Sfe data from the CalSfe data
                    Gen2.IDS.SL900A.SfeParameters verification_sfe = (Gen2.IDS.SL900A.SfeParameters)verification_calSfe.Sfe;

                    //Ensure that the Calibration Data we set matches the current Calibration Data
                    Console.WriteLine("Set SFE Parameters Succeeded? " + test_sfe.ToString().Equals(verification_sfe.ToString()));

                    //Restore the starting SFE Parameters
                    reader.ExecuteTagOp(new Gen2.IDS.SL900A.SetSfeParameters(restore_sfe), null);

                    //Get CalSfe of the restored tag
                    Gen2.IDS.SL900A.CalSfe restored_calSfe = (Gen2.IDS.SL900A.CalSfe)reader.ExecuteTagOp(getCal_tagop, null);

                    //Make sure that CalSfe is now the same as it was before the test
                    Console.WriteLine("Restore Calibration Data Succeeded? " + calSfe.ToString().Equals(restored_calSfe.ToString()));
                }
                finally
                {
                    //Disconnect from the reader
                    reader.Destroy();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e.Message);
            }
        }
예제 #4
0
        private void run(String reader_uri)
        {
            try
            {
                String PARAM_STR_REGION   = "/reader/region/id";
                String PARAM_STR_SESSION  = "/reader/gen2/session";
                String PARAM_STR_READPLAN = "/reader/read/plan";

                Console.WriteLine(String.Format("Connecting to {0}", reader_uri));
                //Create the reader
                reader = Reader.Create(reader_uri);

                try
                {
                    //Uncomment this line to add default transport listener.
                    //reader.Transport += reader.SimpleTransportListener;

                    //Connect to the reader
                    reader.Connect();

                    //Set the region to NA
                    if (Reader.Region.UNSPEC == (Reader.Region)reader.ParamGet(PARAM_STR_REGION))
                    {
                        Reader.Region[] supportedRegions = (Reader.Region[])reader.ParamGet("/reader/region/supportedRegions");
                        if (supportedRegions.Length < 1)
                        {
                            throw new FAULT_INVALID_REGION_Exception();
                        }
                        else
                        {
                            reader.ParamSet(PARAM_STR_REGION, supportedRegions[0]);
                        }
                    }
                    //Set the session to session 0
                    reader.ParamSet(PARAM_STR_SESSION, Gen2.Session.S0);

                    //Get the region
                    Reader.Region region = (Reader.Region)reader.ParamGet(PARAM_STR_REGION);
                    Console.WriteLine("The current region is " + region);

                    //Get the session
                    Gen2.Session session = (Gen2.Session)reader.ParamGet(PARAM_STR_SESSION);
                    Console.WriteLine("The current session is " + session);

                    //Get the read plan
                    ReadPlan rp = (ReadPlan)reader.ParamGet(PARAM_STR_READPLAN);
                    Console.WriteLine("The current Read Plan is: " + rp);

                    //Create the Get Calibration Data tag operation
                    Gen2.IDS.SL900A.GetCalibrationData getCal_tagop = new Gen2.IDS.SL900A.GetCalibrationData();

                    //Use the Get Calibration Data (and SFE Parameters) tag op
                    Gen2.IDS.SL900A.CalSfe calSfe = (Gen2.IDS.SL900A.CalSfe)reader.ExecuteTagOp(getCal_tagop, null);

                    //Save the current Cal to restore it to the tag after the test
                    Gen2.IDS.SL900A.CalibrationData restore_cal = (Gen2.IDS.SL900A.CalibrationData)calSfe.Cal;

                    //Display the Calibration (and SFE Parameters) Data
                    Console.WriteLine("Detected Calibration: " + calSfe);

                    //Set the Calibration Data to 0x0123456789ABCD (56 bits)
                    byte[] test_cal_byte_array = new byte[7] {
                        0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD
                    };

                    Gen2.IDS.SL900A.CalibrationData test_cal = new Gen2.IDS.SL900A.CalibrationData(test_cal_byte_array, 0);

                    //Execute the Set Calibration Data command with test_cal to change its value
                    reader.ExecuteTagOp(new Gen2.IDS.SL900A.SetCalibrationData(test_cal), null);

                    //Use Get Calibration Data to retrieve the new Calibration (and SFE Parameters) from the tag
                    Gen2.IDS.SL900A.CalSfe verification_calSfe = (Gen2.IDS.SL900A.CalSfe)reader.ExecuteTagOp(getCal_tagop, null);

                    //Get the Cal data from the CalSfe data
                    Gen2.IDS.SL900A.CalibrationData verification_cal = (Gen2.IDS.SL900A.CalibrationData)verification_calSfe.Cal;

                    //Print the verificationCal
                    Console.WriteLine("Verification Cal: " + verification_cal.ToString());

                    //Ensure that the Calibration Data we set matches the current Calibration Data
                    Console.WriteLine("Set Calibration Data Succeeded? " + test_cal.ToString().Equals(verification_cal.ToString()));

                    //Restore the starting Calibration Data
                    reader.ExecuteTagOp(new Gen2.IDS.SL900A.SetCalibrationData(restore_cal), null);

                    //Get CalSfe of the restored tag
                    Gen2.IDS.SL900A.CalSfe restored_calSfe = (Gen2.IDS.SL900A.CalSfe)reader.ExecuteTagOp(getCal_tagop, null);

                    //Make sure that CalSfe is now the same as it was before the test
                    Console.WriteLine("Restore Calibration Data Succeeded? " + calSfe.ToString().Equals(restored_calSfe.ToString()));
                }
                finally
                {
                    //Disconnect from the reader
                    reader.Destroy();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e.Message);
            }
        }
예제 #5
0
파일: PlanService.cs 프로젝트: aicl/liebre
 public object Get(ReadPlan request)
 {
     return(ServiceBase.CreateResponse(Store.Get <Plan>(q => q.Id)));
 }
예제 #6
0
파일: frmLoadReader.cs 프로젝트: xlgwr/RFID
        /// <summary>
        /// 连接采集设备
        /// </summary>
        private void Running()
        {
            while (Runningl)
            {
                try
                {

                    reader = Reader.Create(sparmas.Comv, (ModuleTech.Region)sparmas.Region, (ReaderType)sparmas.ReaderType);
                    Funpercent(30, "创建读写器完毕");
                    //
                    reader.ParamSet("CheckAntConnection", sparmas.CheckAnt);
                    Funpercent(40, "检测天线");
                    AntPower[] apwrs = new AntPower[sparmas.AntType];
                    for (int i = 0; i < apwrs.Length; i++)
                    {
                        apwrs[i].AntId = (byte)(i + 1);
                        apwrs[i].ReadPower = ushort.Parse(sparmas.ReadPw[i]);
                        apwrs[i].WritePower = ushort.Parse(sparmas.WritePw[i]);
                    }
                    reader.ParamSet("AntPowerConf", apwrs);
                    Funpercent(50, "配置天线功率");
                    reader.ParamSet("TagopAntenna", sparmas.Opant);
                    Funpercent(60, "配置默认天线");
                    int[] connectedants = (int[])reader.ParamGet("ConnectedAntennas");

                    SimpleReadPlan gen2srp = null;
                    SimpleReadPlan iso6bsrp = null;
                    if (connectedants.Length > 0)
                    {
                        sparmas.Connectants = connectedants;
                        gen2srp = new SimpleReadPlan(TagProtocol.GEN2, connectedants);
                        iso6bsrp = new SimpleReadPlan(TagProtocol.ISO180006B, connectedants);
                    }
                    else
                    {
                        sparmas.Connectants = null;
                        gen2srp = new SimpleReadPlan(TagProtocol.GEN2, new int[] { sparmas.Opant });
                        iso6bsrp = new SimpleReadPlan(TagProtocol.ISO180006B, new int[] { sparmas.Opant });
                    }

                    if (sparmas.Protocol == 0)
                    {
                        reader.ParamSet("ReadPlan", gen2srp);
                        Funpercent(70, "配置盘点方式");
                    }
                    else if (sparmas.Protocol == 1)
                    {
                        reader.ParamSet("ReadPlan", iso6bsrp);
                        Funpercent(70, "配置盘点方式");
                    }
                    else
                    {
                        ReadPlan[] rp = new ReadPlan[2];
                        rp[0] = gen2srp;
                        rp[1] = iso6bsrp;
                        MultiReadPlan mrp = new MultiReadPlan(rp);
                        reader.ParamSet("ReadPlan", rp);
                        Funpercent(70, "配置盘点方式");
                    }

                    reader.ParamSet("Gen2Session", (ModuleTech.Gen2.Session)sparmas.Session);
                    Funpercent(80, "配置会话模式");
                    if (sparmas.CustomFrequency)
                    {
                        List<uint> htb = new List<uint>();
                        for (int i = 0; i < sparmas.Frequencys.Length; i++)
                        {
                            htb.Add(uint.Parse(sparmas.Frequencys[i]));
                        }
                        reader.ParamSet("FrequencyHopTable", htb.ToArray());
                        Funpercent(90, "配置频率表");
                    }
                    else
                    {
                        reader.ParamSet("Region", (ModuleTech.Region)sparmas.Region);
                        Funpercent(90, "配置频率表");
                    }
                    try
                    {

                        reader.ParamSet("PowerMode", (byte)sparmas.PowerMode);
                        reader.ParamSet("IsTransmitPowerSave", true);
                    }
                    catch (Exception omitex)
                    {

                    }

                    Funpercent(100, "配置完毕,读写器工作就绪");

                }
                catch (System.Exception ex)
                {
                    string msg = string.Empty;

                    if (ex is ModuleLibrary.FatalInternalException)
                        msg = Convert.ToString(((ModuleLibrary.FatalInternalException)ex).ErrCode, 16);
                    if (ex is ModuleLibrary.HardwareAlertException)
                        msg = Convert.ToString(((ModuleLibrary.HardwareAlertException)ex).ErrCode, 16);
                    if (ex is ModuleLibrary.ModuleException)
                        msg = Convert.ToString(((ModuleLibrary.ModuleException)ex).ErrCode, 16);
                    if (ex is ModuleLibrary.OpFaidedException)
                        msg = Convert.ToString(((ModuleLibrary.OpFaidedException)ex).ErrCode, 16);
                    if (reader != null)
                        reader.Disconnect();

                    Funpercent(0, "连接失败" + ex.Message + " :" + msg);

                    dlog.WirteLog(ex.Message + ":" + msg + ex.StackTrace);
                }

                Thread.Sleep(1000);
                Runningl = false;
            }

            IsExit = false;

            Funpercent(-100, string.Empty);
        }
예제 #7
0
        private void run(String reader_uri)
        {
            try
            {
                String PARAM_STR_REGION   = "/reader/region/id";
                String PARAM_STR_SESSION  = "/reader/gen2/session";
                String PARAM_STR_READPLAN = "/reader/read/plan";

                Console.WriteLine(String.Format("Connecting to {0}", reader_uri));
                //Create the reader
                reader = Reader.Create(reader_uri);

                try
                {
                    //Uncomment this line to add default transport listener.
                    //reader.Transport += reader.SimpleTransportListener;

                    //Connect to the reader
                    reader.Connect();

                    //Set the region to NA
                    if (Reader.Region.UNSPEC == (Reader.Region)reader.ParamGet(PARAM_STR_REGION))
                    {
                        Reader.Region[] supportedRegions = (Reader.Region[])reader.ParamGet("/reader/region/supportedRegions");
                        if (supportedRegions.Length < 1)
                        {
                            throw new FAULT_INVALID_REGION_Exception();
                        }
                        else
                        {
                            reader.ParamSet(PARAM_STR_REGION, supportedRegions[0]);
                        }
                    }
                    string model = reader.ParamGet("/reader/version/model").ToString();
                    if ((model.Equals("M6e Micro") || model.Equals("M6e Nano") || model.Equals("Sargas")) && antennaList == null)
                    {
                        Console.WriteLine("Module doesn't has antenna detection support please provide antenna list");
                        Usage();
                    }
                    //Use first antenna for operation
                    if (antennaList != null)
                    {
                        reader.ParamSet("/reader/tagop/antenna", antennaList[0]);
                    }

                    //Set the session to session 0
                    reader.ParamSet(PARAM_STR_SESSION, Gen2.Session.S0);

                    //Get the region
                    Reader.Region region = (Reader.Region)reader.ParamGet(PARAM_STR_REGION);
                    Console.WriteLine("The current region is " + region);

                    //Get the session
                    Gen2.Session session = (Gen2.Session)reader.ParamGet(PARAM_STR_SESSION);
                    Console.WriteLine("The current session is " + session);

                    //Get the read plan
                    ReadPlan rp = (ReadPlan)reader.ParamGet(PARAM_STR_READPLAN);
                    Console.WriteLine("The current Read Plan is: " + rp);

                    //Create the Get Calibration Data tag operation
                    Gen2.IDS.SL900A.GetCalibrationData tagOp = new Gen2.IDS.SL900A.GetCalibrationData();

                    //Use the Get Calibration Data (and SFE Parameters) tag op
                    Gen2.IDS.SL900A.CalSfe calSfe = (Gen2.IDS.SL900A.CalSfe)reader.ExecuteTagOp(tagOp, null);

                    //Display the Calibration (and SFE Parameters) Data
                    Console.WriteLine(calSfe);

                    //Display the specific Calibration data gnd_switch
                    Console.WriteLine("gnd_switch: " + calSfe.Cal.GndSwitch);

                    //Display the specific SFE Parameter Verify Sensor ID
                    Console.WriteLine("Verify Sensor ID: " + calSfe.Sfe.VerifySensorID);
                }
                finally
                {
                    //Disconnect from the reader
                    reader.Destroy();
                }
            }
            catch (Exception e) {
                Console.WriteLine("Error: " + e.Message);
            }
        }
예제 #8
0
        /// <summary>
        /// 连接采集设备
        /// </summary>
        private void Running()
        {
            while (Runningl)
            {
                try
                {
                    reader = Reader.Create(sparmas.Comv, (ModuleTech.Region)sparmas.Region, (ReaderType)sparmas.ReaderType);
                    Funpercent(30, "创建读写器完毕");
                    //
                    reader.ParamSet("CheckAntConnection", sparmas.CheckAnt);
                    Funpercent(40, "检测天线");
                    AntPower[] apwrs = new AntPower[sparmas.AntType];
                    for (int i = 0; i < apwrs.Length; i++)
                    {
                        apwrs[i].AntId      = (byte)(i + 1);
                        apwrs[i].ReadPower  = ushort.Parse(sparmas.ReadPw[i]);
                        apwrs[i].WritePower = ushort.Parse(sparmas.WritePw[i]);
                    }
                    reader.ParamSet("AntPowerConf", apwrs);
                    Funpercent(50, "配置天线功率");
                    reader.ParamSet("TagopAntenna", sparmas.Opant);
                    Funpercent(60, "配置默认天线");
                    int[] connectedants = (int[])reader.ParamGet("ConnectedAntennas");

                    SimpleReadPlan gen2srp  = null;
                    SimpleReadPlan iso6bsrp = null;
                    if (connectedants.Length > 0)
                    {
                        sparmas.Connectants = connectedants;
                        gen2srp             = new SimpleReadPlan(TagProtocol.GEN2, connectedants);
                        iso6bsrp            = new SimpleReadPlan(TagProtocol.ISO180006B, connectedants);
                    }
                    else
                    {
                        sparmas.Connectants = null;
                        gen2srp             = new SimpleReadPlan(TagProtocol.GEN2, new int[] { sparmas.Opant });
                        iso6bsrp            = new SimpleReadPlan(TagProtocol.ISO180006B, new int[] { sparmas.Opant });
                    }

                    if (sparmas.Protocol == 0)
                    {
                        reader.ParamSet("ReadPlan", gen2srp);
                        Funpercent(70, "配置盘点方式");
                    }
                    else if (sparmas.Protocol == 1)
                    {
                        reader.ParamSet("ReadPlan", iso6bsrp);
                        Funpercent(70, "配置盘点方式");
                    }
                    else
                    {
                        ReadPlan[] rp = new ReadPlan[2];
                        rp[0] = gen2srp;
                        rp[1] = iso6bsrp;
                        MultiReadPlan mrp = new MultiReadPlan(rp);
                        reader.ParamSet("ReadPlan", rp);
                        Funpercent(70, "配置盘点方式");
                    }

                    reader.ParamSet("Gen2Session", (ModuleTech.Gen2.Session)sparmas.Session);
                    Funpercent(80, "配置会话模式");
                    if (sparmas.CustomFrequency)
                    {
                        List <uint> htb = new List <uint>();
                        for (int i = 0; i < sparmas.Frequencys.Length; i++)
                        {
                            htb.Add(uint.Parse(sparmas.Frequencys[i]));
                        }
                        reader.ParamSet("FrequencyHopTable", htb.ToArray());
                        Funpercent(90, "配置频率表");
                    }
                    else
                    {
                        reader.ParamSet("Region", (ModuleTech.Region)sparmas.Region);
                        Funpercent(90, "配置频率表");
                    }
                    try
                    {
                        reader.ParamSet("PowerMode", (byte)sparmas.PowerMode);
                        reader.ParamSet("IsTransmitPowerSave", true);
                    }
                    catch (Exception omitex)
                    {
                    }

                    Funpercent(100, "配置完毕,读写器工作就绪");
                }
                catch (System.Exception ex)
                {
                    string msg = string.Empty;

                    if (ex is ModuleLibrary.FatalInternalException)
                    {
                        msg = Convert.ToString(((ModuleLibrary.FatalInternalException)ex).ErrCode, 16);
                    }
                    if (ex is ModuleLibrary.HardwareAlertException)
                    {
                        msg = Convert.ToString(((ModuleLibrary.HardwareAlertException)ex).ErrCode, 16);
                    }
                    if (ex is ModuleLibrary.ModuleException)
                    {
                        msg = Convert.ToString(((ModuleLibrary.ModuleException)ex).ErrCode, 16);
                    }
                    if (ex is ModuleLibrary.OpFaidedException)
                    {
                        msg = Convert.ToString(((ModuleLibrary.OpFaidedException)ex).ErrCode, 16);
                    }
                    if (reader != null)
                    {
                        reader.Disconnect();
                    }

                    Funpercent(0, "连接失败" + ex.Message + " :" + msg);

                    dlog.WirteLog(ex.Message + ":" + msg + ex.StackTrace);
                }

                Thread.Sleep(1000);
                Runningl = false;
            }

            IsExit = false;

            Funpercent(-100, string.Empty);
        }