# File lib/sensors/ultrasonic_comm.rb, line 72
  def self.method_missing(name, *args)
    name = name.to_s
    if @@const_codes.has_key? name
      type = :const
      op = @@const_codes[name]
      addr = op[0]
      rx_len = op[1]
    elsif @@var_codes.has_key? name
      type = :var
      op = @@var_codes[name]
      addr = op
      rx_len = 1
    elsif @@cmd_codes.has_key? name
      type = :cmd
      op = @@cmd_codes[name]
      addr = op[0]
      if op[1] then value = op[1]
      elsif args[0] then value = args[0]
      else raise "Missing argument for command #{name}" end
      rx_len = 0
    else
      raise "Unknown ultrasonic sensor command: #{name}"
    end

    data = [@@i2c_dev, addr]
    data += [value] if type == :cmd
    
    [data.size, rx_len] + data
  end