Method: SGS::Otto#reader_thread

Defined in:
lib/sgs/otto.rb

#reader_threadObject

Thread to read status messages from Otto and handle them



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/sgs/otto.rb', line 222

def reader_thread
  puts "Starting OTTO reader thread..."
  while true
    data = read_data
    next if data.nil? or data.length == 0
    case data[0]
    when '$'
      #
      # Status message (every second)
      parse_status(data[1..])
    when '@'
      #
      # Otto elapsed time (every four seconds)
      parse_tstamp(data[1..])
    when '!'
      #
      # Otto mode state (every four seconds)
      parse_mode(data[1..])
    when '>'
      #
      # Telemetry data (every two seconds)
      parse_telemetry(data[1..])
    when '*'
      #
      # Message for the debug log
      parse_debug(data[1..])
    end
  end
end