Hi my code at the moment is as follows:
import java.io.IOException;
import java.util.*;
import net.tinyos.message.*;
import net.tinyos.packet.*;
import net.tinyos.util.*;
public class ConvCast {
private MoteIF moteIF;
private static void usage() {
System.err.println(usage:
Hi Nicole,
Which line is at line 109 in your original ConvCast.java file? This is
where apparently there is a NullPointerException.
In the anonymous class for handling received UpflowResultMsg messages
you seem to have an infinite loop. Is this intended? Or would you rather
want to start
Hi,
at that line is moteIF.send(1,msg). Actually it is always at that point no
matter what I do. I didn't intend any infinite loop. All I wanted to do is to
send the received message, that is 1 message, back to my motes, after I have
received it. Haven't tried your suggestion yet.
Thanks
Nicole
Hi Nicole,
In this case, forget about the thread thing and try this instead. I see
now the problem: you declare a class variable MoteIF, but you then
declare the same variable again in the init() method, thus hiding the
class variable. So in your message handler the variable moteIF is null.
Hi,
I have the problem, that for verification I have to send the same message I
have received via Java from the motes back to the motes. This means I use the
same message type. Problem is I can't forward the original message because I
get a NullPointerException (This problem was send by someone
I'm just making things up because I haven't seen your code, but are you trying
to send back the same message packet that you just received? My thought is that
the packet is being deallocated before you send it. The solution would be
to allocate your own packet, copy, and then send the copy.
With Java Garbage Collection, this, supposedly, can't happen.
If you have an active reference (pointer) to an object, the
object does not get 'deallocated'.
NullPointer usually means just that, a reference that is zeroed out.
So, we'd have to see the code and the actual error messages to make