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 "packet_handler.h" 00021 #include "protocol1_packet_handler.h" 00022 #include "protocol2_packet_handler.h" 00023 #elif defined(__APPLE__) 00024 #include "packet_handler.h" 00025 #include "protocol1_packet_handler.h" 00026 #include "protocol2_packet_handler.h" 00027 #elif defined(_WIN32) || defined(_WIN64) 00028 #define WINDLLEXPORT 00029 #include "packet_handler.h" 00030 #include "protocol1_packet_handler.h" 00031 #include "protocol2_packet_handler.h" 00032 #elif defined(ARDUINO) || defined(__OPENCR__) || defined(__OPENCM904__) 00033 #include "../../include/dynamixel_sdk/packet_handler.h" 00034 #include "../../include/dynamixel_sdk/protocol1_packet_handler.h" 00035 #include "../../include/dynamixel_sdk/protocol2_packet_handler.h" 00036 #endif 00037 00038 using namespace dynamixel; 00039 00040 PacketHandler *PacketHandler::getPacketHandler(float protocol_version) 00041 { 00042 if (protocol_version == 1.0) 00043 { 00044 return (PacketHandler *)(Protocol1PacketHandler::getInstance()); 00045 } 00046 else if (protocol_version == 2.0) 00047 { 00048 return (PacketHandler *)(Protocol2PacketHandler::getInstance()); 00049 } 00050 00051 return (PacketHandler *)(Protocol2PacketHandler::getInstance()); 00052 }