Move code around, read header into int/string
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
|
||||
"""
|
||||
read_data_size(size::Vector{UInt8})::Real
|
||||
|
||||
FIT headers have a data size field, with 4 bytes.
|
||||
"""
|
||||
function byte_vec_to_int(byte_vec::Vector{UInt8})::Integer
|
||||
result::Integer = 0
|
||||
byte_vec = Int64.(byte_vec)
|
||||
|
||||
for i ∈ 0:length(byte_vec) - 1
|
||||
result += byte_vec[1 + i] << (8 * i)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
"""
|
||||
byte_vec_to_string(byte_vec::Vector{UInt8})::AbstractString
|
||||
|
||||
Given the byte vec, create a String
|
||||
"""
|
||||
function byte_vec_to_string(byte_vec::Vector{UInt8})::AbstractString
|
||||
String(Char.(byte_vec))
|
||||
end
|
||||
|
||||
# byte_vec_to_string(UInt8.(collect("ABC")))
|
||||
Reference in New Issue
Block a user