org.epics.pvmanager.sample.JCAClientExample Maven / Gradle / Ivy
/**
* Copyright (C) 2010-12 Brookhaven National Laboratory
* All rights reserved. Use is subject to license terms.
*/
package org.epics.pvmanager.sample;
import gov.aps.jca.JCALibrary;
import java.util.Arrays;
import org.epics.vtype.VEnum;
import org.epics.vtype.VString;
import org.epics.vtype.VDouble;
import org.epics.vtype.VInt;
import org.epics.pvmanager.PVReader;
import org.epics.pvmanager.PVManager;
import org.epics.pvmanager.PVReaderListener;
import org.epics.vtype.VByteArray;
import org.epics.vtype.VDoubleArray;
import org.epics.vtype.VFloatArray;
import org.epics.vtype.VIntArray;
import org.epics.vtype.VShortArray;
import org.epics.vtype.VStringArray;
import static org.epics.pvmanager.ExpressionLanguage.*;
import org.epics.pvmanager.PVReaderEvent;
import static org.epics.pvmanager.vtype.ExpressionLanguage.*;
import org.epics.pvmanager.jca.JCADataSourceBuilder;
import static org.epics.util.time.TimeDuration.*;
/**
*
* @author carcassi
*/
public class JCAClientExample {
private static final String doublePV = "counter1";
private static final String enumPV = doublePV + ".SCAN";
private static final String intPV = doublePV + ".RVAL";
private static final String stringPV = doublePV + ".EGU";
private static final String doubleArrayPV = "SR:C00-Glb:G00RB-X";
public static void main(String[] args) throws Exception {
System.out.println("Test");
System.out.println(System.getProperty("java.library.path"));
PVManager.setDefaultDataSource(new JCADataSourceBuilder().jcaContextClass(JCALibrary.JNI_THREAD_SAFE).build());
testNativeTypeSupport();
testVDoubleSupport();
testVIntSupport();
testVStringSupport();
testVEnumSupport();
testVDoubleArraySupport();
// testVFloatArraySupport();
// testVByteArraySupport();
// testVShortArraySupport();
// testVIntArraySupport();
// testVStringArraySupport();
}
private static void logException(Exception ex) {
if (ex != null)
ex.printStackTrace(System.out);
}
private static void testNativeTypeSupport() throws Exception {
{
final PVReader