module Tdms::Streaming

Public Instance Methods

read_bool() click to toggle source
# File lib/tdms/streaming.rb, line 14
def read_bool
  read(1) == "\001"
end
read_double() click to toggle source
# File lib/tdms/streaming.rb, line 55
def read_double
  read(8).unpack("E")[0]
end
read_i16() click to toggle source
# File lib/tdms/streaming.rb, line 39
def read_i16
  read(2).unpack("s")[0] # TODO little endian not native
end
read_i32() click to toggle source
# File lib/tdms/streaming.rb, line 43
def read_i32
  read(4).unpack("l")[0] # TODO little endian not native
end
read_i64() click to toggle source
# File lib/tdms/streaming.rb, line 47
def read_i64
  read(8).unpack("q")[0] # TODO little endian not native
end
read_i8() click to toggle source
# File lib/tdms/streaming.rb, line 35
def read_i8
  read(2).unpack("c")[0]
end
read_property() click to toggle source
# File lib/tdms/streaming.rb, line 6
def read_property
  name    = read_utf8_string
  type_id = read_u32

  data = Tdms::DataType.find_by_id(type_id).read_from_stream(self)
  Tdms::Property.new(name, data)
end
read_single() click to toggle source
# File lib/tdms/streaming.rb, line 51
def read_single
  read(4).unpack("e")[0]
end
read_timestamp() click to toggle source
# File lib/tdms/streaming.rb, line 64
def read_timestamp
  positive_fractions_of_second = read_u64 # ignored
  seconds_since_labview_epoch  = read(8).unpack("q")[0] # TODO little endian not native

  labview_epoch = ::DateTime.new(1904, 1, 1)
  labview_epoch + Rational(seconds_since_labview_epoch, 86400)
end
read_u16() click to toggle source
# File lib/tdms/streaming.rb, line 22
def read_u16
  read(2).unpack("v")[0]
end
read_u32() click to toggle source
# File lib/tdms/streaming.rb, line 26
def read_u32
  read(4).unpack("V")[0]
end
read_u64() click to toggle source
# File lib/tdms/streaming.rb, line 30
def read_u64
  lo_hi = read(8).unpack("VV")
  lo_hi[0] + (lo_hi[1] << 32)
end
read_u8() click to toggle source
# File lib/tdms/streaming.rb, line 18
def read_u8
  read(1).unpack("C")[0]
end
read_utf8_string() click to toggle source
# File lib/tdms/streaming.rb, line 59
def read_utf8_string
  length = read_u32
  read length
end