コード例 #1
0
        public PublicFunctionBarcode(string COMLocation, IntPtr hw)
        {
            BarcodeType = Convert.ToUInt16(BarcodeType);
            ihw         = hw;
            iPortNumber = Convert.ToInt32(COMLocation.Remove(0, 3));

            mSerialPort               = new SerialPort(COMLocation);
            mSerialPort.BaudRate      = 9600;
            mSerialPort.DataBits      = 8;
            mSerialPort.Parity        = Parity.None;
            mSerialPort.StopBits      = StopBits.One;
            mSerialPort.Handshake     = Handshake.None; // Winmate kenkun modify on 2017/07/28
            mSerialPort.DataReceived += new SerialDataReceivedEventHandler(mSerialPort_DataReceived);

            if (BarcodeType == 2)
            {
                if (!initinalIsdcRsBarCode())
                {
                    m_IsdcRsApi.DisconnectIsdcRs();
                    m_IsdcRsApi.DeinitializeIsdcRs();
                    initinalBarCode();
                }
            }
            else if (BarcodeType == 3)
            {
                initinalSE4500DLBarCode();
            }
            else
            {
                initinalBarCode();
            }
        }
コード例 #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);
        }