Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,12 @@ config :pythonx, :uv_init,
version = "0.0.1"
requires-python = "==3.13.*"
dependencies = [
"secop_check @ git+https://github.com/Bilchreis/secop_check.git",
"secop_check @ git+https://github.com/SampleEnvironment/secop-checker.git@work",
"secop-ophyd"
]
"""
# "secop_check @ git+https://github.com/Bilchreis/secop_check.git",


# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
Expand Down
20 changes: 15 additions & 5 deletions lib/secant_service/describe_message_transformer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ defmodule SecantService.DescribeMessageTransformer do

describe_str = Jason.encode!(statem_state[:raw_description])

check_result = check_description(describe_str)
str_version = get_in(statem_state, [:idn, Access.key(:version)]) || "v1.0"

version =
str_version
|> String.replace_prefix("v", "")
|> String.replace_prefix("V", "")



check_result = check_description(describe_str, version)

ophyd_class =
case ophyd_class(describe_str) do
Expand All @@ -43,6 +52,7 @@ defmodule SecantService.DescribeMessageTransformer do
host: to_string(statem_state[:host]),
port: statem_state[:port],
description: properties[:description],
secop_version: str_version,
firmware: properties[:firmware],
implementor: properties[:implementor],
timeout: properties[:timeout],
Expand Down Expand Up @@ -197,29 +207,29 @@ defmodule SecantService.DescribeMessageTransformer do
"""
from secop_check.checker import Checker

descr_str = descr.decode('utf-8') if isinstance(descr, bytes) else str(descr)
version_str = version.decode('utf-8') if isinstance(version, bytes) else str(version)
output_str = output.decode('utf-8') if isinstance(output, bytes) else str(output)



checker = Checker(version_str, [], output_str)

checker.check(descr)
checker.check(descr_str)


diag_list = []

for diag in checker.get_diags():
step = f' [{diag.step}]' if diag.step else ''
ctx = ' / '.join(f'{ty} {name}'.strip()
for ty, name in diag.ctx.path).strip()
ctx = ' / '.join(str(item) for item in diag.ctx.path).strip()
if ctx:
ctx += ': '

diag_list.append({"severity": diag.severity.name,
"step": diag.step,
"message": diag.msg,
"ctx": [ list(node) for node in diag.ctx.path],
"ctx": [[type(item).__name__, item.name] for item in diag.ctx.path],
"text":f'{diag.severity.name}{step}: {ctx}{diag.msg}'
})

Expand Down
9 changes: 9 additions & 0 deletions lib/secant_service/sec_nodes/sec_node.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ defmodule SecantService.SecNodes.SecNode do
:processed_values_pubsub_topic,
:error_pubsub_topic,
:node_id_str,
:secop_version,
:display_description,
:display_equipment_id,
:datapoint_count,
Expand All @@ -134,6 +135,7 @@ defmodule SecantService.SecNodes.SecNode do
:processed_values_pubsub_topic,
:error_pubsub_topic,
:node_id_str,
:secop_version,
:display_description,
:display_equipment_id,
modules: [:parameters, :commands]
Expand Down Expand Up @@ -215,6 +217,7 @@ defmodule SecantService.SecNodes.SecNode do
:port,
:description,
:firmware,
:secop_version,
:implementor,
:timeout,
:describe_message,
Expand All @@ -237,6 +240,7 @@ defmodule SecantService.SecNodes.SecNode do
:port,
:description,
:firmware,
:secop_version,
:implementor,
:timeout,
:describe_message,
Expand All @@ -257,6 +261,7 @@ defmodule SecantService.SecNodes.SecNode do
:port,
:description,
:firmware,
:secop_version,
:implementor,
:timeout,
:describe_message,
Expand Down Expand Up @@ -353,6 +358,10 @@ defmodule SecantService.SecNodes.SecNode do
public? true
end

attribute :secop_version, :string do
public? true
end

attribute :firmware, :string do
public? true
end
Expand Down
6 changes: 6 additions & 0 deletions lib/secant_service_web/components/secop_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,12 @@ defmodule SecantServiceWeb.SECoPComponents do
|> DateTime.shift_zone!("Europe/Berlin")
|> Calendar.strftime("%d.%m.%Y %H:%M")}
</.property>
<.property prop_key="SECoP Version">
{@node.secop_version || "v1.0"}
</.property>



</ul>

<fieldset
Expand Down
Loading
Loading