From b77fc1670fc9524d398c4d280b44410886533a08 Mon Sep 17 00:00:00 2001 From: Jason Thomas Date: Mon, 11 Dec 2023 16:32:52 -0700 Subject: [PATCH 1/2] telemetry is now tlm, tlm apis take a single string arg --- docs.openc3.com/docs/guides/scripting-api.md | 46 +++++--- .../src/tools/CmdTlmServer/TlmPacketsTab.vue | 2 +- .../src/tools/Handbooks/Target.vue | 2 +- .../autocomplete/mnemonicChecker.js | 2 +- .../src/tools/TlmViewer/NewScreenDialog.vue | 2 +- .../src/tools/TlmViewer/TlmViewer.vue | 2 +- .../components/TargetPacketItemChooser.vue | 10 +- .../src/services/openc3-api.js | 20 +++- openc3/lib/openc3/api/tlm_api.rb | 87 ++++++++++---- openc3/python/openc3/api/tlm_api.py | 110 +++++++++++++----- openc3/python/test/api/test_tlm_api.py | 53 +++++---- openc3/spec/api/tlm_api_spec.rb | 45 ++++--- .../tool_svelte/src/services/openc3-api.js | 12 +- 13 files changed, 267 insertions(+), 126 deletions(-) diff --git a/docs.openc3.com/docs/guides/scripting-api.md b/docs.openc3.com/docs/guides/scripting-api.md index 8641ae8b30..c7eb35af4d 100644 --- a/docs.openc3.com/docs/guides/scripting-api.md +++ b/docs.openc3.com/docs/guides/scripting-api.md @@ -52,7 +52,7 @@ The following API methods are either deprecated (will not be ported to COSMOS 5) | get_all_target_info | Command and Telemetry Server | Deprecated, use get_target_interfaces | | get_background_tasks | Command and Telemetry Server | Deprecated | | get_all_cmd_info | Command and Telemetry Server | Deprecated, use get_all_commands | -| get_all_tlm_info | Command and Telemetry Server | Deprecated, use get_all_telemetry | +| get_all_tlm_info | Command and Telemetry Server | Deprecated, use get_all_tlm | | get_cmd_list | Command and Telemetry Server | Deprecated, use get_all_commands | | get_cmd_log_filename | Command and Telemetry Server | Deprecated | | get_cmd_param_list | Command and Telemetry Server | Deprecated, use get_command | @@ -1245,6 +1245,7 @@ Ruby / Python Syntax: ```ruby tlm(" ") +tlm("", "", "") ``` | Parameter | Description | @@ -1258,6 +1259,7 @@ Ruby Example: ```ruby value = tlm("INST HEALTH_STATUS COLLECTS") +value = tlm("INST", "HEALTH_STATUS", "COLLECTS") value = tlm_raw("INST HEALTH_STATUS COLLECTS") value = tlm_formatted("INST HEALTH_STATUS COLLECTS") value = tlm_with_units("INST HEALTH_STATUS COLLECTS") @@ -1269,6 +1271,7 @@ Python Example: ```python value = tlm("INST HEALTH_STATUS COLLECTS") +value = tlm("INST", "HEALTH_STATUS", "COLLECTS") value = tlm_raw("INST HEALTH_STATUS COLLECTS") value = tlm_formatted("INST HEALTH_STATUS COLLECTS") value = tlm_with_units("INST HEALTH_STATUS COLLECTS") @@ -1278,11 +1281,12 @@ raw_value = tlm("INST HEALTH_STATUS COLLECTS", type='RAW') ### get_tlm_buffer -Returns a packet hash (similar to get_telemetry) along with the raw packet buffer. +Returns a packet hash (similar to get_tlm) along with the raw packet buffer. Ruby / Python Syntax: ```ruby +buffer = get_tlm_buffer(" ")['buffer'] buffer = get_tlm_buffer("", "")['buffer'] ``` @@ -1294,7 +1298,7 @@ buffer = get_tlm_buffer("", "")['buffer'] Ruby / Python Example: ```ruby -packet = get_tlm_buffer("INST", "HEALTH_STATUS") +packet = get_tlm_buffer("INST HEALTH_STATUS") packet['buffer'] ``` @@ -1305,6 +1309,7 @@ Returns the names, values, and limits states of all telemetry items in a specifi Ruby / Python Syntax: ```ruby +get_tlm_packet(" ", ) get_tlm_packet("", "", ) ``` @@ -1317,13 +1322,13 @@ get_tlm_packet("", "", ) Ruby Example: ```ruby -names_values_and_limits_states = get_tlm_packet("INST", "HEALTH_STATUS", type: :FORMATTED) +names_values_and_limits_states = get_tlm_packet("INST HEALTH_STATUS", type: :FORMATTED) ``` Python Example: ```python -names_values_and_limits_states = get_tlm_packet("INST", "HEALTH_STATUS", type='FORMATTED') +names_values_and_limits_states = get_tlm_packet("INST HEALTH_STATUS", type='FORMATTED') ``` ### get_tlm_values (modified in 5.0.0) @@ -1347,14 +1352,14 @@ values = get_tlm_values(["INST__HEALTH_STATUS__TEMP1__CONVERTED", "INST__HEALTH_ print(values) # [[-100.0, :RED_LOW], [0, :RED_LOW]] ``` -### get_all_telemetry (since 5.0.0) +### get_all_tlm (since 5.13.0, since 5.0.0 as get_all_telemetry) Returns an array of all target packet hashes. Ruby / Python Syntax: ```ruby -get_all_telemetry("") +get_all_tlm("") ``` | Parameter | Description | @@ -1364,7 +1369,7 @@ get_all_telemetry("") Ruby / Python Example: ```ruby -packets = get_all_telemetry("INST") +packets = get_all_tlm("INST") print(packets) #[{"target_name"=>"INST", # "packet_name"=>"ADCS", @@ -1378,14 +1383,14 @@ print(packets) # ... ``` -### get_all_telemetry_names (since 5.0.6) +### get_all_tlm_names (since 5.13.0, since 5.0.6 as get_all_telemetry_names) Returns an array of all target packet names. Ruby / Python Syntax: ```ruby -get_all_telemetry_names("") +get_all_tlm_names("") ``` | Parameter | Description | @@ -1395,17 +1400,18 @@ get_all_telemetry_names("") Ruby / Python Example: ```ruby -get_all_telemetry_names("INST") #=> ["ADCS", "HEALTH_STATUS", ...] +get_all_tlm_names("INST") #=> ["ADCS", "HEALTH_STATUS", ...] ``` -### get_telemetry (since 5.0.0) +### get_tlm (since 5.13.0, since 5.0.0 as get_telemetry) Returns a packet hash. Ruby / Python Syntax: ```ruby -get_telemetry("", "") +get_tlm(" ") +get_tlm("", "") ``` | Parameter | Description | @@ -1416,7 +1422,7 @@ get_telemetry("", "") Ruby / Python Example: ```ruby -packet = get_telemetry("INST", "HEALTH_STATUS") +packet = get_tlm("INST HEALTH_STATUS") print(packet) #{"target_name"=>"INST", # "packet_name"=>"HEALTH_STATUS", @@ -1444,6 +1450,7 @@ Returns an item hash. Ruby / Python Syntax: ```ruby +get_item(" ") get_item("", "", "") ``` @@ -1456,7 +1463,7 @@ get_item("", "", "") Ruby / Python Example: ```ruby -item = get_item("INST", "HEALTH_STATUS", "CCSDSVER") +item = get_item("INST HEALTH_STATUS CCSDSVER") print(item) #{"name"=>"CCSDSVER", # "bit_offset"=>0, @@ -1475,6 +1482,7 @@ Returns the number of times a specified telemetry packet has been received. Ruby / Python Syntax: ```ruby +get_tlm_cnt(" ") get_tlm_cnt("", "") ``` @@ -1486,7 +1494,7 @@ get_tlm_cnt("", "") Ruby / Python Example: ```ruby -tlm_cnt = get_tlm_cnt("INST", "HEALTH_STATUS") # Number of times the INST HEALTH_STATUS telemetry packet has been received. +tlm_cnt = get_tlm_cnt("INST HEALTH_STATUS") # Number of times the INST HEALTH_STATUS telemetry packet has been received. ``` ### set_tlm @@ -1733,6 +1741,7 @@ Get the receive count for a telemetry packet Ruby / Python Syntax: ```ruby +get_tlm_cnt(" ") get_tlm_cnt("", "") ``` @@ -1744,7 +1753,7 @@ get_tlm_cnt("", "") Ruby / Python Example: ```ruby -get_tlm_cnt("INST", "HEALTH_STATUS") #=> 10 +get_tlm_cnt("INST HEALTH_STATUS") #=> 10 ``` ### get_tlm_cnts @@ -1775,6 +1784,7 @@ Get the list of derived telemetry items for a packet Ruby / Python Syntax: ```ruby +get_packet_derived_items(" ") get_packet_derived_items("", "") ``` @@ -1786,7 +1796,7 @@ get_packet_derived_items("", "") Ruby / Python Example: ```ruby -get_packet_derived_items("INST", "HEALTH_STATUS") #=> ['PACKET_TIMESECONDS', 'PACKET_TIMEFORMATTED', ...] +get_packet_derived_items("INST HEALTH_STATUS") #=> ['PACKET_TIMESECONDS', 'PACKET_TIMEFORMATTED', ...] ``` ## Delays diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-cmdtlmserver/src/tools/CmdTlmServer/TlmPacketsTab.vue b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-cmdtlmserver/src/tools/CmdTlmServer/TlmPacketsTab.vue index 28e4615171..70cf468ebc 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-cmdtlmserver/src/tools/CmdTlmServer/TlmPacketsTab.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-cmdtlmserver/src/tools/CmdTlmServer/TlmPacketsTab.vue @@ -118,7 +118,7 @@ export default { created() { this.api.get_target_names().then((targets) => { targets.map((target) => { - this.api.get_all_telemetry_names(target).then((names) => { + this.api.get_all_tlm_names(target).then((names) => { this.data = this.data.concat( names.map((packet) => { return { target_name: target, packet_name: packet, count: 0 } diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-handbooks/src/tools/Handbooks/Target.vue b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-handbooks/src/tools/Handbooks/Target.vue index ae89a53136..8086c750f8 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-handbooks/src/tools/Handbooks/Target.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-handbooks/src/tools/Handbooks/Target.vue @@ -112,7 +112,7 @@ export default { this.api.get_all_commands(this.target).then((packets) => { this.commands = packets }) - this.api.get_all_telemetry(this.target).then((packets) => { + this.api.get_all_tlm(this.target).then((packets) => { this.telemetry = packets }) }, diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/autocomplete/mnemonicChecker.js b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/autocomplete/mnemonicChecker.js index 3584fa81c6..d8c3748963 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/autocomplete/mnemonicChecker.js +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/autocomplete/mnemonicChecker.js @@ -165,7 +165,7 @@ export default class MnemonicChecker { const cmdOrTlm = lineObj.mnemonic.item ? 'tlm' : 'cmd' if (!this.targets[target][cmdOrTlm]) { const method = lineObj.mnemonic.item - ? 'get_all_telemetry' + ? 'get_all_tlm' : 'get_all_commands' const response = await this.api[method](target) this.targets[target][cmdOrTlm] = response.reduce( diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-tlmviewer/src/tools/TlmViewer/NewScreenDialog.vue b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-tlmviewer/src/tools/TlmViewer/NewScreenDialog.vue index 6b241dcdd5..ea7dcf4946 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-tlmviewer/src/tools/TlmViewer/NewScreenDialog.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-tlmviewer/src/tools/TlmViewer/NewScreenDialog.vue @@ -165,7 +165,7 @@ export default { methods: { targetSelect(target) { this.selectedTarget = target - this.api.get_all_telemetry_names(this.selectedTarget).then((names) => { + this.api.get_all_tlm_names(this.selectedTarget).then((names) => { this.packetNames = names.map((name) => { return { label: name, diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-tlmviewer/src/tools/TlmViewer/TlmViewer.vue b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-tlmviewer/src/tools/TlmViewer/TlmViewer.vue index cdf165d677..b0400efb00 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-tlmviewer/src/tools/TlmViewer/TlmViewer.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-tlmviewer/src/tools/TlmViewer/TlmViewer.vue @@ -273,7 +273,7 @@ export default { let text = 'SCREEN AUTO AUTO 1.0\n' if (packetName && packetName !== 'BLANK') { text += '\nVERTICAL\n' - await this.api.get_telemetry(targetName, packetName).then((packet) => { + await this.api.get_tlm(targetName, packetName).then((packet) => { packet.items.forEach((item) => { text += ` LABELVALUE ${targetName} ${packetName} ${item.name}\n` }) diff --git a/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/TargetPacketItemChooser.vue b/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/TargetPacketItemChooser.vue index d67ca470c6..ba6fc1ed00 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/TargetPacketItemChooser.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/TargetPacketItemChooser.vue @@ -308,9 +308,7 @@ export default { } this.internalDisabled = true const cmd = - this.mode === 'tlm' - ? 'get_all_telemetry_names' - : 'get_all_command_names' + this.mode === 'tlm' ? 'get_all_tlm_names' : 'get_all_command_names' this.api[cmd](this.selectedTargetName).then((names) => { this.packetNames = names.map((name) => { return { @@ -340,7 +338,7 @@ export default { return } this.internalDisabled = true - const cmd = this.mode === 'tlm' ? 'get_telemetry' : 'get_command' + const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_command' this.api[cmd](this.selectedTargetName, this.selectedPacketName).then( (packet) => { this.itemNames = packet.items @@ -421,7 +419,7 @@ export default { return value === packet.value }) this.selectedPacketName = packet.value - const cmd = this.mode === 'tlm' ? 'get_telemetry' : 'get_command' + const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_command' this.api[cmd](this.selectedTargetName, this.selectedPacketName).then( (packet) => { this.description = packet.description @@ -487,7 +485,7 @@ export default { allTargetPacketItems: function () { this.packetNames.forEach((packetName) => { if (packetName === this.ALL) return - const cmd = this.mode === 'tlm' ? 'get_telemetry' : 'get_command' + const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_command' this.api[cmd](this.selectedTargetName, packetName.value).then( (packet) => { packet.items.forEach((item) => { diff --git a/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/openc3-api.js b/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/openc3-api.js index b179d51a28..a20d664715 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/openc3-api.js +++ b/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/services/openc3-api.js @@ -225,22 +225,34 @@ export class OpenC3Api { return this.exec('get_target', [target_name]) } - // get_target_list is DEPRECATED - get_target_list() { - return this.exec('get_target_list', []) - } get_target_names() { return this.exec('get_target_names', []) } + // DEPRECATED + get_target_list() { + return this.exec('get_target_list', []) + } + get_tlm(target_name, packet_name) { + return this.exec('get_tlm', [target_name, packet_name]) + } + // DEPRECATED get_telemetry(target_name, packet_name) { return this.exec('get_telemetry', [target_name, packet_name]) } + get_all_tlm(target_name) { + return this.exec('get_all_tlm', [target_name]) + } + // DEPREACTE get_all_telemetry(target_name) { return this.exec('get_all_telemetry', [target_name]) } + get_all_tlm_names(target_name) { + return this.exec('get_all_tlm_names', [target_name]) + } + // DEPRECATED get_all_telemetry_names(target_name) { return this.exec('get_all_telemetry_names', [target_name]) } diff --git a/openc3/lib/openc3/api/tlm_api.rb b/openc3/lib/openc3/api/tlm_api.rb index fdc9316f65..db815cf464 100644 --- a/openc3/lib/openc3/api/tlm_api.rb +++ b/openc3/lib/openc3/api/tlm_api.rb @@ -44,9 +44,12 @@ module Api 'get_tlm_buffer', 'get_tlm_packet', 'get_tlm_values', - 'get_all_telemetry', - 'get_all_telemetry_names', - 'get_telemetry', + 'get_all_tlm', + 'get_all_telemetry', # DEPRECATED + 'get_all_tlm_names', + 'get_all_telemetry_names', # DEPRECATED + 'get_tlm', + 'get_telemetry', # DEPRECATED 'get_item', 'subscribe_packets', 'get_packets', @@ -201,9 +204,8 @@ def normalize_tlm(*args, type: :ALL, scope: $openc3_scope, token: $openc3_token) # @param target_name [String] Name of the target # @param packet_name [String] Name of the packet # @return [Hash] telemetry hash with last telemetry buffer - def get_tlm_buffer(target_name, packet_name, scope: $openc3_scope, token: $openc3_token) - target_name = target_name.upcase - packet_name = packet_name.upcase + def get_tlm_buffer(*args, scope: $openc3_scope, token: $openc3_token) + target_name, packet_name = _extract_target_packet_names('get_tlm_buffer', *args) authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token) TargetModel.packet(target_name, packet_name, scope: scope) topic = "#{scope}__TELEMETRY__{#{target_name}}__#{packet_name}" @@ -224,9 +226,8 @@ def get_tlm_buffer(target_name, packet_name, scope: $openc3_scope, token: $openc # @return [Array] Returns an Array consisting # of [item name, item value, item limits state] where the item limits # state can be one of {OpenC3::Limits::LIMITS_STATES} - def get_tlm_packet(target_name, packet_name, stale_time: 30, type: :CONVERTED, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token) - target_name = target_name.upcase - packet_name = packet_name.upcase + def get_tlm_packet(*args, stale_time: 30, type: :CONVERTED, cache_timeout: 0.1, scope: $openc3_scope, token: $openc3_token) + target_name, packet_name = _extract_target_packet_names('get_tlm_packet', *args) authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token) packet = TargetModel.packet(target_name, packet_name, scope: scope) t = _validate_tlm_type(type) @@ -274,22 +275,24 @@ def get_tlm_values(items, stale_time: 30, cache_timeout: 0.1, scope: $openc3_sco # @since 5.0.0 # @param target_name [String] Name of the target # @return [Array] Array of all telemetry packet hashes - def get_all_telemetry(target_name, scope: $openc3_scope, token: $openc3_token) + def get_all_tlm(target_name, scope: $openc3_scope, token: $openc3_token) target_name = target_name.upcase authorize(permission: 'tlm', target_name: target_name, scope: scope, token: token) TargetModel.packets(target_name, type: :TLM, scope: scope) end + alias get_all_telemetry get_all_tlm # Returns an array of all the telemetry packet names # # @since 5.0.6 # @param target_name [String] Name of the target # @return [Array] Array of all telemetry packet names - def get_all_telemetry_names(target_name, scope: $openc3_scope, token: $openc3_token) + def get_all_tlm_names(target_name, scope: $openc3_scope, token: $openc3_token) target_name = target_name.upcase authorize(permission: 'cmd_info', target_name: target_name, scope: scope, token: token) TargetModel.packet_names(target_name, type: :TLM, scope: scope) end + alias get_all_telemetry_names get_all_tlm_names # Returns a telemetry packet hash # @@ -297,12 +300,12 @@ def get_all_telemetry_names(target_name, scope: $openc3_scope, token: $openc3_to # @param target_name [String] Name of the target # @param packet_name [String] Name of the packet # @return [Hash] Telemetry packet hash - def get_telemetry(target_name, packet_name, scope: $openc3_scope, token: $openc3_token) - target_name = target_name.upcase - packet_name = packet_name.upcase + def get_tlm(*args, scope: $openc3_scope, token: $openc3_token) + target_name, packet_name = _extract_target_packet_names('get_tlm', *args) authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token) TargetModel.packet(target_name, packet_name, scope: scope) end + alias get_telemetry get_tlm # Returns a telemetry packet item hash # @@ -311,10 +314,8 @@ def get_telemetry(target_name, packet_name, scope: $openc3_scope, token: $openc3 # @param packet_name [String] Name of the packet # @param item_name [String] Name of the packet # @return [Hash] Telemetry packet item hash - def get_item(target_name, packet_name, item_name, scope: $openc3_scope, token: $openc3_token) - target_name = target_name.upcase - packet_name = packet_name.upcase - item_name = item_name.upcase + def get_item(*args, scope: $openc3_scope, token: $openc3_token) + target_name, packet_name, item_name = _extract_target_packet_item_names('get_item', *args) authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token) TargetModel.packet_item(target_name, packet_name, item_name, scope: scope) end @@ -375,9 +376,8 @@ def get_packets(id, block: nil, count: 1000, scope: $openc3_scope, token: $openc # @param target_name [String] Name of the target # @param packet_name [String] Name of the packet # @return [Numeric] Receive count for the telemetry packet - def get_tlm_cnt(target_name, packet_name, scope: $openc3_scope, token: $openc3_token) - target_name = target_name.upcase - packet_name = packet_name.upcase + def get_tlm_cnt(*args, scope: $openc3_scope, token: $openc3_token) + target_name, packet_name = _extract_target_packet_names('get_tlm_cnt', *args) authorize(permission: 'system', target_name: target_name, packet_name: packet_name, scope: scope, token: token) TargetModel.packet(target_name, packet_name, scope: scope) Topic.get_cnt("#{scope}__TELEMETRY__{#{target_name}}__#{packet_name}") @@ -403,9 +403,8 @@ def get_tlm_cnts(target_packets, scope: $openc3_scope, token: $openc3_token) # @param target_name [String] Target name # @param packet_name [String] Packet name # @return [Array] All of the ignored telemetry items for a packet. - def get_packet_derived_items(target_name, packet_name, scope: $openc3_scope, token: $openc3_token) - target_name = target_name.upcase - packet_name = packet_name.upcase + def get_packet_derived_items(*args, scope: $openc3_scope, token: $openc3_token) + target_name, packet_name = _extract_target_packet_names('get_packet_derived_items', *args) authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token) packet = TargetModel.packet(target_name, packet_name, scope: scope) return packet['items'].select { |item| item['data_type'] == 'DERIVED' }.map { |item| item['name'] } @@ -413,6 +412,46 @@ def get_packet_derived_items(target_name, packet_name, scope: $openc3_scope, tok # PRIVATE + def _extract_target_packet_names(method_name, *args) + target_name = nil + packet_name = nil + case args.length + when 1 + target_name, packet_name = args[0].upcase.split + when 2 + target_name = args[0].upcase + packet_name = args[1].upcase + else + # Invalid number of arguments + raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()" + end + if target_name.nil? or packet_name.nil? + raise "ERROR: Both target name and packet name required. Usage: #{method_name}(\"TGT PKT\") or #{method_name}(\"TGT\", \"PKT\")" + end + return [target_name, packet_name] + end + + def _extract_target_packet_item_names(method_name, *args) + target_name = nil + packet_name = nil + item_name = nil + case args.length + when 1 + target_name, packet_name, item_name = args[0].upcase.split + when 3 + target_name = args[0].upcase + packet_name = args[1].upcase + item_name = args[2].upcase + else + # Invalid number of arguments + raise "ERROR: Invalid number of arguments (#{args.length}) passed to #{method_name}()" + end + if target_name.nil? or packet_name.nil? or item_name.nil? + raise "ERROR: Target name, packet name, and item name are required. Usage: #{method_name}(\"TGT PKT ITEM\") or #{method_name}(\"TGT\", \"PKT\", \"ITEM\")" + end + return [target_name, packet_name, item_name] + end + def _validate_tlm_type(type) case type.intern when :RAW diff --git a/openc3/python/openc3/api/tlm_api.py b/openc3/python/openc3/api/tlm_api.py index 584241feb3..6ed636e409 100644 --- a/openc3/python/openc3/api/tlm_api.py +++ b/openc3/python/openc3/api/tlm_api.py @@ -40,9 +40,12 @@ "get_tlm_buffer", "get_tlm_packet", "get_tlm_values", - "get_all_telemetry", - "get_all_telemetry_names", - "get_telemetry", + "get_all_tlm", + "get_all_telemetry", # DEPRECATED + "get_all_tlm_names", + "get_all_telemetry_names", # DEPRECATED + "get_tlm", + "get_telemetry", # DEPRECATED "get_item", "subscribe_packets", "get_packets", @@ -230,9 +233,8 @@ def normalize_tlm(*args, type="ALL", scope=OPENC3_SCOPE): # @param target_name [String] Name of the target # @param packet_name [String] Name of the packet # @return [Hash] telemetry hash with last telemetry buffer -def get_tlm_buffer(target_name, packet_name, scope=OPENC3_SCOPE): - target_name = target_name.upper() - packet_name = packet_name.upper() +def get_tlm_buffer(*args, scope=OPENC3_SCOPE): + target_name, packet_name = _extract_target_packet_names("get_tlm_buffer", *args) authorize( permission="tlm", target_name=target_name, packet_name=packet_name, scope=scope ) @@ -254,11 +256,8 @@ def get_tlm_buffer(target_name, packet_name, scope=OPENC3_SCOPE): # @return [Array] Returns an Array consisting # of [item name, item value, item limits state] where the item limits # state can be one of {OpenC3::Limits::LIMITS_STATES} -def get_tlm_packet( - target_name, packet_name, stale_time=30, type="CONVERTED", scope=OPENC3_SCOPE -): - target_name = target_name.upper() - packet_name = packet_name.upper() +def get_tlm_packet(*args, stale_time=30, type="CONVERTED", scope=OPENC3_SCOPE): + target_name, packet_name = _extract_target_packet_names("get_tlm_packet", *args) authorize( permission="tlm", target_name=target_name, packet_name=packet_name, scope=scope ) @@ -326,46 +325,57 @@ def get_tlm_values(items, stale_time=30, cache_timeout=0.1, scope=OPENC3_SCOPE): # # @param target_name [String] Name of the target # @return [Array] Array of all telemetry packet hashes -def get_all_telemetry(target_name, scope=OPENC3_SCOPE): +def get_all_tlm(target_name, scope=OPENC3_SCOPE): target_name = target_name.upper() authorize(permission="tlm", target_name=target_name, scope=scope) return TargetModel.packets(target_name, type="TLM", scope=scope) +# get_all_telemetry is DEPRECATED +get_all_telemetry = get_all_tlm + + # Returns an array of all the telemetry packet names # # @param target_name [String] Name of the target # @return [Array] Array of all telemetry packet names -def get_all_telemetry_names(target_name, scope=OPENC3_SCOPE): +def get_all_tlm_names(target_name, scope=OPENC3_SCOPE): target_name = target_name.upper() authorize(permission="cmd_info", target_name=target_name, scope=scope) return TargetModel.packet_names(target_name, type="TLM", scope=scope) +# get_all_telemetry_names is DEPRECATED +get_all_telemetry_names = get_all_tlm_names + + # Returns a telemetry packet hash # # @param target_name [String] Name of the target # @param packet_name [String] Name of the packet # @return [Hash] Telemetry packet hash -def get_telemetry(target_name, packet_name, scope=OPENC3_SCOPE): - target_name = target_name.upper() - packet_name = packet_name.upper() +def get_tlm(*args, scope=OPENC3_SCOPE): + target_name, packet_name = _extract_target_packet_names("get_tlm", *args) authorize( permission="tlm", target_name=target_name, packet_name=packet_name, scope=scope ) return TargetModel.packet(target_name, packet_name, scope=scope) +# get_telemetry is DEPRECATED +get_telemetry = get_tlm + + # Returns a telemetry packet item hash # # @param target_name [String] Name of the target # @param packet_name [String] Name of the packet # @param item_name [String] Name of the packet # @return [Hash] Telemetry packet item hash -def get_item(target_name, packet_name, item_name, scope=OPENC3_SCOPE): - target_name = target_name.upper() - packet_name = packet_name.upper() - item_name = item_name.upper() +def get_item(*args, scope=OPENC3_SCOPE): + target_name, packet_name, item_name = _extract_target_packet_item_names( + "get_item", *args + ) authorize( permission="tlm", target_name=target_name, packet_name=packet_name, scope=scope ) @@ -442,9 +452,8 @@ def get_packets(id, count=1000, scope=OPENC3_SCOPE): # @param target_name [String] Name of the target # @param packet_name [String] Name of the packet # @return [Numeric] Receive count for the telemetry packet -def get_tlm_cnt(target_name, packet_name, scope=OPENC3_SCOPE): - target_name = target_name.upper() - packet_name = packet_name.upper() +def get_tlm_cnt(*args, scope=OPENC3_SCOPE): + target_name, packet_name = _extract_target_packet_names("get_tlm_cnt", *args) authorize( permission="system", target_name=target_name, @@ -476,9 +485,10 @@ def get_tlm_cnts(target_packets, scope=OPENC3_SCOPE): # @param target_name [String] Target name # @param packet_name [String] Packet name # @return [Array] All of the ignored telemetry items for a packet. -def get_packet_derived_items(target_name, packet_name, scope=OPENC3_SCOPE): - target_name = target_name.upper() - packet_name = packet_name.upper() +def get_packet_derived_items(*args, scope=OPENC3_SCOPE): + target_name, packet_name = _extract_target_packet_names( + "get_packet_derived_items", *args + ) authorize( permission="tlm", target_name=target_name, packet_name=packet_name, scope=scope ) @@ -486,6 +496,54 @@ def get_packet_derived_items(target_name, packet_name, scope=OPENC3_SCOPE): return [item["name"] for item in packet["items"] if item["data_type"] == "DERIVED"] +def _extract_target_packet_names(method_name, *args): + target_name = None + packet_name = None + match len(args): + case 1: + target_name, packet_name = args[0].upper().split() + case 2: + target_name = args[0].upper() + packet_name = args[1].upper() + case _: + # Invalid number of arguments + raise RuntimeError( + f"ERROR: Invalid number of arguments ({len(args)}) passed to {method_name}()" + ) + if target_name is None or packet_name is None: + raise RuntimeError( + f'ERROR: Both target name and packet name required. Usage: {method_name}("TGT PKT") or {method_name}("TGT", "PKT")' + ) + return (target_name, packet_name) + + +def _extract_target_packet_item_names(method_name, *args): + target_name = None + packet_name = None + item_name = None + match len(args): + case 1: + try: + target_name, packet_name, item_name = args[0].upper().split() + except ValueError: # Thrown when not enough items given + # Do nothing because below error will catch this + pass + case 3: + target_name = args[0].upper() + packet_name = args[1].upper() + item_name = args[2].upper() + case _: + # Invalid number of arguments + raise RuntimeError( + f"ERROR: Invalid number of arguments ({len(args)}) passed to {method_name}()" + ) + if target_name is None or packet_name is None or item_name is None: + raise RuntimeError( + f'ERROR: Target name, packet name and item name required. Usage: {method_name}("TGT PKT ITEM") or {method_name}("TGT", "PKT", "ITEM")' + ) + return (target_name, packet_name, item_name) + + def _validate_tlm_type(type): match type: case "RAW": diff --git a/openc3/python/test/api/test_tlm_api.py b/openc3/python/test/api/test_tlm_api.py index d18346dbb6..73dbf60006 100644 --- a/openc3/python/test/api/test_tlm_api.py +++ b/openc3/python/test/api/test_tlm_api.py @@ -534,18 +534,22 @@ def test_get_tlm_buffer_returns_a_telemetry_packet_buffer(self): TelemetryTopic.write_packet(packet, scope="DEFAULT") output = get_tlm_buffer("INST", "Health_Status") self.assertEqual(output["buffer"][0:4], buffer) + output = get_tlm_buffer("INST Health_Status") + self.assertEqual(output["buffer"][0:4], buffer) def test_get_tlm_buffer_returns_none_for_no_current_packet(self): output = get_tlm_buffer("INST", "MECH") self.assertIsNone(output) + output = get_tlm_buffer("INST MECH") + self.assertIsNone(output) - # get_all_telemetry - def test_get_all_telemetry_raises_if_the_target_does_not_exist(self): + # get_all_tlm + def test_get_all_tlm_raises_if_the_target_does_not_exist(self): with self.assertRaisesRegex(RuntimeError, "Target 'BLAH' does not exist"): - get_all_telemetry("BLAH", scope="DEFAULT") + get_all_tlm("BLAH", scope="DEFAULT") - def test_get_all_telemetry_returns_an_array_of_all_packet_hashes(self): - pkts = get_all_telemetry("inst", scope="DEFAULT") + def test_get_all_tlm_returns_an_array_of_all_packet_hashes(self): + pkts = get_all_tlm("inst", scope="DEFAULT") self.assertEqual(type(pkts), list) names = [] for pkt in pkts: @@ -558,30 +562,33 @@ def test_get_all_telemetry_returns_an_array_of_all_packet_hashes(self): self.assertIn("IMAGE", names) self.assertIn("MECH", names) - def test_get_all_telemetry_names_returns_an_empty_array_if_the_target_does_not_exist( + # get_all_tlm_names + def test_get_all_tlm_names_returns_an_empty_array_if_the_target_does_not_exist( self, ): - self.assertEqual(get_all_telemetry_names("BLAH"), []) + self.assertEqual(get_all_tlm_names("BLAH"), []) - def test_get_all_telemetry_names_returns_an_array_of_all_packet_names(self): - pkts = get_all_telemetry_names("inst", scope="DEFAULT") + def test_get_all_tlm_names_returns_an_array_of_all_packet_names(self): + pkts = get_all_tlm_names("inst", scope="DEFAULT") self.assertEqual(type(pkts), list) self.assertEqual(type(pkts[0]), str) - # get_telemetry - def test_get_telemetry_raises_if_the_target_or_packet_do_not_exist(self): + # get_tlm + def test_get_tlm_raises_if_the_target_or_packet_do_not_exist(self): with self.assertRaisesRegex( RuntimeError, "Packet 'BLAH HEALTH_STATUS' does not exist" ): - get_telemetry("BLAH", "HEALTH_STATUS", scope="DEFAULT") + get_tlm("BLAH", "HEALTH_STATUS", scope="DEFAULT") with self.assertRaisesRegex(RuntimeError, "Packet 'INST BLAH' does not exist"): - get_telemetry("INST", "BLAH", scope="DEFAULT") + get_tlm("INST BLAH", scope="DEFAULT") - def test_get_telemetry_returns_a_packet_hash(self): - pkt = get_telemetry("inst", "Health_Status", scope="DEFAULT") + def test_get_tlm_returns_a_packet_hash(self): + pkt = get_tlm("inst", "Health_Status", scope="DEFAULT") self.assertEqual(type(pkt), dict) self.assertEqual(pkt["target_name"], "INST") self.assertEqual(pkt["packet_name"], "HEALTH_STATUS") + pkt = get_tlm("inst Health_Status", scope="DEFAULT") + self.assertEqual(type(pkt), dict) # get_item def test_get_item_raises_if_the_target_or_packet_or_item_do_not_exist(self): @@ -590,17 +597,23 @@ def test_get_item_raises_if_the_target_or_packet_or_item_do_not_exist(self): ): get_item("BLAH", "HEALTH_STATUS", "CCSDSVER", scope="DEFAULT") with self.assertRaisesRegex(RuntimeError, "Packet 'INST BLAH' does not exist"): - get_item("INST", "BLAH", "CCSDSVER", scope="DEFAULT") + get_item("INST BLAH CCSDSVER", scope="DEFAULT") with self.assertRaisesRegex( RuntimeError, "Item 'INST HEALTH_STATUS BLAH' does not exist" ): get_item("INST", "HEALTH_STATUS", "BLAH", scope="DEFAULT") + with self.assertRaisesRegex( + RuntimeError, "ERROR: Target name, packet name and item name required." + ): + get_item("INST HEALTH_STATUS", scope="DEFAULT") def test_get_item_returns_an_item_hash(self): item = get_item("inst", "Health_Status", "CcsdsVER", scope="DEFAULT") self.assertEqual(type(item), dict) self.assertEqual(item["name"], "CCSDSVER") self.assertEqual(item["bit_offset"], 0) + item = get_item("inst Health_Status CcsdsVER", scope="DEFAULT") + self.assertEqual(type(item), dict) # get_tlm_packet def test_complains_about_non_existant_targets(self): @@ -611,7 +624,7 @@ def test_complains_about_non_existant_targets(self): def test_complains_about_non_existant_packets(self): with self.assertRaisesRegex(RuntimeError, "Packet 'INST BLAH' does not exist"): - get_tlm_packet("INST", "BLAH") + get_tlm_packet("INST BLAH") def test_complains_using_latest(self): with self.assertRaisesRegex( @@ -623,7 +636,7 @@ def test_complains_about_non_existant_value_types(self): with self.assertRaisesRegex( AttributeError, "Unknown type 'MINE' for INST HEALTH_STATUS" ): - get_tlm_packet("INST", "HEALTH_STATUS", type="MINE") + get_tlm_packet("INST HEALTH_STATUS", type="MINE") def test_reads_all_telemetry_items_as_converted_with_their_limits_states(self): vals = get_tlm_packet("inst", "Health_Status") @@ -664,7 +677,7 @@ def test_reads_all_telemetry_items_as_converted_with_their_limits_states(self): self.assertIsNone(vals[27][2]) def test_reads_all_telemetry_items_as_raw(self): - vals = get_tlm_packet("INST", "HEALTH_STATUS", type="RAW") + vals = get_tlm_packet("INST HEALTH_STATUS", type="RAW") self.assertEqual(vals[11][0], "TEMP1") self.assertEqual(vals[11][1], 0) self.assertEqual(vals[11][2], "RED_LOW") @@ -694,7 +707,7 @@ def test_reads_all_telemetry_items_as_formatted(self): self.assertEqual(vals[14][2], "RED_LOW") def test_reads_all_telemetry_items_as_with_units(self): - vals = get_tlm_packet("INST", "HEALTH_STATUS", type="WITH_UNITS") + vals = get_tlm_packet("INST HEALTH_STATUS", type="WITH_UNITS") self.assertEqual(vals[11][0], "TEMP1") self.assertEqual(vals[11][1], "-100.000 C") self.assertEqual(vals[11][2], "RED_LOW") diff --git a/openc3/spec/api/tlm_api_spec.rb b/openc3/spec/api/tlm_api_spec.rb index 17825a04fb..5d5b4bcfbb 100644 --- a/openc3/spec/api/tlm_api_spec.rb +++ b/openc3/spec/api/tlm_api_spec.rb @@ -473,16 +473,18 @@ def test_tlm_unknown(method) TelemetryTopic.write_packet(packet, scope: 'DEFAULT') output = @api.get_tlm_buffer("INST", "Health_Status") expect(output["buffer"][0..3]).to eq buffer + output = @api.get_tlm_buffer("INST Health_Status") + expect(output["buffer"][0..3]).to eq buffer end end - describe "get_all_telemetry" do + describe "get_all_tlm" do it "raises if the target does not exist" do - expect { @api.get_all_telemetry("BLAH", scope: "DEFAULT") }.to raise_error("Target 'BLAH' does not exist for scope: DEFAULT") + expect { @api.get_all_tlm("BLAH", scope: "DEFAULT") }.to raise_error("Target 'BLAH' does not exist for scope: DEFAULT") end it "returns an array of all packet hashes" do - pkts = @api.get_all_telemetry("inst", scope: "DEFAULT") + pkts = @api.get_all_tlm("inst", scope: "DEFAULT") expect(pkts).to be_a Array names = [] pkts.each do |pkt| @@ -494,37 +496,40 @@ def test_tlm_unknown(method) end end - describe "get_all_telemetry_names" do + describe "get_all_tlm_names" do it "returns an empty array if the target does not exist" do - expect(@api.get_all_telemetry_names("BLAH")).to eql [] + expect(@api.get_all_tlm_names("BLAH")).to eql [] end it "returns an array of all packet names" do - pkts = @api.get_all_telemetry_names("inst", scope: "DEFAULT") + pkts = @api.get_all_tlm_names("inst", scope: "DEFAULT") expect(pkts).to be_a Array expect(pkts[0]).to be_a String end end - describe "get_telemetry" do + describe "get_tlm" do it "raises if the target or packet do not exist" do - expect { @api.get_telemetry("BLAH", "HEALTH_STATUS", scope: "DEFAULT") }.to raise_error("Packet 'BLAH HEALTH_STATUS' does not exist") - expect { @api.get_telemetry("INST", "BLAH", scope: "DEFAULT") }.to raise_error("Packet 'INST BLAH' does not exist") + expect { @api.get_tlm("BLAH", "HEALTH_STATUS", scope: "DEFAULT") }.to raise_error("Packet 'BLAH HEALTH_STATUS' does not exist") + expect { @api.get_tlm("INST BLAH", scope: "DEFAULT") }.to raise_error("Packet 'INST BLAH' does not exist") end it "returns a packet hash" do - pkt = @api.get_telemetry("inst", "Health_Status", scope: "DEFAULT") + pkt = @api.get_tlm("inst", "Health_Status", scope: "DEFAULT") expect(pkt).to be_a Hash expect(pkt['target_name']).to eql "INST" expect(pkt['packet_name']).to eql "HEALTH_STATUS" + pkt = @api.get_tlm("inst Health_Status", scope: "DEFAULT") + expect(pkt).to be_a Hash end end describe "get_item" do it "raises if the target or packet or item do not exist" do expect { @api.get_item("BLAH", "HEALTH_STATUS", "CCSDSVER", scope: "DEFAULT") }.to raise_error("Packet 'BLAH HEALTH_STATUS' does not exist") - expect { @api.get_item("INST", "BLAH", "CCSDSVER", scope: "DEFAULT") }.to raise_error("Packet 'INST BLAH' does not exist") + expect { @api.get_item("INST BLAH CCSDSVER", scope: "DEFAULT") }.to raise_error("Packet 'INST BLAH' does not exist") expect { @api.get_item("INST", "HEALTH_STATUS", "BLAH", scope: "DEFAULT") }.to raise_error("Item 'INST HEALTH_STATUS BLAH' does not exist") + expect { @api.get_item("INST HEALTH_STATUS", scope: "DEFAULT") }.to raise_error(/Target name, packet name, and item name are required./) end it "returns an item hash" do @@ -532,6 +537,8 @@ def test_tlm_unknown(method) expect(item).to be_a Hash expect(item['name']).to eql "CCSDSVER" expect(item['bit_offset']).to eql 0 + item = @api.get_item("inst Health_Status CcsdsVER", scope: "DEFAULT") + expect(item).to be_a Hash end end @@ -541,7 +548,7 @@ def test_tlm_unknown(method) end it "complains about non-existant packets" do - expect { @api.get_tlm_packet("INST", "BLAH") }.to raise_error(RuntimeError, "Packet 'INST BLAH' does not exist") + expect { @api.get_tlm_packet("INST BLAH") }.to raise_error(RuntimeError, "Packet 'INST BLAH' does not exist") end it "complains using LATEST" do @@ -549,7 +556,7 @@ def test_tlm_unknown(method) end it "complains about non-existant value_types" do - expect { @api.get_tlm_packet("INST", "HEALTH_STATUS", type: :MINE) }.to raise_error(/Unknown type 'MINE'/) + expect { @api.get_tlm_packet("INST HEALTH_STATUS", type: :MINE) }.to raise_error(/Unknown type 'MINE'/) end it "reads all telemetry items as CONVERTED with their limits states" do @@ -586,7 +593,7 @@ def test_tlm_unknown(method) end it "reads all telemetry items as RAW" do - vals = @api.get_tlm_packet("INST", "HEALTH_STATUS", type: :RAW) + vals = @api.get_tlm_packet("INST HEALTH_STATUS", type: :RAW) expect(vals[11][0]).to eql "TEMP1" expect(vals[11][1]).to eql 0 expect(vals[11][2]).to eql :RED_LOW @@ -618,7 +625,7 @@ def test_tlm_unknown(method) end it "reads all telemetry items as WITH_UNITS" do - vals = @api.get_tlm_packet("INST", "HEALTH_STATUS", type: :WITH_UNITS) + vals = @api.get_tlm_packet("INST HEALTH_STATUS", type: :WITH_UNITS) expect(vals[11][0]).to eql "TEMP1" expect(vals[11][1]).to eql "-100.000 C" expect(vals[11][2]).to eql :RED_LOW @@ -870,7 +877,7 @@ def test_tlm_unknown(method) end it "complains about non-existant packets" do - expect { @api.get_tlm_cnt("INST", "BLAH") }.to raise_error("Packet 'INST BLAH' does not exist") + expect { @api.get_tlm_cnt("INST BLAH") }.to raise_error("Packet 'INST BLAH' does not exist") end it "returns the receive count" do @@ -883,6 +890,8 @@ def test_tlm_unknown(method) count = @api.get_tlm_cnt("INST", "HEALTH_STATUS") expect(count).to eql start + 1 + count = @api.get_tlm_cnt("INST HEALTH_STATUS") + expect(count).to eql start + 1 end end @@ -903,12 +912,14 @@ def test_tlm_unknown(method) end it "complains about non-existant packets" do - expect { @api.get_packet_derived_items("INST", "BLAH") }.to raise_error("Packet 'INST BLAH' does not exist") + expect { @api.get_packet_derived_items("INST BLAH") }.to raise_error("Packet 'INST BLAH' does not exist") end it "returns the packet derived items" do items = @api.get_packet_derived_items("inst", "Health_Status") expect(items).to include("RECEIVED_TIMESECONDS", "RECEIVED_TIMEFORMATTED", "RECEIVED_COUNT") + items = @api.get_packet_derived_items("inst Health_Status") + expect(items).to include("RECEIVED_TIMESECONDS", "RECEIVED_TIMEFORMATTED", "RECEIVED_COUNT") end end end diff --git a/openc3/templates/tool_svelte/src/services/openc3-api.js b/openc3/templates/tool_svelte/src/services/openc3-api.js index 2eff1553d0..0faeb078d2 100644 --- a/openc3/templates/tool_svelte/src/services/openc3-api.js +++ b/openc3/templates/tool_svelte/src/services/openc3-api.js @@ -221,16 +221,16 @@ export class OpenC3Api { return this.exec('get_target_names', []) } - get_telemetry(target_name, packet_name) { - return this.exec('get_telemetry', [target_name, packet_name]) + get_tlm(target_name, packet_name) { + return this.exec('get_tlm', [target_name, packet_name]) } - get_all_telemetry(target_name) { - return this.exec('get_all_telemetry', [target_name]) + get_all_tlm(target_name) { + return this.exec('get_all_tlm', [target_name]) } - get_all_telemetry_names(target_name) { - return this.exec('get_all_telemetry_names', [target_name]) + get_all_tlm_names(target_name) { + return this.exec('get_all_tlm_names', [target_name]) } async get_tlm_packet(target_name, packet_name, value_type, stale_time = 30) { From e9b04245000eb8f9efdd07cbdcf7db3010adffbf Mon Sep 17 00:00:00 2001 From: Jason Thomas Date: Mon, 11 Dec 2023 20:24:58 -0700 Subject: [PATCH 2/2] Fix merge --- .../src/components/TargetPacketItemChooser.vue | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/TargetPacketItemChooser.vue b/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/TargetPacketItemChooser.vue index 3c20ebfce2..db51a75039 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/TargetPacketItemChooser.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-tool-common/src/components/TargetPacketItemChooser.vue @@ -308,11 +308,7 @@ export default { } this.internalDisabled = true const cmd = -<<<<<<< HEAD - this.mode === 'tlm' ? 'get_all_tlm_names' : 'get_all_command_names' -======= - this.mode === 'tlm' ? 'get_all_telemetry_names' : 'get_all_cmd_names' ->>>>>>> main + this.mode === 'tlm' ? 'get_all_tlm_names' : 'get_all_cmd_names' this.api[cmd](this.selectedTargetName).then((names) => { this.packetNames = names.map((name) => { return { @@ -342,11 +338,7 @@ export default { return } this.internalDisabled = true -<<<<<<< HEAD - const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_command' -======= - const cmd = this.mode === 'tlm' ? 'get_telemetry' : 'get_cmd' ->>>>>>> main + const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_cmd' this.api[cmd](this.selectedTargetName, this.selectedPacketName).then( (packet) => { this.itemNames = packet.items @@ -427,11 +419,7 @@ export default { return value === packet.value }) this.selectedPacketName = packet.value -<<<<<<< HEAD - const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_command' -======= - const cmd = this.mode === 'tlm' ? 'get_telemetry' : 'get_cmd' ->>>>>>> main + const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_cmd' this.api[cmd](this.selectedTargetName, this.selectedPacketName).then( (packet) => { this.description = packet.description