Package se.sics.cooja.interfaces

Examples of se.sics.cooja.interfaces.Position


    // Create memory
    myMemory = new SectionMoteMemory(new Properties());

    // Create position
    myInterfaceHandler = new MoteInterfaceHandler();
    Position myPosition = new Position(this);
    myInterfaceHandler.addPassiveInterface(myPosition);

    // Create radio
    myApplicationRadio = new ApplicationRadio(this);
    myApplicationRadio.addObserver(radioDataObserver);
View Full Code Here


    // Set initial configuration
    mySim = simulation;
    myMemory = new SectionMoteMemory(new Properties());
    myInterfaceHandler = new MoteInterfaceHandler();
    Position myPosition = new Position(this);
    myInterfaceHandler.addPassiveInterface(myPosition);
    myApplicationRadio = new ApplicationRadio(this);
    myApplicationRadio.addObserver(radioDataObserver);
    myInterfaceHandler.addActiveInterface(myApplicationRadio);
   
View Full Code Here

    // Create memory
    myMemory = new SectionMoteMemory(new Properties());

    // Create interface handler
    myInterfaceHandler = new MoteInterfaceHandler();
    Position myPosition = new Position(this);
    myPosition.setCoordinates(myRandom.nextDouble() * 100, myRandom
        .nextDouble() * 100, myRandom.nextDouble() * 100);
    myInterfaceHandler.addPassiveInterface(myPosition);

    // create interface handler for radio
    myDisturberRadio = new DisturberRadio(this);
View Full Code Here

    // Set initial configuration
    mySim = simulation;
    myMemory = new SectionMoteMemory(new Properties());
    myInterfaceHandler = new MoteInterfaceHandler();
    Position myPosition = new Position(this);
    myInterfaceHandler.addPassiveInterface(myPosition);
    myDisturberRadio = new DisturberRadio(this);
    myInterfaceHandler.addActiveInterface(myDisturberRadio);

   
View Full Code Here

        Radio[] destinations = conn.getDestinations();
        if (destinations != null && destinations.length > 0) {
          for (int i = 0; i < destinations.length; i++) {
            // Source pos
            out.write("SRC_POS\t".getBytes());
            Position pos = conn.getSource().getPosition();
            out.write(Double.toString(pos.getXCoordinate()).getBytes());
            out.write("\t".getBytes());
            out.write(Double.toString(pos.getYCoordinate()).getBytes());
            out.write("\t".getBytes());
            out.write(Double.toString(pos.getZCoordinate()).getBytes());
            out.write("\t".getBytes());

            // Source data
            out.write("SRC_DATA\t".getBytes());
            // TODO We need to log destination data again...
            for (byte b : ((PacketRadio) conn.getSource())
                .getLastPacketTransmitted()) {
              String hexString = Integer.toHexString((int) b);
              if (hexString.length() == 1)
                hexString = "0" + hexString;
              out.write(hexString.getBytes());
            }
            out.write("\t".getBytes());

            // Destination pos
            out.write("DEST_POS\t".getBytes());
            pos = destinations[i].getPosition();
            out.write(Double.toString(pos.getXCoordinate()).getBytes());
            out.write("\t".getBytes());
            out.write(Double.toString(pos.getYCoordinate()).getBytes());
            out.write("\t".getBytes());
            out.write(Double.toString(pos.getZCoordinate()).getBytes());
            out.write("\t".getBytes());

            // Source data
            out.write("DEST_DATA\t".getBytes());
            // TODO We need to log destination data again...
            for (byte b : ((PacketRadio) destinations[i])
                .getLastPacketReceived()) {
              String hexString = Integer.toHexString((int) b);
              if (hexString.length() == 1)
                hexString = "0" + hexString;
              out.write(hexString.getBytes());
            }
            out.write("\t".getBytes());

            out.write("\n".getBytes());
          }

        } else {
          // Source pos
          out.write("SRC_POS\t".getBytes());
          Position pos = conn.getSource().getPosition();
          out.write(Double.toString(pos.getXCoordinate()).getBytes());
          out.write("\t".getBytes());
          out.write(Double.toString(pos.getYCoordinate()).getBytes());
          out.write("\t".getBytes());
          out.write(Double.toString(pos.getZCoordinate()).getBytes());
          out.write("\t".getBytes());

          // Source data
          out.write("SRC_DATA\t".getBytes());
          // TODO We need to log destination data again...
View Full Code Here

    // Create memory
    myMemory = new SectionMoteMemory(new Properties());

    // Create interface handler
    myInterfaceHandler = new MoteInterfaceHandler();
    Position myPosition = new Position(this);
    myPosition.setCoordinates(myRandom.nextDouble() * 100, myRandom
        .nextDouble() * 100, myRandom.nextDouble() * 100);
    myInterfaceHandler.addPassiveInterface(myPosition);
  }
View Full Code Here

  public void tick(int simTime) {

    // Perform some dummy task
    if (myRandom.nextDouble() > 0.9) {
      // Move mote randomly
      Position myPosition = myInterfaceHandler.getPosition();
      myPosition.setCoordinates(myPosition.getXCoordinate()
          + myRandom.nextDouble() - 0.5, myPosition.getYCoordinate()
          + myRandom.nextDouble() - 0.5, myPosition.getZCoordinate()
          + myRandom.nextDouble() - 0.5);
    }
  }
View Full Code Here

  public boolean setConfigXML(Simulation simulation,
      Collection<Element> configXML, boolean visAvailable) {
    mySim = simulation;
    myMemory = new SectionMoteMemory(new Properties());
    myInterfaceHandler = new MoteInterfaceHandler();
    myInterfaceHandler.addPassiveInterface(new Position(this));

    for (Element element : configXML) {
      String name = element.getName();

      if (name.equals("motetype_identifier")) {
View Full Code Here

   */
  protected void paintConnection(PaintedConnection connection, Graphics g2d) {
    Point sourcePixelPosition = transformPositionToPixel(connection.radioConnection.getSource().getPosition());
    g2d.setColor(connection.getColor(simulation.isRunning()));
    for (Radio destRadio : connection.radioConnection.getDestinations()) {
      Position destPosition = destRadio.getPosition();
      Point destPixelPosition = transformPositionToPixel(destPosition);
      g2d.drawLine(sourcePixelPosition.x, sourcePixelPosition.y,
          destPixelPosition.x, destPixelPosition.y);
    }
  }
View Full Code Here

      MoteID id = mote.getInterfaces().getMoteID();
      if (id == null) {
        continue;
      }

      Position pos = mote.getInterfaces().getPosition();
      Point pixel = visualizer.transformPositionToPixel(pos);

      String msg = "" + id.getMoteID();
      int msgWidth = fm.stringWidth(msg);
      g.drawString(msg, pixel.x - msgWidth/2, pixel.y + 5);
View Full Code Here

TOP

Related Classes of se.sics.cooja.interfaces.Position

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.