Esempio n. 1
0
  public IPAddress(final Mote mote) {
    moteMem = (AddressMemory) mote.getMemory();

    /* Detect startup IP (only zeroes) */
    TimeEvent updateWhenAddressReady =
        new TimeEvent(0) {
          public void execute(long t) {
            if (!isVersion4() && !isVersion6()) {
              return;
            }

            String ipString = getIPString();
            ipString = ipString.replace(".", "");
            ipString = ipString.replace("0", "");
            if (!ipString.isEmpty()) {
              setChanged();
              notifyObservers();
              return;
            }

            /* Postpone until IP has been set */
            mote.getSimulation()
                .scheduleEvent(
                    this, mote.getSimulation().getSimulationTime() + Simulation.MILLISECOND);
            return;
          }
        };
    updateWhenAddressReady.execute(0);
  }
 /**
  * Creates an interface to the mote ID at mote.
  *
  * @param mote Mote
  * @see Mote
  * @see se.sics.cooja.MoteInterfaceHandler
  */
 public ContikiMoteID(Mote mote) {
   this.mote = mote;
   this.moteMem = (SectionMoteMemory) mote.getMemory();
 }