Skip to content

Commit

Permalink
Merge pull request #2954 from KIT-IBPT/jackie-pv-source
Browse files Browse the repository at this point in the history
Add EPICS Jackie PV source
  • Loading branch information
shroffk authored Feb 22, 2024
2 parents 4119838 + 5b7e091 commit 6622705
Show file tree
Hide file tree
Showing 13 changed files with 3,765 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<module>pva</module>
<module>pv</module>
<module>pv-ca</module>
<module>pv-jackie</module>
<module>pv-mqtt</module>
<module>pv-opva</module>
<module>pv-pva</module>
Expand Down
48 changes: 48 additions & 0 deletions core/pv-jackie/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core-pv-jackie</artifactId>
<parent>
<groupId>org.phoebus</groupId>
<artifactId>core</artifactId>
<version>4.7.4-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.epics</groupId>
<artifactId>vtype</artifactId>
<version>${vtype.version}</version>
</dependency>

<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-framework</artifactId>
<version>4.7.4-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.phoebus</groupId>
<artifactId>core-pv</artifactId>
<version>4.7.4-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.aquenos.epics.jackie</groupId>
<artifactId>epics-jackie-client</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
</project>
758 changes: 758 additions & 0 deletions core/pv-jackie/src/main/java/org/phoebus/pv/jackie/JackiePV.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/*******************************************************************************
* Copyright (c) 2024 aquenos GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
******************************************************************************/

package org.phoebus.pv.jackie;

import com.aquenos.epics.jackie.client.ChannelAccessClient;
import com.aquenos.epics.jackie.client.ChannelAccessClientConfiguration;
import com.aquenos.epics.jackie.client.DefaultChannelAccessClient;
import com.aquenos.epics.jackie.client.beacon.BeaconDetectorConfiguration;
import com.aquenos.epics.jackie.client.resolver.ChannelNameResolverConfiguration;
import com.aquenos.epics.jackie.common.exception.JavaUtilLoggingErrorHandler;
import com.aquenos.epics.jackie.common.util.ListenerLockPolicy;
import org.phoebus.pv.PV;
import org.phoebus.pv.PVFactory;

import java.util.logging.Level;

/**
* <p>
* Factory for instances of {@link JackiePV}.
* </p>
* <p>
* Typically, this factory should not be used directly but through
* {@link org.phoebus.pv.PVPool}. There is no need to create more than one
* instance of this class, because all its state is static anyway.
* </p>
* <p>
* This class statically creates an instance of EPICS Jackie’s
* {@link DefaultChannelAccessClient}, which is configured using the default
* instance of {@link JackiePreferences}.
* </p>
*/
public class JackiePVFactory implements PVFactory {

private final static ChannelAccessClient CLIENT;
private final static JackiePreferences PREFERENCES;
private final static String TYPE = "jackie";

static {
PREFERENCES = JackiePreferences.getDefaultInstance();
// We want to use a higher log-level for errors, so that we can be sure
// that they are reported, even if INFO logging is not enabled.
var error_handler = new JavaUtilLoggingErrorHandler(
Level.SEVERE, Level.WARNING);
var beacon_detector_config = new BeaconDetectorConfiguration(
error_handler,
PREFERENCES.ca_server_port(),
PREFERENCES.ca_repeater_port());
var resolver_config = new ChannelNameResolverConfiguration(
PREFERENCES.charset(),
error_handler,
PREFERENCES.hostname(),
PREFERENCES.username(),
PREFERENCES.ca_server_port(),
PREFERENCES.ca_name_servers(),
PREFERENCES.ca_address_list(),
PREFERENCES.ca_auto_address_list(),
PREFERENCES.ca_max_search_period(),
PREFERENCES.ca_echo_interval(),
PREFERENCES.ca_multicast_ttl());
var client_config = new ChannelAccessClientConfiguration(
PREFERENCES.charset(),
PREFERENCES.hostname(),
PREFERENCES.username(),
PREFERENCES.ca_max_array_bytes(),
PREFERENCES.ca_max_array_bytes(),
PREFERENCES.ca_echo_interval(),
PREFERENCES.cid_block_reuse_time(),
null,
Boolean.TRUE,
error_handler,
beacon_detector_config,
resolver_config);
// We use ListenerLockPolicy.IGNORE, because we call listeners from our
// code, and we cannot be sure whether these listeners might acquire
// locks, so the BLOCK policy could result in deadlocks.
CLIENT = new DefaultChannelAccessClient(
client_config, ListenerLockPolicy.IGNORE);
}

@Override
public String getType() {
return TYPE;
}

@Override
public PV createPV(String name, String base_name) throws Exception {
return new JackiePV(CLIENT, PREFERENCES, name, base_name);
}

}
Loading

0 comments on commit 6622705

Please sign in to comment.