Пример #1
0
 public LLCP_Link(LLCP llcp, LLCP_Client client, byte local_port)
 {
     _llcp      = llcp;
     _service   = client;
     RemotePort = client.ServerPort;
     LocalPort  = local_port;
 }
Пример #2
0
 public LLCP_Link(LLCP llcp, LLCP_Service service, LLCP_PDU recv_pdu)
 {
     _llcp      = llcp;
     _service   = service;
     RemotePort = recv_pdu.SSAP;
     LocalPort  = recv_pdu.DSAP;
 }
Пример #3
0
 public void Stop()
 {
     if (_reader != null)
     {
         _reader.StopMonitor();
     }
     if (_llcp != null)
     {
         _llcp.Stop();
         _llcp = null;
     }
 }
Пример #4
0
        public override bool OnConnect(LLCP_Link link, byte[] ConnectParams)
        {
            Fragments = false;
            Offset    = 0;
            Buffer    = null;

            Trace.WriteLine("SNEP Server: client connect");

            byte[] param_miux = LLCP.FindParameter(ConnectParams, LLCP.PARAM_MAX_INF_UNIT_EXT);
            byte[] param_rw   = LLCP.FindParameter(ConnectParams, LLCP.PARAM_RECV_WINDOW_SIZE);

            /*
             * byte[] cc_params = new byte[4];
             *
             * cc_params[0] = LLCP.PARAM_MAX_INF_UNIT_EXT;
             * cc_params[1] = 2;
             * cc_params[2] = (byte) ((SNEP.MAX_BUFFER_SIZE - 128) / 0x0100);
             * cc_params[3] = (byte) ((SNEP.MAX_BUFFER_SIZE - 128) % 0x0100);
             *
             * link.Send_CC(cc_params);
             */

            return(true);
        }
Пример #5
0
 public LLCP_Link(LLCP llcp, LLCP_Service service)
 {
     _llcp    = llcp;
     _service = service;
 }
Пример #6
0
        void ReaderStatusChanged(uint ReaderState, CardBuffer CardAtr)
        {
            if (ReaderState == SCARD.STATE_UNAWARE)
            {
                Trace.WriteLine("*** Reader removed ***");

                if (_AdapterErrorCallback != null)
                {
                    _AdapterErrorCallback();
                }

                if (_llcp != null)
                {
                    _llcp.Stop();
                    _llcp = null;
                }
                _reader = null;
                return;
            }

            if ((ReaderState & SCARD.STATE_EMPTY) != 0)
            {
                if (_llcp != null)
                {
                    _llcp.Stop();
                    _llcp = null;
                }

                Trace.WriteLine("*** Target removed ***");
            }
            else
            if ((ReaderState & SCARD.STATE_UNAVAILABLE) != 0)
            {
            }
            else
            if ((ReaderState & SCARD.STATE_MUTE) != 0)
            {
            }
            else
            if ((ReaderState & SCARD.STATE_INUSE) != 0)
            {
            }
            else
            if ((ReaderState & SCARD.STATE_PRESENT) != 0)
            {
                Trace.WriteLine("*** Target arrived ***");

                if (_llcp == null)
                {
                    _llcp = new LlcpInitiator(_reader);

                    if (_CreateNdefCallback != null)
                    {
                        Ndef ndef = _CreateNdefCallback();

                        if (ndef != null)
                        {
                            Trace.WriteLine("Create SNEP Client (sender)");

                            SNEP_Client client = new SNEP_Client(ndef);

                            client.OnMessageSent = new SNEP_Client.SNEPMessageSentCallback(_NdefSentCallback);
                            client.MessageSentCallbackOnAcknowledge = true;

                            _llcp.RegisterClient(client);
                        }
                    }

                    _llcp.Start();
                }
            }
        }