port_handler_mac.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright 2017 ROBOTIS CO., LTD.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16 
21 
22 #ifndef DYNAMIXEL_SDK_INCLUDE_DYNAMIXEL_SDK_MAC_PORTHANDLERMAC_H_
23 #define DYNAMIXEL_SDK_INCLUDE_DYNAMIXEL_SDK_MAC_PORTHANDLERMAC_H_
24 
25 
26 #include "port_handler.h"
27 
28 namespace dynamixel
29 {
30 
35 {
36  private:
38  int baudrate_;
39  char port_name_[100];
40 
44 
45  bool setupPort(const int cflag_baud);
46  bool setCustomBaudrate(int speed);
47  int getCFlagBaud(const int baudrate);
48 
49  double getCurrentTime();
50  double getTimeSinceStart();
51 
52  public:
57  PortHandlerMac(const char *port_name);
58 
63  virtual ~PortHandlerMac() { closePort(); }
64 
70  bool openPort();
71 
76  void closePort();
77 
82  void clearPort();
83 
89  void setPortName(const char *port_name);
90 
96  char *getPortName();
97 
106  bool setBaudRate(const int baudrate);
107 
114  int getBaudRate();
115 
122  int getBytesAvailable();
123 
134  int readPort(uint8_t *packet, int length);
135 
146  int writePort(uint8_t *packet, int length);
147 
153  void setPacketTimeout(uint16_t packet_length);
154 
160  void setPacketTimeout(double msec);
161 
166  bool isPacketTimeout();
167 };
168 
169 }
170 
171 
172 #endif /* DYNAMIXEL_SDK_INCLUDE_DYNAMIXEL_SDK_MAC_PORTHANDLERMAC_H_ */
dynamixel::PortHandlerMac::clearPort
void clearPort()
The function that clears the port @description The function clears the port.
dynamixel::PortHandlerMac::getCFlagBaud
int getCFlagBaud(const int baudrate)
dynamixel::PortHandlerMac::port_name_
char port_name_[100]
Definition: port_handler_mac.h:39
dynamixel::PortHandlerMac::baudrate_
int baudrate_
Definition: port_handler_mac.h:38
dynamixel::PortHandlerMac::getCurrentTime
double getCurrentTime()
dynamixel::PortHandlerMac::setBaudRate
bool setBaudRate(const int baudrate)
The function that sets baudrate into the port handler @description The function sets baudrate into th...
dynamixel::PortHandlerMac::setPortName
void setPortName(const char *port_name)
The function that sets port name into the port handler @description The function sets port name into ...
dynamixel::PortHandlerMac::openPort
bool openPort()
The function that opens the port @description The function calls PortHandlerMac::setBaudRate() to ope...
dynamixel::PortHandlerMac::readPort
int readPort(uint8_t *packet, int length)
The function that reads bytes from the port buffer @description The function gets bytes from the port...
dynamixel::PortHandlerMac::setPacketTimeout
void setPacketTimeout(uint16_t packet_length)
The function that sets and starts stopwatch for watching packet timeout @description The function set...
dynamixel
Definition: group_bulk_read.h:31
dynamixel::PortHandler
The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac,...
Definition: port_handler.h:56
dynamixel::PortHandlerMac::writePort
int writePort(uint8_t *packet, int length)
The function that writes bytes on the port buffer @description The function writes bytes on the port ...
dynamixel::PortHandlerMac::closePort
void closePort()
The function that closes the port @description The function closes the port.
dynamixel::PortHandlerMac::socket_fd_
int socket_fd_
Definition: port_handler_mac.h:37
dynamixel::PortHandlerMac::packet_start_time_
double packet_start_time_
Definition: port_handler_mac.h:41
dynamixel::PortHandlerMac::getBaudRate
int getBaudRate()
The function that returns current baudrate set into the port handler @description The function return...
dynamixel::PortHandlerMac::getBytesAvailable
int getBytesAvailable()
The function that checks how much bytes are able to be read from the port buffer @description The fun...
dynamixel::PortHandlerMac::getPortName
char * getPortName()
The function that returns port name set into the port handler @description The function returns curre...
dynamixel::PortHandlerMac::isPacketTimeout
bool isPacketTimeout()
The function that checks whether packet timeout is occurred @description The function checks whether ...
dynamixel::PortHandlerMac::PortHandlerMac
PortHandlerMac(const char *port_name)
The function that initializes instance of PortHandler and gets port_name @description The function in...
dynamixel::PortHandlerMac::setupPort
bool setupPort(const int cflag_baud)
dynamixel::PortHandlerMac::tx_time_per_byte
double tx_time_per_byte
Definition: port_handler_mac.h:43
dynamixel::PortHandlerMac
The class for control port in Mac OS.
Definition: port_handler_mac.h:34
dynamixel::PortHandlerMac::setCustomBaudrate
bool setCustomBaudrate(int speed)
port_handler.h
dynamixel::PortHandlerMac::packet_timeout_
double packet_timeout_
Definition: port_handler_mac.h:42
dynamixel::PortHandlerMac::~PortHandlerMac
virtual ~PortHandlerMac()
The function that closes the port @description The function calls PortHandlerMac::closePort() to clos...
Definition: port_handler_mac.h:63
dynamixel::PortHandlerMac::getTimeSinceStart
double getTimeSinceStart()


dynamixel_sdk
Author(s): Gilbert , Zerom , Darby Lim , Leon
autogenerated on Wed Mar 2 2022 00:13:50