public void close() { if (socket != null) { socket.close(); } if (input != null) { input.close(); } }
public void setEventAcquisitionEnabled(boolean enable) throws HardwareInterfaceException { if (input != null) { input.setPaused(enable); } if (isOpen()) { String s = enable ? "t+\n" : "t-\n"; byte[] b = s.getBytes(); try { DatagramPacket d = new DatagramPacket(b, b.length, client); socket.send(d); } catch (Exception e) { log.warning(e.toString()); } } }
public void open() throws HardwareInterfaceException { try { if (socket != null) { socket.close(); } socket = new DatagramSocket(CONTROL_PORT); socket.setSoTimeout(100); input = new AEUnicastInput(DATA_PORT); input.setSequenceNumberEnabled(false); input.setAddressFirstEnabled(true); input.setSwapBytesEnabled(false); input.set4ByteAddrTimestampEnabled(true); input.setTimestampsEnabled(false); input.setBufferSize(1200); input.setTimestampMultiplier(1); input.setPort(DATA_PORT); input.open(); } catch (IOException ex) { throw new HardwareInterfaceException(ex.toString()); } }
public void setAEBufferSize(int AEBufferSize) { if (input == null) { return; } input.setBufferSize(AEBufferSize); }
public int getAEBufferSize() { if (input == null) { return 0; } return input.getBufferSize(); }
public AEPacketRaw getEvents() { if (input == null) { return null; } return input.readPacket(); }
public AEPacketRaw acquireAvailableEventsFromDriver() throws HardwareInterfaceException { if (input == null) { throw new HardwareInterfaceException("no input connection"); } return input.readPacket(); }