Package it.hakvoort.neuroclient.example

Source Code of it.hakvoort.neuroclient.example.ExampleDisplayAgent

package it.hakvoort.neuroclient.example;

import it.hakvoort.neuroclient.NeuroServerPacket;
import it.hakvoort.neuroclient.NeuroServerPacketListener;
import it.hakvoort.neuroclient.agent.DisplayAgent;
import it.hakvoort.neuroclient.reply.HeaderReply;
import it.hakvoort.neuroclient.reply.RoleReply;
import it.hakvoort.neuroclient.reply.StatusReply;

/**
*
* @author Gido Hakvoort (gido@hakvoort.it)
*
*/
public class ExampleDisplayAgent implements NeuroServerPacketListener {
 
  public ExampleDisplayAgent() {
 
  }
 
  public static void main(String[] args) {
    // create a new DisplayAgent
    DisplayAgent agent = new DisplayAgent("localhost", 8336);
   
    // register this class as listener
    agent.addPacketListener(new ExampleDisplayAgent());
   
    // get the status of NeuroServer
    StatusReply statusReply = agent.getStatus();
   
    // get the header of client 0
    HeaderReply headerReply = agent.getHeader(0);
   
    // get the role of this agent
    RoleReply roleReply = agent.getRole();
   
    // start watching client 0
    agent.watch(0);
   
    // stop watching client 0
    agent.unwatch(0);   

    // close the agent and disconnect from NeuroServer.
    agent.close()
  }

  @Override
  public void receivedPacket(NeuroServerPacket packet) {
    // output the received packet
    System.out.println(packet.toString());
  }
}
TOP

Related Classes of it.hakvoort.neuroclient.example.ExampleDisplayAgent

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.