Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Generalize ArgusProbe for Serial and OpenTestbed inputs #31

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

JelenaKovacc
Copy link

@JelenaKovacc JelenaKovacc commented Mar 4, 2021

Argus is limited to using only BeamLogic device as sniffer. To use nodes over serial or nodes in the testbed as sniffers, we need to extend the ArgusProbe script. In that way, we are not limited by the number of BeamLogic sniffers in the network.

@JelenaKovacc JelenaKovacc changed the title WIP_Using nodes for sniffers on one channel WIP_Using nodes as sniffers on one channel Mar 4, 2021
Copy link

@malishav malishav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor comments to know what to look for when proposing a patch.

Also, the title of the PR is not clear as the code patch has nothing to do with nodes on a single channel. The description of the PR should also be more verbose.

ArgusProbe_Beamlogic.py Outdated Show resolved Hide resolved
ArgusProbe_Beamlogic.py Outdated Show resolved Hide resolved
ArgusProbe_Beamlogic.py Outdated Show resolved Hide resolved
ArgusProbe_Beamlogic.py Outdated Show resolved Hide resolved
ArgusProbe_Beamlogic.py Outdated Show resolved Hide resolved
ArgusProbe_Beamlogic.py Outdated Show resolved Hide resolved
ArgusProbe_Beamlogic.py Show resolved Hide resolved
ArgusProbe_Beamlogic.py Outdated Show resolved Hide resolved
ArgusProbe_Beamlogic.py Show resolved Hide resolved
ArgusProbe_Beamlogic.py Outdated Show resolved Hide resolved
@JelenaKovacc JelenaKovacc changed the title WIP_Using nodes as sniffers on one channel WIP_Extending ArgusProbe script with Serial and OpenTestbed inputs Mar 9, 2021
@malishav malishav changed the title WIP_Extending ArgusProbe script with Serial and OpenTestbed inputs WIP: Generalize ArgusProbe for Serial and OpenTestbed inputs Apr 9, 2021
Copy link

@malishav malishav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks for all the changes. A couple of comments inline.

with self.dataLock:
pleaseConnect = self.pleaseConnect

if pleaseConnect:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pleaseConnect always set to True, why complicate the code. Please remove the if condition and unnecessary pleaseConnect vars.

time.sleep(1)

except Exception as err:
logCrash(self.name, err)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you not destroy the thread in this case as well? i.e. call self.close().


#======================== public ==========================================

def connectSerialPort(self):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this method used anywhere in the code. Please remove.

print "WARNING: Could not read from serial at \"{0}\".".format(
self.serialport)
print "Is device connected?"
self.goOn = False
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose both #335 and #336 lines should be within the close() method. Just invoke the method here instead of doing it manually for each case.

with self.dataLock:
self.pleaseConnect = True

def disconnectSerialPort(self):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please merge disconnectSerialPort and close methods, leaving only close in use throughout the code.

self.send_to_parser([ord(c) for c in self.rxBuffer])

if self.rxBuffer[0] == 'P': #packet from sniffer SERFRAME_MOTE2PC_SNIFFED_PACKET 'P'
self.rxBuffer = self.rxBuffer[1:]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a short comment that you are discarding the type byte.

valid_frame = True

except openhdlc.HdlcException as err:
#log.warning('{}: invalid serial frame: {} {}'.format(self.name, format_string_buf(temp_buf), err))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?


except openhdlc.HdlcException as err:
#log.warning('{}: invalid serial frame: {} {}'.format(self.name, format_string_buf(temp_buf), err))
print 'HDLC Exception'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is too generic of a print, add some context like in the commented warning log just above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants