openc3 5.17.0 → 5.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of openc3 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bin/openc3cli +1 -1
- data/data/config/_interfaces.yaml +4 -4
- data/data/config/command_modifiers.yaml +4 -0
- data/data/config/interface_modifiers.yaml +18 -8
- data/data/config/item_modifiers.yaml +34 -26
- data/data/config/microservice.yaml +4 -1
- data/data/config/param_item_modifiers.yaml +16 -0
- data/data/config/parameter_modifiers.yaml +29 -12
- data/data/config/plugins.yaml +3 -3
- data/data/config/screen.yaml +7 -7
- data/data/config/telemetry_modifiers.yaml +9 -4
- data/data/config/widgets.yaml +41 -14
- data/ext/openc3/ext/packet/packet.c +6 -0
- data/lib/openc3/accessors/accessor.rb +1 -0
- data/lib/openc3/accessors/binary_accessor.rb +170 -11
- data/lib/openc3/api/cmd_api.rb +39 -35
- data/lib/openc3/api/config_api.rb +10 -10
- data/lib/openc3/api/interface_api.rb +28 -21
- data/lib/openc3/api/limits_api.rb +29 -29
- data/lib/openc3/api/metrics_api.rb +3 -3
- data/lib/openc3/api/offline_access_api.rb +5 -5
- data/lib/openc3/api/router_api.rb +25 -19
- data/lib/openc3/api/settings_api.rb +10 -10
- data/lib/openc3/api/stash_api.rb +10 -10
- data/lib/openc3/api/target_api.rb +10 -10
- data/lib/openc3/api/tlm_api.rb +44 -44
- data/lib/openc3/conversions/bit_reverse_conversion.rb +60 -0
- data/lib/openc3/conversions/ip_read_conversion.rb +59 -0
- data/lib/openc3/conversions/ip_write_conversion.rb +61 -0
- data/lib/openc3/conversions/object_read_conversion.rb +88 -0
- data/lib/openc3/conversions/object_write_conversion.rb +38 -0
- data/lib/openc3/conversions.rb +6 -1
- data/lib/openc3/io/json_drb.rb +19 -21
- data/lib/openc3/io/json_rpc.rb +14 -13
- data/lib/openc3/microservices/microservice.rb +11 -11
- data/lib/openc3/microservices/scope_cleanup_microservice.rb +1 -1
- data/lib/openc3/microservices/timeline_microservice.rb +76 -51
- data/lib/openc3/models/activity_model.rb +25 -21
- data/lib/openc3/models/scope_model.rb +44 -13
- data/lib/openc3/models/sorted_model.rb +1 -1
- data/lib/openc3/models/target_model.rb +4 -1
- data/lib/openc3/operators/microservice_operator.rb +2 -2
- data/lib/openc3/operators/operator.rb +9 -9
- data/lib/openc3/packets/packet.rb +18 -1
- data/lib/openc3/packets/packet_config.rb +37 -16
- data/lib/openc3/packets/packet_item.rb +5 -0
- data/lib/openc3/packets/structure.rb +67 -3
- data/lib/openc3/packets/structure_item.rb +49 -12
- data/lib/openc3/script/calendar.rb +2 -2
- data/lib/openc3/script/extract.rb +5 -3
- data/lib/openc3/script/web_socket_api.rb +11 -0
- data/lib/openc3/topics/decom_interface_topic.rb +2 -1
- data/lib/openc3/topics/system_events_topic.rb +40 -0
- data/lib/openc3/utilities/authentication.rb +2 -1
- data/lib/openc3/utilities/authorization.rb +2 -2
- data/lib/openc3/version.rb +5 -5
- data/templates/tool_angular/package.json +5 -5
- data/templates/tool_react/package.json +8 -8
- data/templates/tool_svelte/package.json +10 -10
- data/templates/tool_vue/package.json +10 -10
- data/templates/widget/package.json +10 -10
- data/templates/widget/src/Widget.vue +0 -1
- metadata +22 -2
data/lib/openc3/api/tlm_api.rb
CHANGED
@@ -69,27 +69,27 @@ module OpenC3
|
|
69
69
|
# @param args [String|Array<String>] See the description for calling style
|
70
70
|
# @param type [Symbol] Telemetry type, :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS
|
71
71
|
# @return [Object] The telemetry value formatted as requested
|
72
|
-
def tlm(*args, type: :CONVERTED, cache_timeout: nil, scope: $openc3_scope, token: $openc3_token)
|
72
|
+
def tlm(*args, type: :CONVERTED, cache_timeout: nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
73
73
|
target_name, packet_name, item_name = _tlm_process_args(args, 'tlm', cache_timeout: cache_timeout, scope: scope)
|
74
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
74
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
75
75
|
CvtModel.get_item(target_name, packet_name, item_name, type: type.intern, cache_timeout: cache_timeout, scope: scope)
|
76
76
|
end
|
77
77
|
|
78
|
-
def tlm_raw(*args, cache_timeout: nil, scope: $openc3_scope, token: $openc3_token)
|
79
|
-
tlm(*args, type: :RAW, cache_timeout: cache_timeout, scope: scope, token: token)
|
78
|
+
def tlm_raw(*args, cache_timeout: nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
79
|
+
tlm(*args, type: :RAW, cache_timeout: cache_timeout, manual: manual, scope: scope, token: token)
|
80
80
|
end
|
81
81
|
|
82
|
-
def tlm_formatted(*args, cache_timeout: nil, scope: $openc3_scope, token: $openc3_token)
|
83
|
-
tlm(*args, type: :FORMATTED, cache_timeout: cache_timeout, scope: scope, token: token)
|
82
|
+
def tlm_formatted(*args, cache_timeout: nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
83
|
+
tlm(*args, type: :FORMATTED, cache_timeout: cache_timeout, manual: manual, scope: scope, token: token)
|
84
84
|
end
|
85
85
|
|
86
|
-
def tlm_with_units(*args, cache_timeout: nil, scope: $openc3_scope, token: $openc3_token)
|
87
|
-
tlm(*args, type: :WITH_UNITS, cache_timeout: cache_timeout, scope: scope, token: token)
|
86
|
+
def tlm_with_units(*args, cache_timeout: nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
87
|
+
tlm(*args, type: :WITH_UNITS, cache_timeout: cache_timeout, manual: manual, scope: scope, token: token)
|
88
88
|
end
|
89
89
|
|
90
90
|
# @deprecated Use tlm with type:
|
91
|
-
def tlm_variable(*args, cache_timeout: nil, scope: $openc3_scope, token: $openc3_token)
|
92
|
-
tlm(*args[0..-2], type: args[-1].intern, cache_timeout: cache_timeout, scope: scope, token: token)
|
91
|
+
def tlm_variable(*args, cache_timeout: nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
92
|
+
tlm(*args[0..-2], type: args[-1].intern, cache_timeout: cache_timeout, manual: manual, scope: scope, token: token)
|
93
93
|
end
|
94
94
|
|
95
95
|
# Set a telemetry item in the current value table.
|
@@ -107,9 +107,9 @@ module OpenC3
|
|
107
107
|
#
|
108
108
|
# @param args [String|Array<String>] See the description for calling style
|
109
109
|
# @param type [Symbol] Telemetry type, :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS
|
110
|
-
def set_tlm(*args, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
|
110
|
+
def set_tlm(*args, type: :CONVERTED, manual: false, scope: $openc3_scope, token: $openc3_token)
|
111
111
|
target_name, packet_name, item_name, value = _set_tlm_process_args(args, __method__, scope: scope)
|
112
|
-
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
112
|
+
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
113
113
|
CvtModel.set_item(target_name, packet_name, item_name, value, type: type.intern, scope: scope)
|
114
114
|
end
|
115
115
|
|
@@ -119,8 +119,8 @@ module OpenC3
|
|
119
119
|
# @param packet_name [String] Packet name of the packet
|
120
120
|
# @param item_hash [Hash] Hash of item_name and value for each item you want to change from the current value table
|
121
121
|
# @param type [Symbol] Telemetry type, :RAW, :CONVERTED (default), :FORMATTED, or :WITH_UNITS
|
122
|
-
def inject_tlm(target_name, packet_name, item_hash = nil, type: :CONVERTED, scope: $openc3_scope, token: $openc3_token)
|
123
|
-
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
122
|
+
def inject_tlm(target_name, packet_name, item_hash = nil, type: :CONVERTED, manual: false, scope: $openc3_scope, token: $openc3_token)
|
123
|
+
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
124
124
|
type = type.to_s.intern
|
125
125
|
target_name = target_name.upcase
|
126
126
|
packet_name = packet_name.upcase
|
@@ -168,15 +168,15 @@ module OpenC3
|
|
168
168
|
# three strings followed by a value (see the calling style in the
|
169
169
|
# description).
|
170
170
|
# @param type [Symbol] Telemetry type, :ALL (default), :RAW, :CONVERTED, :FORMATTED, :WITH_UNITS
|
171
|
-
def override_tlm(*args, type: :ALL, scope: $openc3_scope, token: $openc3_token)
|
171
|
+
def override_tlm(*args, type: :ALL, manual: false, scope: $openc3_scope, token: $openc3_token)
|
172
172
|
target_name, packet_name, item_name, value = _set_tlm_process_args(args, __method__, scope: scope)
|
173
|
-
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
173
|
+
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
174
174
|
CvtModel.override(target_name, packet_name, item_name, value, type: type.intern, scope: scope)
|
175
175
|
end
|
176
176
|
|
177
177
|
# Get the list of CVT overrides
|
178
|
-
def get_overrides(scope: $openc3_scope, token: $openc3_token)
|
179
|
-
authorize(permission: 'tlm', scope: scope, token: token)
|
178
|
+
def get_overrides(manual: false, scope: $openc3_scope, token: $openc3_token)
|
179
|
+
authorize(permission: 'tlm', manual: manual, scope: scope, token: token)
|
180
180
|
CvtModel.overrides(scope: scope)
|
181
181
|
end
|
182
182
|
|
@@ -193,9 +193,9 @@ module OpenC3
|
|
193
193
|
# (see the calling style in the description).
|
194
194
|
# @param type [Symbol] Telemetry type, :ALL (default), :RAW, :CONVERTED, :FORMATTED, :WITH_UNITS
|
195
195
|
# Also takes :ALL which means to normalize all telemetry types
|
196
|
-
def normalize_tlm(*args, type: :ALL, scope: $openc3_scope, token: $openc3_token)
|
196
|
+
def normalize_tlm(*args, type: :ALL, manual: false, scope: $openc3_scope, token: $openc3_token)
|
197
197
|
target_name, packet_name, item_name = _tlm_process_args(args, __method__, scope: scope)
|
198
|
-
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
198
|
+
authorize(permission: 'tlm_set', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
199
199
|
CvtModel.normalize(target_name, packet_name, item_name, type: type.intern, scope: scope)
|
200
200
|
end
|
201
201
|
|
@@ -204,9 +204,9 @@ module OpenC3
|
|
204
204
|
# @param target_name [String] Name of the target
|
205
205
|
# @param packet_name [String] Name of the packet
|
206
206
|
# @return [Hash] telemetry hash with last telemetry buffer
|
207
|
-
def get_tlm_buffer(*args, scope: $openc3_scope, token: $openc3_token)
|
207
|
+
def get_tlm_buffer(*args, manual: false, scope: $openc3_scope, token: $openc3_token)
|
208
208
|
target_name, packet_name = _extract_target_packet_names('get_tlm_buffer', *args)
|
209
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
209
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
210
210
|
TargetModel.packet(target_name, packet_name, scope: scope)
|
211
211
|
topic = "#{scope}__TELEMETRY__{#{target_name}}__#{packet_name}"
|
212
212
|
msg_id, msg_hash = Topic.get_newest_message(topic)
|
@@ -226,9 +226,9 @@ module OpenC3
|
|
226
226
|
# @return [Array<String, Object, Symbol|nil>] Returns an Array consisting
|
227
227
|
# of [item name, item value, item limits state] where the item limits
|
228
228
|
# state can be one of {OpenC3::Limits::LIMITS_STATES}
|
229
|
-
def get_tlm_packet(*args, stale_time: 30, type: :CONVERTED, cache_timeout: nil, scope: $openc3_scope, token: $openc3_token)
|
229
|
+
def get_tlm_packet(*args, stale_time: 30, type: :CONVERTED, cache_timeout: nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
230
230
|
target_name, packet_name = _extract_target_packet_names('get_tlm_packet', *args)
|
231
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
231
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
232
232
|
packet = TargetModel.packet(target_name, packet_name, scope: scope)
|
233
233
|
t = _validate_tlm_type(type)
|
234
234
|
raise ArgumentError, "Unknown type '#{type}' for #{target_name} #{packet_name}" if t.nil?
|
@@ -248,7 +248,7 @@ module OpenC3
|
|
248
248
|
# @return [Array<Object, Symbol>]
|
249
249
|
# Array consisting of the item value and limits state
|
250
250
|
# given as symbols such as :RED, :YELLOW, :STALE
|
251
|
-
def get_tlm_values(items, stale_time: 30, cache_timeout: nil, scope: $openc3_scope, token: $openc3_token)
|
251
|
+
def get_tlm_values(items, stale_time: 30, cache_timeout: nil, manual: false, scope: $openc3_scope, token: $openc3_token)
|
252
252
|
if !items.is_a?(Array) || !items[0].is_a?(String)
|
253
253
|
raise ArgumentError, "items must be array of strings: ['TGT__PKT__ITEM__TYPE', ...]"
|
254
254
|
end
|
@@ -265,7 +265,7 @@ module OpenC3
|
|
265
265
|
end
|
266
266
|
packets.uniq!
|
267
267
|
packets.each do |target_name, packet_name|
|
268
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
268
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
269
269
|
end
|
270
270
|
CvtModel.get_tlm_values(cvt_items, stale_time: stale_time, cache_timeout: cache_timeout, scope: scope)
|
271
271
|
end
|
@@ -275,9 +275,9 @@ module OpenC3
|
|
275
275
|
# @since 5.0.0
|
276
276
|
# @param target_name [String] Name of the target
|
277
277
|
# @return [Array<Hash>] Array of all telemetry packet hashes
|
278
|
-
def get_all_tlm(target_name, scope: $openc3_scope, token: $openc3_token)
|
278
|
+
def get_all_tlm(target_name, manual: false, scope: $openc3_scope, token: $openc3_token)
|
279
279
|
target_name = target_name.upcase
|
280
|
-
authorize(permission: 'tlm', target_name: target_name, scope: scope, token: token)
|
280
|
+
authorize(permission: 'tlm', target_name: target_name, manual: manual, scope: scope, token: token)
|
281
281
|
TargetModel.packets(target_name, type: :TLM, scope: scope)
|
282
282
|
end
|
283
283
|
alias get_all_telemetry get_all_tlm
|
@@ -287,9 +287,9 @@ module OpenC3
|
|
287
287
|
# @since 5.0.6
|
288
288
|
# @param target_name [String] Name of the target
|
289
289
|
# @return [Array<String>] Array of all telemetry packet names
|
290
|
-
def get_all_tlm_names(target_name, hidden: false, scope: $openc3_scope, token: $openc3_token)
|
290
|
+
def get_all_tlm_names(target_name, hidden: false, manual: false, scope: $openc3_scope, token: $openc3_token)
|
291
291
|
begin
|
292
|
-
packets = get_all_tlm(target_name, scope: scope, token: token)
|
292
|
+
packets = get_all_tlm(target_name, manual: manual, scope: scope, token: token)
|
293
293
|
rescue RuntimeError
|
294
294
|
packets = []
|
295
295
|
end
|
@@ -311,9 +311,9 @@ module OpenC3
|
|
311
311
|
# @param target_name [String] Name of the target
|
312
312
|
# @param packet_name [String] Name of the packet
|
313
313
|
# @return [Hash] Telemetry packet hash
|
314
|
-
def get_tlm(*args, scope: $openc3_scope, token: $openc3_token)
|
314
|
+
def get_tlm(*args, manual: false, scope: $openc3_scope, token: $openc3_token)
|
315
315
|
target_name, packet_name = _extract_target_packet_names('get_tlm', *args)
|
316
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
316
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
317
317
|
TargetModel.packet(target_name, packet_name, scope: scope)
|
318
318
|
end
|
319
319
|
alias get_telemetry get_tlm
|
@@ -325,9 +325,9 @@ module OpenC3
|
|
325
325
|
# @param packet_name [String] Name of the packet
|
326
326
|
# @param item_name [String] Name of the packet
|
327
327
|
# @return [Hash] Telemetry packet item hash
|
328
|
-
def get_item(*args, scope: $openc3_scope, token: $openc3_token)
|
328
|
+
def get_item(*args, manual: false, scope: $openc3_scope, token: $openc3_token)
|
329
329
|
target_name, packet_name, item_name = _extract_target_packet_item_names('get_item', *args)
|
330
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
330
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
331
331
|
TargetModel.packet_item(target_name, packet_name, item_name, scope: scope)
|
332
332
|
end
|
333
333
|
|
@@ -339,7 +339,7 @@ module OpenC3
|
|
339
339
|
#
|
340
340
|
# @param packets [Array<Array<String, String>>] Array of arrays consisting of target name, packet name
|
341
341
|
# @return [String] ID which should be passed to get_packets
|
342
|
-
def subscribe_packets(packets, scope: $openc3_scope, token: $openc3_token)
|
342
|
+
def subscribe_packets(packets, manual: false, scope: $openc3_scope, token: $openc3_token)
|
343
343
|
if !packets.is_a?(Array) || !packets[0].is_a?(Array)
|
344
344
|
raise ArgumentError, "packets must be nested array: [['TGT','PKT'],...]"
|
345
345
|
end
|
@@ -348,7 +348,7 @@ module OpenC3
|
|
348
348
|
packets.each do |target_name, packet_name|
|
349
349
|
target_name = target_name.upcase
|
350
350
|
packet_name = packet_name.upcase
|
351
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
351
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
352
352
|
topic = "#{scope}__DECOM__{#{target_name}}__#{packet_name}"
|
353
353
|
id, _ = Topic.get_newest_message(topic)
|
354
354
|
result[topic] = id ? id : '0-0'
|
@@ -363,8 +363,8 @@ module OpenC3
|
|
363
363
|
# @param block [Integer] Unused - Blocking must be implemented at the client
|
364
364
|
# @param count [Integer] Maximum number of packets to return from EACH packet stream
|
365
365
|
# @return [Array<String, Array<Hash>] Array of the ID and array of all packets found
|
366
|
-
def get_packets(id, block: nil, count: 1000, scope: $openc3_scope, token: $openc3_token)
|
367
|
-
authorize(permission: 'tlm', scope: scope, token: token)
|
366
|
+
def get_packets(id, block: nil, count: 1000, manual: false, scope: $openc3_scope, token: $openc3_token)
|
367
|
+
authorize(permission: 'tlm', manual: manual, scope: scope, token: token)
|
368
368
|
# Split the list of topic, ID values and turn it into a hash for easy updates
|
369
369
|
lookup = Hash[*id.split(SUBSCRIPTION_DELIMITER)]
|
370
370
|
xread = Topic.read_topics(lookup.keys, lookup.values, nil, count) # Always don't block
|
@@ -387,9 +387,9 @@ module OpenC3
|
|
387
387
|
# @param target_name [String] Name of the target
|
388
388
|
# @param packet_name [String] Name of the packet
|
389
389
|
# @return [Numeric] Receive count for the telemetry packet
|
390
|
-
def get_tlm_cnt(*args, scope: $openc3_scope, token: $openc3_token)
|
390
|
+
def get_tlm_cnt(*args, manual: false, scope: $openc3_scope, token: $openc3_token)
|
391
391
|
target_name, packet_name = _extract_target_packet_names('get_tlm_cnt', *args)
|
392
|
-
authorize(permission: 'system', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
392
|
+
authorize(permission: 'system', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
393
393
|
TargetModel.packet(target_name, packet_name, scope: scope)
|
394
394
|
Topic.get_cnt("#{scope}__TELEMETRY__{#{target_name}}__#{packet_name}")
|
395
395
|
end
|
@@ -398,8 +398,8 @@ module OpenC3
|
|
398
398
|
#
|
399
399
|
# @param target_packets [Array<Array<String, String>>] Array of arrays containing target_name, packet_name
|
400
400
|
# @return [Array<Numeric>] Receive count for the telemetry packets
|
401
|
-
def get_tlm_cnts(target_packets, scope: $openc3_scope, token: $openc3_token)
|
402
|
-
authorize(permission: 'system', scope: scope, token: token)
|
401
|
+
def get_tlm_cnts(target_packets, manual: false, scope: $openc3_scope, token: $openc3_token)
|
402
|
+
authorize(permission: 'system', manual: manual, scope: scope, token: token)
|
403
403
|
counts = []
|
404
404
|
target_packets.each do |target_name, packet_name|
|
405
405
|
target_name = target_name.upcase
|
@@ -414,9 +414,9 @@ module OpenC3
|
|
414
414
|
# @param target_name [String] Target name
|
415
415
|
# @param packet_name [String] Packet name
|
416
416
|
# @return [Array<String>] All of the ignored telemetry items for a packet.
|
417
|
-
def get_packet_derived_items(*args, scope: $openc3_scope, token: $openc3_token)
|
417
|
+
def get_packet_derived_items(*args, manual: false, scope: $openc3_scope, token: $openc3_token)
|
418
418
|
target_name, packet_name = _extract_target_packet_names('get_packet_derived_items', *args)
|
419
|
-
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, scope: scope, token: token)
|
419
|
+
authorize(permission: 'tlm', target_name: target_name, packet_name: packet_name, manual: manual, scope: scope, token: token)
|
420
420
|
packet = TargetModel.packet(target_name, packet_name, scope: scope)
|
421
421
|
return packet['items'].select { |item| item['data_type'] == 'DERIVED' }.map { |item| item['name'] }
|
422
422
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2024 OpenC3, Inc.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU Affero General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# This file may also be used under the terms of a commercial license
|
17
|
+
# if purchased from OpenC3, Inc.
|
18
|
+
|
19
|
+
require 'openc3/conversions/conversion'
|
20
|
+
|
21
|
+
module OpenC3
|
22
|
+
class BitReverseConversion < Conversion
|
23
|
+
def initialize(converted_type, converted_bit_size)
|
24
|
+
super()
|
25
|
+
@converted_type = converted_type.to_s.upcase.intern
|
26
|
+
@converted_bit_size = converted_bit_size.to_i
|
27
|
+
if @converted_type == :FLOAT
|
28
|
+
raise "Float Bit Reverse Not Yet Supported"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Perform the conversion on the value.
|
33
|
+
#
|
34
|
+
# @param value [Object] The value to convert
|
35
|
+
# @param packet [Packet] The packet which contains the value. This can
|
36
|
+
# be useful to reach into the packet and use other values in the
|
37
|
+
# conversion.
|
38
|
+
# @param buffer [String] The packet buffer
|
39
|
+
# @return The converted value
|
40
|
+
def call(value, _packet, _buffer)
|
41
|
+
reversed = 0
|
42
|
+
@converted_bit_size.times do
|
43
|
+
reversed = (reversed << 1) | (value & 1)
|
44
|
+
value >>= 1
|
45
|
+
end
|
46
|
+
return reversed & ((2 ** @converted_bit_size) - 1)
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [String] The conversion class
|
50
|
+
def to_s
|
51
|
+
"#{self.class.to_s.split('::')[-1]}.new(:#{@converted_type}, #{@converted_bit_size})"
|
52
|
+
end
|
53
|
+
|
54
|
+
# @param read_or_write [String] Either 'READ' or 'WRITE'
|
55
|
+
# @return [String] Config fragment for this conversion
|
56
|
+
def to_config(read_or_write)
|
57
|
+
" #{read_or_write}_CONVERSION #{self.class.name.class_name_to_filename} #{@converted_type} #{@converted_bit_size}\n"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2024 OpenC3, Inc.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU Affero General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# This file may also be used under the terms of a commercial license
|
17
|
+
# if purchased from OpenC3, Inc.
|
18
|
+
|
19
|
+
require 'openc3/conversions/conversion'
|
20
|
+
|
21
|
+
module OpenC3
|
22
|
+
class IpReadConversion < Conversion
|
23
|
+
def initialize
|
24
|
+
@converted_type = :STRING
|
25
|
+
@converted_bit_size = 120
|
26
|
+
@converted_array_size = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
# Perform the conversion on the value.
|
30
|
+
#
|
31
|
+
# @param value [Object] The value to convert
|
32
|
+
# @param packet [Packet] The packet which contains the value. This can
|
33
|
+
# be useful to reach into the packet and use other values in the
|
34
|
+
# conversion.
|
35
|
+
# @param buffer [String] The packet buffer
|
36
|
+
# @return The converted value
|
37
|
+
def call(value, _packet, _buffer)
|
38
|
+
byte4 = (value & 0xFF)
|
39
|
+
value = value >> 8
|
40
|
+
byte3 = (value & 0xFF)
|
41
|
+
value = value >> 8
|
42
|
+
byte2 = (value & 0xFF)
|
43
|
+
value = value >> 8
|
44
|
+
byte1 = (value & 0xFF)
|
45
|
+
return "#{byte1}.#{byte2}.#{byte3}.#{byte4}"
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [String] The conversion class
|
49
|
+
def to_s
|
50
|
+
"#{self.class.to_s.split('::')[-1]}.new"
|
51
|
+
end
|
52
|
+
|
53
|
+
# @param read_or_write [String] Either 'READ' or 'WRITE'
|
54
|
+
# @return [String] Config fragment for this conversion
|
55
|
+
def to_config(read_or_write)
|
56
|
+
" #{read_or_write}_CONVERSION #{self.class.name.class_name_to_filename}\n"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2024 OpenC3, Inc.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU Affero General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# This file may also be used under the terms of a commercial license
|
17
|
+
# if purchased from OpenC3, Inc.
|
18
|
+
|
19
|
+
require 'openc3/conversions/conversion'
|
20
|
+
|
21
|
+
module OpenC3
|
22
|
+
class IpWriteConversion < Conversion
|
23
|
+
def initialize
|
24
|
+
@converted_type = :UINT
|
25
|
+
@converted_bit_size = 32
|
26
|
+
@converted_array_size = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
# Perform the conversion on the value.
|
30
|
+
#
|
31
|
+
# @param value [Object] The value to convert
|
32
|
+
# @param packet [Packet] The packet which contains the value. This can
|
33
|
+
# be useful to reach into the packet and use other values in the
|
34
|
+
# conversion.
|
35
|
+
# @param buffer [String] The packet buffer
|
36
|
+
# @return The converted value
|
37
|
+
def call(value, _packet, _buffer)
|
38
|
+
bytes = value.split('.')
|
39
|
+
result = 0
|
40
|
+
result += Integer(bytes[0])
|
41
|
+
result = result << 8
|
42
|
+
result += Integer(bytes[1])
|
43
|
+
result = result << 8
|
44
|
+
result += Integer(bytes[2])
|
45
|
+
result = result << 8
|
46
|
+
result += Integer(bytes[3])
|
47
|
+
return result
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [String] The conversion class
|
51
|
+
def to_s
|
52
|
+
"#{self.class.to_s.split('::')[-1]}.new"
|
53
|
+
end
|
54
|
+
|
55
|
+
# @param read_or_write [String] Either 'READ' or 'WRITE'
|
56
|
+
# @return [String] Config fragment for this conversion
|
57
|
+
def to_config(read_or_write)
|
58
|
+
" #{read_or_write}_CONVERSION #{self.class.name.class_name_to_filename}\n"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2024 OpenC3, Inc.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU Affero General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# This file may also be used under the terms of a commercial license
|
17
|
+
# if purchased from OpenC3, Inc.
|
18
|
+
|
19
|
+
require 'openc3/config/config_parser'
|
20
|
+
require 'openc3/conversions/conversion'
|
21
|
+
|
22
|
+
module OpenC3
|
23
|
+
class ObjectReadConversion < Conversion
|
24
|
+
def initialize(cmd_or_tlm, target_name, packet_name)
|
25
|
+
super()
|
26
|
+
cmd_or_tlm = ConfigParser.handle_nil(cmd_or_tlm)
|
27
|
+
if cmd_or_tlm
|
28
|
+
@cmd_or_tlm = cmd_or_tlm.to_s.upcase.intern
|
29
|
+
raise ArgumentError, "Unknown type: #{cmd_or_tlm}" unless %i(CMD TLM COMMAND TELEMETRY).include?(@cmd_or_tlm)
|
30
|
+
else
|
31
|
+
# Unknown - Will need to search
|
32
|
+
@cmd_or_tlm = nil
|
33
|
+
end
|
34
|
+
@target_name = target_name.to_s.upcase
|
35
|
+
@packet_name = packet_name.to_s.upcase
|
36
|
+
@converted_type = :OBJECT
|
37
|
+
@converted_bit_size = 0
|
38
|
+
end
|
39
|
+
|
40
|
+
def lookup_packet
|
41
|
+
if @cmd_or_tlm
|
42
|
+
if @cmd_or_tlm == :CMD or @cmd_or_tlm == :COMMAND
|
43
|
+
return System.commands.packet(@target_name, @packet_name)
|
44
|
+
else
|
45
|
+
return System.telemetry.packet(@target_name, @packet_name)
|
46
|
+
end
|
47
|
+
else
|
48
|
+
# Always searches commands first
|
49
|
+
begin
|
50
|
+
return System.commands.packet(@target_name, @packet_name)
|
51
|
+
rescue
|
52
|
+
return System.telemetry.packet(@target_name, @packet_name)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Perform the conversion on the value.
|
58
|
+
#
|
59
|
+
# @param value [String] The BLOCK data to make into a packet
|
60
|
+
# @param packet [Packet] Unused
|
61
|
+
# @param buffer [String] The packet buffer
|
62
|
+
# @return The converted value
|
63
|
+
def call(value, _packet, buffer)
|
64
|
+
fill_packet = lookup_packet()
|
65
|
+
fill_packet.buffer = value
|
66
|
+
return fill_packet.read_all(:CONVERTED, buffer, true).to_h
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [String] The conversion class
|
70
|
+
def to_s
|
71
|
+
"#{self.class.to_s.split('::')[-1]} #{@cmd_or_tlm ? @cmd_or_tlm : "nil"} #{@target_name} #{@packet_name}"
|
72
|
+
end
|
73
|
+
|
74
|
+
# @param read_or_write [String] Not used
|
75
|
+
# @return [String] Config fragment for this conversion
|
76
|
+
def to_config(read_or_write)
|
77
|
+
" #{read_or_write}_CONVERSION #{self.class.name.class_name_to_filename} #{@cmd_or_tlm ? @cmd_or_tlm : "nil"} #{@target_name} #{@packet_name}\n"
|
78
|
+
end
|
79
|
+
|
80
|
+
def as_json(*a)
|
81
|
+
result = super(*a)
|
82
|
+
result['cmd_or_tlm'] = @cmd_or_tlm
|
83
|
+
result['target_name'] = @target_name
|
84
|
+
result['packet_name'] = @packet_name
|
85
|
+
return result
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: ascii-8bit
|
2
|
+
|
3
|
+
# Copyright 2024 OpenC3, Inc.
|
4
|
+
# All Rights Reserved.
|
5
|
+
#
|
6
|
+
# This program is free software; you can modify and/or redistribute it
|
7
|
+
# under the terms of the GNU Affero General Public License
|
8
|
+
# as published by the Free Software Foundation; version 3 with
|
9
|
+
# attribution addendums as found in the LICENSE.txt
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU Affero General Public License for more details.
|
15
|
+
#
|
16
|
+
# This file may also be used under the terms of a commercial license
|
17
|
+
# if purchased from OpenC3, Inc.
|
18
|
+
|
19
|
+
require 'openc3/conversions/object_read_conversion'
|
20
|
+
|
21
|
+
module OpenC3
|
22
|
+
class ObjectWriteConversion < ObjectReadConversion
|
23
|
+
# Perform the conversion on the value.
|
24
|
+
#
|
25
|
+
# @param value [Object] Hash of packet key/value pairs
|
26
|
+
# @param packet [Packet] Unused
|
27
|
+
# @param buffer [String] The packet buffer
|
28
|
+
# @return Raw BLOCK data
|
29
|
+
def call(value, _packet, buffer)
|
30
|
+
fill_packet = lookup_packet()
|
31
|
+
fill_packet.restore_defaults()
|
32
|
+
value.each do |key, write_value|
|
33
|
+
fill_packet.write(key, write_value)
|
34
|
+
end
|
35
|
+
return fill_packet.buffer
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/openc3/conversions.rb
CHANGED
@@ -17,12 +17,17 @@
|
|
17
17
|
# All changes Copyright 2022, OpenC3, Inc.
|
18
18
|
# All Rights Reserved
|
19
19
|
#
|
20
|
-
# This file may also be used under the terms of a commercial license
|
20
|
+
# This file may also be used under the terms of a commercial license
|
21
21
|
# if purchased from OpenC3, Inc.
|
22
22
|
|
23
23
|
module OpenC3
|
24
24
|
autoload(:Conversion, 'openc3/conversions/conversion.rb')
|
25
|
+
autoload(:BitReverseConversion, 'openc3/conversions/bit_reverse_conversion.rb')
|
25
26
|
autoload(:GenericConversion, 'openc3/conversions/generic_conversion.rb')
|
27
|
+
autoload(:IpReadConversion, 'openc3/conversions/ip_read_conversion.rb')
|
28
|
+
autoload(:IpWriteConversion, 'openc3/conversions/ip_write_conversion.rb')
|
29
|
+
autoload(:ObjectReadConversion, 'openc3/conversions/object_read_conversion.rb')
|
30
|
+
autoload(:ObjectWriteConversion, 'openc3/conversions/object_write_conversion.rb')
|
26
31
|
autoload(:PacketTimeFormattedConversion, 'openc3/conversions/packet_time_formatted_conversion.rb')
|
27
32
|
autoload(:PacketTimeSecondsConversion, 'openc3/conversions/packet_time_seconds_conversion.rb')
|
28
33
|
autoload(:PolynomialConversion, 'openc3/conversions/polynomial_conversion.rb')
|