From b89131cd59452eee4beba98814f473d631017729 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Sun, 7 Jun 2015 14:44:53 +0800 Subject: [PATCH 01/23] GD_IM_SCRIPT. add commands to configure golden image. --- .../openVisualizerApp/openVisualizerCli.py | 50 ++++++++++++++- .../moteConnector/OpenParser.py | 1 + .../moteConnector/moteConnector.py | 64 +++++++++++++++++++ .../openvisualizer/moteState/moteState.py | 28 ++++++++ 4 files changed, 142 insertions(+), 1 deletion(-) diff --git a/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py b/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py index 4a7a40caf..cc74224a7 100755 --- a/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py +++ b/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py @@ -94,7 +94,55 @@ def do_root(self, arg): ms.triggerAction(moteState.moteState.TRIGGER_DAGROOT) except ValueError as err: self.stdout.write(err) - + + def do_set(self,arg): + """ + Sets mote with parameters + Usag + """ + if not arg: + self.stdout.write('Available ports:') + if self.app.moteStates: + for ms in self.app.moteStates: + self.stdout.write(' {0}'.format(ms.moteConnector.serialport)) + else: + self.stdout.write(' ') + self.stdout.write('\n') + else: + try: + [port,image,command,parameter] = arg.split(' ') + for ms in self.app.moteStates: + try: + if (ms.moteConnector.serialport==port): + ms.triggerAction([moteState.moteState.SET_COMMAND,image,command,parameter]) + except ValueError as err: + self.stdout.write(err) + except ValueError as err: + print "{0}:{1}".format(type(err),err) + + def do_ping(self,arg): + """ + Sets mote with parameters + Usag + """ + if not arg: + self.stdout.write('Available ports:') + if self.app.moteStates: + for ms in self.app.moteStates: + self.stdout.write(' {0}'.format(ms.moteConnector.serialport)) + else: + self.stdout.write(' ') + self.stdout.write('\n') + else: + try: + if sys.platform.startswith('win32'): + pingComand = 'ping -6 ' + arg + ' -n 1 -l 1' + elif sys.platform.startswith('linux'): + pingComand = 'ping6 ' + arg + ' -n 1 -l 1' + os.system(pingComand) + except ValueError as err: + self.stdout.write(err) + def help_all(self): """Lists first line of help for all documented commands""" names = self.get_names() diff --git a/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py b/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py index ee440e3bd..7f8e3dbf7 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py +++ b/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py @@ -28,6 +28,7 @@ class OpenParser(Parser.Parser): SERFRAME_PC2MOTE_SETDAGROOT = ord('R') SERFRAME_PC2MOTE_DATA = ord('D') SERFRAME_PC2MOTE_TRIGGERSERIALECHO = ord('S') + SERFRAME_PC2MOTE_COMMAND_GD = ord('G') SERFRAME_ACTION_YES = ord('Y') SERFRAME_ACTION_NO = ord('N') diff --git a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py index 899926922..5e065678d 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py +++ b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py @@ -144,9 +144,73 @@ def _cmdToMote_handler(self,sender,signal,data): self._sendToMoteProbe( dataToSend = dataToSend, ) + elif data['action'][0]==moteState.moteState.SET_COMMAND: + # this is command for golden image + with self.stateLock: + [success,dataToSend] = self._GDcommandToBytes(data['action'][1:]) + + if success == False: + return + + print dataToSend + # send command to GD image + self._sendToMoteProbe( + dataToSend = dataToSend, + ) else: raise SystemError('unexpected action={0}'.format(data['action'])) + def _GDcommandToBytes(self,data): + + SUCCESS = False + dataToSend = [] + + # get imageId + if data[0] == 'image1': + imageId = 1 + elif data[1] == 'image2': + iamgeId = 2 + else: + print "Wrong Image ({0})! (Available: image1 OR image2)\n".format(data[0]) + return [SUCCESS,dataToSend] + + # get commandId + commandIndex = 0 + for cmd in moteState.moteState.COMMAND_ALL: + if data[1] == cmd[0]: + commandId = cmd[1] + commandLen = cmd[2] + break + else: + commandIndex += 1 + + # check avaliability of command + if commandIndex == len(moteState.moteState.COMMAND_ALL): + print "Wrong Command ID ! (Available: 0~9)\n" + return [SUCCESS,dataToSend] + + # get parameter + parameter = int(data[2]) + if parameter <= 0xffff: + parameter = [(parameter & 0xff),((parameter >> 8) & 0xff)] + dataToSend = [OpenParser.OpenParser.SERFRAME_PC2MOTE_COMMAND_GD, + 1, # version + imageId, + commandId, + commandLen, # length + parameter[0], + parameter[1] + ] + else: + # more than two bytes parameter, error + print "Paramter Wrong! (Available: 0x0000~0xffff)\n" + return [SUCCESS,dataToSend] + + # the command is legal if I got here + SUCCESS = True + return [SUCCESS,dataToSend] + + def _bytesToMesh_handler(self,sender,signal,data): assert type(data)==tuple assert len(data)==2 diff --git a/software/openvisualizer/openvisualizer/moteState/moteState.py b/software/openvisualizer/openvisualizer/moteState/moteState.py index 47cc87135..262f6879d 100644 --- a/software/openvisualizer/openvisualizer/moteState/moteState.py +++ b/software/openvisualizer/openvisualizer/moteState/moteState.py @@ -410,6 +410,34 @@ class moteState(eventBusClient.eventBusClient): ] TRIGGER_DAGROOT = 'DAGroot' + SET_GD_IM1 = 'SetGoldenImage1' + SET_GD_IM2 = 'SetGoldenImage2' + SET_COMMAND = 'imageCommand' + + # command for golen image: command, id length + COMMAND_SET_EBPERIOD = ['ebPeriod', 0, 1] + COMMAND_SET_CHANNEL = ['channel', 1, 1] + COMMAND_SET_KAPERIOD = ['kaPeriod', 2, 2] + COMMAND_SET_DIOPERIOD = ['dioPeriod', 3, 2] + COMMAND_SET_DAOPERIOD = ['daoPeriod', 4, 2] + COMMAND_PING_MOTE = ['ping', 5, 8] + COMMAND_SET_DAGRANK = ['dagrank', 6, 2] + COMMAND_SET_SECURITY_STATUS = ['security', 7, 1] + COMMAND_SET_FRAMELENGTH = ['frameLength', 8, 2] + COMMAND_SET_ACK_STATUS = ['ackReply', 9, 1] + COMMAND_ALL = [ + COMMAND_SET_EBPERIOD , + COMMAND_SET_CHANNEL, + COMMAND_SET_KAPERIOD, + COMMAND_SET_DIOPERIOD, + COMMAND_SET_DAOPERIOD, + COMMAND_PING_MOTE, + COMMAND_SET_DAGRANK, + COMMAND_SET_SECURITY_STATUS, + COMMAND_SET_FRAMELENGTH, + COMMAND_SET_ACK_STATUS, + ] + TRIGGER_ALL = [ TRIGGER_DAGROOT, ] From 84a039e72c8b2436859729778b4dc7a9a1b41f0c Mon Sep 17 00:00:00 2001 From: changtengfei Date: Sun, 7 Jun 2015 15:23:00 +0800 Subject: [PATCH 02/23] GD_IM_SCRIPT. comment debug info. --- .../openvisualizer/moteConnector/moteConnector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py index 5e065678d..0aafa8397 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py +++ b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py @@ -152,7 +152,7 @@ def _cmdToMote_handler(self,sender,signal,data): if success == False: return - print dataToSend + # print dataToSend # send command to GD image self._sendToMoteProbe( dataToSend = dataToSend, From 8381bd81d215d691814ce991bcc221b1668ddbd6 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Tue, 9 Jun 2015 11:48:03 +0800 Subject: [PATCH 03/23] GD_IM_SCRIPT. add string for ERR_PACKET_SYNC info. --- .../openvisualizer/openvisualizer/moteConnector/StackDefines.py | 1 + 1 file changed, 1 insertion(+) diff --git a/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py b/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py index a23d1fdb4..7ab75486a 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py +++ b/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py @@ -99,4 +99,5 @@ 55: "invalid packet frome radio, length {1} (code location {0})", 56: "busy receiving when stop of serial activity, buffer input length {1} (code location {0})", 57: "wrong CRC in input Buffer (input length {0})", + 58: "Synchronized at asn {0} with timeCorrection of {1}", } From e14af85a95ab20f266b70bb91b19ab52b0bce0f8 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Tue, 9 Jun 2015 13:33:58 +0800 Subject: [PATCH 04/23] GD_IM_SCRIPT. add ParserPacket module. --- .../openvisualizer/eventBus/eventBusMonitor.py | 3 +++ .../openvisualizer/moteConnector/OpenParser.py | 9 ++++++++- .../openvisualizer/moteConnector/moteConnector.py | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py index e1aa1719d..1fd3bf2bc 100644 --- a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py +++ b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py @@ -140,6 +140,9 @@ def _eventBusNotification(self,signal,sender,data): lowpan = lowpan, ) self._dispatchMeshDebugPacket(zep) + + if signal=='fromMote.packet': + print data if signal=='bytesToMesh': # Forwards a copy of the 6LoWPAN packet destined for the mesh diff --git a/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py b/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py index 7f8e3dbf7..abcc108a8 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py +++ b/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py @@ -13,6 +13,7 @@ import ParserStatus import ParserInfoErrorCritical as ParserIEC import ParserData +import ParserPacket class OpenParser(Parser.Parser): @@ -24,6 +25,7 @@ class OpenParser(Parser.Parser): SERFRAME_MOTE2PC_ERROR = ParserIEC.ParserInfoErrorCritical.SEVERITY_ERROR SERFRAME_MOTE2PC_CRITICAL = ParserIEC.ParserInfoErrorCritical.SEVERITY_CRITICAL SERFRAME_MOTE2PC_REQUEST = ord('R') + SERFRAME_MOTE2PC_PACKET = ord('P') SERFRAME_PC2MOTE_SETDAGROOT = ord('R') SERFRAME_PC2MOTE_DATA = ord('D') @@ -48,6 +50,7 @@ def __init__(self): self.parserError = ParserIEC.ParserInfoErrorCritical(self.SERFRAME_MOTE2PC_ERROR) self.parserCritical = ParserIEC.ParserInfoErrorCritical(self.SERFRAME_MOTE2PC_CRITICAL) self.parserData = ParserData.ParserData() + self.parserPacket = ParserPacket.ParserPacket() # register subparsers self._addSubParser( @@ -75,7 +78,11 @@ def __init__(self): val = self.SERFRAME_MOTE2PC_CRITICAL, parser = self.parserCritical.parseInput, ) - + self._addSubParser( + index = 0, + val = self.SERFRAME_MOTE2PC_PACKET, + parser = self.parserPacket.parseInput, + ) #======================== public ========================================== #======================== private ========================================= \ No newline at end of file diff --git a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py index 0aafa8397..d24089dd1 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py +++ b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py @@ -81,6 +81,8 @@ def _sendToParser(self,data): log.error(str(err)) pass else: + if eventSubType == 'packet': + print "I got a packet from Mote!\n" # dispatch self.dispatch('fromMote.'+eventSubType,parsedNotif) From 4d8446d2236daecd1837a07fac5e531c68e4d5b8 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Tue, 9 Jun 2015 13:43:21 +0800 Subject: [PATCH 05/23] GD_IM_SCRIPT. add parserPacket.py --- .../moteConnector/ParserPacket.py | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py diff --git a/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py b/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py new file mode 100644 index 000000000..bce6badb3 --- /dev/null +++ b/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py @@ -0,0 +1,60 @@ +# 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='packet' + # 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 ========================================= \ No newline at end of file From 0e00c20de56558f4e3f80593e8dec4e75e3f3529 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Tue, 9 Jun 2015 14:07:33 +0800 Subject: [PATCH 06/23] GD_IM.add openSniffer module. --- .../openVisualizerApp/openVisualizerApp.py | 2 + .../openvisualizer/openSniffer/__init__.py | 0 .../openvisualizer/openSniffer/openSniffer.py | 106 ++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 software/openvisualizer/openvisualizer/openSniffer/__init__.py create mode 100644 software/openvisualizer/openvisualizer/openSniffer/openSniffer.py diff --git a/software/openvisualizer/bin/openVisualizerApp/openVisualizerApp.py b/software/openvisualizer/bin/openVisualizerApp/openVisualizerApp.py index 24ac8252e..816b121bb 100644 --- a/software/openvisualizer/bin/openVisualizerApp/openVisualizerApp.py +++ b/software/openvisualizer/bin/openVisualizerApp/openVisualizerApp.py @@ -24,6 +24,7 @@ from openvisualizer.RPL import UDPLatency from openvisualizer.RPL import topology from openvisualizer import appdirs +from openvisualizer.openSniffer import openSniffer import openvisualizer.openvisualizer_utils as u @@ -52,6 +53,7 @@ def __init__(self,confdir,datadir,logdir,simulatorMode,numMotes,trace,debug,simT self.rpl = RPL.RPL() self.topology = topology.topology() self.udpLatency = UDPLatency.UDPLatency() + self.openSniffer = openSniffer.OpenSniffer() self.DAGrootList = [] # create openTun call last since indicates prefix self.openTun = openTun.create() diff --git a/software/openvisualizer/openvisualizer/openSniffer/__init__.py b/software/openvisualizer/openvisualizer/openSniffer/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/software/openvisualizer/openvisualizer/openSniffer/openSniffer.py b/software/openvisualizer/openvisualizer/openSniffer/openSniffer.py new file mode 100644 index 000000000..8710440b6 --- /dev/null +++ b/software/openvisualizer/openvisualizer/openSniffer/openSniffer.py @@ -0,0 +1,106 @@ +# 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('openSniffer') +log.setLevel(logging.ERROR) +log.addHandler(logging.NullHandler()) + +from openvisualizer.eventBus import eventBusClient +import threading +import openvisualizer.openvisualizer_utils as u + +#============================ parameters ====================================== + +class OpenSniffer(eventBusClient.eventBusClient): + ''' + Class which is responsible for translating the packet received from Mote + to the wireshark. + + ''' + + def __init__(self): + + # log + log.info("create instance") + + # store params + self.stateLock = threading.Lock() + self.networkPrefix = None + self.dagRootEui64 = None + + # initialize parent class + eventBusClient.eventBusClient.__init__( + self, + name = 'OpenSniffer', + registrations = [ + { + 'sender' : self.WILDCARD, #signal when a pkt from sniffer + 'signal' : 'fromMote.packet', + 'callback' : self._packetToWireshark, + }, + ] + ) + + # local variables + + #======================== public ========================================== + + #======================== private ========================================= + + + def _packetToWireshark(self,sender,signal,data): + ''' + Converts a packet into wireshark format. + + ''' + + print data + + + + #======================== helpers ========================================= + + def _formatWireshark(self,pkt): + NUM_BYTES_PER_LINE = 16 + + output = [] + index = 0 + while index32 and b<127: + end_chars += [chr(b)] + else: + end_chars += ['.'] + + # pad + for _ in range(len(bytes),NUM_BYTES_PER_LINE): + this_line += [' '] + + # print the end_chars + this_line += end_chars + + # store the line + this_line = ''.join(this_line) + output += [this_line] + + # increment index + index += NUM_BYTES_PER_LINE + + return '\n'.join(output) From 8b5aa9a6df7251809a56d7de0adc729207c2813f Mon Sep 17 00:00:00 2001 From: changtengfei Date: Tue, 9 Jun 2015 14:09:24 +0800 Subject: [PATCH 07/23] GD_IM. remove one debugging info. --- .../openvisualizer/moteConnector/moteConnector.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py index d24089dd1..0aafa8397 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py +++ b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py @@ -81,8 +81,6 @@ def _sendToParser(self,data): log.error(str(err)) pass else: - if eventSubType == 'packet': - print "I got a packet from Mote!\n" # dispatch self.dispatch('fromMote.'+eventSubType,parsedNotif) From d605a2c638c5d6447ff4953c2a258d59ce619d6d Mon Sep 17 00:00:00 2001 From: changtengfei Date: Tue, 9 Jun 2015 23:34:34 +0800 Subject: [PATCH 08/23] GD_IM_SCRIPT. add component definition. --- .../openvisualizer/moteConnector/StackDefines.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py b/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py index 7ab75486a..7fac0eac8 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py +++ b/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py @@ -34,11 +34,15 @@ 27: "CEXAMPLE", 28: "CINFO", 29: "CLEDS", - 30: "CSTORM", - 31: "CWELLKNOWN", - 32: "TECHO", - 33: "TOHLONE", - 34: "UECHO", + 30: "CSENSORS", + 31: "CSTORM", + 32: "CWELLKNOWN", + 33: "TECHO", + 34: "TOHLONE", + 35: "UECHO", + 36: "UINJECT", + 37: "RRT", + 38: "SECURITY", } errorDescriptions = { From 7034d8245f5f3911adfea5ea62a4d95cd782175c Mon Sep 17 00:00:00 2001 From: changtengfei Date: Tue, 9 Jun 2015 23:38:22 +0800 Subject: [PATCH 09/23] GD_IM_SCRIPT. add security error descriptor. --- .../openvisualizer/moteConnector/StackDefines.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py b/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py index 7fac0eac8..cb44f4d0f 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py +++ b/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py @@ -103,5 +103,6 @@ 55: "invalid packet frome radio, length {1} (code location {0})", 56: "busy receiving when stop of serial activity, buffer input length {1} (code location {0})", 57: "wrong CRC in input Buffer (input length {0})", - 58: "Synchronized at asn {0} with timeCorrection of {1}", + 58: "synchronized at asn {0} with timeCorrection of {1}", + 59: "security error on frameType {0}, code location {1}" } From b42aade8ed31ef68c375c31ec5625d57cfb825fb Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 11 Jun 2015 15:56:19 +0800 Subject: [PATCH 10/23] GD_IM_SCRIPT. remove 'fromMote.packet' signal in evenBusMonitor.py --- .../openvisualizer/openvisualizer/eventBus/eventBusMonitor.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py index 1fd3bf2bc..e1aa1719d 100644 --- a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py +++ b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py @@ -140,9 +140,6 @@ def _eventBusNotification(self,signal,sender,data): lowpan = lowpan, ) self._dispatchMeshDebugPacket(zep) - - if signal=='fromMote.packet': - print data if signal=='bytesToMesh': # Forwards a copy of the 6LoWPAN packet destined for the mesh From 3bdb52f30fad998399d60c47ec5b24353e294393 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 11 Jun 2015 16:34:30 +0800 Subject: [PATCH 11/23] GD_IM_SCRIPT. set DTR and RTS after connecting to serial port. --- software/openvisualizer/openvisualizer/moteProbe/moteProbe.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/software/openvisualizer/openvisualizer/moteProbe/moteProbe.py b/software/openvisualizer/openvisualizer/moteProbe/moteProbe.py index d88c734b9..6aaaf8350 100644 --- a/software/openvisualizer/openvisualizer/moteProbe/moteProbe.py +++ b/software/openvisualizer/openvisualizer/moteProbe/moteProbe.py @@ -165,6 +165,8 @@ def run(self): if self.mode==self.MODE_SERIAL: self.serial = serial.Serial(self.serialport,self.baudrate) + self.serial.setDTR(0) + self.serial.setRTS(0) elif self.mode==self.MODE_EMULATED: self.serial = self.emulatedMote.bspUart elif self.mode==self.MODE_IOTLAB: From 54eceb733c777ac7bb38d55a849ae5167d9f999c Mon Sep 17 00:00:00 2001 From: changtengfei Date: Sat, 13 Jun 2015 20:55:57 +0800 Subject: [PATCH 12/23] GD_IM_SCRIPT. update information description. --- .../openvisualizer/openvisualizer/moteConnector/StackDefines.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py b/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py index cb44f4d0f..73b986517 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py +++ b/software/openvisualizer/openvisualizer/moteConnector/StackDefines.py @@ -103,6 +103,6 @@ 55: "invalid packet frome radio, length {1} (code location {0})", 56: "busy receiving when stop of serial activity, buffer input length {1} (code location {0})", 57: "wrong CRC in input Buffer (input length {0})", - 58: "synchronized at asn {0} with timeCorrection of {1}", + 58: "frame received at asn {0} with timeCorrection of {1}", 59: "security error on frameType {0}, code location {1}" } From 9e413fe25bfce9c2680d2e9517cd8aa436efb309 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Sun, 14 Jun 2015 15:40:39 +0800 Subject: [PATCH 13/23] GD_IM_SCRIPT. inject packet into wireshark. --- .../openVisualizerApp/openVisualizerApp.py | 2 - .../openVisualizerApp/openVisualizerCli.py | 1 + .../eventBus/eventBusMonitor.py | 9 ++ .../openvisualizer/openSniffer/__init__.py | 0 .../openvisualizer/openSniffer/openSniffer.py | 106 ------------------ 5 files changed, 10 insertions(+), 108 deletions(-) delete mode 100644 software/openvisualizer/openvisualizer/openSniffer/__init__.py delete mode 100644 software/openvisualizer/openvisualizer/openSniffer/openSniffer.py diff --git a/software/openvisualizer/bin/openVisualizerApp/openVisualizerApp.py b/software/openvisualizer/bin/openVisualizerApp/openVisualizerApp.py index 816b121bb..24ac8252e 100644 --- a/software/openvisualizer/bin/openVisualizerApp/openVisualizerApp.py +++ b/software/openvisualizer/bin/openVisualizerApp/openVisualizerApp.py @@ -24,7 +24,6 @@ from openvisualizer.RPL import UDPLatency from openvisualizer.RPL import topology from openvisualizer import appdirs -from openvisualizer.openSniffer import openSniffer import openvisualizer.openvisualizer_utils as u @@ -53,7 +52,6 @@ def __init__(self,confdir,datadir,logdir,simulatorMode,numMotes,trace,debug,simT self.rpl = RPL.RPL() self.topology = topology.topology() self.udpLatency = UDPLatency.UDPLatency() - self.openSniffer = openSniffer.OpenSniffer() self.DAGrootList = [] # create openTun call last since indicates prefix self.openTun = openTun.create() diff --git a/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py b/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py index cc74224a7..24e38ca85 100755 --- a/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py +++ b/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py @@ -176,5 +176,6 @@ def do_quit(self, arg): if __name__=="__main__": app = openVisualizerApp.main() + app.eventBusMonitor.setWiresharkDebug(True) cli = OpenVisualizerCli(app) cli.cmdloop() diff --git a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py index e1aa1719d..cddbf65ae 100644 --- a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py +++ b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py @@ -140,6 +140,15 @@ def _eventBusNotification(self,signal,sender,data): lowpan = lowpan, ) self._dispatchMeshDebugPacket(zep) + + if signal=='fromMote.packet': + body = data[0:-3] + crc = data[-3:-1] + frequency = data[-1] + + # wrap with zep header + zep = self._wrapZepCrc(body,frequency) + self._dispatchMeshDebugPacket(zep) if signal=='bytesToMesh': # Forwards a copy of the 6LoWPAN packet destined for the mesh diff --git a/software/openvisualizer/openvisualizer/openSniffer/__init__.py b/software/openvisualizer/openvisualizer/openSniffer/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/software/openvisualizer/openvisualizer/openSniffer/openSniffer.py b/software/openvisualizer/openvisualizer/openSniffer/openSniffer.py deleted file mode 100644 index 8710440b6..000000000 --- a/software/openvisualizer/openvisualizer/openSniffer/openSniffer.py +++ /dev/null @@ -1,106 +0,0 @@ -# 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('openSniffer') -log.setLevel(logging.ERROR) -log.addHandler(logging.NullHandler()) - -from openvisualizer.eventBus import eventBusClient -import threading -import openvisualizer.openvisualizer_utils as u - -#============================ parameters ====================================== - -class OpenSniffer(eventBusClient.eventBusClient): - ''' - Class which is responsible for translating the packet received from Mote - to the wireshark. - - ''' - - def __init__(self): - - # log - log.info("create instance") - - # store params - self.stateLock = threading.Lock() - self.networkPrefix = None - self.dagRootEui64 = None - - # initialize parent class - eventBusClient.eventBusClient.__init__( - self, - name = 'OpenSniffer', - registrations = [ - { - 'sender' : self.WILDCARD, #signal when a pkt from sniffer - 'signal' : 'fromMote.packet', - 'callback' : self._packetToWireshark, - }, - ] - ) - - # local variables - - #======================== public ========================================== - - #======================== private ========================================= - - - def _packetToWireshark(self,sender,signal,data): - ''' - Converts a packet into wireshark format. - - ''' - - print data - - - - #======================== helpers ========================================= - - def _formatWireshark(self,pkt): - NUM_BYTES_PER_LINE = 16 - - output = [] - index = 0 - while index32 and b<127: - end_chars += [chr(b)] - else: - end_chars += ['.'] - - # pad - for _ in range(len(bytes),NUM_BYTES_PER_LINE): - this_line += [' '] - - # print the end_chars - this_line += end_chars - - # store the line - this_line = ''.join(this_line) - output += [this_line] - - # increment index - index += NUM_BYTES_PER_LINE - - return '\n'.join(output) From 2d1c169510cd685306fd302defdc441487d7490b Mon Sep 17 00:00:00 2001 From: changtengfei Date: Sun, 14 Jun 2015 23:14:46 +0800 Subject: [PATCH 14/23] GD_IM_SCRIPT. fixed. --- .../openvisualizer/moteConnector/moteConnector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py index 0aafa8397..e8b3a876c 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py +++ b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py @@ -168,8 +168,8 @@ def _GDcommandToBytes(self,data): # get imageId if data[0] == 'image1': imageId = 1 - elif data[1] == 'image2': - iamgeId = 2 + elif data[0] == 'image2': + imageId = 2 else: print "Wrong Image ({0})! (Available: image1 OR image2)\n".format(data[0]) return [SUCCESS,dataToSend] From 2972d35935e1c3f78d3fec1cdcf39ecd5b055dd3 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Tue, 16 Jun 2015 10:55:16 +0800 Subject: [PATCH 15/23] GD_IM. remove ping command. --- .../openVisualizerApp/openVisualizerCli.py | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py b/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py index 24e38ca85..f9c1bccc6 100755 --- a/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py +++ b/software/openvisualizer/bin/openVisualizerApp/openVisualizerCli.py @@ -120,29 +120,6 @@ def do_set(self,arg): except ValueError as err: print "{0}:{1}".format(type(err),err) - def do_ping(self,arg): - """ - Sets mote with parameters - Usag - """ - if not arg: - self.stdout.write('Available ports:') - if self.app.moteStates: - for ms in self.app.moteStates: - self.stdout.write(' {0}'.format(ms.moteConnector.serialport)) - else: - self.stdout.write(' ') - self.stdout.write('\n') - else: - try: - if sys.platform.startswith('win32'): - pingComand = 'ping -6 ' + arg + ' -n 1 -l 1' - elif sys.platform.startswith('linux'): - pingComand = 'ping6 ' + arg + ' -n 1 -l 1' - os.system(pingComand) - except ValueError as err: - self.stdout.write(err) - def help_all(self): """Lists first line of help for all documented commands""" names = self.get_names() From 183bb4d1bafd91f4b82245e96fd10a58afc75c0f Mon Sep 17 00:00:00 2001 From: changtengfei Date: Mon, 29 Jun 2015 11:19:17 +0800 Subject: [PATCH 16/23] GD_IM_SCRIPT: add SECURITY COMPONENT type. --- .../openvisualizer/openvisualizer/openType/typeComponent.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/software/openvisualizer/openvisualizer/openType/typeComponent.py b/software/openvisualizer/openvisualizer/openType/typeComponent.py index 61aba3d6b..291530ffb 100644 --- a/software/openvisualizer/openvisualizer/openType/typeComponent.py +++ b/software/openvisualizer/openvisualizer/openType/typeComponent.py @@ -60,6 +60,7 @@ class typeComponent(openType.openType): COMPONENT_UECHO = 0x23 COMPONENT_UINJECT = 0x24 COMPONENT_RRT = 0x25 + COMPONENT_SECURITY = 0x26 def __init__(self): # log @@ -158,6 +159,9 @@ def update(self,type): elif type==self.COMPONENT_RRT: self.desc = 'RRT' + + elif type==self.COMPONENT_SECURITY: + self.desc = 'SECURITY' else: self.desc = 'unknown' self.addr = None From d7246691941dd2fe51bb3438ef0caa82f923f75b Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 2 Jul 2015 11:26:47 +0800 Subject: [PATCH 17/23] SW-209. rename eventType 'packet' by 'snifferedPacket' --- .../openvisualizer/openvisualizer/eventBus/eventBusMonitor.py | 2 +- .../openvisualizer/openvisualizer/moteConnector/ParserPacket.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py index cddbf65ae..9303458c3 100644 --- a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py +++ b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py @@ -141,7 +141,7 @@ def _eventBusNotification(self,signal,sender,data): ) self._dispatchMeshDebugPacket(zep) - if signal=='fromMote.packet': + if signal=='fromMote.snifferedPacket': body = data[0:-3] crc = data[-3:-1] frequency = data[-1] diff --git a/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py b/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py index bce6badb3..74df82c9f 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py +++ b/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py @@ -53,7 +53,7 @@ def parseInput(self,input): - eventType='packet' + eventType='snifferedPacket' # notify a tuple including source as one hop away nodes elide SRC address as can be inferred from MAC layer header return (eventType,input) From 7d8bfe97281dbb7f4885a2a48076cf8025f21cca Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 2 Jul 2015 11:30:02 +0800 Subject: [PATCH 18/23] SW-209. rename eventType 'snifferedPacket' by 'sniffedPacket' --- .../openvisualizer/openvisualizer/eventBus/eventBusMonitor.py | 2 +- .../openvisualizer/openvisualizer/moteConnector/ParserPacket.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py index 9303458c3..243dcaf88 100644 --- a/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py +++ b/software/openvisualizer/openvisualizer/eventBus/eventBusMonitor.py @@ -141,7 +141,7 @@ def _eventBusNotification(self,signal,sender,data): ) self._dispatchMeshDebugPacket(zep) - if signal=='fromMote.snifferedPacket': + if signal=='fromMote.sniffedPacket': body = data[0:-3] crc = data[-3:-1] frequency = data[-1] diff --git a/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py b/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py index 74df82c9f..01c5cb1e8 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py +++ b/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py @@ -53,7 +53,7 @@ def parseInput(self,input): - eventType='snifferedPacket' + 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) From 6ed8d687a2e23ef7169983a86d4b235e4c406459 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 2 Jul 2015 11:32:38 +0800 Subject: [PATCH 19/23] SW-209. replace 'SERFRAME_MOTE2PC_PACKET' by 'SERFRAME_MOTE2PC_SNIFFED_PACKET' --- .../openvisualizer/openvisualizer/moteConnector/OpenParser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py b/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py index abcc108a8..a1ff39fc2 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py +++ b/software/openvisualizer/openvisualizer/moteConnector/OpenParser.py @@ -25,7 +25,7 @@ class OpenParser(Parser.Parser): SERFRAME_MOTE2PC_ERROR = ParserIEC.ParserInfoErrorCritical.SEVERITY_ERROR SERFRAME_MOTE2PC_CRITICAL = ParserIEC.ParserInfoErrorCritical.SEVERITY_CRITICAL SERFRAME_MOTE2PC_REQUEST = ord('R') - SERFRAME_MOTE2PC_PACKET = ord('P') + SERFRAME_MOTE2PC_SNIFFED_PACKET = ord('P') SERFRAME_PC2MOTE_SETDAGROOT = ord('R') SERFRAME_PC2MOTE_DATA = ord('D') @@ -80,7 +80,7 @@ def __init__(self): ) self._addSubParser( index = 0, - val = self.SERFRAME_MOTE2PC_PACKET, + val = self.SERFRAME_MOTE2PC_SNIFFED_PACKET, parser = self.parserPacket.parseInput, ) #======================== public ========================================== From 61e490c0e10e9f9921a91900ab68074e39d014da Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 2 Jul 2015 11:34:21 +0800 Subject: [PATCH 20/23] SW-209. remove extra line in ParserPacket --- .../openvisualizer/moteConnector/ParserPacket.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py b/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py index 01c5cb1e8..2d1a6262f 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py +++ b/software/openvisualizer/openvisualizer/moteConnector/ParserPacket.py @@ -19,10 +19,8 @@ class ParserPacket(Parser.Parser): HEADER_LENGTH = 2 MSPERSLOT = 15 #ms per slot. - IPHC_SAM = 4 IPHC_DAM = 0 - def __init__(self): @@ -32,7 +30,6 @@ def __init__(self): # initialize parent class Parser.Parser.__init__(self,self.HEADER_LENGTH) - #======================== public ========================================== def parseInput(self,input): @@ -50,8 +47,6 @@ def parseInput(self,input): 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 From 46beb6ecddd3c07fefd04334c270750bc522d644 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 2 Jul 2015 11:38:09 +0800 Subject: [PATCH 21/23] SW-209. replace 'SUCCESS' by 'outcome'. --- .../openvisualizer/moteConnector/moteConnector.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py index e8b3a876c..5dd74d306 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py +++ b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py @@ -162,7 +162,7 @@ def _cmdToMote_handler(self,sender,signal,data): def _GDcommandToBytes(self,data): - SUCCESS = False + outcome = False dataToSend = [] # get imageId @@ -172,7 +172,7 @@ def _GDcommandToBytes(self,data): imageId = 2 else: print "Wrong Image ({0})! (Available: image1 OR image2)\n".format(data[0]) - return [SUCCESS,dataToSend] + return [outcome,dataToSend] # get commandId commandIndex = 0 @@ -187,7 +187,7 @@ def _GDcommandToBytes(self,data): # check avaliability of command if commandIndex == len(moteState.moteState.COMMAND_ALL): print "Wrong Command ID ! (Available: 0~9)\n" - return [SUCCESS,dataToSend] + return [outcome,dataToSend] # get parameter parameter = int(data[2]) @@ -204,11 +204,11 @@ def _GDcommandToBytes(self,data): else: # more than two bytes parameter, error print "Paramter Wrong! (Available: 0x0000~0xffff)\n" - return [SUCCESS,dataToSend] + return [outcome,dataToSend] # the command is legal if I got here - SUCCESS = True - return [SUCCESS,dataToSend] + outcome = True + return [outcome,dataToSend] def _bytesToMesh_handler(self,sender,signal,data): From 9f580d09c55e9d509f719e99a9a0f136c993b578 Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 2 Jul 2015 11:54:09 +0800 Subject: [PATCH 22/23] SW-209. rename image1 and image2 by gd_root and gd_sniffer --- .../openvisualizer/moteConnector/moteConnector.py | 6 +++--- .../openvisualizer/openvisualizer/moteState/moteState.py | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py index 5dd74d306..129ab4eaa 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py +++ b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py @@ -166,12 +166,12 @@ def _GDcommandToBytes(self,data): dataToSend = [] # get imageId - if data[0] == 'image1': + if data[0] == 'gd_root': imageId = 1 - elif data[0] == 'image2': + elif data[0] == 'gd_sniffer': imageId = 2 else: - print "Wrong Image ({0})! (Available: image1 OR image2)\n".format(data[0]) + print "Wrong Image ({0})! (Available: gd_root OR gd_sniffer)\n".format(data[0]) return [outcome,dataToSend] # get commandId diff --git a/software/openvisualizer/openvisualizer/moteState/moteState.py b/software/openvisualizer/openvisualizer/moteState/moteState.py index 262f6879d..b0c1bb8f2 100644 --- a/software/openvisualizer/openvisualizer/moteState/moteState.py +++ b/software/openvisualizer/openvisualizer/moteState/moteState.py @@ -410,8 +410,6 @@ class moteState(eventBusClient.eventBusClient): ] TRIGGER_DAGROOT = 'DAGroot' - SET_GD_IM1 = 'SetGoldenImage1' - SET_GD_IM2 = 'SetGoldenImage2' SET_COMMAND = 'imageCommand' # command for golen image: command, id length From f59f6c360d3e57f47012541f836e0511f54ebdac Mon Sep 17 00:00:00 2001 From: changtengfei Date: Thu, 2 Jul 2015 15:47:02 +0800 Subject: [PATCH 23/23] SW-209. Add bar for separating the information provide by each command. --- .../openvisualizer/moteConnector/moteConnector.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py index 129ab4eaa..6b3844d47 100644 --- a/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py +++ b/software/openvisualizer/openvisualizer/moteConnector/moteConnector.py @@ -171,6 +171,7 @@ def _GDcommandToBytes(self,data): elif data[0] == 'gd_sniffer': imageId = 2 else: + print "=============================================" print "Wrong Image ({0})! (Available: gd_root OR gd_sniffer)\n".format(data[0]) return [outcome,dataToSend] @@ -186,7 +187,11 @@ def _GDcommandToBytes(self,data): # check avaliability of command if commandIndex == len(moteState.moteState.COMMAND_ALL): - print "Wrong Command ID ! (Available: 0~9)\n" + print "=============================================" + print "Wrong Command Type! Available Command Type: {" + for cmd in moteState.moteState.COMMAND_ALL: + print " {0}".format(cmd[0]) + print " }" return [outcome,dataToSend] # get parameter @@ -203,6 +208,7 @@ def _GDcommandToBytes(self,data): ] else: # more than two bytes parameter, error + print "=============================================" print "Paramter Wrong! (Available: 0x0000~0xffff)\n" return [outcome,dataToSend]