Ejemplo n.º 1
0
        private void OnQueryInterfaceResponse(IdpResponse response)
        {
            if (response.ResponseCode == IdpResponseCode.OK)
            {
                var vid = response.Transaction.Read <UInt16>();
                var pid = response.Transaction.Read <UInt16>();

                InterfaceFound?.Invoke(this, new InterfaceFoundEventArgs(vid, pid, response.Transaction.Source));
            }
        }
Ejemplo n.º 2
0
        public IdpCommandManager()
        {
            _commandHandlers = new Dictionary <UInt16, CommandHandler>();

            _responseHandlers = new Dictionary <UInt16, ResponseHandler>();

            _onResponseReceived = new Subject <IdpResponse>();

            RegisterCommand(0xA000, (incomingTransaction, outgoingTransaction) =>
            {
                var response = new IdpResponse(incomingTransaction);

                if (_responseHandlers.ContainsKey(response.ResponseId))
                {
                    _responseHandlers[response.ResponseId](response);
                }
                else
                {
                    _onResponseReceived.OnNext(response);
                }

                return(IdpResponseCode.OK);
            });
        }