Example #1
0
 private void ReadCard()
 {
     ActionType = WRITETYPE.CARD;
     if (!SystemPub.ADRcp.SendBytePkt(PassiveRcp.Read6C(SystemPub.ADRcp.Address, 1, (byte)intAddr, (byte)intlen)))
     {
     }
 }
Example #2
0
        private void btnRead_Click(object sender, EventArgs e)
        {
            ActionType         = WRITETYPE.DATA;
            btnRead.Enabled    = false;
            utxtReadData.Value = "";
            Application.DoEvents();
            byte mem   = Convert.ToByte(cmbReadBlock.SelectedIndex);
            byte state = Convert.ToByte(ltxtReadAddress.Text);
            byte len   = Convert.ToByte(ltxtReadLength.Text);

            PassiveCommand.Read6C(SystemPub.ADRcp, mem, state, len);
            //if (!SystemPub.ADRcp.SendBytePkt(PassiveRcp.Read6C(SystemPub.ADRcp.Address, mem, state, len))) { }
            btnRead.Enabled = true;
        }
Example #3
0
        private void btnWrite_Click(object sender, EventArgs e)
        {
            ActionType       = WRITETYPE.DATA;
            btnWrite.Enabled = false;

            byte mem   = Convert.ToByte(cmbWriteBlock.SelectedIndex);
            byte state = Convert.ToByte(ltxtWriteAddress.Text);
            byte len   = Convert.ToByte(ltxtWriteLength.Text);

            byte[] sndData = ConvertData.HexStringToByteArray(utxtWriteData.Text.Replace("-", ""));

            PassiveCommand.Write6C(SystemPub.ADRcp, mem, state, len, sndData);
            //if (!SystemPub.ADRcp.SendBytePkt(PassiveRcp.Write6C(SystemPub.ADRcp.Address, mem, state, len, sndData))) { }

            btnWrite.Enabled = true;
        }
Example #4
0
        private void btnWriteAscii_Click(object sender, EventArgs e)
        {
            ActionType            = WRITETYPE.DATA;
            btnWriteAscii.Enabled = false;

            byte[] bytData = Encoding.GetEncoding("gb2312").GetBytes(txtWriteAscii.Text.Trim());
            byte[] sndData = new byte[12];
            for (int i = 0; i < 8; i++)
            {
                sndData[i] = bytData[i];
            }
            for (int i = 8; i < 12; i++)
            {
                sndData[i] = 0;
            }

            PassiveCommand.Write6C(SystemPub.ADRcp, 1, 2, 12, sndData);
            //if (!SystemPub.ADRcp.SendBytePkt(PassiveRcp.Write6C(SystemPub.ADRcp.Address, 1, 2, 12, sndData))) { }

            btnWriteAscii.Enabled = true;
        }
Example #5
0
        private void WriteCard()
        {
            ActionType = WRITETYPE.CARD;
            try
            {
                byte[] SendDataBuff = ConvertData.DecLongToByteArray(LngSendData, UserSettings.WriteMode > 0);

                if (chkAddHex.Checked)
                {
                    if (UserSettings.WriteMode > 0)
                    {
                        SendDataBuff = ConvertData.HexStringToByteArray(LngSendData.ToString("00000000"));
                    }
                    else
                    {
                        SendDataBuff = ConvertData.HexStringToByteArray(LngSendData.ToString("000000"));
                    }
                }
                else
                {
                    SendDataBuff = ConvertData.DecLongToByteArray(LngSendData, UserSettings.WriteMode > 0);
                }

                byte[] SendData = new byte[intlen];
                for (int i = intpoint; i < intlen; i++)
                {
                    try
                    {
                        SendData[i] = SendDataBuff[i - intpoint];
                    }
                    catch { }
                }

                if (!SystemPub.ADRcp.SendBytePkt(PassiveRcp.Write6C(SystemPub.ADRcp.Address, 1, (byte)intAddr, (byte)intlen, SendData)))
                {
                }
            }
            catch { }
        }