text: /*
   * Joystick.cpp: joystick/gamepad support for MulticopterSim
   *
   * Copyright (C) 2018 Simon D. Levy
   *
   * MIT License
   */
  
  #pragma once
  
  #include "CoreMinimal.h"
  
  /**
   * 
   */
  class MULTICOPTERSIM_API Joystick {
  
      public:
  
          void init(void);
  
          void poll(float axes[6], uint8_t & buttonState);
  
          bool isRcTransmitter;
  
      private:
  
          static const uint16_t VENDOR_STM	        = 0x0483;
  
          static const uint16_t PRODUCT_PS3_CLONE		= 0x0003;
          static const uint16_t PRODUCT_XBOX360	    = 0x02a1;
          static const uint16_t PRODUCT_TARANIS		= 0x5710;
          static const uint16_t PRODUCT_EXTREMEPRO3D	= 0xc215;
          static const uint16_t PRODUCT_F310	        = 0xc21d;
          static const uint16_t PRODUCT_PS4	        = 0x09cc;
          static const uint16_t PRODUCT_XBOX360_CLONE	= 0xfafe;
  
          int  _joystickId;
          uint16_t _productId;
  
          void getAxes(float axes[6], DWORD axis0, DWORD axis1, DWORD axis2, DWORD axis3, DWORD axis4);
          void getButtons(DWORD dwButtons, uint8_t & buttonState, uint8_t button0, uint8_t button1, uint8_t button2);
  
  };
  