mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
bugfix: time event was initialized with null mote
This commit is contained in:
parent
b832479e34
commit
5d6a073655
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: MspSerial.java,v 1.2 2010/02/03 19:17:30 fros4943 Exp $
|
* $Id: MspSerial.java,v 1.3 2010/02/03 20:00:29 fros4943 Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package se.sics.cooja.mspmote.interfaces;
|
package se.sics.cooja.mspmote.interfaces;
|
||||||
@ -62,6 +62,8 @@ public class MspSerial extends SerialUI implements SerialPort {
|
|||||||
|
|
||||||
private Vector<Byte> incomingData = new Vector<Byte>();
|
private Vector<Byte> incomingData = new Vector<Byte>();
|
||||||
|
|
||||||
|
private TimeEvent writeDataEvent;
|
||||||
|
|
||||||
public MspSerial(Mote mote) {
|
public MspSerial(Mote mote) {
|
||||||
this.mote = (MspMote) mote;
|
this.mote = (MspMote) mote;
|
||||||
this.simulation = mote.getSimulation();
|
this.simulation = mote.getSimulation();
|
||||||
@ -81,6 +83,18 @@ public class MspSerial extends SerialUI implements SerialPort {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeDataEvent = new MspMoteTimeEvent((MspMote) mote, 0) {
|
||||||
|
public void execute(long t) {
|
||||||
|
super.execute(t);
|
||||||
|
|
||||||
|
tryWriteNextByte();
|
||||||
|
if (!incomingData.isEmpty()) {
|
||||||
|
simulation.scheduleEvent(this, t+DELAY_INCOMING_DATA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeByte(byte b) {
|
public void writeByte(byte b) {
|
||||||
@ -137,17 +151,6 @@ public class MspSerial extends SerialUI implements SerialPort {
|
|||||||
mote.requestImmediateWakeup();
|
mote.requestImmediateWakeup();
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeEvent writeDataEvent = new MspMoteTimeEvent(mote, 0) {
|
|
||||||
public void execute(long t) {
|
|
||||||
super.execute(t);
|
|
||||||
|
|
||||||
tryWriteNextByte();
|
|
||||||
if (!incomingData.isEmpty()) {
|
|
||||||
simulation.scheduleEvent(this, t+DELAY_INCOMING_DATA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public Mote getMote() {
|
public Mote getMote() {
|
||||||
return mote;
|
return mote;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user