Method: OpenC3::MqttInterface#write

Defined in:
lib/openc3/interfaces/mqtt_interface.rb

#write(packet) ⇒ Object



190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/openc3/interfaces/mqtt_interface.rb', line 190

def write(packet)
  @write_mutex.synchronize do
    topics = packet.meta['TOPIC']
    topics = packet.meta['TOPICS'] unless topics
    if topics
      topics.each do |topic|
        @write_topics << topic
        super(packet)
      end
    else
      raise "Command packet '#{packet.target_name} #{packet.packet_name}' requires a META TOPIC or TOPICS"
    end
  end
end