Use bit_at utility function

main
Jacob Windle 2023-04-21 07:14:55 -04:00
parent 83c34dbe23
commit 977b9bf507
2 changed files with 8 additions and 8 deletions

View File

@ -8,8 +8,8 @@ import Base.show
export RecordHeader, read_row
include("mesg_num.jl")
using .mesg_num
include("bytes.jl"); using.bytes
include("mesg_num.jl"); using .mesg_num
struct DefinitionMessage end
struct DataMessage end
@ -21,6 +21,7 @@ The byte that corresponds to the type of message that this record holds.
"""
struct RecordHeader
definition_message::Bool
timestamp_message::Bool
end
@ -32,13 +33,11 @@ TODO: Endianness matters here. Need to resolve endianness with the architecture
"""
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)
RecordHeader(
bit_at(header_byte, 2),
bit_at(header_byte, 1))
end
function show(io::IO, header::RecordHeader)

View File

@ -7,7 +7,8 @@
module header
export FITHeader, read_header
include("bytes.jl")
include("bytes.jl"); using .bytes
const DATA_SIZE_LENGTH = 4