Open
Conversation
285ade2 to
88b1269
Compare
tluijken
reviewed
Sep 11, 2024
Comment on lines
+91
to
+95
| var bufferSize = 48; | ||
|
|
||
| FlushSocket(_socket, bufferSize); | ||
|
|
||
| var buffer = new byte[bufferSize]; |
Collaborator
There was a problem hiding this comment.
Wat als we de buffer definieren vlak voor gebruik. Zeg, op regel 105? Krijg je dan niet hetzelfde effect? Dan kan de hele flush methode eruit. Voelt nu alsof we 2 keer hetzelfde doen.
Contributor
Author
There was a problem hiding this comment.
Goed punt, ik heb het verwerkt en opnieuw getest. Het lijkt erop dat het toch niet helemaal hetzelfde is...
+> info: [PDMS.Dispatcher.Tests.Mocks.SickRfidScannerMock] Sending response :\x02sAN MIStartIn\x03
+> info: [PDMS.Dispatcher.Tests.Mocks.SickRfidScannerMock] Sending response :\x02sAN MIStopIn\x03
+> info: [PDMS.Dispatcher.Tests.Mocks.SickRfidScannerMock] Sending RFID 91456789415679
+> warn: [PDMS.Dispatcher.Core.Implementation.BinService] Could not find bin in repository for bin tag 914567894156789145678941567891456789415678914567
Ik heb ook de code met de flush methode nog even gerund als sanity check, en die werkt wel. (Met deze test "Dispatch VS22-0009 plates are all in 3 different trays, but one tray has all the plates" )
🤔
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When reading input from the socket, often you will read leftover data from it.
This results in static noise, because you're reading previously scanned RFID's.
The FlushSocket function will flush the socket by reading the buffer size from the socket and discarding it. This will have tests succeed in the PDS codebase.
Please take a look and see if this is the proper solution, I feel it might not be an industry standard way of solving this probably quite common problem. The reason I picked this solutoin, instead of filtering out the noise, is because the RFID scanner sends its RFID's over the socket without delimiters, making parsing impossible.