Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions openvisualizer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import coloredlogs
import pkg_resources
import verboselogs
from iotlabcli.parser import common
# from iotlabcli.parser import common

from openvisualizer import PACKAGE_NAME, WINDOWS_COLORS, UNIX_COLORS, DEFAULT_LOGGING_CONF, APPNAME
from openvisualizer.eventbus import eventbusmonitor
Expand All @@ -34,7 +34,7 @@
from openvisualizer.motehandler.moteconnector import moteconnector
from openvisualizer.motehandler.moteprobe import emulatedmoteprobe
from openvisualizer.motehandler.moteprobe import testbedmoteprobe
from openvisualizer.motehandler.moteprobe.iotlabmoteprobe import IotlabMoteProbe
# from openvisualizer.motehandler.moteprobe.iotlabmoteprobe import IotlabMoteProbe
from openvisualizer.motehandler.moteprobe.serialmoteprobe import SerialMoteProbe
from openvisualizer.motehandler.motestate import motestate
from openvisualizer.motehandler.motestate.motestate import MoteState
Expand Down Expand Up @@ -881,7 +881,7 @@ def main():

parser = ArgumentParser()
_add_parser_args(parser)
_add_iotlab_parser_args(parser)
# _add_iotlab_parser_args(parser)
args = parser.parse_args()

# create directories to store logs and application data
Expand Down Expand Up @@ -985,9 +985,9 @@ def main():
auto_boot=args.auto_boot,
root=args.set_root,
topo_file=args.topo_file,
iotlab_motes=args.iotlab_motes,
iotlab_user=args.username,
iotlab_passwd=args.password,
iotlab_motes=None,
iotlab_user=None,
iotlab_passwd=None,
)

try:
Expand Down
35 changes: 18 additions & 17 deletions openvisualizer/motehandler/moteconnector/openparser/parserdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ def parse_input(self, data):
# cross layer trick here. capture UDP packet from udpLatency and get ASN to compute latency.
offset = 0
if len(data) > 37:
offset -= 7
if self.UINJECT_MASK == ''.join(chr(i) for i in data[offset:]):
offset += 31
if self.UINJECT_MASK == ''.join(chr(i) for i in data[offset:offset+len(self.UINJECT_MASK)]):

offset += len(self.UINJECT_MASK)
pkt_info = \
{
'asn': 0,
Expand All @@ -115,30 +116,30 @@ def parse_input(self, data):
'dutyCycle': 0,
}

offset -= 2
pkt_info['counter'] = data[offset - 2] + 256 * data[offset - 1] # counter sent by mote
pkt_info['counter'] = data[offset] + 256 * data[offset+1] # counter sent by mote
offset += 2

pkt_info['asn'] = struct.unpack('<I', ''.join([chr(c) for c in data[offset - 5:offset - 1]]))[0]
aux = data[offset - 5:offset] # last 5 bytes of the packet are the ASN in the UDP latency packet
pkt_info['asn'] = struct.unpack('<I', ''.join([chr(c) for c in data[offset : offset+4]]))[0]
aux = data[offset:offset+5] # last 5 bytes of the packet are the ASN in the UDP latency packet
diff = ParserData._asn_diference(aux, asn_bytes) # calculate difference
pkt_info['latency'] = diff # compute time in slots
offset -= 5
offset += 5

pkt_info['numCellsUsedTx'] = data[offset - 1]
offset -= 1
pkt_info['numCellsUsedTx'] = data[offset]
offset += 1

pkt_info['numCellsUsedRx'] = data[offset - 1]
offset -= 1
pkt_info['numCellsUsedRx'] = data[offset]
offset += 1

pkt_info['src_id'] = ''.join(['%02x' % x for x in [data[offset - 1], data[offset - 2]]]) # mote id
pkt_info['src_id'] = ''.join(['%02x' % x for x in [data[offset], data[offset+1]]]) # mote id
src_id = pkt_info['src_id']
offset -= 2
offset += 2

num_ticks_on = struct.unpack('<I', ''.join([chr(c) for c in data[offset - 4:offset]]))[0]
offset -= 4
num_ticks_on = struct.unpack('<I', ''.join([chr(c) for c in data[offset : offset+4]]))[0]
offset += 4

num_ticks_in_total = struct.unpack('<I', ''.join([chr(c) for c in data[offset - 4:offset]]))[0]
offset -= 4
num_ticks_in_total = struct.unpack('<I', ''.join([chr(c) for c in data[offset : offset+4]]))[0]
offset += 4

pkt_info['dutyCycle'] = float(num_ticks_on) / float(num_ticks_in_total) # duty cycle

Expand Down
2 changes: 1 addition & 1 deletion openvisualizer/motehandler/moteprobe/serialmoteprobe.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _get_ports_from_mask(port_mask=None):
if platform.system() == 'Darwin':
port_mask = ['/dev/tty.usbserial-*']
else:
port_mask = ['/dev/ttyUSB*']
port_mask = ['/dev/ttyUSB*', '/dev/ttyACM*']
for mask in port_mask:
ports += [s for s in glob.glob(mask)]
else:
Expand Down