Begin body reading code
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
"""
|
||||
read the body of the FIT file.
|
||||
"""
|
||||
module body
|
||||
|
||||
# TODO: Why do this?
|
||||
import Base.show
|
||||
|
||||
export RecordHeader, read_row
|
||||
|
||||
include("mesg_num.jl")
|
||||
using .mesg_num
|
||||
|
||||
struct DefinitionMessage end
|
||||
struct DataMessage end
|
||||
|
||||
"""
|
||||
RecordHeader
|
||||
|
||||
The byte that corresponds to the type of message that this record holds.
|
||||
"""
|
||||
struct RecordHeader
|
||||
definition_message::Bool
|
||||
end
|
||||
|
||||
|
||||
"""
|
||||
read_row(f::io)
|
||||
|
||||
Read a row of the file at a time. Parse the row into a data or def message.
|
||||
TODO: Endianness matters here. Need to resolve endianness with the architecture bit.
|
||||
"""
|
||||
function read_row(f::IO)
|
||||
header_byte = read(f, 1; all=false)[1]
|
||||
println(bitstring(header_byte))
|
||||
|
||||
# The message byte is 7
|
||||
RecordHeader(Bool(parse(Int64, bitstring(header_byte)[2])))
|
||||
end
|
||||
|
||||
function read_header_byte(f::Core.IO)
|
||||
end
|
||||
|
||||
function show(io::IO, header::RecordHeader)
|
||||
println(io, header.definition_message ? "DefinitionMessage" : "DataMessage")
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user