-
Notifications
You must be signed in to change notification settings - Fork 13
Automatic interview process for new nodes #4
base: master
Are you sure you want to change the base?
Conversation
Sometimes when you reconnect to a usb connected controller there are data bufferd that are incomplete. By emptying it first we start on a blank slate :)
Added NIF to the interview process and automatic restart of the interview process if it isnt completed yet
empty: | ||
for { | ||
select { | ||
case <-parserInput: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of relying on go frameLayer.bgRead() to empty the buffer, could we perhaps consume what is on transportLayer instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the issue is to make something that is non-blocking and that was the best solution I could think of.. because when the buffer is empty the read will block until new data is sent from the controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the reader may be backed by bufio.Reader
. Could we expand the interface and add the Reset method? (Or something similar). Would it be possible to make/reset the buffer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea! Will take a look at that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #10
application/node.go
Outdated
n.saveToDb() | ||
n.nextQueryStage() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing jumps out at me here code-wise in this file. Not sure what this does well enough :). @bjyoungblood might have a better idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nextQueryStage is the method that runs each step of the interview process.
Right now the interview process is 4 steps
- get the NIF
- get security cababilities
- get manufacturer info
- get command classes versions
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
=========================================
Coverage ? 20.02%
=========================================
Files ? 371
Lines ? 14743
Branches ? 0
=========================================
Hits ? 2952
Misses ? 11768
Partials ? 23
Continue to review full report at Codecov.
|
@@ -106,6 +107,8 @@ func (s *Layer) receiveThread() { | |||
return | |||
} | |||
|
|||
fmt.Printf("Received: 0x%X\n", frameIn.Payload) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want some kind of leveled logging? logrus for example. This seems pretty low-level debug outout...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #9
@stamp, are all these commits based on the original PR? |
Sorry, my question might have been a bit vague. Just to make sure I'm not being confusing, I mean: Are they all related to "Automatic interview process"? Was just wondering if that feature is still on-going, or if I needed to do any additional review. |
I think it works as it should. The issue here is that the interview process is not complete. There are more work to be done before the whole automatic interview process is complete but this code is ready to be used. The open issue with I suggest we move both open discussions about |
Add device pairing example
No description provided.