|  | 
|  | JoystickDrive (unsigned int uL, const DriveHandler *pDH, const std::string &sFileName, integer nButtons, const std::vector< doublereal > &lc_scale, const std::vector< doublereal > &v0) | 
|  | 
| virtual | ~JoystickDrive (void) | 
|  | 
| virtual std::ostream & | Restart (std::ostream &out) const | 
|  | 
| virtual void | ServePending (const doublereal &t) | 
|  | 
|  | FileDrive (unsigned int uL, const DriveHandler *pDH, const std::string &s, integer nd, const std::vector< doublereal > &v0) | 
|  | 
| virtual | ~FileDrive (void) | 
|  | 
| virtual Drive::Type | GetDriveType (void) const | 
|  | 
| virtual integer | iGetNumDrives (void) const | 
|  | 
| virtual doublereal | dGet (const doublereal &t, int i=1) const | 
|  | 
|  | Drive (unsigned int uL, const DriveHandler *pDH) | 
|  | 
| virtual | ~Drive (void) | 
|  | 
|  | WithLabel (unsigned int uL=0, const std::string &sN="") | 
|  | 
| virtual | ~WithLabel (void) | 
|  | 
| void | PutLabel (unsigned int uL) | 
|  | 
| void | PutName (const std::string &sN) | 
|  | 
| unsigned int | GetLabel (void) const | 
|  | 
| const std::string & | GetName (void) const | 
|  | 
Definition at line 43 of file module-hid.cc.
 
Definition at line 78 of file module-hid.cc.
std::vector< doublereal > m_lc_scale
FileDrive(unsigned int uL, const DriveHandler *pDH, const std::string &s, integer nd, const std::vector< doublereal > &v0)
static const std::vector< doublereal > v0
std::vector< bool > m_b_reset
 
 
 
  
  | 
        
          | JoystickDrive::~JoystickDrive | ( | void |  | ) |  |  | virtual | 
 
 
  
  | 
        
          | bool JoystickDrive::get_fd_flags | ( | void |  | ) |  |  | private | 
 
 
  
  | 
        
          | bool JoystickDrive::get_one | ( | void |  | ) |  |  | private | 
 
Definition at line 127 of file module-hid.cc.
References buf, m_b_reset, m_fd, m_lc_scale, m_nButtons, m_nLC, m_pdB, m_pdLC, MBDYN_EXCEPT_ARGS, read(), set_fd_blocking(), FileDrive::sFileName, and WithLabel::uLabel.
Referenced by ServePending().
  131         FD_SET(
m_fd, &readfds);
 
  132         struct timeval tv = { 0, 0 };
 
  133         int rc = select(
m_fd + 1, &readfds, NULL, NULL, &tv);
 
  136         std::cerr << 
"select=" << rc << std::endl;
 
  141                 int save_errno = errno;
 
  142                 char *err_msg = strerror(save_errno);
 
  144                 silent_cout(
"JoystickDrive(" << 
uLabel << 
", " << 
sFileName << 
"): select failed" 
  145                         << 
" (" << save_errno << 
": " << err_msg << 
")" << std::endl);
 
  153                 if (!FD_ISSET(
m_fd, &readfds)) {
 
  154                         silent_cout(
"JoystickDrive" 
  156                                 "socket " << 
m_fd << 
" reset" 
  165         ssize_t n2 = 
read(
m_fd, (
void *)&buf[0], 
sizeof(buf));
 
  169                 int save_errno = errno;
 
  170                 std::cerr << 
"recv=" << save_errno << 
" " << strerror(save_errno) << std::endl;
 
  175         uint32_t cnt = *((uint32_t *)&buf[0]);
 
  177         uint8_t type = (uint8_t)buf[6];
 
  178         uint8_t idx = (uint8_t)buf[7];
 
  179         int16_t value = *((int16_t *)&buf[4]);
 
  182         std::cerr << 
"n2=" << n2 << 
" cnt=" << cnt << 
" value=" << 
int(value) << 
" type=" << unsigned(type) << 
" idx=" << unsigned(idx) << std::endl;
 
#define MBDYN_EXCEPT_ARGS
std::vector< doublereal > m_lc_scale
bool set_fd_blocking(bool bBlocking)
static doublereal buf[BUFSIZE]
static void * read(LoadableElem *pEl, DataManager *pDM, MBDynParser &HP)
std::vector< bool > m_b_reset
 
 
 
  
  | 
        
          | void JoystickDrive::init | ( | void |  | ) |  |  | private | 
 
Definition at line 249 of file module-hid.cc.
References buf, get_fd_flags(), m_fd, m_nButtons, m_nLC, MBDYN_EXCEPT_ARGS, read(), set_fd_blocking(), FileDrive::sFileName, and WithLabel::uLabel.
Referenced by ServePending().
  253                 int save_errno = errno;
 
  254                 silent_cerr(
"JoystickDrive(" << 
uLabel << 
", " << 
sFileName << 
")::init(): " 
  255                         "unable to open device <" << 
sFileName << 
"> " 
  256                         "(" << save_errno << 
": " << strerror(save_errno) << 
")" 
  263         uint8_t iBmax = 0, iLCmax = 0;
 
  266                 ssize_t n = 
read(
m_fd, (
void *)&buf[0], 
sizeof(buf));
 
  269                 std::cerr << 
"read idx=" << i << 
" n=" << n << std::endl;
 
  273                         int save_errno = errno;
 
  274                         silent_cerr(
"JoystickDrive(" << 
uLabel << 
", " << 
sFileName << 
")::init(): " 
  275                                 "read failed (" << save_errno << 
": " << strerror(save_errno) << 
")" 
  280                 uint8_t type = (uint8_t)buf[6];
 
  281                 uint8_t idx = (uint8_t)buf[7];
 
  283                 if ((type & 0x7F) == 1) {
 
  285                         iBmax = std::max(iBmax, idx);
 
  287                 } 
else if ((type & 0x7F) == 2) {
 
  289                         iLCmax = std::max(iLCmax, idx);
 
  293                                 "warning, unknown type " << 
int(type & 0x7F) << 
", ignored" << std::endl); }
 
  296                 std::cerr << 
"    type=" << uint(type) << 
" idx=" << uint(idx) << 
" value=" << value << std::endl;
 
  301         if (nB != m_nButtons) {
 
  303                         "inconsistent number of buttons: expected " << m_nButtons << 
", got " << nB << std::endl);
 
  307         if (iBmax >= m_nButtons) {
 
  309                         "inconsistent largest button index: expected " << m_nButtons - 1 << 
", got " << 
unsigned(iBmax) << std::endl);
 
  315                         "inconsistent number of linear controls: expected " << 
m_nLC << 
", got " << nLC << std::endl);
 
  319         if (iLCmax >= 
m_nLC) {
 
  321                         "inconsistent largest linear control index: expected " << 
m_nLC - 1 << 
", got " << 
unsigned(iLCmax) << std::endl);
 
#define MBDYN_EXCEPT_ARGS
bool set_fd_blocking(bool bBlocking)
static doublereal buf[BUFSIZE]
static void * read(LoadableElem *pEl, DataManager *pDM, MBDynParser &HP)
 
 
 
  
  | 
        
          | std::ostream & JoystickDrive::Restart | ( | std::ostream & | out | ) | const |  | virtual | 
 
 
  
  | 
        
          | void JoystickDrive::ServePending | ( | const doublereal & | t | ) |  |  | virtual | 
 
 
  
  | 
        
          | bool JoystickDrive::set_fd_blocking | ( | bool | bBlocking | ) |  |  | private | 
 
 
  
  | 
        
          | int JoystickDrive::m_flags |  | private | 
 
 
The documentation for this class was generated from the following file: