-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from NSLS-II-SRX/more-caproto-ioc-flavors
String/Char caproto IOC with demo tests
- Loading branch information
Showing
12 changed files
with
301 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
#!/bin/bash | ||
|
||
act -W .github/workflows/ci.yml -j checks --matrix python-version:3.11 | ||
set -vxeuo pipefail | ||
|
||
PYTHON_VERSION="${1:-3.11}" | ||
|
||
act -W .github/workflows/ci.yml -j checks --matrix python-version:"${PYTHON_VERSION}" |
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 @@ | ||
""""Example Caproto IOC code.""" |
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,60 @@ | ||
from __future__ import annotations | ||
|
||
import textwrap | ||
|
||
from caproto import ChannelType | ||
from caproto.server import PVGroup, pvproperty, run, template_arg_parser | ||
|
||
from ..base import check_args | ||
|
||
|
||
class CaprotoStringIOC(PVGroup): | ||
"""Test channel types for strings.""" | ||
|
||
common_kwargs = {"max_length": 255, "string_encoding": "utf-8"} | ||
|
||
bare_string = pvproperty( | ||
value="bare_string", doc="A test for a bare string", **common_kwargs | ||
) | ||
implicit_string_type = pvproperty( | ||
value="implicit_string_type", | ||
doc="A test for an implicit string type", | ||
report_as_string=True, | ||
**common_kwargs, | ||
) | ||
string_type = pvproperty( | ||
value="string_type", | ||
doc="A test for a string type", | ||
dtype=str, | ||
report_as_string=True, | ||
**common_kwargs, | ||
) | ||
string_type_enum = pvproperty( | ||
value="string_type_enum", | ||
doc="A test for a string type", | ||
dtype=ChannelType.STRING, | ||
**common_kwargs, | ||
) | ||
char_type_as_string = pvproperty( | ||
value="char_type_as_string", | ||
doc="A test for a char type reported as string", | ||
report_as_string=True, | ||
dtype=ChannelType.CHAR, | ||
**common_kwargs, | ||
) | ||
char_type = pvproperty( | ||
value="char_type", | ||
doc="A test for a char type not reported as string", | ||
dtype=ChannelType.CHAR, | ||
**common_kwargs, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser, split_args = template_arg_parser( | ||
default_prefix="", desc=textwrap.dedent(CaprotoStringIOC.__doc__) | ||
) | ||
ioc_options, run_options = check_args(parser, split_args) | ||
ioc = CaprotoStringIOC(**ioc_options) | ||
|
||
run(ioc.pvdb, **run_options) |
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,15 @@ | ||
from __future__ import annotations | ||
|
||
from ophyd import Component as Cpt | ||
from ophyd import Device, EpicsSignal | ||
|
||
|
||
class OphydChannelTypes(Device): | ||
"""An ophyd Device which works with the CaprotoStringIOC caproto IOC.""" | ||
|
||
bare_string = Cpt(EpicsSignal, "bare_string", string=True) | ||
implicit_string_type = Cpt(EpicsSignal, "implicit_string_type", string=True) | ||
string_type = Cpt(EpicsSignal, "string_type", string=True) | ||
string_type_enum = Cpt(EpicsSignal, "string_type_enum", string=True) | ||
char_type_as_string = Cpt(EpicsSignal, "char_type_as_string", string=True) | ||
char_type = Cpt(EpicsSignal, "char_type", string=True) |
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
Oops, something went wrong.