71 lines
1.5 KiB
Bash
Executable File
71 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
cmd="laymanshex"
|
|
|
|
accTable="LogDataAccessTbl.bin"
|
|
storage="LogDataStorage.bin"
|
|
|
|
assignVariables='while read -r line; do typeset -x "$line"; done <<< '
|
|
|
|
function printNonEmpty {
|
|
varname='$'"$1"
|
|
eval "val=$varname"
|
|
if [ "$val" != "" ]; then
|
|
echo "$1=$val"
|
|
fi
|
|
}
|
|
|
|
function printSplit {
|
|
outputSplit="$($cmd -nopadding -fvar=offset=$1,splitNo=$2 $storage-Workout$3.layhex $storage 2> /dev/null)"
|
|
status=$?
|
|
if [ $status -eq 0 ]; then
|
|
eval "$assignVariables $outputSplit"
|
|
echo
|
|
echo "Split $(($2+1))"
|
|
echo "----------"
|
|
printNonEmpty "SplitDuration"
|
|
printNonEmpty "SplitDistance"
|
|
printNonEmpty "SplitHeartRate"
|
|
printNonEmpty "SplitSPM"
|
|
fi
|
|
}
|
|
|
|
function printWorkout {
|
|
echo "Workout $1"
|
|
echo "============="
|
|
outputHeader="$($cmd -nopadding -fvar=offset=$2,splitNo=0 $storage-Workout$3.layhex $storage 2> /dev/null)"
|
|
status=$?
|
|
if [ $status -eq 0 ]; then
|
|
eval "$assignVariables $outputHeader"
|
|
printNonEmpty "HeaderTotalDuration"
|
|
printNonEmpty "HeaderTotalDistance"
|
|
printNonEmpty "HeaderSplitSize"
|
|
printNonEmpty "HeaderSPM"
|
|
j=0
|
|
while [ "$j" -lt "$NoSplits" ]; do
|
|
printSplit $2 $j $3
|
|
j=$((j+1))
|
|
done
|
|
echo
|
|
fi
|
|
}
|
|
|
|
|
|
function printAll {
|
|
i=0
|
|
while : ; do
|
|
offset=$(($i))
|
|
output="$($cmd -nopadding -fvar=offset=$offset $accTable.layhex $accTable 2>/dev/null)"
|
|
status=$?
|
|
if [ $status -ne 0 ]; then
|
|
break
|
|
else
|
|
eval "$assignVariables $output"
|
|
printWorkout $Index $Offset $WorkoutType
|
|
fi
|
|
i=$((i+1))
|
|
done
|
|
}
|
|
|
|
printAll
|