Ejemplo n.º 1
0
        public void free()
        {
            if (IsDebugMode)
            {
                Trace.WriteLine("PublicFunctionBarcode - free() , Type : " + BarcodeType + " , Port.IsOpen : " + mSerialPort.IsOpen);
            }
            if (BarcodeType == 2)
            {
                if (m_IsdcRsApi != null)
                {
                    try
                    {
                        m_IsdcRsApi.DisconnectIsdcRs();
                        m_IsdcRsApi.DeinitializeIsdcRs();
                        m_IsdcRsApi = null;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
            else if (BarcodeType == 3)
            {
                closePortSSI();
            }

            if (mSerialPort.IsOpen)
            {
                mSerialPort.Close();
            }
            mSerialPort.Dispose();
            mSerialPort = null;
        }
Ejemplo n.º 2
0
        public bool initinalIsdcRsBarCode()
        {
            if (IsDebugMode)
            {
                Trace.WriteLine("PublicFunctionBarcode - initinalIsdcRsBarCode()");
            }
            byte   status = 0;
            string s      = "";
            byte   port   = 15;
            int    num    = PortAddressBarcode.IndexOf("COM", 0); // gCOMLocation.IndexOf("COM", 0);

            if (num >= 0)
            {
                s    = PortAddressBarcode.Remove(num, 3); // gCOMLocation.Remove(num, 3);
                port = Convert.ToByte(s);
            }

            m_IsdcRsApi = new IsdcRsApi();

            status = m_IsdcRsApi.InitializeIsdcRs("HKCU\\SOFTWARE\\HotTab\\Intermec\n"); // for windws 7 or windows 8

            if (status != 0)
            {
                return(false);
            }

            status += m_IsdcRsApi.SetPortNumber(port);
            status += m_IsdcRsApi.SetBaudRate(57600);
            if (status != 0)
            {
                m_IsdcRsApi.DeinitializeIsdcRs();
                return(false);
            }

            status += m_IsdcRsApi.ConnectIsdcRs(); // 出現搜尋Comport的ProcessBar視窗
            if (status != 0)
            {
                m_IsdcRsApi.DeinitializeIsdcRs();
                return(false);
            }

            status += m_IsdcRsApi.GetVersion(out IsdcRsVersion);
            Trace.WriteLine("status: " + status);
            if (status == 0)
            {
                isSupportBarCode = true;
                firstScan        = true;
                msg2             = "";
                type             = 4;
                Trace.WriteLine("type set to 4");
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        public static byte IsdcRsApiInit()
        {
            byte status = 0;

            BarcodeType = Convert.ToUInt16(BarcodeType);
            if (IsDebugMode)
            {
                Trace.WriteLine("IsdcRsApiInit() - Set BarcodeType : " + BarcodeType);
            }

            if (BarcodeType == 2)
            {
                m_IsdcRsApi = new IsdcRsApi();

                // for windws 7 or windows 8
                status = m_IsdcRsApi.InitializeIsdcRs("HKCU\\SOFTWARE\\HotTab\\Intermec\n");
            }
            return(status);
        }