From 5650f8ba8950d8d2f8973d925da9c8f371759b57 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Tue, 28 Oct 2008 12:09:14 +0000 Subject: [PATCH] implemented by mote interfaces to determine when they should be polled --- .../interfaces/PolledAfterActiveTicks.java | 45 +++++++++++++++++++ .../cooja/interfaces/PolledAfterAllTicks.java | 41 +++++++++++++++++ .../interfaces/PolledBeforeActiveTicks.java | 45 +++++++++++++++++++ .../interfaces/PolledBeforeAllTicks.java | 41 +++++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 tools/cooja/java/se/sics/cooja/interfaces/PolledAfterActiveTicks.java create mode 100644 tools/cooja/java/se/sics/cooja/interfaces/PolledAfterAllTicks.java create mode 100644 tools/cooja/java/se/sics/cooja/interfaces/PolledBeforeActiveTicks.java create mode 100644 tools/cooja/java/se/sics/cooja/interfaces/PolledBeforeAllTicks.java diff --git a/tools/cooja/java/se/sics/cooja/interfaces/PolledAfterActiveTicks.java b/tools/cooja/java/se/sics/cooja/interfaces/PolledAfterActiveTicks.java new file mode 100644 index 000000000..50ebe45ba --- /dev/null +++ b/tools/cooja/java/se/sics/cooja/interfaces/PolledAfterActiveTicks.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: PolledAfterActiveTicks.java,v 1.1 2008/10/28 12:09:14 fros4943 Exp $ + */ + +package se.sics.cooja.interfaces; + +import se.sics.cooja.contikimote.interfaces.ContikiLog; + +/** + * A mote interface polled after a mote tick ONLY IF the mote is awake. + * + * @see ContikiLog + * + * @author Fredrik Österlind + */ +public interface PolledAfterActiveTicks { + public void doActionsAfterTick(); +} diff --git a/tools/cooja/java/se/sics/cooja/interfaces/PolledAfterAllTicks.java b/tools/cooja/java/se/sics/cooja/interfaces/PolledAfterAllTicks.java new file mode 100644 index 000000000..b6e049519 --- /dev/null +++ b/tools/cooja/java/se/sics/cooja/interfaces/PolledAfterAllTicks.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: PolledAfterAllTicks.java,v 1.1 2008/10/28 12:09:14 fros4943 Exp $ + */ + +package se.sics.cooja.interfaces; + +/** + * A mote interface polled after ALL mote ticks. + * + * @author Fredrik Österlind + */ +public interface PolledAfterAllTicks { + public void doActionsAfterTick(); +} diff --git a/tools/cooja/java/se/sics/cooja/interfaces/PolledBeforeActiveTicks.java b/tools/cooja/java/se/sics/cooja/interfaces/PolledBeforeActiveTicks.java new file mode 100644 index 000000000..b12e4a6ed --- /dev/null +++ b/tools/cooja/java/se/sics/cooja/interfaces/PolledBeforeActiveTicks.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: PolledBeforeActiveTicks.java,v 1.1 2008/10/28 12:09:14 fros4943 Exp $ + */ + +package se.sics.cooja.interfaces; + +import se.sics.cooja.contikimote.interfaces.ContikiClock; + +/** + * A mote interface polled before each mote tick ONLY IF the mote is awake. + * + * @see ContikiClock + * + * @author Fredrik Österlind + */ +public interface PolledBeforeActiveTicks { + public void doActionsBeforeTick(); +} diff --git a/tools/cooja/java/se/sics/cooja/interfaces/PolledBeforeAllTicks.java b/tools/cooja/java/se/sics/cooja/interfaces/PolledBeforeAllTicks.java new file mode 100644 index 000000000..ddbc28f1e --- /dev/null +++ b/tools/cooja/java/se/sics/cooja/interfaces/PolledBeforeAllTicks.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2008, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: PolledBeforeAllTicks.java,v 1.1 2008/10/28 12:09:14 fros4943 Exp $ + */ + +package se.sics.cooja.interfaces; + +/** + * A mote interface polled before ALL mote ticks. + * + * @author Fredrik Österlind + */ +public interface PolledBeforeAllTicks { + public void doActionsBeforeTick(); +}