コード例 #1
0
        public byte WriteTriggerTimeout(byte time)
        {
            // Trace.WriteLine("WriteTriggerTimeout=" + time.ToString());

            if (type == 5)
            {
                openPortSSI();
                if (isOpenSE4500DL)
                {
                    int iRet = -1;

                    if (time > 9)
                    {
                        time = 9;
                    }

                    time = (byte)(time * 10);

                    byte[] data = { 0x88, time };

                    iRet = SsiDllApi.SetParameters(data, data.Length, iPortNumber);

                    // Trace.WriteLine("WriteTriggerTimeout Ret=" + iRet.ToString());

                    Thread.Sleep(100);
                }
            }

            return(0);
        }
コード例 #2
0
        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);
                }
            }
        }
コード例 #3
0
 public void closePortSSI()
 {
     // Trace.WriteLine("closePortSSI");
     if (type == 5)
     {
         if (isOpenSE4500DL)
         {
             if (SsiDllApi.SSIDisconnect(ihw, iPortNumber) == 0)
             {
                 isOpenSE4500DL = false;
             }
         }
     }
 }
コード例 #4
0
 public void openPortSSI()
 {
     // Trace.WriteLine("openPortSSI");
     if (type == 5)
     {
         if (!isOpenSE4500DL)
         {
             if (SsiDllApi.SSIConnect(ihw, 9600, iPortNumber) == 0)
             {
                 isOpenSE4500DL = true;
             }
         }
     }
 }
コード例 #5
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);
        }
コード例 #6
0
        public void initinalSE4500DLBarCode()
        {
            if (IsComportReady() && (!IsSupportBarCode()))
            {
                if (IsDebugMode)
                {
                    Trace.WriteLine("initinalSE4500DLBarCode()");
                }
                openPort();

                firstScan        = false;
                isSupportBarCode = false;
                DeviceResponse   = 0x00;

                byte[] PowerModeAlwaysOn = { 0xFF, 0x80, 0x00 };
                byte[] Data = { 0xFF, 0xEE, 0x01 };

                Thread.Sleep(400);

                for (int i = 0; i < 10; i++)
                {
                    // Trace.WriteLine("initinalSE4500DLBarCode="+ i.ToString());
                    Thread.Sleep(50);

                    moto_write(PARAM_SEND, PowerModeAlwaysOn, PowerModeAlwaysOn.Length);
                    Thread.Sleep(50);

                    moto_write(PARAM_SEND, PowerModeAlwaysOn, PowerModeAlwaysOn.Length);
                    Thread.Sleep(50);

                    moto_write(PARAM_SEND, PowerModeAlwaysOn, PowerModeAlwaysOn.Length);
                    Thread.Sleep(50);

                    moto_write(PARAM_SEND, PowerModeAlwaysOn, PowerModeAlwaysOn.Length);
                    Thread.Sleep(50);

                    moto_write(PARAM_SEND, Data, Data.Length);
                    Thread.Sleep(50);

                    if (isSupportBarCode)
                    {
                        if (IsDebugMode)
                        {
                            Trace.WriteLine("initinalSE4500DLBarCode() success!");
                        }
                        break;
                    }
                }
                closePort();

                if ((isSupportBarCode) && (type == 5))
                {
                    openPortSSI();

                    Thread.Sleep(200);
                    SsiDllApi.TransmitVersion(iPortNumber);
                    SsiDllApi.SetVersionBuffer(iPortNumber, SsiDllApi.DecodeData, SsiDllApi.MAX_LEN);
                    Thread.Sleep(200);
                    WriteTriggerTimeout((byte)(BarcodeReadTime / 1000));
                    Thread.Sleep(200);
                }
            }
        }