DETI-Dynamixel Interface  1
DevCommUsb.h
1 #ifndef DEV_COMM_USB_H_
2 #define DEV_COMM_USB_H_
3 
4 #include "DevComm.h"
5 #include <stdio.h>
6 #include <termios.h>
7 #include <unistd.h>
8 #include <sys/ioctl.h>
9 #include <stdlib.h>
10 
11 #include <fcntl.h>
12 #include <sys/types.h>
13 #include <sys/stat.h>
14 #include <string.h>
15 
16 #define DEBUG_PRINTS 0
17 
21 class DevCommUsb : public DevComm {
22 public:
23  DevCommUsb();
24  DevCommUsb(const char* devName);
25  ~DevCommUsb();
26 
27  void openChannel();
28  void closeChannel();
29  bool txRx(const char* txPacket, char* rxPacket, int rxSize);
30 
31 private:
32  int fd;
33  struct termios newtio;
34  struct termios oldtio;
35  const char* devname;
36  int baudrate;
37  int databits;
38  int stopbits;
39  int parity;
41  int setNewSettings(int baudrate, int databits, const int parity, const int stopbits, bool softwareHandshake, bool hardwareHandshake);
42  void resetAttributes();
43 };
44 
45 #endif /* DEV_COMM_USB_H_ */
struct termios newtio
Definition: DevCommUsb.h:33
void closeChannel()
Definition: DevCommUsb.cpp:212
const char * devname
Definition: DevCommUsb.h:35
struct termios oldtio
Definition: DevCommUsb.h:34
Abstract class to handle the communication with the device This class has the base methods to open...
Definition: DevComm.h:9
int fd
Definition: DevCommUsb.h:32
This class implements the device communication for a USB device in Linux (see DevComm for general det...
Definition: DevCommUsb.h:21
int databits
Definition: DevCommUsb.h:37
int stopbits
Definition: DevCommUsb.h:38
void openChannel()
Definition: DevCommUsb.cpp:44
bool txRx(const char *txPacket, char *rxPacket, int rxSize)
Definition: DevCommUsb.cpp:229
int baudrate
Definition: DevCommUsb.h:36
int parity
Definition: DevCommUsb.h:39