port_handler_windows.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_WINDOWS_PORTHANDLERWINDOWS_H_
23 #define DYNAMIXEL_SDK_INCLUDE_DYNAMIXEL_SDK_WINDOWS_PORTHANDLERWINDOWS_H_
24 
25 #include <Windows.h>
26 
27 #include "port_handler.h"
28 
29 namespace dynamixel
30 {
31 
35 class WINDECLSPEC PortHandlerWindows : public PortHandler
36 {
37  private:
39  LARGE_INTEGER freq_, counter_;
40 
41  int baudrate_;
42  char port_name_[100];
43 
47 
48  bool setupPort(const int baudrate);
49 
50  double getCurrentTime();
51  double getTimeSinceStart();
52 
53  public:
58  PortHandlerWindows(const char *port_name);
59 
64  virtual ~PortHandlerWindows() { closePort(); }
65 
71  bool openPort();
72 
77  void closePort();
78 
83  void clearPort();
84 
90  void setPortName(const char *port_name);
91 
97  char *getPortName();
98 
107  bool setBaudRate(const int baudrate);
108 
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_WINDOWS_PORTHANDLERWINDOWS_H_ */
virtual ~PortHandlerWindows()
The function that closes the port The function calls PortHandlerWindows::closePort() to close the po...
The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac, or PortHandlerArduino.
Definition: port_handler.h:56
The class for control port in Windows.


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