41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/openc3/microservices/interface_decom_common.rb', line 41
def handle_build_cmd(build_cmd_json, msg_id)
build_cmd_hash = JSON.parse(build_cmd_json, allow_nan: true, create_additions: true)
target_name = build_cmd_hash['target_name']
cmd_name = build_cmd_hash['cmd_name']
cmd_params = build_cmd_hash['cmd_params']
range_check = build_cmd_hash['range_check']
raw = build_cmd_hash['raw']
ack_topic = "{#{@scope}__ACKCMD}TARGET__#{target_name}"
begin
command = System.commands.build_cmd(target_name, cmd_name, cmd_params, range_check, raw)
msg_hash = {
id: msg_id,
result: 'SUCCESS',
time: command.packet_time.to_nsec_from_epoch,
received_time: command.received_time.to_nsec_from_epoch,
target_name: command.target_name,
packet_name: command.packet_name,
received_count: command.received_count,
buffer: command.buffer(false)
}
rescue => error
msg_hash = {
id: msg_id,
result: 'ERROR',
message: error.message
}
end
Topic.write_topic(ack_topic, msg_hash)
end
|