openc3 5.5.2 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/openc3cli +167 -69
- data/data/config/_interfaces.yaml +1 -6
- data/data/config/interface_modifiers.yaml +55 -4
- data/data/config/microservice.yaml +30 -3
- data/ext/openc3/ext/crc/crc.c +82 -1
- data/lib/openc3/api/cmd_api.rb +19 -7
- data/lib/openc3/api/tlm_api.rb +13 -12
- data/lib/openc3/bridge/bridge_config.rb +4 -4
- data/lib/openc3/config/config_parser.rb +1 -0
- data/lib/openc3/conversions/unix_time_conversion.rb +3 -1
- data/lib/openc3/ext/.keep +0 -0
- data/lib/openc3/interfaces/interface.rb +54 -26
- data/lib/openc3/interfaces/serial_interface.rb +4 -5
- data/lib/openc3/interfaces/simulated_target_interface.rb +4 -4
- data/lib/openc3/interfaces/stream_interface.rb +2 -2
- data/lib/openc3/interfaces/tcpip_client_interface.rb +4 -3
- data/lib/openc3/interfaces/tcpip_server_interface.rb +18 -19
- data/lib/openc3/interfaces/udp_interface.rb +10 -4
- data/lib/openc3/io/json_api.rb +72 -0
- data/lib/openc3/io/serial_driver.rb +4 -5
- data/lib/openc3/logs/buffered_packet_log_writer.rb +2 -4
- data/lib/openc3/logs/log_writer.rb +9 -8
- data/lib/openc3/logs/packet_log_reader.rb +8 -1
- data/lib/openc3/logs/packet_log_writer.rb +3 -4
- data/lib/openc3/logs/stream_log.rb +116 -0
- data/lib/openc3/logs/stream_log_pair.rb +70 -0
- data/lib/openc3/microservices/cleanup_microservice.rb +1 -1
- data/lib/openc3/microservices/decom_microservice.rb +17 -2
- data/lib/openc3/microservices/interface_decom_common.rb +42 -0
- data/lib/openc3/microservices/interface_microservice.rb +24 -17
- data/lib/openc3/microservices/router_microservice.rb +46 -4
- data/lib/openc3/migrations/20221202214600_add_target_names.rb +1 -1
- data/lib/openc3/migrations/20230319154100_log_stream.rb +40 -0
- data/lib/openc3/migrations/20230413101100_remove_log.rb +30 -0
- data/lib/openc3/models/gem_model.rb +2 -2
- data/lib/openc3/models/interface_model.rb +13 -14
- data/lib/openc3/models/metadata_model.rb +1 -1
- data/lib/openc3/models/note_model.rb +1 -1
- data/lib/openc3/models/plugin_model.rb +3 -2
- data/lib/openc3/operators/operator.rb +2 -0
- data/lib/openc3/packets/commands.rb +2 -0
- data/lib/openc3/packets/packet_config.rb +3 -2
- data/lib/openc3/packets/parsers/xtce_converter.rb +2 -1
- data/lib/openc3/script/gems.rb +125 -0
- data/lib/openc3/script/plugins.rb +186 -0
- data/lib/openc3/script/screen.rb +119 -0
- data/lib/openc3/script/script.rb +3 -0
- data/lib/openc3/script/script_runner.rb +19 -8
- data/lib/openc3/script/suite_results.rb +2 -2
- data/lib/openc3/script/web_socket_api.rb +5 -1
- data/lib/openc3/streams/serial_stream.rb +14 -11
- data/lib/openc3/streams/tcpip_client_stream.rb +5 -2
- data/lib/openc3/streams/tcpip_socket_stream.rb +37 -71
- data/lib/openc3/streams/web_socket_client_stream.rb +5 -3
- data/lib/openc3/system/system.rb +2 -0
- data/lib/openc3/topics/interface_topic.rb +13 -4
- data/lib/openc3/topics/router_topic.rb +6 -6
- data/lib/openc3/topics/telemetry_decom_topic.rb +10 -1
- data/lib/openc3/utilities/bucket_utilities.rb +12 -5
- data/lib/openc3/utilities/cli_generator.rb +56 -4
- data/lib/openc3/utilities/crc.rb +42 -7
- data/lib/openc3/utilities/process_manager.rb +3 -1
- data/lib/openc3/utilities/ruby_lex_utils.rb +265 -504
- data/lib/openc3/version.rb +6 -6
- data/templates/conversion/conversion.rb +10 -2
- data/templates/microservice/microservices/TEMPLATE/microservice.rb +1 -1
- data/templates/plugin/Rakefile +8 -1
- data/templates/widget/.browserslistrc +16 -0
- data/templates/widget/.eslintrc.js +43 -0
- data/templates/widget/.nycrc +3 -0
- data/templates/widget/.prettierrc.js +5 -0
- data/templates/widget/LICENSE.txt +20 -0
- data/templates/widget/Rakefile +24 -0
- data/templates/widget/babel.config.json +11 -0
- data/templates/widget/package.json +35 -0
- data/templates/widget/src/Widget.vue +46 -0
- data/templates/widget/vue.config.js +25 -0
- data/templates/widget/yarn.lock +8938 -0
- metadata +23 -4
- data/lib/openc3/io/raw_logger.rb +0 -170
- data/lib/openc3/io/raw_logger_pair.rb +0 -80
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openc3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Melton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -811,6 +811,7 @@ files:
|
|
811
811
|
- lib/openc3/core_ext/stringio.rb
|
812
812
|
- lib/openc3/core_ext/tempfile.rb
|
813
813
|
- lib/openc3/core_ext/time.rb
|
814
|
+
- lib/openc3/ext/.keep
|
814
815
|
- lib/openc3/interfaces.rb
|
815
816
|
- lib/openc3/interfaces/interface.rb
|
816
817
|
- lib/openc3/interfaces/linc_interface.rb
|
@@ -833,6 +834,7 @@ files:
|
|
833
834
|
- lib/openc3/interfaces/udp_interface.rb
|
834
835
|
- lib/openc3/io/buffered_file.rb
|
835
836
|
- lib/openc3/io/io_multiplexer.rb
|
837
|
+
- lib/openc3/io/json_api.rb
|
836
838
|
- lib/openc3/io/json_api_object.rb
|
837
839
|
- lib/openc3/io/json_drb.rb
|
838
840
|
- lib/openc3/io/json_drb_object.rb
|
@@ -840,8 +842,6 @@ files:
|
|
840
842
|
- lib/openc3/io/json_rpc.rb
|
841
843
|
- lib/openc3/io/openc3_snmp.rb
|
842
844
|
- lib/openc3/io/posix_serial_driver.rb
|
843
|
-
- lib/openc3/io/raw_logger.rb
|
844
|
-
- lib/openc3/io/raw_logger_pair.rb
|
845
845
|
- lib/openc3/io/serial_driver.rb
|
846
846
|
- lib/openc3/io/stderr.rb
|
847
847
|
- lib/openc3/io/stdout.rb
|
@@ -854,9 +854,12 @@ files:
|
|
854
854
|
- lib/openc3/logs/packet_log_constants.rb
|
855
855
|
- lib/openc3/logs/packet_log_reader.rb
|
856
856
|
- lib/openc3/logs/packet_log_writer.rb
|
857
|
+
- lib/openc3/logs/stream_log.rb
|
858
|
+
- lib/openc3/logs/stream_log_pair.rb
|
857
859
|
- lib/openc3/logs/text_log_writer.rb
|
858
860
|
- lib/openc3/microservices/cleanup_microservice.rb
|
859
861
|
- lib/openc3/microservices/decom_microservice.rb
|
862
|
+
- lib/openc3/microservices/interface_decom_common.rb
|
860
863
|
- lib/openc3/microservices/interface_microservice.rb
|
861
864
|
- lib/openc3/microservices/log_microservice.rb
|
862
865
|
- lib/openc3/microservices/microservice.rb
|
@@ -871,6 +874,8 @@ files:
|
|
871
874
|
- lib/openc3/microservices/trigger_group_microservice.rb
|
872
875
|
- lib/openc3/migrations/20221202214600_add_target_names.rb
|
873
876
|
- lib/openc3/migrations/20221210174900_convert_to_multi.rb
|
877
|
+
- lib/openc3/migrations/20230319154100_log_stream.rb
|
878
|
+
- lib/openc3/migrations/20230413101100_remove_log.rb
|
874
879
|
- lib/openc3/models/activity_model.rb
|
875
880
|
- lib/openc3/models/auth_model.rb
|
876
881
|
- lib/openc3/models/cvt_model.rb
|
@@ -939,8 +944,11 @@ files:
|
|
939
944
|
- lib/openc3/script/commands.rb
|
940
945
|
- lib/openc3/script/exceptions.rb
|
941
946
|
- lib/openc3/script/extract.rb
|
947
|
+
- lib/openc3/script/gems.rb
|
942
948
|
- lib/openc3/script/limits.rb
|
943
949
|
- lib/openc3/script/metadata.rb
|
950
|
+
- lib/openc3/script/plugins.rb
|
951
|
+
- lib/openc3/script/screen.rb
|
944
952
|
- lib/openc3/script/script.rb
|
945
953
|
- lib/openc3/script/script_runner.rb
|
946
954
|
- lib/openc3/script/storage.rb
|
@@ -1031,6 +1039,17 @@ files:
|
|
1031
1039
|
- templates/target/targets/TARGET/procedures/procedure.rb
|
1032
1040
|
- templates/target/targets/TARGET/screens/status.txt
|
1033
1041
|
- templates/target/targets/TARGET/target.txt
|
1042
|
+
- templates/widget/.browserslistrc
|
1043
|
+
- templates/widget/.eslintrc.js
|
1044
|
+
- templates/widget/.nycrc
|
1045
|
+
- templates/widget/.prettierrc.js
|
1046
|
+
- templates/widget/LICENSE.txt
|
1047
|
+
- templates/widget/Rakefile
|
1048
|
+
- templates/widget/babel.config.json
|
1049
|
+
- templates/widget/package.json
|
1050
|
+
- templates/widget/src/Widget.vue
|
1051
|
+
- templates/widget/vue.config.js
|
1052
|
+
- templates/widget/yarn.lock
|
1034
1053
|
homepage: https://github.com/OpenC3/openc3
|
1035
1054
|
licenses:
|
1036
1055
|
- AGPL-3.0-only
|
data/lib/openc3/io/raw_logger.rb
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
# encoding: ascii-8bit
|
2
|
-
|
3
|
-
# Copyright 2022 Ball Aerospace & Technologies Corp.
|
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
|
-
# Modified by OpenC3, Inc.
|
17
|
-
# All changes Copyright 2022, OpenC3, Inc.
|
18
|
-
# All Rights Reserved
|
19
|
-
#
|
20
|
-
# This file may also be used under the terms of a commercial license
|
21
|
-
# if purchased from OpenC3, Inc.
|
22
|
-
|
23
|
-
require 'thread'
|
24
|
-
require 'socket' # For gethostname
|
25
|
-
require 'openc3/config/config_parser'
|
26
|
-
|
27
|
-
module OpenC3
|
28
|
-
# Creates a log file of raw data for either reads or writes. Can automatically
|
29
|
-
# cycle the log based on when the log file reaches a predefined size.
|
30
|
-
class RawLogger
|
31
|
-
# @return [String] The filename of the log
|
32
|
-
attr_reader :filename
|
33
|
-
|
34
|
-
# @return [Queue] Queue for asynchronous logging
|
35
|
-
attr_reader :queue
|
36
|
-
|
37
|
-
# @return [Boolean] Is logging enabled?
|
38
|
-
attr_reader :logging_enabled
|
39
|
-
|
40
|
-
# @return [String] Original name passed to raw logger
|
41
|
-
attr_reader :orig_name
|
42
|
-
|
43
|
-
# The allowable log types
|
44
|
-
LOG_TYPES = [:READ, :WRITE]
|
45
|
-
|
46
|
-
# The cycle time interval. Cycle times are only checked at this level of
|
47
|
-
# granularity.
|
48
|
-
CYCLE_TIME_INTERVAL = 60
|
49
|
-
|
50
|
-
# @param log_name [String] The name of the raw logger. Typically matches the
|
51
|
-
# name of the corresponding interface
|
52
|
-
# @param log_type [Symbol] The type of log to create. Must be :READ
|
53
|
-
# or :WRITE.
|
54
|
-
# @param log_directory [String] The directory to store the log files.
|
55
|
-
# @param logging_enabled [Boolean] Whether to enable raw logging
|
56
|
-
# @param cycle_size [Integer] The size in bytes before creating a new log file.
|
57
|
-
def initialize(
|
58
|
-
log_name,
|
59
|
-
log_type,
|
60
|
-
log_directory,
|
61
|
-
logging_enabled = false,
|
62
|
-
cycle_size = 2000000000
|
63
|
-
)
|
64
|
-
raise "log_type must be :READ or :WRITE" unless LOG_TYPES.include? log_type
|
65
|
-
|
66
|
-
@log_type = log_type
|
67
|
-
@orig_name = log_name
|
68
|
-
@log_name = (log_name.to_s.downcase + '_raw_' + @log_type.to_s.downcase + '_' + self.object_id.to_s).freeze
|
69
|
-
@log_directory = log_directory
|
70
|
-
@cycle_size = ConfigParser.handle_nil(cycle_size)
|
71
|
-
@cycle_size = Integer(@cycle_size) if @cycle_size
|
72
|
-
@mutex = Mutex.new
|
73
|
-
@file = nil
|
74
|
-
@filename = nil
|
75
|
-
@start_time = Time.now.sys
|
76
|
-
@logging_enabled = ConfigParser.handle_true_false(logging_enabled)
|
77
|
-
end
|
78
|
-
|
79
|
-
# Set the raw logger name
|
80
|
-
# @param log_name [String] new name
|
81
|
-
def name=(log_name)
|
82
|
-
@orig_name = log_name
|
83
|
-
@log_name = (log_name.to_s.downcase + '_raw_' + @log_type.to_s.downcase + '_' + self.object_id.to_s).freeze
|
84
|
-
end
|
85
|
-
|
86
|
-
# Write data to the log file.
|
87
|
-
#
|
88
|
-
# If no log file currently exists in the filesystem, a new file will be
|
89
|
-
# created.
|
90
|
-
#
|
91
|
-
# Writing a log file is a critical operation so the entire method is
|
92
|
-
# wrapped with a rescue and handled with handle_critical_exception
|
93
|
-
#
|
94
|
-
# @param data [String] The data to write to the log file
|
95
|
-
def write(data)
|
96
|
-
if @logging_enabled
|
97
|
-
return if !data or data.length <= 0
|
98
|
-
|
99
|
-
need_new_file = false
|
100
|
-
@mutex.synchronize do
|
101
|
-
if !@file or (@cycle_size and (@file.stat.size + data.length) > @cycle_size)
|
102
|
-
need_new_file = true
|
103
|
-
end
|
104
|
-
end
|
105
|
-
start_new_file() if need_new_file
|
106
|
-
@mutex.synchronize { @file.write(data) if @file }
|
107
|
-
end
|
108
|
-
rescue => err
|
109
|
-
Logger.instance.error "Error writing #{@filename} : #{err.formatted}"
|
110
|
-
OpenC3.handle_critical_exception(err)
|
111
|
-
end
|
112
|
-
|
113
|
-
# Starts a new log file by closing the existing log file. New log files are
|
114
|
-
# not created until data is written by {#write} so this does not
|
115
|
-
# immediately create a log file on the filesystem.
|
116
|
-
def start
|
117
|
-
close_file() unless (Time.now.sys - @start_time) < 1.0 # Prevent close/open too fast
|
118
|
-
@mutex.synchronize { @logging_enabled = true }
|
119
|
-
end
|
120
|
-
|
121
|
-
# Stops all logging and closes the current log file.
|
122
|
-
def stop
|
123
|
-
@mutex.synchronize { @logging_enabled = false }
|
124
|
-
close_file()
|
125
|
-
end
|
126
|
-
|
127
|
-
# Create a clone of this object with a new name
|
128
|
-
def clone
|
129
|
-
raw_logger = super()
|
130
|
-
raw_logger.name = raw_logger.orig_name
|
131
|
-
raw_logger
|
132
|
-
end
|
133
|
-
|
134
|
-
protected
|
135
|
-
|
136
|
-
# Starting a new log file is a critical operation so the entire method is
|
137
|
-
# wrapped with a rescue and handled with handle_critical_exception
|
138
|
-
def start_new_file
|
139
|
-
close_file()
|
140
|
-
@mutex.synchronize do
|
141
|
-
@filename = File.join(@log_directory, File.build_timestamped_filename([@log_name], '.bin'))
|
142
|
-
@file = File.new(@filename, 'wb')
|
143
|
-
@start_time = Time.now.sys
|
144
|
-
Logger.instance.info "Raw Log File Opened : #{@filename}"
|
145
|
-
end
|
146
|
-
rescue => err
|
147
|
-
Logger.instance.error "Error opening #{@filename} : #{err.formatted}"
|
148
|
-
@logging_enabled = false
|
149
|
-
OpenC3.handle_critical_exception(err)
|
150
|
-
end
|
151
|
-
|
152
|
-
# Closing a log file isn't critical so we just log an error
|
153
|
-
def close_file
|
154
|
-
@mutex.synchronize do
|
155
|
-
if @file
|
156
|
-
begin
|
157
|
-
@file.close unless @file.closed?
|
158
|
-
File.chmod(0444, @file.path) # Make file read only
|
159
|
-
Logger.instance.info "Raw Log File Closed : #{@filename}"
|
160
|
-
rescue => err
|
161
|
-
Logger.instance.error "Error closing #{@filename} : #{err.formatted}"
|
162
|
-
end
|
163
|
-
|
164
|
-
@file = nil
|
165
|
-
@filename = nil
|
166
|
-
end
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# encoding: ascii-8bit
|
2
|
-
|
3
|
-
# Copyright 2022 Ball Aerospace & Technologies Corp.
|
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
|
-
# Modified by OpenC3, Inc.
|
17
|
-
# All changes Copyright 2022, OpenC3, Inc.
|
18
|
-
# All Rights Reserved
|
19
|
-
#
|
20
|
-
# This file may also be used under the terms of a commercial license
|
21
|
-
# if purchased from OpenC3, Inc.
|
22
|
-
|
23
|
-
require 'openc3/io/raw_logger'
|
24
|
-
|
25
|
-
module OpenC3
|
26
|
-
# Holds a read/write pair of raw loggers
|
27
|
-
class RawLoggerPair
|
28
|
-
# @return [RawLogger] The read logger
|
29
|
-
attr_accessor :read_logger
|
30
|
-
# @return [RawLogger] The write logger
|
31
|
-
attr_accessor :write_logger
|
32
|
-
|
33
|
-
# @param name [String] name to be added to log filenames
|
34
|
-
# @param log_directory [String] The directory to store the log files
|
35
|
-
# @param params [Array] raw log writer parameters or empty array
|
36
|
-
def initialize(name, log_directory, params = [])
|
37
|
-
if params.empty?
|
38
|
-
raw_logger_class = RawLogger
|
39
|
-
else
|
40
|
-
raw_logger_class = OpenC3.require_class(params[0])
|
41
|
-
end
|
42
|
-
if params[1]
|
43
|
-
@read_logger = raw_logger_class.new(name, :READ, log_directory, *params[1..-1])
|
44
|
-
@write_logger = raw_logger_class.new(name, :WRITE, log_directory, *params[1..-1])
|
45
|
-
else
|
46
|
-
@read_logger = raw_logger_class.new(name, :READ, log_directory)
|
47
|
-
@write_logger = raw_logger_class.new(name, :WRITE, log_directory)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Change the raw logger name
|
52
|
-
# @param name [String] new name
|
53
|
-
def name=(name)
|
54
|
-
@read_logger.name = name
|
55
|
-
@write_logger.name = name
|
56
|
-
end
|
57
|
-
|
58
|
-
# Start raw logging
|
59
|
-
def start
|
60
|
-
@read_logger.start
|
61
|
-
@write_logger.start
|
62
|
-
end
|
63
|
-
|
64
|
-
# Close any open raw data log files
|
65
|
-
def stop
|
66
|
-
@read_logger.stop
|
67
|
-
@write_logger.stop
|
68
|
-
end
|
69
|
-
|
70
|
-
# Clone the raw logger pair
|
71
|
-
def clone
|
72
|
-
raw_logger_pair = super()
|
73
|
-
raw_logger_pair.read_logger = @read_logger.clone
|
74
|
-
raw_logger_pair.write_logger = @write_logger.clone
|
75
|
-
raw_logger_pair.read_logger.start if @read_logger.logging_enabled
|
76
|
-
raw_logger_pair.write_logger.start if @write_logger.logging_enabled
|
77
|
-
raw_logger_pair
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|