Skip to content

Commit

Permalink
re #635 Update get_cmd_param_list to return the type for each parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Hall, Donald committed Nov 2, 2017
1 parent 9802e0c commit b353862
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions lib/cosmos/tools/cmd_tlm_server/api.rb
Expand Up @@ -292,12 +292,12 @@ def get_cmd_param_list(target_name, command_name)
System.commands.params(target_name, command_name).each do |parameter|
if parameter.format_string
unless parameter.default.kind_of?(Array)
list << [parameter.name, sprintf(parameter.format_string, parameter.default), parameter.states, parameter.description, parameter.units_full, parameter.units, parameter.required]
list << [parameter.name, sprintf(parameter.format_string, parameter.default), parameter.states, parameter.description, parameter.units_full, parameter.units, parameter.required, parameter.data_type.to_s]
else
list << [parameter.name, "[]", parameter.states, parameter.description, parameter.units_full, parameter.units, parameter.required]
list << [parameter.name, "[]", parameter.states, parameter.description, parameter.units_full, parameter.units, parameter.required, parameter.data_type.to_s]
end
else
list << [parameter.name, parameter.default, parameter.states, parameter.description, parameter.units_full, parameter.units, parameter.required]
list << [parameter.name, parameter.default, parameter.states, parameter.description, parameter.units_full, parameter.units, parameter.required, parameter.data_type.to_s]
end
end
return list
Expand Down
2 changes: 1 addition & 1 deletion spec/script/commands_disconnect_spec.rb
Expand Up @@ -254,7 +254,7 @@ module Cosmos
describe "get_cmd_param_list" do
it "returns all the parameters for a command" do
list = get_cmd_param_list("INST", "COLLECT")
expect(list).to include(["TYPE", 0, {"NORMAL"=>0, "SPECIAL"=>1}, "Collect type", nil, nil, true])
expect(list).to include(["TYPE", 0, {"NORMAL"=>0, "SPECIAL"=>1}, "Collect type", nil, nil, true, "UINT"])
end
end

Expand Down
3 changes: 2 additions & 1 deletion spec/script/commands_spec.rb
Expand Up @@ -272,7 +272,8 @@ module Cosmos
describe "get_cmd_param_list" do
it "returns all the parameters for a command" do
list = get_cmd_param_list("INST", "COLLECT")
expect(list).to include(["TYPE", 0, {"NORMAL"=>0, "SPECIAL"=>1}, "Collect type", nil, nil, true])
#puts list
expect(list).to include(["TYPE", 0, {"NORMAL"=>0, "SPECIAL"=>1}, "Collect type", nil, nil, true, "UINT"])
end
end

Expand Down
6 changes: 3 additions & 3 deletions spec/tools/cmd_tlm_server/api_spec.rb
Expand Up @@ -472,15 +472,15 @@ def test_cmd_unknown(method)
result = @api.get_cmd_param_list("INST","COLLECT")
# Each element in the results array contains:
# name, default, states, description, full units, units, required
expect(result).to include ['TYPE',0,{"NORMAL"=>0,"SPECIAL"=>1},'Collect type',nil,nil,true]
expect(result).to include ['TEMP',0.0,nil,'Collect temperature','Celcius','C',false]
expect(result).to include ['TYPE',0,{"NORMAL"=>0,"SPECIAL"=>1},'Collect type',nil,nil,true,"UINT"]
expect(result).to include ['TEMP',0.0,nil,'Collect temperature','Celcius','C',false,"FLOAT"]
end

it "returns array parameters for the command" do
result = @api.get_cmd_param_list("INST","ARYCMD")
# Each element in the results array contains:
# name, default, states, description, full units, units, required
expect(result).to include ['ARRAY',[],nil,'Array parameter',nil,nil,false]
expect(result).to include ['ARRAY',[],nil,'Array parameter',nil,nil,false,"FLOAT"]
end
end

Expand Down

0 comments on commit b353862

Please sign in to comment.