Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup tlm apis #970

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions docs.openc3.com/docs/guides/scripting-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_cmds |
| 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_cmds |
| get_cmd_log_filename | Command and Telemetry Server | Deprecated |
| get_cmd_param_list | Command and Telemetry Server | Deprecated, use get_cmd |
Expand Down Expand Up @@ -1249,6 +1249,7 @@ Ruby / Python Syntax:

```ruby
tlm("<Target Name> <Packet Name> <Item Name>")
tlm("<Target Name>", "<Packet Name>", "<Item Name>")
```

| Parameter | Description |
Expand All @@ -1262,6 +1263,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")
Expand All @@ -1273,6 +1275,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")
Expand All @@ -1282,11 +1285,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("<Target Name> <Packet Name>")['buffer']
buffer = get_tlm_buffer("<Target Name>", "<Packet Name>")['buffer']
```

Expand All @@ -1298,7 +1302,7 @@ buffer = get_tlm_buffer("<Target Name>", "<Packet Name>")['buffer']
Ruby / Python Example:

```ruby
packet = get_tlm_buffer("INST", "HEALTH_STATUS")
packet = get_tlm_buffer("INST HEALTH_STATUS")
packet['buffer']
```

Expand All @@ -1309,6 +1313,7 @@ Returns the names, values, and limits states of all telemetry items in a specifi
Ruby / Python Syntax:

```ruby
get_tlm_packet("<Target Name> <Packet Name>", <type>)
get_tlm_packet("<Target Name>", "<Packet Name>", <type>)
```

Expand All @@ -1321,13 +1326,13 @@ get_tlm_packet("<Target Name>", "<Packet Name>", <type>)
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)
Expand All @@ -1351,14 +1356,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("<Target Name>")
get_all_tlm("<Target Name>")
```

| Parameter | Description |
Expand All @@ -1368,7 +1373,7 @@ get_all_telemetry("<Target Name>")
Ruby / Python Example:

```ruby
packets = get_all_telemetry("INST")
packets = get_all_tlm("INST")
print(packets)
#[{"target_name"=>"INST",
# "packet_name"=>"ADCS",
Expand All @@ -1382,14 +1387,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("<Target Name>")
get_all_tlm_names("<Target Name>")
```

| Parameter | Description |
Expand All @@ -1399,17 +1404,18 @@ get_all_telemetry_names("<Target Name>")
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("<Target Name>", "<Packet Name>")
get_tlm("<Target Name> <Packet Name>")
get_tlm("<Target Name>", "<Packet Name>")
```

| Parameter | Description |
Expand All @@ -1420,7 +1426,7 @@ get_telemetry("<Target Name>", "<Packet Name>")
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",
Expand Down Expand Up @@ -1448,6 +1454,7 @@ Returns an item hash.
Ruby / Python Syntax:

```ruby
get_item("<Target Name> <Packet Name> <Item Name>")
get_item("<Target Name>", "<Packet Name>", "<Item Name>")
```

Expand All @@ -1460,7 +1467,7 @@ get_item("<Target Name>", "<Packet Name>", "<Item Name>")
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,
Expand All @@ -1479,6 +1486,7 @@ Returns the number of times a specified telemetry packet has been received.
Ruby / Python Syntax:

```ruby
get_tlm_cnt("<Target Name> <Packet Name>")
get_tlm_cnt("<Target Name>", "<Packet Name>")
```

Expand All @@ -1490,7 +1498,7 @@ get_tlm_cnt("<Target Name>", "<Packet Name>")
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
Expand Down Expand Up @@ -1737,6 +1745,7 @@ Get the receive count for a telemetry packet
Ruby / Python Syntax:

```ruby
get_tlm_cnt("<Target> <Packet>")
get_tlm_cnt("<Target>", "<Packet>")
```

Expand All @@ -1748,7 +1757,7 @@ get_tlm_cnt("<Target>", "<Packet>")
Ruby / Python Example:

```ruby
get_tlm_cnt("INST", "HEALTH_STATUS") #=> 10
get_tlm_cnt("INST HEALTH_STATUS") #=> 10
```

### get_tlm_cnts
Expand Down Expand Up @@ -1779,6 +1788,7 @@ Get the list of derived telemetry items for a packet
Ruby / Python Syntax:

```ruby
get_packet_derived_items("<Target> <Packet>")
get_packet_derived_items("<Target>", "<Packet>")
```

Expand All @@ -1790,7 +1800,7 @@ get_packet_derived_items("<Target>", "<Packet>")
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export default {
this.api.get_all_cmds(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
})
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_cmds'
const response = await this.api[method](target)
this.targets[target][cmdOrTlm] = response.reduce(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export default {
}
this.internalDisabled = true
const cmd =
this.mode === 'tlm' ? 'get_all_telemetry_names' : 'get_all_cmd_names'
this.mode === 'tlm' ? 'get_all_tlm_names' : 'get_all_cmd_names'
this.api[cmd](this.selectedTargetName).then((names) => {
this.packetNames = names.map((name) => {
return {
Expand Down Expand Up @@ -338,7 +338,7 @@ export default {
return
}
this.internalDisabled = true
const cmd = this.mode === 'tlm' ? 'get_telemetry' : 'get_cmd'
const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_cmd'
this.api[cmd](this.selectedTargetName, this.selectedPacketName).then(
(packet) => {
this.itemNames = packet.items
Expand Down Expand Up @@ -419,7 +419,7 @@ export default {
return value === packet.value
})
this.selectedPacketName = packet.value
const cmd = this.mode === 'tlm' ? 'get_telemetry' : 'get_cmd'
const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_cmd'
this.api[cmd](this.selectedTargetName, this.selectedPacketName).then(
(packet) => {
this.description = packet.description
Expand Down Expand Up @@ -485,7 +485,7 @@ export default {
allTargetPacketItems: function () {
this.packetNames.forEach((packetName) => {
if (packetName === this.ALL) return
const cmd = this.mode === 'tlm' ? 'get_telemetry' : 'get_cmd'
const cmd = this.mode === 'tlm' ? 'get_tlm' : 'get_cmd'
this.api[cmd](this.selectedTargetName, packetName.value).then(
(packet) => {
packet.items.forEach((item) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,22 +229,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])
}
Expand Down
Loading
Loading