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_ */
bool setBaudRate(const int baudrate)
The function that sets baudrate into the port handler The function sets baudrate into the port handl...
void setPortName(const char *port_name)
The function that sets port name into the port handler The function sets port name into the port han...
bool openPort()
The function that opens the port The function calls PortHandlerMac::setBaudRate() to open the port...
virtual ~PortHandlerMac()
The function that closes the port The function calls PortHandlerMac::closePort() to close the port...
char * getPortName()
The function that returns port name set into the port handler The function returns current port name...
PortHandlerMac(const char *port_name)
The function that initializes instance of PortHandler and gets port_name The function initializes in...
bool setupPort(const int cflag_baud)
int readPort(uint8_t *packet, int length)
The function that reads bytes from the port buffer The function gets bytes from the port buffer...
bool isPacketTimeout()
The function that checks whether packet timeout is occurred The function checks whether current time...
void setPacketTimeout(uint16_t packet_length)
The function that sets and starts stopwatch for watching packet timeout The function sets the stopwa...
int writePort(uint8_t *packet, int length)
The function that writes bytes on the port buffer The function writes bytes on the port buffer...
void closePort()
The function that closes the port The function closes the port.
bool setCustomBaudrate(int speed)
The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac, or PortHandlerArduino.
Definition: port_handler.h:56
int getBytesAvailable()
The function that checks how much bytes are able to be read from the port buffer The function checks...
void clearPort()
The function that clears the port The function clears the port.
int getCFlagBaud(const int baudrate)
int getBaudRate()
The function that returns current baudrate set into the port handler The function returns current ba...
The class for control port in Mac OS.


dynamixel_sdk
Author(s): Gilbert , Zerom , Darby Lim , Leon
autogenerated on Fri Apr 16 2021 02:25:55