using MoteTimeEvent instead of TimeEvent: scheduled events are automatically removed when the mote is removed

This commit is contained in:
fros4943 2009-10-28 15:58:42 +00:00
parent 281639c779
commit 82b8006c0c
6 changed files with 38 additions and 31 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: IPAddress.java,v 1.6 2009/05/26 14:24:21 fros4943 Exp $
* $Id: IPAddress.java,v 1.7 2009/10/28 15:58:43 fros4943 Exp $
*/
package se.sics.cooja.interfaces;
@ -59,7 +59,7 @@ public class IPAddress extends MoteInterface {
moteMem = (AddressMemory) mote.getMemory();
/* Detect startup IP (only zeroes) */
TimeEvent updateWhenAddressReady = new TimeEvent(0) {
TimeEvent updateWhenAddressReady = new MoteTimeEvent(mote, 0) {
public void execute(long t) {
if (!isVersion4() && !isVersion6()) {
return;

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: RimeAddress.java,v 1.3 2009/05/26 14:24:21 fros4943 Exp $
* $Id: RimeAddress.java,v 1.4 2009/10/28 15:58:43 fros4943 Exp $
*/
package se.sics.cooja.interfaces;
@ -61,7 +61,7 @@ public class RimeAddress extends MoteInterface {
moteMem = (AddressMemory) mote.getMemory();
/* Detect startup address (only zeroes) */
TimeEvent updateWhenAddressReady = new TimeEvent(0) {
TimeEvent updateWhenAddressReady = new MoteTimeEvent(mote, 0) {
public void execute(long t) {
String addrString = getAddressString();
addrString = addrString.replace(".", "");