From 3428e28c4b75584f0d68fb24236ef7bccf9ca3f8 Mon Sep 17 00:00:00 2001 From: Hugo Jean Ponsin Date: Wed, 29 Apr 2026 09:10:27 +0200 Subject: [PATCH] ePowerSocket initial commit --- README.md | 0 documentation/graph.puml | 6 ++++++ ePowerSwitch.db | 8 -------- ePowerSwitch.proto | 5 ----- ePowerSwitch_info.db | 4 ---- feedback_records.db | 9 +++++++++ outlet_getter_4.proto | 5 +++++ outlet_getter_8.proto | 5 +++++ outlet_set.proto | 6 ++++++ socket_record.db | 13 +++++++++++++ st.cmd | 2 +- template4.substitutions | 8 ++++---- template8.substitutions | 8 ++++---- 13 files changed, 53 insertions(+), 26 deletions(-) create mode 100644 README.md create mode 100644 documentation/graph.puml delete mode 100644 ePowerSwitch.db delete mode 100644 ePowerSwitch.proto delete mode 100644 ePowerSwitch_info.db create mode 100644 feedback_records.db create mode 100644 outlet_getter_4.proto create mode 100644 outlet_getter_8.proto create mode 100644 outlet_set.proto create mode 100644 socket_record.db diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/documentation/graph.puml b/documentation/graph.puml new file mode 100644 index 0000000..f750d65 --- /dev/null +++ b/documentation/graph.puml @@ -0,0 +1,6 @@ +@startuml + + + + +@enduml \ No newline at end of file diff --git a/ePowerSwitch.db b/ePowerSwitch.db deleted file mode 100644 index 265a637..0000000 --- a/ePowerSwitch.db +++ /dev/null @@ -1,8 +0,0 @@ -record(longout, "$(DEVICE)_command_$(PARAMETER_NAME)_$(PARAMETER_ID)") { - field(DTYP, "stream") - - field(PINI, "NO") - - field(OUT, "@ePowerSwitch.proto command($(PARAMETER_ID)) $(PORT)") -} - diff --git a/ePowerSwitch.proto b/ePowerSwitch.proto deleted file mode 100644 index e4c1e7e..0000000 --- a/ePowerSwitch.proto +++ /dev/null @@ -1,5 +0,0 @@ -OutTerminator = "\r\n"; - -command { - out "GET /M0:O\$1=%{OFF|ON|RESTART}"; -} \ No newline at end of file diff --git a/ePowerSwitch_info.db b/ePowerSwitch_info.db deleted file mode 100644 index b24a369..0000000 --- a/ePowerSwitch_info.db +++ /dev/null @@ -1,4 +0,0 @@ - -record(longout, "$(DEVICE)_config_$(PARAMETER_NAME)") { - field(VAL, "$(VALUE)") -} diff --git a/feedback_records.db b/feedback_records.db new file mode 100644 index 0000000..8b67f50 --- /dev/null +++ b/feedback_records.db @@ -0,0 +1,9 @@ +record(longout, "$(DEVICE)_config_$(PARAMETER_NAME)") { + field(VAL, "$(OUTLET_NUMBER)") +} + +record(stringout, "$(DEVICE)_outlet_getter") { + field(DTYP, "stream") + field(SCAN, "1 second") + field(OUT, "@outlet_getter_$(OUTLET_NUMBER).proto get($(DEVICE)_get_$(GETTER_OUTPUT_PARAMETER_NAME)) $(PORT)") +} \ No newline at end of file diff --git a/outlet_getter_4.proto b/outlet_getter_4.proto new file mode 100644 index 0000000..376f78e --- /dev/null +++ b/outlet_getter_4.proto @@ -0,0 +1,5 @@ +get { + out "GET /hidden.htm"; + in "Hidden Page\n%*d%*s%*d %*d:%*d:%*d\nVersion: %*u.%*u.%*u.%*u\nM0:O1=%(\$1_0)s\nM0:O2=%(\$1_1)s\nM0:O3=%(\$1_2)s\nM0:O4=%(\$1_3)s\n"; + disconnect; +} \ No newline at end of file diff --git a/outlet_getter_8.proto b/outlet_getter_8.proto new file mode 100644 index 0000000..8f2307a --- /dev/null +++ b/outlet_getter_8.proto @@ -0,0 +1,5 @@ +get { + out "GET /hidden.htm"; + in "Hidden Page\n%*d%*s%*d %*d:%*d:%*d\nVersion: %*u.%*u.%*u.%*u\nM0:O1=%(\$1_0)s\nM0:O2=%(\$1_1)s\nM0:O3=%(\$1_2)s\nM0:O4=%(\$1_3)s\nM0:O5=%(\$1_4)s\nM0:O6=%(\$1_5)s\nM0:O7=%(\$1_6)s\nM0:O8=%(\$1_7)s\n"; + disconnect; +} \ No newline at end of file diff --git a/outlet_set.proto b/outlet_set.proto new file mode 100644 index 0000000..0792da5 --- /dev/null +++ b/outlet_set.proto @@ -0,0 +1,6 @@ +OutTerminator = "\r\n"; + +set { + out "POST /hidden.htm/M0:O\$1=%s"; + disconnect; +} \ No newline at end of file diff --git a/socket_record.db b/socket_record.db new file mode 100644 index 0000000..534cb0e --- /dev/null +++ b/socket_record.db @@ -0,0 +1,13 @@ +record(stringout, "$(DEVICE)_set_$(PARAMETER_NAME)_$(PARAMETER_ID)") { + field(DTYP, "stream") + + field(VAL, "Off") + field(PINI, "YES") + + field(OUT, "@ePowerSwitch.proto set($(PARAMETER_ID)) $(PORT)") +} + +record(stringin, "$(DEVICE)_get_$(PARAMETER_NAME)_$(PARAMETER_ID)") { + field(PINI, "NO") +} + diff --git a/st.cmd b/st.cmd index 8381bbc..c41d978 100644 --- a/st.cmd +++ b/st.cmd @@ -4,7 +4,7 @@ epicsEnvSet("ASYN_PORT","myDriverPort") drvAsynIPPortConfigure("$(ASYN_PORT)","127.0.0.1:55555 http", 0, 0, 0) -dbLoadTemplate("template8.substitutions", "PORT=$(ASYN_PORT)") +dbLoadTemplate("template4.substitutions", "PORT=$(ASYN_PORT)") iocInit() diff --git a/template4.substitutions b/template4.substitutions index 2486c51..f1eeb48 100644 --- a/template4.substitutions +++ b/template4.substitutions @@ -1,4 +1,4 @@ -file ePowerSwitch.db +file socket_record.db { pattern { DEVICE, PARAMETER_NAME, PARAMETER_ID} @@ -8,9 +8,9 @@ file ePowerSwitch.db { "ePowerSwitch", "outlet", 3 } } -file ePowerSwitch_info.db +file feedback_records.db { pattern - {DEVICE, PARAMETER_NAME, VALUE} - { "ePowerSwitch", "maxOutlet", 4} + {DEVICE, PARAMETER_NAME, OUTLET_NUMBER, GETTER_OUTPUT_PARAMETER_NAME} + { "ePowerSwitch", "maxOutlet", 4, "outlet"} } \ No newline at end of file diff --git a/template8.substitutions b/template8.substitutions index d6b2732..2c33a4d 100644 --- a/template8.substitutions +++ b/template8.substitutions @@ -1,4 +1,4 @@ -file ePowerSwitch.db +file socket_record.db { pattern { DEVICE, PARAMETER_NAME, PARAMETER_ID} @@ -12,9 +12,9 @@ file ePowerSwitch.db { "ePowerSwitch", "outlet", 7 } } -file ePowerSwitch_info.db +file feedback_records.db { pattern - {DEVICE, PARAMETER_NAME, VALUE} - { "ePowerSwitch", "maxOutlet", 8} + {DEVICE, PARAMETER_NAME, OUTLET_NUMBER, GETTER_OUTPUT_PARAMETER_NAME} + { "ePowerSwitch", "maxOutlet", 8, "outlet"} } \ No newline at end of file