-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from changtengfei/develop
SW-209. Fix.
- Loading branch information
Showing
9 changed files
with
206 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright (c) 2010-2013, Regents of the University of California. | ||
# All rights reserved. | ||
# | ||
# Released under the BSD 3-Clause license as published at the link below. | ||
# https://openwsn.atlassian.net/wiki/display/OW/License | ||
import logging | ||
log = logging.getLogger('ParserPacket') | ||
log.setLevel(logging.ERROR) | ||
log.addHandler(logging.NullHandler()) | ||
|
||
import struct | ||
|
||
from pydispatch import dispatcher | ||
|
||
from ParserException import ParserException | ||
import Parser | ||
|
||
class ParserPacket(Parser.Parser): | ||
|
||
HEADER_LENGTH = 2 | ||
MSPERSLOT = 15 #ms per slot. | ||
IPHC_SAM = 4 | ||
IPHC_DAM = 0 | ||
|
||
def __init__(self): | ||
|
||
# log | ||
log.info("create instance") | ||
|
||
# initialize parent class | ||
Parser.Parser.__init__(self,self.HEADER_LENGTH) | ||
|
||
#======================== public ========================================== | ||
|
||
def parseInput(self,input): | ||
# log | ||
if log.isEnabledFor(logging.DEBUG): | ||
log.debug("received packet {0}".format(input)) | ||
|
||
# ensure input not short longer than header | ||
self._checkLength(input) | ||
|
||
headerBytes = input[:2] | ||
|
||
# remove mote id at the beginning. | ||
input = input[2:] | ||
|
||
if log.isEnabledFor(logging.DEBUG): | ||
log.debug("packet without header {0}".format(input)) | ||
|
||
eventType='sniffedPacket' | ||
# notify a tuple including source as one hop away nodes elide SRC address as can be inferred from MAC layer header | ||
return (eventType,input) | ||
|
||
#======================== private ========================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters