Package jNab.core.protocol

Examples of jNab.core.protocol.Packet.addBlock()


  // Playing recorded sound
  Packet p = new Packet();
  MessageBlock mb = new MessageBlock(600);
  mb.addPlayLocalSoundCommand("echo" + this.bunny.getSerialNumber() + ".wav");
  mb.addWaitPreviousEndCommand();
  p.addBlock(mb);
  p.addBlock(new PingIntervalBlock(1));
  this.bunny.addPacket(p);
    }

    /**
 
View Full Code Here


  Packet p = new Packet();
  MessageBlock mb = new MessageBlock(600);
  mb.addPlayLocalSoundCommand("echo" + this.bunny.getSerialNumber() + ".wav");
  mb.addWaitPreviousEndCommand();
  p.addBlock(mb);
  p.addBlock(new PingIntervalBlock(1));
  this.bunny.addPacket(p);
    }

    /**
     * @see jNab.core.events.RecordEventListener#onDoubleRecord(byte[])
View Full Code Here

  {
      MessageBlock mb = new MessageBlock(600);
      mb.addPlayLocalSoundCommand("message" + receiver + ".wav");
      mb.addWaitPreviousEndCommand();
      Packet p = new Packet();
      p.addBlock(mb);
      p.addBlock(new PingIntervalBlock(1));

      this.bunny.getBurrow().getBunny(receiver).addPacket(p);
  }
  catch (NoSuchBunnyException e)
View Full Code Here

      MessageBlock mb = new MessageBlock(600);
      mb.addPlayLocalSoundCommand("message" + receiver + ".wav");
      mb.addWaitPreviousEndCommand();
      Packet p = new Packet();
      p.addBlock(mb);
      p.addBlock(new PingIntervalBlock(1));

      this.bunny.getBurrow().getBunny(receiver).addPacket(p);
  }
  catch (NoSuchBunnyException e)
  {
View Full Code Here

    {
  // Preparing a new packet
  Packet p = new Packet();
 
  // Asking the bunny to ping 20s later (i.e. when the choreography has finished playing)
  p.addBlock(new PingIntervalBlock(20));
  MessageBlock mb = new MessageBlock(12345);
 
  // Playing the choreography associated to current level.
  mb.addPlayChoreographyFromLibraryCommand(this.getChoreography());
  mb.addWaitPreviousEndCommand();
View Full Code Here

  MessageBlock mb = new MessageBlock(12345);
 
  // Playing the choreography associated to current level.
  mb.addPlayChoreographyFromLibraryCommand(this.getChoreography());
  mb.addWaitPreviousEndCommand();
  p.addBlock(mb);
  this.bunny.addPacket(p);
 
  // Switching level if needed
  if (System.currentTimeMillis() - this.lastSwitchingTime > 60000)
  {
View Full Code Here

    public void onEndOfMessage()
    {
  // When choreography has finished playing, bunny notifies a end-of-message
  // Then it is asked to ping immediately
  Packet p = new Packet();
  p.addBlock(new PingIntervalBlock(1));
  this.bunny.addPacket(p);
    }

    /**
     * @see jNab.core.events.StopEventListener#onSingleClickWhilePlaying()
View Full Code Here

  // If some click occurs while the choreography is playing, it is handled as a single-click event
  // A choreography is sent to raise both ears and bunny is asked to ping immediately after (to be able to send
  // packets generated by single-click event handling)
  this.bunny.handleEvent(Bunny.SINGLE_CLICK_EVENT, null);
  Packet p = new Packet();
  p.addBlock(new PingIntervalBlock(1));
  MessageBlock mb = new MessageBlock(12345);
  mb.addPlayChoreographyFromLibraryCommand("raisedEars");
  p.addBlock(mb);
  this.bunny.forcePacket(p);
    }
View Full Code Here

  this.bunny.handleEvent(Bunny.SINGLE_CLICK_EVENT, null);
  Packet p = new Packet();
  p.addBlock(new PingIntervalBlock(1));
  MessageBlock mb = new MessageBlock(12345);
  mb.addPlayChoreographyFromLibraryCommand("raisedEars");
  p.addBlock(mb);
  this.bunny.forcePacket(p);
    }
}
View Full Code Here

  MessageBlock mb = new MessageBlock(333);
  mb.addPlayLocalSoundCommand("files/sounds/dice/get.mp3");
  mb.addWaitPreviousEndCommand();
  mb.addPlayLocalSoundCommand("files/sounds/dice/" + n + ".mp3");
  mb.addWaitPreviousEndCommand();
  p.addBlock(mb);
  p.addBlock(new PingIntervalBlock(1));
  this.bunny.addPacket(p);
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.