00001 #!/usr/bin/env python 00002 # -*- coding: utf-8 -*- 00003 00004 ################################################################################ 00005 # Copyright 2017 ROBOTIS CO., LTD. 00006 # 00007 # Licensed under the Apache License, Version 2.0 (the "License"); 00008 # you may not use this file except in compliance with the License. 00009 # You may obtain a copy of the License at 00010 # 00011 # http://www.apache.org/licenses/LICENSE-2.0 00012 # 00013 # Unless required by applicable law or agreed to in writing, software 00014 # distributed under the License is distributed on an "AS IS" BASIS, 00015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 # See the License for the specific language governing permissions and 00017 # limitations under the License. 00018 ################################################################################ 00019 00020 # Author: Ryu Woon Jung (Leon) 00021 00022 from .protocol1_packet_handler import * 00023 from .protocol2_packet_handler import * 00024 00025 00026 def PacketHandler(protocol_version): 00027 # FIXME: float or int-to-float comparison can generate weird behaviour 00028 if protocol_version == 1.0: 00029 return Protocol1PacketHandler() 00030 elif protocol_version == 2.0: 00031 return Protocol2PacketHandler() 00032 else: 00033 return Protocol2PacketHandler()