Exemple #1
0
        /// <summary>
        /// dio 접점을 On한다.
        /// </summary>
        /// <param name="shtDioPort"></param>
        public bool DIOSetOn(short shtDioPort)
        {
            try
            {
                Byte[] byteData;

                switch (shtDioPort)
                {
                case 1:
                    byteData = new byte [] { 0x10, 0x02, 0x02, 0x01, 0x63, 0x00, 0x05, 0x00, 0x03, 0x01, 0x01, 0x00, 0xAC, 0xB8, 0x10, 0x03 };
                    break;

                case 2:
                    byteData = new byte [] { 0x10, 0x02, 0x02, 0x01, 0x63, 0x00, 0x05, 0x00, 0x03, 0x02, 0x01, 0x00, 0xF5, 0xE8, 0x10, 0x03 };
                    break;

                case 3:
                    byteData = new byte [] { 0x10, 0x02, 0x02, 0x01, 0x63, 0x00, 0x05, 0x00, 0x03, 0x04, 0x01, 0x00, 0x47, 0x48, 0x10, 0x03 };
                    break;

                case 4:
                    byteData = new byte[] { 0x10, 0x02, 0x02, 0x01, 0x63, 0x00, 0x05, 0x00, 0x03, 0x08, 0x01, 0x00, 0x32, 0x29, 0x10, 0x03 };
                    break;

                default:
                    byteData = new byte[] { };
                    break;
                }


                clsLog.WLog(string.Format("DIOSetOn Port[{0}] : {1}", shtDioPort, Fnc.Bytes2String(byteData)));

                boolAckDio = false;

                if (Send_Packet(byteData))
                {
                    //0.3초 단위로 응답이 들어 왔는지 확인한다.
                    for (int i = 0; i < intMaxDuration; i += 300)
                    {
                        if (boolAckDio)
                        {
                            break;
                        }

                        Thread.Sleep(300);
                    }

                    return(boolAckDio);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                clsLog.WLog_Exception("DIOSetOn", ex);
                throw ex;
            }
        }
Exemple #2
0
        /// <summary>
        /// Verbose 모드에서 테그 수신 명령을 보낸다.
        /// </summary>
        /// <param name="shtPort">안테나 포트</param>
        private void InventoryRead(short shtPort)
        {
            Byte[] byteData;


            parser.readingPort = shtPort;
            byteData           = (Byte[])parser.ReadInventory();

            clsLog.WLog(string.Format("InventoryRead : {0}", Fnc.Bytes2String(byteData)));

            Send_Packet(byteData);
        }
Exemple #3
0
        private void clsSerial_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            Thread.Sleep(intRecieveWatingTime);
            int intLength = clsSn.BytesToRead;

            if (intLength < 1)
            {
                return;
            }

            byte[] bytReceive = new byte[intLength];
            clsSn.Read(bytReceive, 0, intLength);

            Console.WriteLine("[serial]{0} / {1}", Fnc.Bytes2String(bytReceive), Encoding.Default.GetString(bytReceive));

            if (OnDataReceived != null)
            {
                ThreadPool.QueueUserWorkItem(new WaitCallback(RaiseEvent), bytReceive);
            }
        }
Exemple #4
0
        void clsDS2200_OnReceiveBarcode(byte[] data)
        {
            isConnected = true;

            LastLog = string.Format("[Data_OnReceived]{0} / {1}", Fnc.Bytes2String(data), Encoding.Default.GetString(data));

            if (isTriigered)
            {
                int len = data.Length;
                //바코드양식 <stx>바코드<cr><lf>
                if (data[0] == 0x2 && data[len - 2] == 0x0d & data[len - 1] == 0x0a)
                {
                    Barode_Last = Encoding.Default.GetString(data, 1, len - 3);

                    LastLog = string.Format("[바코드 수신]" + Barode_Last);

                    if (_onReceiveBarcode != null)
                    {
                        _onReceiveBarcode(this, Barode_Last);
                    }
                }
            }
        }