Skip to content

Commit

Permalink
Merge pull request #111 from openwsn-berkeley/develop_SW-222
Browse files Browse the repository at this point in the history
SW-222. Fixed.
  • Loading branch information
changtengfei committed Jan 28, 2016
2 parents 6413430 + 0f48788 commit 0a60c70
Show file tree
Hide file tree
Showing 5 changed files with 468 additions and 231 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,8 @@
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: "frame received at asn {0} with timeCorrection of {1}",
59: "security error on frameType {0}, code location {1}"
59: "security error on frameType {0}, code location {1}",
60: "sixtop return code {0} at sixtop state {1} ",
61: "there are {0} cells to request mote",
62: "the cells reserved to request mote contains slot {0} and slot {1}",
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def _GDcommandToBytes(self,data):
print "============================================="
print "Wrong Image ({0})! (Available: gd_root OR gd_sniffer)\n".format(data[0])
return [outcome,dataToSend]

# get commandId
commandIndex = 0
for cmd in moteState.moteState.COMMAND_ALL:
Expand All @@ -193,24 +193,40 @@ def _GDcommandToBytes(self,data):
print " {0}".format(cmd[0])
print " }"
return [outcome,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]
]

if data[1][:2] == '6p':
try:
dataToSend = [OpenParser.OpenParser.SERFRAME_PC2MOTE_COMMAND_GD,
2, # version
imageId,
commandId,
len(data[2][1:-1].split(','))
]
if data[1] == '6pAdd' or data[1] == '6pDelete':
if len(data[2][1:-1].split(','))>0:
dataToSend += [int(i) for i in data[2][1:-1].split(',')] # celllist
except:
print "============================================="
print "Wrong 6p parameter format {0}. Split the slot by".format(data[2])
print "comma. e.g. 6,7. (up to 3)"
return [outcome,dataToSend]
else:
# more than two bytes parameter, error
print "============================================="
print "Paramter Wrong! (Available: 0x0000~0xffff)\n"
return [outcome,dataToSend]
parameter = int(data[2])
if parameter <= 0xffff:
parameter = [(parameter & 0xff),((parameter >> 8) & 0xff)]
dataToSend = [OpenParser.OpenParser.SERFRAME_PC2MOTE_COMMAND_GD,
2, # version
imageId,
commandId,
commandLen, # length
parameter[0],
parameter[1]
]
else:
# more than two bytes parameter, error
print "============================================="
print "Paramter Wrong! (Available: 0x0000~0xffff)\n"
return [outcome,dataToSend]

# the command is legal if I got here
outcome = True
Expand Down
34 changes: 23 additions & 11 deletions software/openvisualizer/openvisualizer/moteState/moteState.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,27 +413,39 @@ class moteState(eventBusClient.eventBusClient):
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_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_SET_DAGRANK = ['dagrank', 5, 2]
COMMAND_SET_SECURITY_STATUS = ['security', 6, 1]
COMMAND_SET_FRAMELENGTH = ['frameLength', 7, 2]
COMMAND_SET_ACK_STATUS = ['ackReply', 8, 1]
COMMAND_SET_6P_ADD = ['6pAdd', 9, 3]
COMMAND_SET_6P_DELETE = ['6pDelete', 10, 3]
COMMAND_SET_6P_COUNT = ['6pCount', 11, 0]
COMMAND_SET_6P_LIST = ['6pList', 12, 0]
COMMAND_SET_6P_CLEAR = ['6pClear', 13, 0]
COMMAND_SET_SLOTDURATION = ['slotDuration',14, 2]
COMMAND_SET_6PRESPONSE_STATUS = ['response', 15, 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,
COMMAND_SET_6P_ADD,
COMMAND_SET_6P_DELETE,
COMMAND_SET_6P_COUNT,
COMMAND_SET_6P_LIST,
COMMAND_SET_6P_CLEAR,
COMMAND_SET_SLOTDURATION,
COMMAND_SET_6PRESPONSE_STATUS
]

TRIGGER_ALL = [
Expand Down
Loading

0 comments on commit 0a60c70

Please sign in to comment.