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 00017 /* Author: zerom, Ryu Woon Jung (Leon) */ 00018 00019 #if defined(__linux__) 00020 #include "port_handler.h" 00021 #include "port_handler_linux.h" 00022 #elif defined(__APPLE__) 00023 #include "port_handler.h" 00024 #include "port_handler_mac.h" 00025 #elif defined(_WIN32) || defined(_WIN64) 00026 #define WINDLLEXPORT 00027 #include "port_handler.h" 00028 #include "port_handler_windows.h" 00029 #elif defined(ARDUINO) || defined(__OPENCR__) || defined(__OPENCM904__) 00030 #include "../../include/dynamixel_sdk/port_handler.h" 00031 #include "../../include/dynamixel_sdk/port_handler_arduino.h" 00032 #endif 00033 00034 using namespace dynamixel; 00035 00036 PortHandler *PortHandler::getPortHandler(const char *port_name) 00037 { 00038 #if defined(__linux__) 00039 return (PortHandler *)(new PortHandlerLinux(port_name)); 00040 #elif defined(__APPLE__) 00041 return (PortHandler *)(new PortHandlerMac(port_name)); 00042 #elif defined(_WIN32) || defined(_WIN64) 00043 return (PortHandler *)(new PortHandlerWindows(port_name)); 00044 #elif defined(ARDUINO) || defined(__OPENCR__) || defined(__OPENCM904__) 00045 return (PortHandler *)(new PortHandlerArduino(port_name)); 00046 #endif 00047 }