Search in sources :

Example 6 with MACAddress

use of com.neuronrobotics.sdk.common.MACAddress in project java-bowler by NeuronRobotics.

the class UDPBowlerConnection method getAllAddresses.

/**
 * @return
 */
public ArrayList<InetAddress> getAllAddresses() {
    if (addrs == null) {
        addrs = new ArrayList<InetAddress>();
        try {
            // Generate a ping command
            BowlerDatagram ping = BowlerDatagramFactory.build(new MACAddress(), new PingCommand());
            ping.setUpstream(false);
            Log.info("Sending synchronization ping: \n" + ping);
            // send it to the UDP socket
            write(ping.getBytes());
            // wait for all devices to report back
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    return addrs;
}
Also used : MACAddress(com.neuronrobotics.sdk.common.MACAddress) BowlerDatagram(com.neuronrobotics.sdk.common.BowlerDatagram) IOException(java.io.IOException) InetAddress(java.net.InetAddress) PingCommand(com.neuronrobotics.sdk.commands.bcs.core.PingCommand)

Aggregations

MACAddress (com.neuronrobotics.sdk.common.MACAddress)6 BowlerDatagram (com.neuronrobotics.sdk.common.BowlerDatagram)5 PingCommand (com.neuronrobotics.sdk.commands.bcs.core.PingCommand)3 RpcEncapsulation (com.neuronrobotics.sdk.common.RpcEncapsulation)2 IOException (java.io.IOException)2 Test (org.junit.Test)2 BowlerAbstractCommand (com.neuronrobotics.sdk.common.BowlerAbstractCommand)1 BowlerAbstractDevice (com.neuronrobotics.sdk.common.BowlerAbstractDevice)1 BowlerDataType (com.neuronrobotics.sdk.common.BowlerDataType)1 ByteList (com.neuronrobotics.sdk.common.ByteList)1 BowlerAbstractDeviceServerNamespace (com.neuronrobotics.sdk.common.device.server.BowlerAbstractDeviceServerNamespace)1 BowlerAbstractServer (com.neuronrobotics.sdk.common.device.server.BowlerAbstractServer)1 IBowlerCommandProcessor (com.neuronrobotics.sdk.common.device.server.IBowlerCommandProcessor)1 BowlerTCPClient (com.neuronrobotics.sdk.network.BowlerTCPClient)1 VirtualGenericPIDDevice (com.neuronrobotics.sdk.pid.VirtualGenericPIDDevice)1 InetAddress (java.net.InetAddress)1 ArrayList (java.util.ArrayList)1