当前位置: 首页>>代码示例>>Python>>正文


Python Packet.decodePacket方法代码示例

本文整理汇总了Python中Packet.decodePacket方法的典型用法代码示例。如果您正苦于以下问题:Python Packet.decodePacket方法的具体用法?Python Packet.decodePacket怎么用?Python Packet.decodePacket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Packet的用法示例。


在下文中一共展示了Packet.decodePacket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: notify

# 需要导入模块: import Packet [as 别名]
# 或者: from Packet import decodePacket [as 别名]
   def notify(self):
       #initialize variables
       self.choice= None
       self.info = None
       try:
           (self.choice, self.info) = Packet.decodePacket(self.hardwareLink.getLine(), self.wayListCount)   #get packet information
       except Exception:
           pass   
       
       if(self.choice == 0 ):                #check for bad packet
           self.badPacketCount = self.badPacketCount + 1
           self.VGO.setTelError(self.info)                #sends error packet to VGo
           print "BAD PACKET SUCKA!"
           
       while(self.shake_flag):                        #check for handshake 
            
           if(self.choice == 1):    #handshake acknowledged 
               self.shake_flag = False; 
               self.VGO.completeHandShake() 
               self.handShakeComplete = True               
           time.sleep(0.1) 
       
       #after handshake, system will just push to object 
       if(self.choice == 2):                        #Packet A
                    
           self.packetInfo = self.info 
           self.VGO.pushPacket(1,self.info) 
       elif(self.choice ==3):                        #Packet B 
           self.packetInfo = self.info 
           self.VGO.pushPacket(2,self.info)
       elif(self.choice ==4):                    #vehicle packets 
           self.packetInfo = self.info 
           self.setOldstats(self.status_varLat,self.status_varLong)
           self.setNewStats(self.info)
           self.VGO.pushPacket(3,self.info)
       elif(self.choice==5):
           self.VGO.pushPacket(4,self.info)
       elif(self.choice==6):                    #antenna packet
           #update anntena information
           varSide = 0
           self.varRun = float(self.VGO.getVehicleLatitude()) - float(self.VGO.getGroundLat())    #get horizontal component
           if(self.varRun<0):    #right side
               self.varAntennaSide=1
               
           self.varRise = self.VGO.getVehicleLongitude() - self.VGO.getGroundLong() #get vertical component
           try:
               self.theta = math.atan(self.varRise/self.varRun)/10            #calcuate angle between antenna and truck
           except ZeroDivisionError:
               pass

           self.setLine(self.theta)
开发者ID:datvikash,项目名称:BLACKDOG-,代码行数:53,代码来源:Communications.py


注:本文中的Packet.decodePacket方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。