public void BarcodeScan()
        {
            byte[] TriggerMDI3100 = { 0x1B, 0x5A, 0x0D };   // command Z: trigger the reader
            byte[] TriggerBS523   = { 0x1B, 0x31 };         // command Z: trigger the reader
            byte[] TriggerM3      = { 0x55, 0x30, 0x41, 0xAA };

            try
            {
                if (type == 5)
                {
                    openPortSSI();
                    if (isOpenSE4500DL)
                    {
                        SsiDllApi.PullTrigger(iPortNumber);
                        SsiDllApi.SetDecodeBuffer(iPortNumber, SsiDllApi.DecodeData, SsiDllApi.MAX_LEN);
                    }
                }
                else if (type != 4)
                {
                    if (isOpen())
                    {
                        if ((type == 0) || (type == 3))// Opticon
                        {
                            if (IsDebugMode)
                            {
                                Trace.WriteLine("Send MDI3100 Trigger : 0x1B, 0x5A, 0x0D");
                            }
                            mSerialPort.Write(TriggerMDI3100, 0, TriggerMDI3100.Length);
                        }
                        else if (type == 1)// BS523
                        {
                            if (IsDebugMode)
                            {
                                Trace.WriteLine("Send BS523 Trigger : 0x1B, 0x31");
                            }
                            mSerialPort.Write(TriggerBS523, 0, TriggerBS523.Length);
                        }
                        else if (type == 2)// Opticon M3
                        {
                            if (IsDebugMode)
                            {
                                Trace.WriteLine("Send M3 Trigger : 0x55, 0x30, 0x41, 0xAA");
                            }
                            mSerialPort.Write(TriggerM3, 0, TriggerM3.Length);
                        }
                    }
                }
                else
                {
                    m_IsdcRsApi.ScanStart();
                }
            }
            catch (Exception ex)
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine(ex.Message);
                }
            }
        }
Exemple #2
0
        protected override void WndProc(ref Message m)
        {
            if (m == null)
            {
                return;
            }

            #region Intermec 用來收 Comport 回傳 Data 的事件(Intermec自己將Comport操作的function直接包成DLL給User用)
            if (m.Msg == PublicFunctionBarcode.WM_ISCP_FRAME)
            {
                switch ((byte)m.WParam)
                {
                case PublicFunctionBarcode.BCD:
                    PublicFunctionBarcode.GetBarcodeDataIsdcRs();
                    break;
                }
            }
            else if (m.Msg == PublicFunctionBarcode.WM_RAW_DATA)
            {
                PublicFunctionBarcode.GetRawDataIsdcRs();
            }
            #endregion

            #region Moto 用來收 Comport 回傳 Data 的事件(Moto自己將Comport操作的function直接包成DLL給User用)
            if (m.Msg == 0x8001)
            {
                PublicFunctionBarcode.GetDecodeData();
                SsiDllApi.SetDecodeBuffer(Convert.ToInt32(PortAddressBarcode.Remove(0, 3)), SsiDllApi.DecodeData, SsiDllApi.MAX_LEN);
            }
            else if (m.Msg == 0x8008)
            {
                PublicFunctionBarcode.GetVersionData();
                SsiDllApi.SetDecodeBuffer(Convert.ToInt32(PortAddressBarcode.Remove(0, 3)), SsiDllApi.DecodeData, SsiDllApi.MAX_LEN);
            }
            #endregion

            base.WndProc(ref m);
        }