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)); } }
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); }); }