Concept2 PM5 definitions and bash glue

This commit is contained in:
gutmet 2020-04-28 22:44:24 +02:00
parent cb5206fe03
commit aebb6d04c8
4 changed files with 83 additions and 0 deletions

View File

@ -0,0 +1,13 @@
little endian
: byte[offset]
Magic : byte[1]
WorkoutType : uint8
: byte[10]
NoSplits : uint16
: byte[2]
Offset : uint16
: byte[6]
Size : uint16
Index : uint16
: byte[4]
Marker : byte[32]

View File

@ -0,0 +1,6 @@
big endian
: byte[offset]
SplitDistance : uint16
SplitHeartRate : uint8
SplitSPM : uint8
: byte[28]

View File

@ -0,0 +1,16 @@
big endian
: byte[offset]
HeaderMagic : byte[1]
: byte[1]
: byte[2]
: byte[4]
HeaderTimestamp : byte[4]
HeaderUserID : uint16
: byte[4]
HeaderRecordID : uint8
HeaderMagic2 : byte[3]
HeaderTotalDuration : uint16
HeaderTotalDistance : uint32
HeaderSPM : uint8
: byte[1]
HeaderSplitSize : uint16

View File

@ -0,0 +1,48 @@
#!/bin/bash
cmd="/home/alexander/Spielewiese/laymanshex/laymanshex"
accTable="LogDataAccessTbl.bin"
storage="LogDataStorage.bin"
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
while read -r line; do
typeset -x "$line"
done <<< "$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
while read -r line; do
typeset -x "$line"
done <<< $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