Method: OpenC3::Api#get_cmd_buffer

Defined in:
lib/openc3/api/cmd_api.rb

#get_cmd_buffer(target_name, command_name, scope: $openc3_scope, token: $openc3_token) ⇒ Hash

Returns the raw buffer from the most recent specified command packet.

Parameters:

  • target_name (String)

    Target name of the command

  • command_name (String)

    Packet name of the command

Returns:

  • (Hash)

    command hash with last command buffer



113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/openc3/api/cmd_api.rb', line 113

def get_cmd_buffer(target_name, command_name, scope: $openc3_scope, token: $openc3_token)
  target_name = target_name.upcase
  command_name = command_name.upcase
  authorize(permission: 'cmd_info', target_name: target_name, packet_name: command_name, scope: scope, token: token)
  TargetModel.packet(target_name, command_name, type: :CMD, scope: scope)
  topic = "#{scope}__COMMAND__{#{target_name}}__#{command_name}"
  msg_id, msg_hash = Topic.get_newest_message(topic)
  if msg_id
    msg_hash['buffer'] = msg_hash['buffer'].b
    return msg_hash
  end
  return nil
end