-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TCP-search bug in server and client
- Loading branch information
kasemir
committed
Jun 18, 2024
1 parent
f23fcdb
commit 1b6fd22
Showing
6 changed files
with
125 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.cosylab.epics.caj.test; | ||
|
||
import gov.aps.jca.JCALibrary; | ||
import gov.aps.jca.Context; | ||
import com.cosylab.epics.caj.CAJContext; | ||
import gov.aps.jca.Channel; | ||
import gov.aps.jca.dbr.DBR; | ||
import gov.aps.jca.dbr.DBRType; | ||
import gov.aps.jca.dbr.DBR_Double; | ||
|
||
/** Bad but simple 'caget' demo | ||
* Better implementation would use listeners | ||
* instead of fixed wait times, | ||
* handle all data types, | ||
* and properly close channel and context. | ||
* | ||
* Example invocation: | ||
* java -cp target/classes:target/test-classes -DCAJ_DEBUG=true -Djca.use_env=true com.cosylab.epics.caj.test.caget PV_name | ||
*/ | ||
public class caget | ||
{ | ||
public static void main(String[] args) throws Exception | ||
{ | ||
if (args.length != 1) | ||
{ | ||
System.err.println("USAGE: caget PV_name"); | ||
System.exit(1); | ||
} | ||
final String name = args[0]; | ||
|
||
final JCALibrary jca = JCALibrary.getInstance(); | ||
final Context context = new CAJContext(); | ||
final Channel channel = context.createChannel(name); | ||
context.pendIO(2.0); | ||
|
||
DBR data = channel.get(DBRType.DOUBLE, 1); | ||
context.pendIO(2.0); | ||
|
||
if (data instanceof DBR_Double) | ||
{ | ||
DBR_Double value = (DBR_Double) data; | ||
System.out.println(name + " = " + value.getDoubleValue()[0]); | ||
} | ||
else | ||
System.out.println(data); | ||
System.exit(0); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
record(calc, "ramp") | ||
{ | ||
field(SCAN, "1 second") | ||
field(CALC, "A+1") | ||
field(INPA, "ramp") | ||
} |