Skip to content

Commit

Permalink
allow many not identified robots (id '?') to register tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
rbudde committed Jul 16, 2024
1 parent 3fbea86 commit 8c357d4
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ public boolean addNewRegistration(RobotCommunicationData newRobotCommunicationDa
if ( existingIdentificator == null
|| !existingIdentificator.equals(newIdentificator)
|| existingIdentificator.equals("usb")
|| existingIdentificator.equals("unknown") ) {
|| existingIdentificator.equals("unknown")
|| existingIdentificator.equals("?") ) //
{
LOG.info("ROBOT_RC: token already used. New token required");
return false;
}
}
for ( String storedToken : this.allStates.keySet() ) {
RobotCommunicationData storedState = this.allStates.get(storedToken);
if ( newIdentificator.equals(storedState.getRobotIdentificator()) && !newIdentificator.equals("usb") && !newIdentificator.equals("unknown") ) {
if ( newIdentificator.equals(storedState.getRobotIdentificator())
&& !newIdentificator.equals("usb")
&& !newIdentificator.equals("unknown")
&& !newIdentificator.equals("?") ) //
{
LOG.info("ROBOT_RC: token approval request for robot [" + newIdentificator + "], but an old request is pending. Start abort old request");
this.allStates.remove(storedToken);
storedState.abort(); // notifyAll() executed
Expand Down

0 comments on commit 8c357d4

Please sign in to comment.