1

Is there a possibility to change the range of a CommDevice? We would like to broadcast a message with a small range and gradually expand the range when no response is received.

rinde
  • 1,181
  • 1
  • 8
  • 20
Tom Houben
  • 51
  • 7

1 Answers1

1

The range of a CommDevice is meant to model the physical limitations of a communication device. The current implementation assumes that these limitations cannot change over time.

The best way of implementing the behaviour that you want is to implement an additional method for broadcasting in CommDevice:

public void broadcast(MessageContents contents, double range){ 
  checkRegistered();
  // construct a predicate based on 'range' and 'rangePredicate' (if it exists)
  outbox.add(Message.createBroadcast(user, contents, predicate));
}

If you want, you can send a pull request, I will accept it if it is well tested.

rinde
  • 1,181
  • 1
  • 8
  • 20