def _wrapMacAndZep(self, previousHop, nextHop, lowpan): ''' Returns Exegin ZEP protocol header and dummy 802.15.4 header wrapped around outgoing 6LoWPAN layer packet. ''' phop = previousHop[:] phop.reverse() nhop = nextHop[:] nhop.reverse() # ZEP zep = [ord('E'),ord('X')] # Protocol ID String zep += [0x02] # Protocol Version zep += [0x01] # Type zep += [0x00] # Channel ID zep += [0x00,0x01] # Device ID zep += [0x01] # LQI/CRC mode zep += [0xff] zep += [0x01]*8 # timestamp zep += [0x02]*4 # sequence number zep += [0x00]*10 # reserved zep += [21+len(lowpan)+2] # length # IEEE802.15.4 (data frame with dummy values) mac = [0x41,0xcc] # frame control mac += [0x66] # sequence number mac += [0xfe,0xca] # destination PAN ID mac += nhop # destination address mac += phop # source address mac += lowpan # CRC mac += u.calculateFCS(mac) return zep+mac
def _wrapMacAndZep(self, previousHop, nextHop, lowpan): ''' Returns Exegin ZEP protocol header and dummy 802.15.4 header wrapped around outgoing 6LoWPAN layer packet. ''' phop = previousHop[:] phop.reverse() nhop = nextHop[:] nhop.reverse() # ZEP zep = [ord('E'), ord('X')] # Protocol ID String zep += [0x02] # Protocol Version zep += [0x01] # Type zep += [0x00] # Channel ID zep += [0x00, 0x01] # Device ID zep += [0x01] # LQI/CRC mode zep += [0xff] zep += [0x01] * 8 # timestamp zep += [0x02] * 4 # sequence number zep += [0x00] * 10 # reserved zep += [21 + len(lowpan) + 2] # length # IEEE802.15.4 (data frame with dummy values) mac = [0x41, 0xcc] # frame control mac += [0x66] # sequence number mac += [0xfe, 0xca] # destination PAN ID mac += nhop # destination address mac += phop # source address mac += lowpan # CRC mac += u.calculateFCS(mac) return zep + mac
def _wrapZepCrc(self, body, frequency): # ZEP header zep = [ord('E'),ord('X')] # Protocol ID String zep += [0x02] # Protocol Version zep += [0x01] # Type zep += [frequency] # Channel ID zep += [0x00,0x01] # Device ID zep += [0x01] # LQI/CRC mode zep += [0xff] zep += [0x01]*8 # timestamp zep += [0x02]*4 # sequence number zep += [0x00]*10 # reserved zep += [len(body)+2] # length # mac frame mac = body mac += u.calculateFCS(mac) return zep+mac
def _wrapZepCrc(self, body, frequency): # ZEP header zep = [ord('E'), ord('X')] # Protocol ID String zep += [0x02] # Protocol Version zep += [0x01] # Type zep += [frequency] # Channel ID zep += [0x00, 0x01] # Device ID zep += [0x01] # LQI/CRC mode zep += [0xff] zep += [0x01] * 8 # timestamp zep += [0x02] * 4 # sequence number zep += [0x00] * 10 # reserved zep += [len(body) + 2] # length # mac frame mac = body mac += u.calculateFCS(mac) return zep + mac