Variato emissione log chiamate alle callback dei driver
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
||||
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
||||
|
||||
# Log file for driver output
|
||||
LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
||||
|
||||
# Status directory
|
||||
STATUS_DIR="/home/pi/piGarden/state"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
function drv_sample_init {
|
||||
|
||||
echo "$(date) drv_sample_init" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
function drv_sample_rain_sensor_init {
|
||||
|
||||
echo "$(date) drv_sample_rain_sensor_init $1" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ function drv_sample_rain_sensor_init {
|
||||
#
|
||||
function drv_sample_rain_sensor_get {
|
||||
|
||||
echo "$(date) drv_sample_rain_sensor_get $1" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#
|
||||
function drv_sample_rele_init {
|
||||
|
||||
echo "$(date) drv_sample_rele_init $1" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ function drv_sample_rele_init {
|
||||
#
|
||||
function drv_sample_rele_open {
|
||||
|
||||
echo "$(date) drv_sample_rele_open $1" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ function drv_sample_rele_open {
|
||||
#
|
||||
function drv_sample_rele_close {
|
||||
|
||||
echo "$(date) drv_sample_rele_close $1" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#
|
||||
function drv_sample_supply_bistable_init {
|
||||
|
||||
echo "$(date) drv_sample_supply_bistable_init $1 $2" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
@@ -17,7 +18,7 @@ function drv_sample_supply_bistable_init {
|
||||
#
|
||||
function drv_sample_supply_positive {
|
||||
|
||||
echo "$(date) drv_sample_supply_positive $1 $2" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +30,7 @@ function drv_sample_supply_positive {
|
||||
#
|
||||
function drv_sample_supply_negative {
|
||||
|
||||
echo "$(date) drv_sample_supply_negative $1 $2" >> /tmp/piGarden.drv.sample
|
||||
local FOO="bar"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,8 @@ function drv_rele_init {
|
||||
log_write "Driver not found: $idx"
|
||||
message_write "warning" "Driver not found: $idx"
|
||||
else
|
||||
$fnc "$idx"
|
||||
echo "$(date) $fnc arg:$idx" > "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc "$idx" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -106,7 +107,8 @@ function drv_rele_close {
|
||||
log_write "Driver not found: $idx"
|
||||
message_write "warning" "Driver not found: $idx"
|
||||
else
|
||||
$fnc "$idx"
|
||||
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc "$idx" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -127,7 +129,8 @@ function drv_rele_open {
|
||||
log_write "Driver not found: $idx"
|
||||
message_write "warning" "Driver not found: $idx"
|
||||
else
|
||||
$fnc "$idx"
|
||||
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc "$idx" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -153,7 +156,8 @@ function drv_supply_bistable_init {
|
||||
message_write "warning" "Driver not found: $idx1"
|
||||
return
|
||||
else
|
||||
$fnc1 "$idx1"
|
||||
echo "$(date) $fnc1 arg:$idx1" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc1 "$idx1" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
|
||||
# Nessun driver definito, esegue l'operazione tramite gpio del raspberry
|
||||
@@ -165,7 +169,8 @@ function drv_supply_bistable_init {
|
||||
log_write "Driver not found: $idx2"
|
||||
message_write "warning" "Driver not found: $idx2"
|
||||
else
|
||||
$fnc2 "$idx2"
|
||||
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc2 "$idx2" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -191,7 +196,8 @@ function drv_supply_positive {
|
||||
message_write "warning" "Driver not found: $idx1"
|
||||
return
|
||||
else
|
||||
$fnc1 "$idx1"
|
||||
echo "$(date) $fnc1 arg:$idx1" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc1 "$idx1" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
|
||||
# Nessun driver definito, esegue l'operazione tramite gpio del raspberry
|
||||
@@ -202,7 +208,8 @@ function drv_supply_positive {
|
||||
log_write "Driver not found: $idx2"
|
||||
message_write "warning" "Driver not found: $idx2"
|
||||
else
|
||||
$fnc2 "$idx2"
|
||||
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc2 "$idx2" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -228,7 +235,8 @@ function drv_supply_negative {
|
||||
message_write "warning" "Driver not found: $idx1"
|
||||
return
|
||||
else
|
||||
$fnc1 "$idx1"
|
||||
echo "$(date) $fnc1 arg:$idx1" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc1 "$idx1" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
|
||||
# Nessun driver definito, esegue l'operazione tramite gpio del raspberry
|
||||
@@ -239,7 +247,8 @@ function drv_supply_negative {
|
||||
log_write "Driver not found: $idx2"
|
||||
message_write "warning" "Driver not found: $idx2"
|
||||
else
|
||||
$fnc2 "$idx2"
|
||||
echo "$(date) $fnc2 arg:$idx2" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc2 "$idx2" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -262,7 +271,8 @@ function drv_rain_sensor_init {
|
||||
log_write "Driver not found: $idx"
|
||||
message_write "warning" "Driver not found: $idx"
|
||||
else
|
||||
$fnc "$idx"
|
||||
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
$fnc "$idx" >> "$LOG_OUTPUT_DRV_FILE" 2>&1
|
||||
fi
|
||||
|
||||
}
|
||||
@@ -285,6 +295,7 @@ function drv_rain_sensor_get {
|
||||
log_write "Driver not found: $idx"
|
||||
message_write "warning" "Driver not found: $idx"
|
||||
else
|
||||
echo "$(date) $fnc arg:$idx" >> "$LOG_OUTPUT_DRV_FILE"
|
||||
vret=`$fnc "$idx"`
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user