I am able to generate an Observable from HID Input Report events, but I would like to dive in to the packet data with Linq queries.
I am having trouble making all the types line up.
readerPackets = Observable
.FromEventPattern
<TypedEventHandler<HidDevice, HidInputReportReceivedEventArgs>,
HidDevice,
HidInputReportReceivedEventArgs>(
h => reader.InputReportReceived += h,
h => reader.InputReportReceived -= h)
.Select(x => x.EventArgs);
This works without the .Select. When I add the select I get the error:
Cannot implicitly convert type 'System.IObservable<Windows.Devices.HumanInterfaceDevice.HidInputReportReceivedEventArgs>' to 'System.IObservable<System.Reactive.EventPattern<Windows.Devices.HumanInterfaceDevice.HidDevice,Windows.Devices.HumanInterfaceDevice.HidInputReportReceivedEventArgs>>'. An explicit conversion exists (are you missing a cast?)
I have tried casting with the types listed in the error, but apparently I am missing something because I can never make it happy.
Can you tell what cast type I should use and where it should be placed?