diff --git a/UpdateController.sh b/UpdateController.sh index e8c3f85..028fabb 100755 --- a/UpdateController.sh +++ b/UpdateController.sh @@ -50,7 +50,12 @@ wait_for_trigger() { fi } +# APISM has al least two TCP-ports open: 7778 and 7779. To check for a running +# APISM it is therefore enough to check for the port 7778. netcat will return 0 +# if the port 7778 is open. check_for_apism() { + return 0 + nc localhost 7778 if [ $? -eq 0 ]; then return 0 @@ -58,7 +63,50 @@ check_for_apism() { return 1 } +######################### send_to_ismas.txt ################################### +# #M=GH_APP +# #C=REQ_ISMASParameter +# #J={} +# { +# "DEV_ID": { +# "Device_Type": "2020", +# "Custom_ID": 999, +# "Device_ID": 1 +# }, +# "REQ_ISMASParameter_#1": {} +# } +# +# APISM should respond with (something like this): +# +# { +# "REQ_ISMASPARAMETER#69553_Response": { +# "Aknoledge": "OK" +# }, +# "Dev_ID": { +# "Device_Type": "ISMAS", +# "Custom_ID": 999, +# "Device_ID": 2 +# }, +# "Fileupload": [ +# { "IPK": "BladiBlupp.Zip", +# "MD5": "01234567890123456789012345678901"} +# ], +# "Parameter": { +# "Location": "An der Bahn 11", +# "Group": "G1", +# "Zone": "Z1", +# "Name": "Bruno", +# "SecNumber": "0", +# "LastAcc": "1", +# "GPSLat": "49,6019", +# "GPSLon": "12,1258" +# } +# } +# +# where the interesting part is contained in "FileUpload". +# check_for_updates() { + # ismas_response=$(cat send_to_ismas.txt; sleep 1) | nc localhost 7778) return 0 } @@ -169,6 +217,9 @@ UpdateController() { echo "DEBUG no updates available" continue fi + + echo "$(date +'%Y-%m-%d %T') fetching updates..." + exit 1 # Fetch new updates (using git) while :