Skip to content

Commit

Permalink
Merge pull request #26 from openwsn-berkeley/develop_24
Browse files Browse the repository at this point in the history
Develop 24
  • Loading branch information
Keoma Brun authored Aug 1, 2017
2 parents e92b802 + 956061a commit 04539eb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ArgusProbe_Beamlogic.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class RxSnifferThread(threading.Thread):
Thread which attaches to the sniffer and parses incoming frames.
"""

PCAP_GLOBALHEADER_LEN = 24 # 4+2+2+4+4+4+4
PCAP_PACKETHEADER_LEN = 16 # 4+4+4+4
BEAMLOGIC_HEADER_LEN = 18 # 8+1+1+4+4
PCAP_GLOBALHEADER_LEN = 24 # 4+2+2+4+4+4+4
PCAP_PACKETHEADER_LEN = 16 # 4+4+4+4
BEAMLOGIC_HEADER_LEN = 20 # 1+8+1+1+4+4+1
PIPE_SNIFFER = r'\\.\pipe\analyzer'

def __init__(self, txMqttThread):
Expand Down Expand Up @@ -160,12 +160,12 @@ def _transformFrame(self, frame):
Replace BeamLogic header by ZEP header.
"""

beamlogic = self._parseBeamlogicHeader(frame[1:1+self.BEAMLOGIC_HEADER_LEN])
ieee154 = frame[self.BEAMLOGIC_HEADER_LEN+2:-1]
beamlogic = self._parseBeamlogicHeader(frame[:self.BEAMLOGIC_HEADER_LEN])
ieee154 = frame[self.BEAMLOGIC_HEADER_LEN:beamlogic['Length']+self.BEAMLOGIC_HEADER_LEN]
zep = self._formatZep(
channel = beamlogic['Channel'],
timestamp = beamlogic['TimeStamp'],
length = len(ieee154),
length = beamlogic['Length'],
rssi = beamlogic['RSSI']
)

Expand All @@ -186,12 +186,14 @@ def _parseBeamlogicHeader(self, header):

returnVal = {}
(
returnVal['Reserved'],
returnVal['TimeStamp'],
returnVal['Channel'],
returnVal['RSSI'],
returnVal['GpsLat'],
returnVal['GpsLong'],
) = struct.unpack('<QBBII', ''.join([chr(b) for b in header]))
returnVal['Length'],
) = struct.unpack('<BQBBIIB', ''.join([chr(b) for b in header]))

return returnVal

Expand Down

0 comments on commit 04539eb

Please sign in to comment.