laymanshex-files/Sports/Concept2/PM5/pm5conv.bash

51 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
cmd="laymanshex"
accTable="LogDataAccessTbl.bin"
storage="LogDataStorage.bin"
function assignVariables {
while read -r line; do
typeset -g "$line"
done <<< "$1"
}
i=0
while : ; do
offset=$(($i*32))
output="$($cmd -nopadding -fvar=offset=$offset $accTable.layhex $accTable 2>/dev/null)"
status=$?
if [ $status -ne 0 ]; then
break
else
assignVariables "$output"
echo "Workout $Index"
echo "============="
outputHeader="$($cmd -nopadding -fvar=offset=$Offset $storage-HeaderWorkout$WorkoutType.layhex $storage 2>/dev/null)"
status=$?
if [ $status -eq 0 ]; then
assignVariables "$outputHeader"
echo "TotalDuration=$HeaderTotalDuration"
echo "TotalDistance=$HeaderTotalDistance"
echo "SplitSize=$HeaderSplitSize"
echo "SPM=$HeaderSPM"
j=0
while [ "$j" -lt "$NoSplits" ]; do
splitOffset=$((Offset+50+j*32))
outputSplit="$($cmd -nopadding -fvar=offset=$splitOffset $storage-FrameWorkout$WorkoutType.layhex $storage 2>/dev/null)"
status=$?
if [ $status -eq 0 ]; then
echo
echo "Split $((j+1))"
echo "----------"
echo "$outputSplit"
fi
j=$((j+1))
done
echo
fi
fi
i=$((i+1))
done