none
[UWP][C#] HIDDevice InputReportReceived -> initial / default value for device RRS feed

  • Question

  • Hey,

    I am new in developing (even for windows universal apps & c# etc.).
    Currently I am creating a 'test' app for myself which I would like to control via a JoyStick (Logitech Attack3).

    I am able to access the whole device and read the values from it etc. without any problem.
    Everything fine so far :)

    Unfortunately the device has a small wheel at the bottom which can be turned to a specific value (from 0 to 255).

    When I create a new instance of my device class I would like to read the value from that wheel (because I do not know at which value it is from the last usage).
    But I am unable to receive an 'initial' automatic generated HidInputReport object which contains the value I require. :(

    I already tried to receive that via the 'GetInputReportAsync()' method.
    Without success.

    Probably you can help me further.
    Here is the required part of my code:

    class LogitechAttack3
        {
    		private HidDevice HIDDevice { get; set; } // Handle to the actual controller HidDevice
    		
    		private const double WheelMax = 255;
            private const double WheelMin = 0;
    
            private double LastWheelValue = 0; //this causes the first inputrecieved event to be always a wheel set
    										   //Required to set the correct initial value
    
            public delegate void WheelMovedHandler(double WheelPrecent);
            public event WheelMovedHandler WheelMoved;
    		
    		public LogitechAttack3(HidDevice HIDDevice)
            {
                //Debug.WriteLine("LogitechAttack3() - started.");
                this.HIDDevice = HIDDevice;
                
                HIDDevice.InputReportReceived += inputReportReceived;
    
                //-> unfortunately not working - ErrorCode: The semaphore timeout period has expired. (Exception from HRESULT: 0x80070079)
                //var InitReport = HIDDevice.GetInputReportAsync();
                //Debug.WriteLine("LogitechAttack3() - InitReport.Completed = " + InitReport.Completed);
                //Debug.WriteLine("LogitechAttack3() - InitReport.Status = " + InitReport.Status);
                //Debug.WriteLine("LogitechAttack3() - InitReport.ErrorCode = " + InitReport.ErrorCode);
    			
    			//Set the correct initial wheel value: -> NOT WORKING, but has to
    			LastWheelValue = InitReport.GetNumericControl(0x00, 0x32).Value;
    		}
    		
    		private void inputReportReceived(HidDevice sender, HidInputReportReceivedEventArgs args)
            {
                Debug.WriteLine("inputReportReceived() - started");
    			
    			double WheelValue = args.Report.GetNumericControl(0x00, 0x32).Value; // VALUE OF -/+ WHEEL
                
                if(WheelValue != LastWheelValue)
                {
                    LastWheelValue = WheelValue;
                    double WheelPercent = 100 - (WheelValue * 100 / (WheelMax - WheelMin));
                    WheelMoved(WheelPercent);
                    return;
                }
    		}
    		
    	}

    Thank you in advance




    • Edited by MK-Maddin Monday, September 14, 2015 1:55 PM
    Sunday, September 13, 2015 3:00 PM

Answers

  • I would suggest you contacting with Device OEM: Logitech to see if it is supported currently

    Best Regards,
    Please remember to mark the replies as answers if they help

    • Marked as answer by MK-Maddin Monday, August 29, 2016 5:30 PM
    Monday, September 14, 2015 12:29 PM

All replies

  • I would suggest you contacting with Device OEM: Logitech to see if it is supported currently

    Best Regards,
    Please remember to mark the replies as answers if they help

    • Marked as answer by MK-Maddin Monday, August 29, 2016 5:30 PM
    Monday, September 14, 2015 12:29 PM
  • Hi MK-Maddin,

    Welcome to the Developing Universal Windows apps forum! 

    What type of app are you writing? As a friendly reminder please make sure to add the appropriate tags to the title of your post as per Guide to posting: subject line tags


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, September 14, 2015 12:35 PM
    Moderator
  • Hey,

    Thanks for that information.
    Sorry for missing the tags. 

    I added them to topic - like you can see it is about Windows 10 universal app platform & c#

    Monday, September 14, 2015 1:56 PM