@Override public void close() { reader.close(); writer.close(); }
public void m2_readMultipleChannels() { // Write a map to the channels named "one", "two" and "three" PVWriter<Map<String, Object>> pvWriter = PVManager .write(mapOf(channels("one", "two", "three"))) .async(); // Prepare the 3 values Map<String, Object> values = new HashMap<String, Object>(); values.put("one", 1.0); values.put("two", 2.0); values.put("three", "run"); // Write pvWriter.write(values); // Remember to close pvWriter.close(); // Note that when using a composite datasource, the channels can be //from different sources (e.g. "sim://noise" and "ca://mypv"). }
public void b4_synchronousWrite() { PVWriter<Object> pvWriter = PVManager.write(channel("channelName")).sync(); // This will block until the write is done pvWriter.write("New value"); System.out.println("Write finished"); // Remember to close pvWriter.close(); }
System.out.println("Closing..."); reader.close(); namePv.close(); PVManager.getDefaultDataSource().close(); System.out.println("Done");
public void b3_asynchronousWrite() { PVWriter<Object> pvWriter = PVManager.write(channel("channelName")) .writeListener(new PVWriterListener<Object>() { public void pvChanged(PVWriterEvent<Object> event) { if (event.isWriteSucceeded()) { System.out.println("Write finished"); } } }) .async(); // This will return right away, and the notification will be sent // on the listener pvWriter.write("New value"); // Remember to close pvWriter.close(); }
public void m5_writeOrdering() { // Write a map to the channels named "one", "two" and "three" // Write "two" after "one" and write "three" after "two" PVWriter<Map<String, Object>> pvWriter = PVManager.write( mapOf(channel("one") .and(channel("two").after("one")) .and(channel("three").after("two")))).async(); // Do something // ... // Remember to close pvWriter.close(); } }