示例#1
0
 public void close() {
   if (socket != null) {
     socket.close();
   }
   if (input != null) {
     input.close();
   }
 }
示例#2
0
 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());
     }
   }
 }
示例#3
0
    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());
      }
    }
示例#4
0
 public void setAEBufferSize(int AEBufferSize) {
   if (input == null) {
     return;
   }
   input.setBufferSize(AEBufferSize);
 }
示例#5
0
 public int getAEBufferSize() {
   if (input == null) {
     return 0;
   }
   return input.getBufferSize();
 }
示例#6
0
 public AEPacketRaw getEvents() {
   if (input == null) {
     return null;
   }
   return input.readPacket();
 }
示例#7
0
 public AEPacketRaw acquireAvailableEventsFromDriver() throws HardwareInterfaceException {
   if (input == null) {
     throw new HardwareInterfaceException("no input connection");
   }
   return input.readPacket();
 }