Skip to content

Commit

Permalink
Use of default pipeline server address in CamServer inline device.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgobbo committed Dec 13, 2023
1 parent 5f2a89e commit a95fb90
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/main/java/ch/psi/pshell/core/InlineDevice.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import ch.psi.pshell.device.Averager.RegisterStats;
import ch.psi.pshell.device.Cacheable;
import ch.psi.pshell.device.DeviceAdapter;
import ch.psi.pshell.device.DeviceListener;
import ch.psi.pshell.device.Writable;
import ch.psi.pshell.epics.Epics;
import ch.psi.pshell.epics.EpicsRegister;
Expand Down Expand Up @@ -344,8 +343,14 @@ else if ((width >= 0) && (height >= 0)) {
url = Str.replaceLast(url, " ", "?channel=");
}
if (!url.startsWith("tcp://")) {
String instanceName = url.substring(url.lastIndexOf("/") + 1);
url = url.substring(0, url.lastIndexOf("/"));
String instanceName = null;
if (url.lastIndexOf("/") >= 0 ){
instanceName = url.substring(url.lastIndexOf("/") + 1);
url = url.substring(0, url.lastIndexOf("/"));
} else {
instanceName= url;
url = Setup.getPipelineServer();
}
PipelineSource server = new PipelineSource(null, url);
try {
server.initialize();
Expand Down Expand Up @@ -564,7 +569,7 @@ public static Device create(String url, DeviceBase parent) throws IOException, I
Stream innerStream = null;
if (parent == null) {
if (getUrlProtocol(url).equals("bs")) {
innerStream = new Stream("Url device stream");
innerStream = new Stream("Inline device stream");
parent = innerStream;
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/ch/psi/pshell/core/Setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public class Setup extends Config {
public static transient final String PROPERTY_SCRIPT_TYPE = "ch.psi.pshell.type";
public static transient final String PROPERTY_LOCAL_STARTUP_SCRIPT = "ch.psi.pshell.local.startup";
public static transient final String PROPERTY_PARALLEL_INIT = "ch.psi.pshell.parallel.init";
public static transient final String PROPERTY_PIPELINE_SERVER = "ch.psi.pshell.pipeline.server";
public static transient final String PROPERTY_CAMERA_SERVER = "ch.psi.pshell.camera.server";

//Fixed tokens
public static transient final String TOKEN_HOME = "{home}";
Expand Down Expand Up @@ -819,6 +821,15 @@ public String getXScanPath() {
public String getQueuePath() {
return expandPath(queuePath);
}

public static String getPipelineServer() {
return System.getProperty(PROPERTY_PIPELINE_SERVER);
}

public static String getCameraServer() {
return System.getProperty(PROPERTY_CAMERA_SERVER);
}


public static String getSourceAssemblyFolder() {
return Paths.get("src", "main", "assembly").toString();
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/ch/psi/pshell/ui/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,16 @@ static public void init(String[] args) {
if (isArgumentDefined("scrp")) {
System.setProperty(Setup.PROPERTY_EXT_SCRIPT_PATH, String.join(";", getArgumentValues("scrp")));
}

if (isArgumentDefined("camera_server")) {
System.setProperty(Setup.PROPERTY_CAMERA_SERVER, getArgumentValue("camera_server"));
}

if (isArgumentDefined("pipeline_server")) {
System.setProperty(Setup.PROPERTY_PIPELINE_SERVER, getArgumentValue("pipeline_server"));
}


if (isLocalMode()) {
System.setProperty(Context.PROPERTY_LOCAL_MODE, "true");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/psi/pshell/ui/StripChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ public void onCacheChanged(Device device, Object value, Object former, long time
Context.getInstance().waitStateNot(State.Initializing, -1);
Logger.getLogger(StripChart.class.getName()).fine("Waiting done");
}
try {
try {
dev = Context.getInstance().getDevicePool().getByName(name, Device.class);
if (dev == null) {
dev = (Device) Context.getInstance().tryEvalLineBackground(name);
Expand Down

0 comments on commit a95fb90

Please sign in to comment.