Exemplo n.º 1
0
        /// <summary>
        /// Suica読取開始。
        /// </summary>
        /// <param name="onScanAction">Suica検知デリゲート。引数はSuicaから読み取った残高と日付。</param>
        public void StartScanningSuica(Action <int, DateTime> onScanAction)
        {
            // Suica検知デリゲートを保存。
            _onScanAction = onScanAction;

            // NFC読取セッションを開始する。
            _session = new NFCTagReaderSession(NFCPollingOption.Iso18092, this, DispatchQueue.CurrentQueue);
            _session.AlertMessage = "Suica/Kitacaをかざして";
            _session.BeginSession();
        }
Exemplo n.º 2
0
        public void BeginSession()
        {
            TryInvalidateSession();

            Session = new NFCTagReaderSession(
                NFCPollingOption.Iso14443,
                GetSessionDelegate(),
                DispatchQueue.MainQueue);

            Session.BeginSession();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Starts tags detection
        /// </summary>
        public void StartListening()
        {
            _customInvalidation = false;
            _isWriting          = false;
            _isFormatting       = false;

            NfcSession = new NFCTagReaderSession(NFCPollingOption.Iso14443 | NFCPollingOption.Iso15693, this, DispatchQueue.CurrentQueue)
            {
                AlertMessage = UIMessages.NFCDialogAlertMessage
            };
            NfcSession?.BeginSession();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Starts tag publishing (writing or formatting)
        /// </summary>
        /// <param name="clearMessage">Format tag</param>
        public void StartPublishing(bool clearMessage = false)
        {
            if (!IsAvailable)
            {
                throw new InvalidOperationException(UIMessages.NFCWritingNotSupported);
            }

            _customInvalidation = false;
            _isWriting          = true;
            _isFormatting       = clearMessage;

            NfcSession = new NFCTagReaderSession(NFCPollingOption.Iso14443 | NFCPollingOption.Iso15693, this, DispatchQueue.CurrentQueue)
            {
                AlertMessage = UIMessages.NFCDialogAlertMessage
            };
            NfcSession?.BeginSession();
        }
Exemplo n.º 5
0
        public void StartListening(bool Write)
        {
            if (!IsAvailable())
            {
                throw new InvalidOperationException("NFC not available");
            }

            if (!IsEnabled()) // todo: offer possibility to open dialog
            {
                throw new InvalidOperationException("NFC is not enabled");
            }

            WriteMode = Write;

            NfcSession = new NFCTagReaderSession(NFCPollingOption.Iso14443, this, null)
            {
                AlertMessage = "Present your NFC tag"
            };

            NfcSession?.BeginSession();
            Enabled = true;
        }