Ignore:
Timestamp:
Apr 8, 2016, 3:48:40 PM (5 years ago)
Author:
Bayard Gildas
Message:

Reformatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/Controller/DualShock3/src/DualShock3.h

    r11 r16  
    1212//  version:    $Id: $
    1313//
    14 //  purpose:    Sony DualShock3 host side driver class. Talks to target side through ethernet.
     14//  purpose:    Sony DualShock3 host side driver class. Talks to target side
     15//  through ethernet.
    1516//
    1617//
     
    2829
    2930namespace flair {
    30     namespace core {
    31         class FrameworkManager;
    32     }
    33     namespace gui {
    34         class SpinBox;
    35         class Label;
    36         class CheckBox;
    37     }
     31namespace core {
     32class FrameworkManager;
     33}
     34namespace gui {
     35class SpinBox;
     36class Label;
     37class CheckBox;
     38}
    3839}
    3940
    4041struct motion_dev;
    4142
    42 namespace flair { namespace sensor {
    43     /*! \class DualShock3
    44     *
    45     * \brief Sony DualShock3 host side driver class. Talks to target side through ethernet.
    46     */
    47     class DualShock3 : public HostEthController {
    48     public:
    49         typedef enum {
    50             Usb,
    51             Bluetooth
    52         } ConnectionType_t;
     43namespace flair {
     44namespace sensor {
     45/*! \class DualShock3
     46*
     47* \brief Sony DualShock3 host side driver class. Talks to target side through
     48*ethernet.
     49*/
     50class DualShock3 : public HostEthController {
     51public:
     52  typedef enum { Usb, Bluetooth } ConnectionType_t;
    5353
    54         DualShock3(const core::FrameworkManager* parent,std::string name,std::string receiverAddress,int receiverPort,ConnectionType_t connectionType,uint32_t period=10,uint32_t bitsPerAxis=7,uint8_t priority=0);
    55         ~DualShock3();
    56     private:
    57         gui::SpinBox* deadZone;
    58         gui::CheckBox* enabled;
    59         gui::Label *batteryChargeLevel;
    60         ConnectionType_t connectionType;
    61         core::Time now;
     54  DualShock3(const core::FrameworkManager *parent, std::string name,
     55             std::string receiverAddress, int receiverPort,
     56             ConnectionType_t connectionType, uint32_t period = 10,
     57             uint32_t bitsPerAxis = 7, uint8_t priority = 0);
     58  ~DualShock3();
    6259
    63         std::string GetAxisDescription(unsigned int axis);
    64         std::string GetButtonDescription(unsigned int button);
    65         void GetAxisData();
    66         void GetButtonData();
    67         bool IsDataFrameReady();
    68         void ProcessMessage(core::Message *controllerAction);
     60private:
     61  gui::SpinBox *deadZone;
     62  gui::CheckBox *enabled;
     63  gui::Label *batteryChargeLevel;
     64  ConnectionType_t connectionType;
     65  core::Time now;
    6966
    70         void UpdateFrom(const core::io_data *data) {};
    71         void fatal(const char *msg);
    72         int l2cap_listen(const bdaddr_t *bdaddr, unsigned short psm);
    73         struct motion_dev *accept_device(int csk, int isk);
    74         void hidp_trans(int csk, char *buf, int len);
    75         void setup_device(struct motion_dev *dev);
    76         bool parse_report_sixaxis_ds3(unsigned char *r, int len);
    77         int mystr2ba(const char *s, bdaddr_t *ba);
    78         char *myba2str(const bdaddr_t *ba);
    79         int8_t compute_dead_zone(int axis,unsigned char value);
    80         struct motion_dev *dev;
    81         int usb_fd;
    82         int isk;
    83         core::Time last_voltage_time;
     67  std::string GetAxisDescription(unsigned int axis);
     68  std::string GetButtonDescription(unsigned int button);
     69  void GetAxisData();
     70  void GetButtonData();
     71  bool IsDataFrameReady();
     72  void ProcessMessage(core::Message *controllerAction);
    8473
    85         int8_t *datas;
    86         uint8_t dataSize;
     74  void UpdateFrom(const core::io_data *data){};
     75  void fatal(const char *msg);
     76  int l2cap_listen(const bdaddr_t *bdaddr, unsigned short psm);
     77  struct motion_dev *accept_device(int csk, int isk);
     78  void hidp_trans(int csk, char *buf, int len);
     79  void setup_device(struct motion_dev *dev);
     80  bool parse_report_sixaxis_ds3(unsigned char *r, int len);
     81  int mystr2ba(const char *s, bdaddr_t *ba);
     82  char *myba2str(const bdaddr_t *ba);
     83  int8_t compute_dead_zone(int axis, unsigned char value);
     84  struct motion_dev *dev;
     85  int usb_fd;
     86  int isk;
     87  core::Time last_voltage_time;
    8788
    88         void usb_scan();
    89         void usb_pair_device(struct usb_device *dev, int itfnum);
     89  int8_t *datas;
     90  uint8_t dataSize;
    9091
    91         void rumble(uint8_t left_force,uint8_t left_timeout,uint8_t right_force,uint8_t right_timeout);
    92         void set_led(uint8_t led,uint8_t on_timeout,uint8_t off_timeout);
    93         char ledmask;
    94         uint8_t led1_on,led1_off,led2_on,led2_off,led3_on,led3_off,led4_on,led4_off;
     92  void usb_scan();
     93  void usb_pair_device(struct usb_device *dev, int itfnum);
    9594
    96     };
    97 }}
     95  void rumble(uint8_t left_force, uint8_t left_timeout, uint8_t right_force,
     96              uint8_t right_timeout);
     97  void set_led(uint8_t led, uint8_t on_timeout, uint8_t off_timeout);
     98  char ledmask;
     99  uint8_t led1_on, led1_off, led2_on, led2_off, led3_on, led3_off, led4_on,
     100      led4_off;
     101};
     102}
     103}
    98104
    99105#endif // DUALSHOCK3_H
Note: See TracChangeset for help on using the changeset viewer.