コード例 #1
0
ファイル: Encoder.cs プロジェクト: tw0r2/wms_rfid
        private byte[] getbyte_GetKey(CmdData cmd)
        {
            int nRack = 0, nNode = 0, nVerify = 0;

            byte[] OutBuff = { 0, 0, 0, 0, 0, 0, 0 };

            nRack = cmd.address / 256 + 0x80;
            nNode = cmd.address % 256;

            if (nNode == 13)
            {
                nNode += 200;
            }

            nVerify = 0x40 ^ nRack ^ nNode ^ 0x56;

            OutBuff[0] = 0x40;
            OutBuff[1] = (byte)nRack;
            OutBuff[2] = (byte)nNode;
            OutBuff[3] = 0x56;
            OutBuff[4] = (byte)nVerify;
            OutBuff[5] = 0x2a;
            OutBuff[6] = 0xd;
            return(OutBuff);
        }
コード例 #2
0
        private void ExecuteCmd(int address, CmdType cmdType, object data)
        {
            CmdData cmddata = new CmdData();

            cmddata.address = address + 256 * (base.Com.port - 2);
            cmddata.cmdType = cmdType;
            cmddata.data    = data;
            this.Send(cmddata);
        }
コード例 #3
0
ファイル: Encoder.cs プロジェクト: tw0r2/wms_rfid
        private byte[] getbyte_SendText(CmdData cmd)
        {
            IList <byte> byteList = new List <byte>();

            int nAddressH = cmd.address / 256 + 0x80;
            int nAddressL = cmd.address % 256;

            if (nAddressL == 13)
            {
                nAddressL += 200;
            }

            byteList.Add(0x40);
            byteList.Add((byte)nAddressH);
            byteList.Add((byte)nAddressL);
            byteList.Add(0x50);

            int nPosition = 4;

            string[] aryData;
            string   strData = "";

            aryData = (string[])(cmd.data);
            strData = aryData[0] + aryData[1] + aryData[2] + aryData[3];

            byte[] aryByteTemp = Encoding.Default.GetBytes(strData);
            foreach (byte data in aryByteTemp)
            {
                byteList.Add(data);
                nPosition++;
                if (nPosition == 100)
                {
                    break;
                }
            }

            int nVerify = byteList[0];

            for (int j = 1; j < 100; j++)
            {
                nVerify = nVerify ^ byteList[j];
            }

            byteList.Add((byte)nVerify);
            byteList.Add(0x2a);
            byteList.Add(0xd);

            return(byteList.ToArray());
        }
コード例 #4
0
ファイル: Encoder.cs プロジェクト: tw0r2/wms_rfid
        public byte[] Encode(object CMD)
        {
            CmdData cmd = (CmdData)CMD;

            byte[] aryByte = {};

            switch (cmd.cmdType)
            {
            case CmdType.SendData:
                aryByte = getbyte_SendText(cmd);
                break;

            case CmdType.ResetElectronicLabel:
                aryByte = getbyte_Reset(cmd);
                break;

            case CmdType.ControlPlateID:
                break;

            case CmdType.OpenLight:
                break;

            case CmdType.CloseLight:
                break;

            case CmdType.LoudSpeaker:
                break;

            case CmdType.ShowOnly:
                break;

            case CmdType.KeyRaisedAck:
                break;

            case CmdType.Delete:
                break;

            case CmdType.ResetControlPlate:
                break;

            case CmdType.GetKey:
                aryByte = getbyte_GetKey(cmd);
                break;

            default:
                break;
            }
            return(aryByte);
        }
コード例 #5
0
ファイル: Encoder.cs プロジェクト: uwitec/wms_rfid
        private byte[] getbyte_GetKey(CmdData cmd)
        {
            int nRack = 0, nNode = 0, nVerify = 0;
            byte[] OutBuff = { 0, 0, 0, 0, 0, 0, 0 };

            nRack = cmd.address  / 256 + 0x80;
            nNode = cmd.address  % 256;

            if (nNode == 13)
                nNode += 200;

            nVerify = 0x40 ^ nRack ^ nNode ^ 0x56;

            OutBuff[0] = 0x40;
            OutBuff[1] = (byte)nRack;
            OutBuff[2] = (byte)nNode;
            OutBuff[3] = 0x56;
            OutBuff[4] = (byte)nVerify;
            OutBuff[5] = 0x2a;
            OutBuff[6] = 0xd;
            return OutBuff;
        }
コード例 #6
0
ファイル: Encoder.cs プロジェクト: uwitec/wms_rfid
        private byte[] getbyte_SendText(CmdData cmd)
        {
            IList<byte>  byteList = new List<byte>();

            int  nAddressH = cmd.address / 256 + 0x80;
            int  nAddressL = cmd.address % 256;

            if (nAddressL == 13)
                nAddressL += 200;

            byteList.Add(0x40);
            byteList.Add((byte)nAddressH);
            byteList.Add((byte)nAddressL);
            byteList.Add(0x50);

            int nPosition = 4;

            string[] aryData;
            string strData = "";

            aryData = (string[])(cmd.data);
            strData = aryData[0] + aryData[1] + aryData[2] + aryData[3];

            byte[] aryByteTemp = Encoding.Default.GetBytes(strData);
            foreach (byte data in aryByteTemp)
            {
                byteList.Add(data);
                nPosition++;
                if (nPosition == 100)
                    break;
            }

            int nVerify = byteList[0];

            for (int j = 1; j < 100; j++)
            {
                nVerify = nVerify ^ byteList[j];
            }

            byteList.Add((byte)nVerify);
            byteList.Add( 0x2a);
            byteList.Add( 0xd);

            return byteList.ToArray();
        }
コード例 #7
0
ファイル: ELabelOperator.cs プロジェクト: uwitec/wms_rfid
 private void ExecuteCmd(int address, CmdType cmdType, object data)
 {
     CmdData  cmddata = new CmdData();
     cmddata.address = address + 256 * (base.Com.port - 2);
     cmddata.cmdType = cmdType;
     cmddata.data = data;
     this.Send(cmddata);
 }