private void buttonRead_Click(object sender, EventArgs e)
        {
            textBoxReadValue.Text = "";
            textBoxSc.Text        = "";
            textBoxIDm.Text       = "";

            bool ret;

            ret = mFNS.pollingF();
            if (!ret)
            {
                MessageBox.Show("Polling fail");
                return;
            }
            textBoxIDm.Text = BitConverter.ToString(mFNS.NfcId);
            textBoxSc.Text  = mLite.SystemCode.ToString("x4");

            UInt16 block;

            if (comboBoxReadBlock.SelectedIndex <= 14)
            {
                // 0~14
                block = (UInt16)comboBoxReadBlock.SelectedIndex;
            }
            else if (comboBoxReadBlock.SelectedIndex <= 23)
            {
                // 15~23
                block = (UInt16)(NfcStarterKitWrap.FelicaLite.BLOCK_RC + comboBoxReadBlock.SelectedIndex - 15);
            }
            else if (comboBoxReadBlock.SelectedIndex <= 26)
            {
                // 24~26
                block = (UInt16)(NfcStarterKitWrap.FelicaLite.BLOCK_WCNT + comboBoxReadBlock.SelectedIndex - 24);
            }
            else
            {
                block = NfcStarterKitWrap.FelicaLite.BLOCK_CRC_CHECK;
            }

            byte[] rbuf = null;
            ret = mLite.Read(ref rbuf, block);
            mFNS.unpoll();
            if (!ret)
            {
                MessageBox.Show("Read fail");
                return;
            }
            textBoxReadValue.Text = BitConverter.ToString(rbuf);
        }
        private void buttonRead_Click(object sender, EventArgs e)
        {
            textBoxReadValue.Text = "";
            textBoxUID.Text       = "";

            bool ret;

            ret = mFNS.pollingA();
            if (!ret)
            {
                MessageBox.Show("Polling fail");
                return;
            }
            textBoxUID.Text = BitConverter.ToString(mFNS.NfcId);

            byte sector = (byte)comboBoxReadSector.SelectedIndex;
            byte block  = (byte)comboBoxReadBlock.SelectedIndex;

            ret = mClassic.Auth(NfcStarterKitWrap.MifareClassic.CMD_AUTHA, sector, block);
            if (!ret)
            {
                MessageBox.Show("Auth fail");
                return;
            }

            byte[] rbuf = null;
            ret = mClassic.Read(ref rbuf, sector, block);
            if (!ret)
            {
                MessageBox.Show("Read fail");
                return;
            }

            mFNS.unpoll();
            textBoxReadValue.Text = BitConverter.ToString(rbuf);
        }
예제 #3
0
        private void buttonPush_Click(object sender, EventArgs e)
        {
            buttonPush.Enabled = false;
            bool b = mFelica.polling();

            if (!b)
            {
                MessageBox.Show("Polling fail");
                buttonPush.Enabled = true;
                return;
            }
            b = mFelica.pushUrl(textBoxUrl.Text);
            if (!b)
            {
                MessageBox.Show("Polling fail");
            }
            mFNS.unpoll();
            buttonPush.Enabled = true;
        }
예제 #4
0
        private bool polling()
        {
            bool b = mFNS.pollingF();

            if (b)
            {
                if ((mFNS.NfcId[0] == 0x03) &&
                    (mFNS.NfcId[1] == 0xfe) &&
                    (mFNS.NfcId[2] == 0x00) &&
                    (mFNS.NfcId[3] == 0x1d))
                {
                    // OK
                }
                else
                {
                    b = false;
                }
            }
            if (!b)
            {
                mFNS.unpoll();
            }
            return(b);
        }
예제 #5
0
 /// <summary>
 /// 事後処理
 /// </summary>
 private void afterProc()
 {
     mFNS.unpoll();
 }