Added several utilities to set / request the APISM trigger state.

This commit is contained in:
Gerhard Hoffmann 2022-06-03 20:00:07 +02:00
parent 57df68fabf
commit 3be55e2702

View File

@ -1 +1,60 @@
# !/bin/bash -
source ./log_helpers
if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
readonly APISM_DB_PORT=7777
news_to_ismas () {
local data="#M=APISM#C=CMD_EVENT#J=
{
\"REASON\":\"SW_UP\",
\"Timestamp\":\"$(date +%Y-%m-%dT%T.000%z)\",
\"EVENT\":\"$1\",
\"EVENTSTATE\":1,
\"PARAMETER\":\"Testdaten\"
}"
echo $((echo "$data"; sleep 1) | nc localhost $APISM_DB_PORT)
}
reset_update_trigger () {
news_to_ismas "U0002"
return $?
}
# only for testing
set_updates_available () {
news_to_ismas "U99"
return $?
}
update_started () {
news_to_ismas "U0010"
return $?
}
update_in_progress () {
news_to_ismas "U0011"
return $?
}
update_finished () {
news_to_ismas "U0012"
return $?
}
update_failed () {
news_to_ismas "U0003"
return $?
}
update_success () {
news_to_ismas "U0001"
return $?
}
set_update_active () {
reset_update_trigger
return $?
}
fi