if hackish then hackish

This commit is contained in:
gutmet 2020-04-30 16:30:26 +02:00
parent 1b339ae6d0
commit df77a0b33e
2 changed files with 17 additions and 18 deletions

View File

@ -1,19 +1,19 @@
big endian
: byte[offset]
HeaderMagic : byte[1]
: byte[1]
: byte[1]
: byte[2]
: byte[4]
HeaderTimestamp : byte[4]
HeaderUserID : uint16
Timestamp : byte[4]
UserID : uint16
: byte[4]
HeaderRecordID : uint8
HeaderMagic2 : byte[3]
HeaderTotalDuration : uint16
HeaderTotalDistance : uint32
HeaderSPM : uint8
RecordID : uint8
: byte[3]
TotalDuration : uint16
TotalDistance : uint32
SPM : uint8
: byte[1]
HeaderSplitSize : uint16
SplitSize : uint16
: byte[18]
: byte[splitNo*32]
SplitDistance : uint16

View File

@ -5,7 +5,7 @@ cmd="laymanshex"
accTable="LogDataAccessTbl.bin"
storage="LogDataStorage.bin"
assignVariables='while read -r line; do typeset -x "$line"; done <<< '
# uses evil eval
function printNonEmpty {
varname='$'"$1"
@ -19,7 +19,7 @@ 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"
eval "$outputSplit"
echo
echo "Split $(($2+1))"
echo "----------"
@ -36,11 +36,11 @@ function printWorkout {
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"
eval "$outputHeader"
printNonEmpty "TotalDuration"
printNonEmpty "TotalDistance"
printNonEmpty "SplitSize"
printNonEmpty "SPM"
j=0
while [ "$j" -lt "$NoSplits" ]; do
printSplit $2 $j $3
@ -50,7 +50,6 @@ function printWorkout {
fi
}
function printAll {
i=0
while : ; do
@ -60,7 +59,7 @@ function printAll {
if [ $status -ne 0 ]; then
break
else
eval "$assignVariables $output"
eval "$output"
printWorkout $Index $Offset $WorkoutType
fi
i=$((i+1))