port_handler_linux.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 * Copyright 2017 ROBOTIS CO., LTD.
00003 *
00004 * Licensed under the Apache License, Version 2.0 (the "License");
00005 * you may not use this file except in compliance with the License.
00006 * You may obtain a copy of the License at
00007 *
00008 *     http://www.apache.org/licenses/LICENSE-2.0
00009 *
00010 * Unless required by applicable law or agreed to in writing, software
00011 * distributed under the License is distributed on an "AS IS" BASIS,
00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 * See the License for the specific language governing permissions and
00014 * limitations under the License.
00015 *******************************************************************************/
00016 
00021 
00022 #ifndef DYNAMIXEL_SDK_INCLUDE_DYNAMIXEL_SDK_LINUX_PORTHANDLERLINUX_H_
00023 #define DYNAMIXEL_SDK_INCLUDE_DYNAMIXEL_SDK_LINUX_PORTHANDLERLINUX_H_
00024 
00025 
00026 #include "port_handler.h"
00027 
00028 namespace dynamixel
00029 {
00030 
00034 class PortHandlerLinux : public PortHandler
00035 {
00036  private:
00037   int     socket_fd_;
00038   int     baudrate_;
00039   char    port_name_[100];
00040 
00041   double  packet_start_time_;
00042   double  packet_timeout_;
00043   double  tx_time_per_byte;
00044 
00045   bool    setupPort(const int cflag_baud);
00046   bool    setCustomBaudrate(int speed);
00047   int     getCFlagBaud(const int baudrate);
00048 
00049   double  getCurrentTime();
00050   double  getTimeSinceStart();
00051 
00052  public:
00057   PortHandlerLinux(const char *port_name);
00058 
00063   virtual ~PortHandlerLinux() { closePort(); }
00064 
00070   bool    openPort();
00071 
00076   void    closePort();
00077 
00082   void    clearPort();
00083 
00089   void    setPortName(const char *port_name);
00090 
00096   char   *getPortName();
00097 
00106   bool    setBaudRate(const int baudrate);
00107 
00113   int     getBaudRate();
00114 
00121   int     getBytesAvailable();
00122 
00133   int     readPort(uint8_t *packet, int length);
00134 
00145   int     writePort(uint8_t *packet, int length);
00146 
00152   void    setPacketTimeout(uint16_t packet_length);
00153 
00159   void    setPacketTimeout(double msec);
00160 
00165   bool    isPacketTimeout();
00166 };
00167 
00168 }
00169 
00170 
00171 #endif /* DYNAMIXEL_SDK_INCLUDE_DYNAMIXEL_SDK_LINUX_PORTHANDLERLINUX_H_ */


ros
Author(s): Pyo , Zerom , Leon
autogenerated on Sat Jun 8 2019 18:32:11