FreeStick  0.3
Cross Platform Open Sorce Joystick Lib
FSUSBJoystick.h
Go to the documentation of this file.
1 /**************************************************************************
2 Created by Alan Uthoff on 10/13/2013
3 Copyright (C) 2013
4 
5 This Code is free software; you can redistribute it and/or
6 modify it under the terms of the zlib/libpng License as published
7 by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9 This software is provided 'as-is', without any express or implied warranty.
10 
11 In no event will the authors be held liable for any damages arising from the use of this software.
12 
13 Permission is granted to anyone to use this software for any purpose,
14 including commercial applications, and to alter it and redistribute
15 it freely, subject to the following restrictions:
16 
17 1. The origin of this software must not be misrepresented;
18 you must not claim that you wrote the original software.
19 If you use this software in a product, an acknowledgment
20 in the product documentation would be appreciated but is not required.
21 
22 2. Altered source versions must be plainly marked as such,
23 and must not be misrepresented as being the original software.
24 
25 3. This notice may not be removed or altered from any source distribution.
26 **************************************************************************/
27 
28 #pragma once
29 #include <string>
30 #include "FSUSBDevice.h"
32 #include <map>
33 namespace freestick
34 {
35 typedef std::map<idNumber,FSUSBJoyStickInputElement > JoyStickElementMap ;
36  class FSUSBJoystick : public FSUSBDevice
37  {
38  private:
39  unsigned int _numberOfButtons;
40  unsigned int _numberOfAnlogSticks;
41  unsigned int _numberOfDigitalSticks;
42  bool _forceFeedBackSupported;
43  protected:
45 
46  protected:
47  FSUSBJoystick();
48  public:
49 
51  FSUSBJoystick(idNumber joyStickID,
52  unsigned int numberOfButtons,
53  unsigned int numberOfAnlogSticks,
54  unsigned int numberOfDigitalSticks,
55  bool forceFeedBackSupported,
56  vendorIDType vendorID,
57  productIDType productID);
58  unsigned int getNumberOfButtons() const {return _numberOfButtons;}
59  unsigned int getNumberOfAnlogSticks()const {return _numberOfAnlogSticks;}
60  unsigned int getNumberOfDigitalSticks() const {return _numberOfDigitalSticks;}
61  bool getForceFeedbackSupport() const {return _forceFeedBackSupported;}
62  virtual FSDeviceType getClassType() const {return FSUSBJoystickType;}
65  std::vector<idNumber> getElementIds() const;
67  JoyStickElementMap::const_iterator begin() const;
68  JoyStickElementMap::const_iterator end() const ;
69  JoyStickElementMap::iterator begin();
70  JoyStickElementMap::iterator end();
71  };
72 }
73 
Definition: FSUSBJoyStickInputElement.h:38
Definition: IFSDevice.h:104
JoyStickElementMap::const_iterator end() const
Definition: FSUSBJoystick.cpp:87
void addInputElement(FSUSBJoyStickInputElement &element)
Definition: FSUSBJoystick.cpp:55
virtual FSDeviceType getClassType() const
Definition: FSUSBJoystick.h:62
std::vector< idNumber > getElementIds() const
Definition: FSUSBJoystick.cpp:70
JoyStickElementMap::const_iterator begin() const
Definition: FSUSBJoystick.cpp:83
unsigned int getNumberOfDigitalSticks() const
Definition: FSUSBJoystick.h:60
uint32_t idNumber
Definition: FSTypes.h:33
FSUSBJoystick()
Definition: FSUSBJoystick.cpp:30
unsigned int getNumberOfAnlogSticks() const
Definition: FSUSBJoystick.h:59
const FSUSBJoyStickInputElement * findInputElement(idNumber id) const
Definition: FSUSBJoystick.cpp:60
JoyStickElementMap getElements() const
Definition: FSUSBJoystick.h:64
uint32_t productIDType
Definition: FSTypes.h:39
Definition: FSBaseDevice.h:32
Definition: FSUSBJoystick.h:36
Definition: FSUSBDevice.h:43
FSDeviceType
Definition: IFSDevice.h:100
unsigned int numberOfButtons(IOHIDDeviceRef device)
Definition: FSUSBMacOSXJoystickDeviceManager.mm:282
uint32_t vendorIDType
Definition: FSTypes.h:38
std::map< idNumber, FSUSBJoyStickInputElement > JoyStickElementMap
Definition: FSUSBJoystick.h:35
unsigned int getNumberOfButtons() const
Definition: FSUSBJoystick.h:58
~FSUSBJoystick()
Definition: FSUSBJoystick.cpp:34
bool getForceFeedbackSupport() const
Definition: FSUSBJoystick.h:61
JoyStickElementMap _inputElementMap
Definition: FSUSBJoystick.h:44