示例#1
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("-", ""));

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

            btnWrite.Enabled = true;
        }
示例#2
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;
            }

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

            btnWriteAscii.Enabled = true;
        }
示例#3
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 { }
        }