MercurySDK
Software development kit for Mercury digital servos
All Classes Namespaces Files Functions Variables Macros
port_handler.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2021 <Robot Articulation/code@robotarticulation.com>
3 *
4 * Source files modified to support the Mercury range of digital servo motors from Robot Articulation
5 *******************************************************************************/
6 
7 /*******************************************************************************
8 * Copyright 2017 ROBOTIS CO., LTD.
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *******************************************************************************/
22 
23 /* Original author: Zerom, Leon (RyuWoon Jung) */
24 
25 #if defined(__linux__)
26 #include "port_handler.h"
27 #include "port_handler_linux.h"
28 #elif defined(_WIN32) || defined(_WIN64)
29 #define WINDLLEXPORT
30 #include "port_handler.h"
31 #include "port_handler_windows.h"
32 #endif
33 
34 using namespace mercury;
35 
37 {
38 #if defined(__linux__)
39  return (PortHandler *)(new PortHandlerLinux(port_name));
40 #elif defined(_WIN32) || defined(_WIN64)
41  return (PortHandler *)(new PortHandlerWindows(port_name));
42 #endif
43 }
The class for port control that inherits PortHandlerLinux, PortHandlerWindows, PortHandlerMac,...
Definition: port_handler.h:56
static PortHandler * getPortHandler(const char *port_name)
The function that gets PortHandler class inheritance @description The function gets class inheritance...
The class for control port in Linux.
The class for control port in Windows.