openc3 5.0.6
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.
- checksums.yaml +7 -0
- data/Gemfile +18 -0
- data/Guardfile +35 -0
- data/LICENSE.txt +727 -0
- data/README.md +37 -0
- data/Rakefile +131 -0
- data/bin/cstol_converter +1178 -0
- data/bin/openc3cli +531 -0
- data/bin/rubysloc +139 -0
- data/data/config/_array_params.yaml +23 -0
- data/data/config/_id_items.yaml +24 -0
- data/data/config/_id_params.yaml +58 -0
- data/data/config/_interfaces.yaml +214 -0
- data/data/config/_interfaces.yaml.err +1017 -0
- data/data/config/_items.yaml +20 -0
- data/data/config/_params.yaml +60 -0
- data/data/config/cmd_tlm_server.yaml +136 -0
- data/data/config/command.yaml +44 -0
- data/data/config/command_modifiers.yaml +160 -0
- data/data/config/command_telemetry.yaml +3 -0
- data/data/config/interface_modifiers.yaml +104 -0
- data/data/config/item_modifiers.yaml +221 -0
- data/data/config/microservice.yaml +78 -0
- data/data/config/param_item_modifiers.yaml +52 -0
- data/data/config/parameter_modifiers.yaml +200 -0
- data/data/config/plugins.yaml +80 -0
- data/data/config/protocols.yaml +290 -0
- data/data/config/screen.yaml +147 -0
- data/data/config/table_manager.yaml +89 -0
- data/data/config/table_parameter_modifiers.yaml +9 -0
- data/data/config/target.yaml +142 -0
- data/data/config/target_config.yaml +94 -0
- data/data/config/telemetry.yaml +87 -0
- data/data/config/telemetry_modifiers.yaml +159 -0
- data/data/config/tool.yaml +63 -0
- data/data/config/unknown.yaml +3 -0
- data/data/config/widgets.yaml +1505 -0
- data/ext/mkrf_conf.rb +49 -0
- data/ext/openc3/ext/array/array.c +122 -0
- data/ext/openc3/ext/array/extconf.rb +13 -0
- data/ext/openc3/ext/buffered_file/buffered_file.c +198 -0
- data/ext/openc3/ext/buffered_file/extconf.rb +13 -0
- data/ext/openc3/ext/config_parser/config_parser.c +280 -0
- data/ext/openc3/ext/config_parser/extconf.rb +13 -0
- data/ext/openc3/ext/crc/crc.c +351 -0
- data/ext/openc3/ext/crc/extconf.rb +13 -0
- data/ext/openc3/ext/openc3_io/extconf.rb +13 -0
- data/ext/openc3/ext/openc3_io/openc3_io.c +158 -0
- data/ext/openc3/ext/packet/extconf.rb +13 -0
- data/ext/openc3/ext/packet/packet.c +318 -0
- data/ext/openc3/ext/platform/extconf.rb +13 -0
- data/ext/openc3/ext/platform/platform.c +134 -0
- data/ext/openc3/ext/polynomial_conversion/extconf.rb +13 -0
- data/ext/openc3/ext/polynomial_conversion/polynomial_conversion.c +79 -0
- data/ext/openc3/ext/string/extconf.rb +13 -0
- data/ext/openc3/ext/string/string.c +63 -0
- data/ext/openc3/ext/structure/structure.c +1719 -0
- data/ext/openc3/ext/tabbed_plots_config/extconf.rb +13 -0
- data/ext/openc3/ext/tabbed_plots_config/tabbed_plots_config.c +62 -0
- data/ext/openc3/ext/telemetry/extconf.rb +13 -0
- data/ext/openc3/ext/telemetry/telemetry.c +336 -0
- data/lib/cosmos.rb +20 -0
- data/lib/cosmosc2.rb +20 -0
- data/lib/openc3/api/api.rb +39 -0
- data/lib/openc3/api/authorized_api.rb +30 -0
- data/lib/openc3/api/cmd_api.rb +451 -0
- data/lib/openc3/api/config_api.rb +58 -0
- data/lib/openc3/api/interface_api.rb +117 -0
- data/lib/openc3/api/limits_api.rb +375 -0
- data/lib/openc3/api/router_api.rb +117 -0
- data/lib/openc3/api/settings_api.rb +70 -0
- data/lib/openc3/api/target_api.rb +78 -0
- data/lib/openc3/api/tlm_api.rb +455 -0
- data/lib/openc3/bridge/bridge.rb +54 -0
- data/lib/openc3/bridge/bridge_config.rb +167 -0
- data/lib/openc3/bridge/bridge_interface_thread.rb +42 -0
- data/lib/openc3/bridge/bridge_router_thread.rb +42 -0
- data/lib/openc3/ccsds/ccsds_packet.rb +68 -0
- data/lib/openc3/ccsds/ccsds_parser.rb +148 -0
- data/lib/openc3/config/config_parser.rb +549 -0
- data/lib/openc3/config/meta_config_parser.rb +74 -0
- data/lib/openc3/conversions/conversion.rb +70 -0
- data/lib/openc3/conversions/generic_conversion.rb +83 -0
- data/lib/openc3/conversions/packet_time_formatted_conversion.rb +43 -0
- data/lib/openc3/conversions/packet_time_seconds_conversion.rb +43 -0
- data/lib/openc3/conversions/polynomial_conversion.rb +87 -0
- data/lib/openc3/conversions/processor_conversion.rb +70 -0
- data/lib/openc3/conversions/received_count_conversion.rb +38 -0
- data/lib/openc3/conversions/received_time_formatted_conversion.rb +42 -0
- data/lib/openc3/conversions/received_time_seconds_conversion.rb +42 -0
- data/lib/openc3/conversions/segmented_polynomial_conversion.rb +171 -0
- data/lib/openc3/conversions/unix_time_conversion.rb +68 -0
- data/lib/openc3/conversions/unix_time_formatted_conversion.rb +49 -0
- data/lib/openc3/conversions/unix_time_seconds_conversion.rb +49 -0
- data/lib/openc3/conversions.rb +34 -0
- data/lib/openc3/core_ext/array.rb +416 -0
- data/lib/openc3/core_ext/binding.rb +29 -0
- data/lib/openc3/core_ext/class.rb +72 -0
- data/lib/openc3/core_ext/exception.rb +61 -0
- data/lib/openc3/core_ext/file.rb +83 -0
- data/lib/openc3/core_ext/hash.rb +37 -0
- data/lib/openc3/core_ext/io.rb +134 -0
- data/lib/openc3/core_ext/kernel.rb +42 -0
- data/lib/openc3/core_ext/math.rb +128 -0
- data/lib/openc3/core_ext/matrix.rb +156 -0
- data/lib/openc3/core_ext/objectspace.rb +36 -0
- data/lib/openc3/core_ext/openc3_io.rb +57 -0
- data/lib/openc3/core_ext/range.rb +27 -0
- data/lib/openc3/core_ext/socket.rb +38 -0
- data/lib/openc3/core_ext/string.rb +389 -0
- data/lib/openc3/core_ext/stringio.rb +33 -0
- data/lib/openc3/core_ext/time.rb +508 -0
- data/lib/openc3/core_ext.rb +36 -0
- data/lib/openc3/interfaces/interface.rb +498 -0
- data/lib/openc3/interfaces/linc_interface.rb +475 -0
- data/lib/openc3/interfaces/protocols/burst_protocol.rb +192 -0
- data/lib/openc3/interfaces/protocols/crc_protocol.rb +193 -0
- data/lib/openc3/interfaces/protocols/fixed_protocol.rb +155 -0
- data/lib/openc3/interfaces/protocols/ignore_packet_protocol.rb +56 -0
- data/lib/openc3/interfaces/protocols/length_protocol.rb +165 -0
- data/lib/openc3/interfaces/protocols/override_protocol.rb +60 -0
- data/lib/openc3/interfaces/protocols/preidentified_protocol.rb +206 -0
- data/lib/openc3/interfaces/protocols/protocol.rb +82 -0
- data/lib/openc3/interfaces/protocols/template_protocol.rb +261 -0
- data/lib/openc3/interfaces/protocols/terminated_protocol.rb +93 -0
- data/lib/openc3/interfaces/serial_interface.rb +94 -0
- data/lib/openc3/interfaces/simulated_target_interface.rb +168 -0
- data/lib/openc3/interfaces/stream_interface.rb +81 -0
- data/lib/openc3/interfaces/tcpip_client_interface.rb +69 -0
- data/lib/openc3/interfaces/tcpip_server_interface.rb +629 -0
- data/lib/openc3/interfaces/udp_interface.rb +169 -0
- data/lib/openc3/interfaces.rb +44 -0
- data/lib/openc3/io/buffered_file.rb +109 -0
- data/lib/openc3/io/io_multiplexer.rb +80 -0
- data/lib/openc3/io/json_api_object.rb +208 -0
- data/lib/openc3/io/json_drb.rb +335 -0
- data/lib/openc3/io/json_drb_object.rb +114 -0
- data/lib/openc3/io/json_drb_rack.rb +84 -0
- data/lib/openc3/io/json_rpc.rb +420 -0
- data/lib/openc3/io/openc3_snmp.rb +58 -0
- data/lib/openc3/io/posix_serial_driver.rb +156 -0
- data/lib/openc3/io/raw_logger.rb +167 -0
- data/lib/openc3/io/raw_logger_pair.rb +77 -0
- data/lib/openc3/io/serial_driver.rb +105 -0
- data/lib/openc3/io/stderr.rb +43 -0
- data/lib/openc3/io/stdout.rb +43 -0
- data/lib/openc3/io/udp_sockets.rb +194 -0
- data/lib/openc3/io/win32_serial_driver.rb +196 -0
- data/lib/openc3/logs/log_writer.rb +302 -0
- data/lib/openc3/logs/packet_log_constants.rb +62 -0
- data/lib/openc3/logs/packet_log_reader.rb +345 -0
- data/lib/openc3/logs/packet_log_writer.rb +299 -0
- data/lib/openc3/logs/text_log_writer.rb +68 -0
- data/lib/openc3/logs.rb +25 -0
- data/lib/openc3/microservices/cleanup_microservice.rb +68 -0
- data/lib/openc3/microservices/decom_microservice.rb +136 -0
- data/lib/openc3/microservices/interface_microservice.rb +532 -0
- data/lib/openc3/microservices/log_microservice.rb +108 -0
- data/lib/openc3/microservices/microservice.rb +204 -0
- data/lib/openc3/microservices/plugin_microservice.rb +43 -0
- data/lib/openc3/microservices/reaction_microservice.rb +541 -0
- data/lib/openc3/microservices/reducer_microservice.rb +313 -0
- data/lib/openc3/microservices/router_microservice.rb +44 -0
- data/lib/openc3/microservices/text_log_microservice.rb +84 -0
- data/lib/openc3/microservices/timeline_microservice.rb +363 -0
- data/lib/openc3/microservices/trigger_group_microservice.rb +638 -0
- data/lib/openc3/models/activity_model.rb +319 -0
- data/lib/openc3/models/auth_model.rb +65 -0
- data/lib/openc3/models/cvt_model.rb +185 -0
- data/lib/openc3/models/environment_model.rb +58 -0
- data/lib/openc3/models/gem_model.rb +137 -0
- data/lib/openc3/models/info_model.rb +31 -0
- data/lib/openc3/models/interface_model.rb +281 -0
- data/lib/openc3/models/interface_status_model.rb +117 -0
- data/lib/openc3/models/metadata_model.rb +139 -0
- data/lib/openc3/models/metric_model.rb +59 -0
- data/lib/openc3/models/microservice_model.rb +206 -0
- data/lib/openc3/models/microservice_status_model.rb +74 -0
- data/lib/openc3/models/model.rb +204 -0
- data/lib/openc3/models/note_model.rb +122 -0
- data/lib/openc3/models/notification_model.rb +40 -0
- data/lib/openc3/models/ping_model.rb +35 -0
- data/lib/openc3/models/plugin_model.rb +292 -0
- data/lib/openc3/models/process_status_model.rb +76 -0
- data/lib/openc3/models/reaction_model.rb +322 -0
- data/lib/openc3/models/reducer_model.rb +65 -0
- data/lib/openc3/models/router_model.rb +35 -0
- data/lib/openc3/models/router_status_model.rb +27 -0
- data/lib/openc3/models/scope_model.rb +153 -0
- data/lib/openc3/models/settings_model.rb +55 -0
- data/lib/openc3/models/sorted_model.rb +167 -0
- data/lib/openc3/models/target_model.rb +759 -0
- data/lib/openc3/models/timeline_model.rb +154 -0
- data/lib/openc3/models/tool_config_model.rb +38 -0
- data/lib/openc3/models/tool_model.rb +262 -0
- data/lib/openc3/models/trigger_group_model.rb +186 -0
- data/lib/openc3/models/trigger_model.rb +330 -0
- data/lib/openc3/models/widget_model.rb +138 -0
- data/lib/openc3/operators/microservice_operator.rb +128 -0
- data/lib/openc3/operators/operator.rb +277 -0
- data/lib/openc3/packets/binary_accessor.rb +1207 -0
- data/lib/openc3/packets/commands.rb +373 -0
- data/lib/openc3/packets/json_packet.rb +134 -0
- data/lib/openc3/packets/limits.rb +271 -0
- data/lib/openc3/packets/limits_response.rb +53 -0
- data/lib/openc3/packets/packet.rb +1168 -0
- data/lib/openc3/packets/packet_config.rb +625 -0
- data/lib/openc3/packets/packet_item.rb +586 -0
- data/lib/openc3/packets/packet_item_limits.rb +162 -0
- data/lib/openc3/packets/parsers/format_string_parser.rb +65 -0
- data/lib/openc3/packets/parsers/limits_parser.rb +159 -0
- data/lib/openc3/packets/parsers/limits_response_parser.rb +61 -0
- data/lib/openc3/packets/parsers/packet_item_parser.rb +272 -0
- data/lib/openc3/packets/parsers/packet_parser.rb +134 -0
- data/lib/openc3/packets/parsers/processor_parser.rb +73 -0
- data/lib/openc3/packets/parsers/state_parser.rb +127 -0
- data/lib/openc3/packets/parsers/xtce_converter.rb +442 -0
- data/lib/openc3/packets/parsers/xtce_parser.rb +722 -0
- data/lib/openc3/packets/structure.rb +553 -0
- data/lib/openc3/packets/structure_item.rb +365 -0
- data/lib/openc3/packets/telemetry.rb +487 -0
- data/lib/openc3/processors/processor.rb +86 -0
- data/lib/openc3/processors/statistics_processor.rb +82 -0
- data/lib/openc3/processors/watermark_processor.rb +58 -0
- data/lib/openc3/processors.rb +24 -0
- data/lib/openc3/script/api_shared.rb +828 -0
- data/lib/openc3/script/calendar.rb +89 -0
- data/lib/openc3/script/commands.rb +227 -0
- data/lib/openc3/script/exceptions.rb +29 -0
- data/lib/openc3/script/extract.rb +161 -0
- data/lib/openc3/script/limits.rb +60 -0
- data/lib/openc3/script/script.rb +299 -0
- data/lib/openc3/script/script_runner.rb +238 -0
- data/lib/openc3/script/storage.rb +146 -0
- data/lib/openc3/script/suite.rb +542 -0
- data/lib/openc3/script/suite_results.rb +196 -0
- data/lib/openc3/script/suite_runner.rb +217 -0
- data/lib/openc3/script.rb +21 -0
- data/lib/openc3/streams/serial_stream.rb +167 -0
- data/lib/openc3/streams/stream.rb +63 -0
- data/lib/openc3/streams/tcpip_client_stream.rb +116 -0
- data/lib/openc3/streams/tcpip_socket_stream.rb +195 -0
- data/lib/openc3/system/system.rb +127 -0
- data/lib/openc3/system/system_config.rb +411 -0
- data/lib/openc3/system/target.rb +269 -0
- data/lib/openc3/system.rb +24 -0
- data/lib/openc3/tools/cmd_tlm_server/api.rb +20 -0
- data/lib/openc3/tools/cmd_tlm_server/cmd_tlm_server_config.rb +320 -0
- data/lib/openc3/tools/cmd_tlm_server/interface_thread.rb +294 -0
- data/lib/openc3/tools/table_manager/table.rb +77 -0
- data/lib/openc3/tools/table_manager/table_config.rb +273 -0
- data/lib/openc3/tools/table_manager/table_item.rb +90 -0
- data/lib/openc3/tools/table_manager/table_item_parser.rb +66 -0
- data/lib/openc3/tools/table_manager/table_manager_core.rb +333 -0
- data/lib/openc3/tools/table_manager/table_parser.rb +93 -0
- data/lib/openc3/tools/test_runner/test.rb +67 -0
- data/lib/openc3/top_level.rb +595 -0
- data/lib/openc3/topics/autonomic_topic.rb +52 -0
- data/lib/openc3/topics/calendar_topic.rb +44 -0
- data/lib/openc3/topics/command_decom_topic.rb +76 -0
- data/lib/openc3/topics/command_topic.rb +83 -0
- data/lib/openc3/topics/config_topic.rb +68 -0
- data/lib/openc3/topics/interface_topic.rb +73 -0
- data/lib/openc3/topics/limits_event_topic.rb +109 -0
- data/lib/openc3/topics/notifications_topic.rb +28 -0
- data/lib/openc3/topics/router_topic.rb +85 -0
- data/lib/openc3/topics/telemetry_decom_topic.rb +54 -0
- data/lib/openc3/topics/telemetry_topic.rb +36 -0
- data/lib/openc3/topics/timeline_topic.rb +45 -0
- data/lib/openc3/topics/topic.rb +53 -0
- data/lib/openc3/utilities/authentication.rb +141 -0
- data/lib/openc3/utilities/authorization.rb +51 -0
- data/lib/openc3/utilities/crc.rb +278 -0
- data/lib/openc3/utilities/csv.rb +153 -0
- data/lib/openc3/utilities/logger.rb +187 -0
- data/lib/openc3/utilities/message_log.rb +91 -0
- data/lib/openc3/utilities/metric.rb +141 -0
- data/lib/openc3/utilities/process_manager.rb +139 -0
- data/lib/openc3/utilities/quaternion.rb +257 -0
- data/lib/openc3/utilities/ruby_lex_utils.rb +568 -0
- data/lib/openc3/utilities/s3.rb +202 -0
- data/lib/openc3/utilities/s3_autoload.rb +9 -0
- data/lib/openc3/utilities/s3_file_cache.rb +274 -0
- data/lib/openc3/utilities/simulated_target.rb +117 -0
- data/lib/openc3/utilities/sleeper.rb +51 -0
- data/lib/openc3/utilities/store.rb +23 -0
- data/lib/openc3/utilities/store_autoload.rb +237 -0
- data/lib/openc3/utilities/zip.rb +21 -0
- data/lib/openc3/utilities.rb +35 -0
- data/lib/openc3/version.rb +14 -0
- data/lib/openc3/win32/excel.rb +132 -0
- data/lib/openc3/win32/win32.rb +402 -0
- data/lib/openc3/win32/win32_main.rb +333 -0
- data/lib/openc3.rb +49 -0
- data/tasks/gemfile_stats.rake +113 -0
- data/tasks/spec.rake +30 -0
- data/templates/plugin-template/README.md +15 -0
- data/templates/plugin-template/Rakefile +12 -0
- data/templates/plugin-template/plugin.gemspec +23 -0
- data/templates/plugin-template/plugin.txt +9 -0
- data/templates/plugin-template/targets/TARGET/cmd_tlm/cmd.txt +8 -0
- data/templates/plugin-template/targets/TARGET/cmd_tlm/tlm.txt +8 -0
- data/templates/plugin-template/targets/TARGET/lib/target.rb +10 -0
- data/templates/plugin-template/targets/TARGET/procedures/procedure.rb +3 -0
- data/templates/plugin-template/targets/TARGET/screens/status.txt +9 -0
- data/templates/plugin-template/targets/TARGET/target.txt +5 -0
- metadata +849 -0
|
@@ -0,0 +1,333 @@
|
|
|
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
|
+
module OpenC3
|
|
21
|
+
if RUBY_ENGINE == 'ruby'
|
|
22
|
+
# Win32API is deprecated in 1.9.x so recreate it
|
|
23
|
+
require 'fiddle'
|
|
24
|
+
|
|
25
|
+
POINTER_TYPE = Fiddle::SIZEOF_VOIDP == Fiddle::SIZEOF_LONG_LONG ? 'q*' : 'l!*'
|
|
26
|
+
|
|
27
|
+
class Win32API
|
|
28
|
+
# Cache to hold already opened dll files
|
|
29
|
+
DLL_CACHE = {}
|
|
30
|
+
|
|
31
|
+
VALUE_TYPEMAP = { "0" => Fiddle::TYPE_VOID, "S" => Fiddle::TYPE_VOIDP, "I" => Fiddle::TYPE_LONG }
|
|
32
|
+
|
|
33
|
+
def initialize(dll_name, function_name, import, export = "0")
|
|
34
|
+
# Convert all input parameters into either 0, S, or I
|
|
35
|
+
@function_prototype = [import].join.tr("VPpNnLlIiCc", "0SSI")
|
|
36
|
+
params = []
|
|
37
|
+
@function_prototype.split('').each do |param|
|
|
38
|
+
params << VALUE_TYPEMAP[param]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Get handle to dll file and add to cache if necessary
|
|
42
|
+
dll_handle = DLL_CACHE[dll_name] ||= Fiddle.dlopen(dll_name)
|
|
43
|
+
|
|
44
|
+
# Create Fiddle::Function necessary to call a function with proper return type and name
|
|
45
|
+
@function = Fiddle::Function.new(dll_handle[function_name], params, VALUE_TYPEMAP[export.tr("VPpNnLlIi", "0SSI")])
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def call(*args)
|
|
49
|
+
# Break up prototype into characters
|
|
50
|
+
import = @function_prototype.split('')
|
|
51
|
+
|
|
52
|
+
args.each_with_index do |arg, index|
|
|
53
|
+
case import[index]
|
|
54
|
+
when 'S'
|
|
55
|
+
# Handle NULL specified with 0 value
|
|
56
|
+
arg = nil if arg == 0
|
|
57
|
+
|
|
58
|
+
# Convert argument into array of longs
|
|
59
|
+
args[index], = [arg].pack("p").unpack(POINTER_TYPE)
|
|
60
|
+
when 'I'
|
|
61
|
+
# Handle intergers larger than 2^31 - 1
|
|
62
|
+
args[index], = [arg].pack("I").unpack("i")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Call the function and return its return value
|
|
67
|
+
return_value = @function.call(*args)
|
|
68
|
+
return_value ||= 0
|
|
69
|
+
return_value
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Make an equivalent capital C call method
|
|
73
|
+
alias Call call
|
|
74
|
+
end
|
|
75
|
+
else
|
|
76
|
+
require 'Win32API'
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# Win32 class
|
|
80
|
+
#
|
|
81
|
+
# This class implements the Win32
|
|
82
|
+
#
|
|
83
|
+
class Win32
|
|
84
|
+
# Data Types
|
|
85
|
+
BOOL = 'i'
|
|
86
|
+
BYTE = 'C'
|
|
87
|
+
DWORD = 'L'
|
|
88
|
+
HANDLE = 'L'
|
|
89
|
+
LP = 'P'
|
|
90
|
+
LPSECURITY_ATTRIBUTES = DWORD
|
|
91
|
+
|
|
92
|
+
# Misc Constants
|
|
93
|
+
NULL = 0
|
|
94
|
+
INVALID_HANDLE_VALUE = -1
|
|
95
|
+
|
|
96
|
+
# Generic Rights (WinNT.h)
|
|
97
|
+
GENERIC_READ = 0x80000000
|
|
98
|
+
GENERIC_WRITE = 0x40000000
|
|
99
|
+
GENERIC_EXECUTE = 0x20000000
|
|
100
|
+
GENERIC_ALL = 0x10000000
|
|
101
|
+
|
|
102
|
+
# File Sharing (WinNT.h)
|
|
103
|
+
FILE_UNSHARED = 0x00000000 # not defined in WinNT.h
|
|
104
|
+
FILE_SHARE_READ = 0x00000001
|
|
105
|
+
FILE_SHARE_WRITE = 0x00000002
|
|
106
|
+
FILE_SHARE_DELETE = 0x00000004
|
|
107
|
+
|
|
108
|
+
# File Open Options (WinBase.h)
|
|
109
|
+
CREATE_NEW = 1
|
|
110
|
+
CREATE_ALWAYS = 2
|
|
111
|
+
OPEN_EXISTING = 3
|
|
112
|
+
OPEN_ALWAYS = 4
|
|
113
|
+
TRUNCATE_EXISTING = 5
|
|
114
|
+
|
|
115
|
+
# File Attributes (WinNT.h)
|
|
116
|
+
FILE_ATTRIBUTE_READONLY = 0x00000001
|
|
117
|
+
FILE_ATTRIBUTE_HIDDEN = 0x00000002
|
|
118
|
+
FILE_ATTRIBUTE_SYSTEM = 0x00000004
|
|
119
|
+
FILE_ATTRIBUTE_DIRECTORY = 0x00000010
|
|
120
|
+
FILE_ATTRIBUTE_ARCHIVE = 0x00000020
|
|
121
|
+
FILE_ATTRIBUTE_DEVICE = 0x00000040
|
|
122
|
+
FILE_ATTRIBUTE_NORMAL = 0x00000080
|
|
123
|
+
FILE_ATTRIBUTE_TEMPORARY = 0x00000100
|
|
124
|
+
FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200
|
|
125
|
+
FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400
|
|
126
|
+
FILE_ATTRIBUTE_COMPRESSED = 0x00000800
|
|
127
|
+
FILE_ATTRIBUTE_OFFLINE = 0x00001000
|
|
128
|
+
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000
|
|
129
|
+
FILE_ATTRIBUTE_ENCRYPTED = 0x00004000
|
|
130
|
+
FILE_ATTRIBUTE_VIRTUAL = 0x00010000
|
|
131
|
+
|
|
132
|
+
# Baud Rates
|
|
133
|
+
CBR_110 = 110
|
|
134
|
+
CBR_300 = 300
|
|
135
|
+
CBR_600 = 600
|
|
136
|
+
CBR_1200 = 1200
|
|
137
|
+
CBR_2400 = 2400
|
|
138
|
+
CBR_4800 = 4800
|
|
139
|
+
CBR_9600 = 9600
|
|
140
|
+
CBR_14400 = 14400
|
|
141
|
+
CBR_19200 = 19200
|
|
142
|
+
CBR_38400 = 38400
|
|
143
|
+
CBR_56000 = 56000
|
|
144
|
+
CBR_57600 = 57600
|
|
145
|
+
CBR_115200 = 115200
|
|
146
|
+
CBR_128000 = 128000
|
|
147
|
+
CBR_256000 = 256000
|
|
148
|
+
|
|
149
|
+
BAUD_RATES = [
|
|
150
|
+
CBR_110, CBR_300, CBR_600, CBR_1200, CBR_2400, CBR_4800, CBR_9600,
|
|
151
|
+
CBR_14400, CBR_19200, CBR_38400, CBR_56000, CBR_57600, CBR_115200,
|
|
152
|
+
CBR_128000, CBR_256000, 230400, 460800, 500000, 576000, 921600,
|
|
153
|
+
1000000, 1152000, 1500000, 2000000, 3000000, 3500000, 4000000
|
|
154
|
+
]
|
|
155
|
+
|
|
156
|
+
# Parity
|
|
157
|
+
NOPARITY = 0
|
|
158
|
+
ODDPARITY = 1
|
|
159
|
+
EVENPARITY = 2
|
|
160
|
+
MARKPARITY = 3
|
|
161
|
+
SPACEPARITY = 4
|
|
162
|
+
PARITY_SETTINGS = [NOPARITY, ODDPARITY, EVENPARITY, MARKPARITY, SPACEPARITY]
|
|
163
|
+
|
|
164
|
+
# Stop Bits
|
|
165
|
+
ONESTOPBIT = 0
|
|
166
|
+
ONE5STOPBITS = 1
|
|
167
|
+
TWOSTOPBITS = 2
|
|
168
|
+
STOP_BIT_SETTINGS = [ONESTOPBIT, ONE5STOPBITS, TWOSTOPBITS]
|
|
169
|
+
|
|
170
|
+
# Dialog Box Command Ids
|
|
171
|
+
IDOK = 1
|
|
172
|
+
IDCANCEL = 2
|
|
173
|
+
IDABORT = 3
|
|
174
|
+
IDRETRY = 4
|
|
175
|
+
IDIGNORE = 5
|
|
176
|
+
IDYES = 6
|
|
177
|
+
IDNO = 7
|
|
178
|
+
IDCLOSE = 8
|
|
179
|
+
IDHELP = 9
|
|
180
|
+
|
|
181
|
+
# Message Box Types
|
|
182
|
+
MB_OK = 0x00000000
|
|
183
|
+
MB_OKCANCEL = 0x00000001
|
|
184
|
+
MB_ABORTRETRYIGNORE = 0x00000002
|
|
185
|
+
MB_YESNOCANCEL = 0x00000003
|
|
186
|
+
MB_YESNO = 0x00000004
|
|
187
|
+
MB_RETRYCANCEL = 0x00000005
|
|
188
|
+
|
|
189
|
+
# Message Box Icons
|
|
190
|
+
MB_ICONHAND = 0x00000010
|
|
191
|
+
MB_ICONQUESTION = 0x00000020
|
|
192
|
+
MB_ICONEXCLAMATION = 0x00000030
|
|
193
|
+
MB_ICONASTERISK = 0x00000040
|
|
194
|
+
|
|
195
|
+
# Heap Information Types
|
|
196
|
+
HEAP_COMPATIBILITY_INFORMATION = 0
|
|
197
|
+
HEAP_ENABLE_TERMINATION_ON_CORRUPTION = 1
|
|
198
|
+
|
|
199
|
+
# Heap Information Values
|
|
200
|
+
HEAP_STANDARD = 0
|
|
201
|
+
HEAP_LOOKASIDE = 1
|
|
202
|
+
HEAP_LOW_FRAGMENTATION = 2
|
|
203
|
+
|
|
204
|
+
# Open Filename Constants
|
|
205
|
+
OFN_READONLY = 0x00000001
|
|
206
|
+
OFN_OVERWRITEPROMPT = 0x00000002
|
|
207
|
+
OFN_HIDEREADONLY = 0x00000004
|
|
208
|
+
OFN_NOCHANGEDIR = 0x00000008
|
|
209
|
+
OFN_SHOWHELP = 0x00000010
|
|
210
|
+
OFN_ENABLEHOOK = 0x00000020
|
|
211
|
+
OFN_ENABLETEMPLATE = 0x00000040
|
|
212
|
+
OFN_ENABLETEMPLATEHANDLE = 0x00000080
|
|
213
|
+
OFN_NOVALIDATE = 0x00000100
|
|
214
|
+
OFN_ALLOWMULTISELECT = 0x00000200
|
|
215
|
+
OFN_EXTENSIONDIFFERENT = 0x00000400
|
|
216
|
+
OFN_PATHMUSTEXIST = 0x00000800
|
|
217
|
+
OFN_FILEMUSTEXIST = 0x00001000
|
|
218
|
+
OFN_CREATEPROMPT = 0x00002000
|
|
219
|
+
OFN_SHAREAWARE = 0x00004000
|
|
220
|
+
OFN_NOREADONLYRETURN = 0x00008000
|
|
221
|
+
OFN_NOTESTFILECREATE = 0x00010000
|
|
222
|
+
OFN_NONETWORKBUTTON = 0x00020000
|
|
223
|
+
OFN_NOLONGNAMES = 0x00040000
|
|
224
|
+
OFN_EXPLORER = 0x00080000
|
|
225
|
+
OFN_NODEREFERENCELINKS = 0x00100000
|
|
226
|
+
OFN_LONGNAMES = 0x00200000
|
|
227
|
+
OFN_ENABLEINCLUDENOTIFY = 0x00400000
|
|
228
|
+
OFN_ENABLESIZING = 0x00800000
|
|
229
|
+
OFN_DONTADDTORECENT = 0x02000000
|
|
230
|
+
OFN_FORCESHOWHIDDEN = 0x10000000
|
|
231
|
+
OFN_EX_NOPLACESBAR = 0x00000001
|
|
232
|
+
|
|
233
|
+
# Format Message Settings
|
|
234
|
+
FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100
|
|
235
|
+
FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200
|
|
236
|
+
FORMAT_MESSAGE_FROM_STRING = 0x00000400
|
|
237
|
+
FORMAT_MESSAGE_FROM_HMODULE = 0x00000800
|
|
238
|
+
FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000
|
|
239
|
+
FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000
|
|
240
|
+
FORMAT_MESSAGE_MAX_WIDTH_MASK = 0x000000FF
|
|
241
|
+
|
|
242
|
+
# Primary Language Ids
|
|
243
|
+
LANG_NEUTRAL = 0x00
|
|
244
|
+
|
|
245
|
+
# Sub Language Ids
|
|
246
|
+
SUBLANG_DEFAULT = 0x01
|
|
247
|
+
SUBLANG_SYS_DEFAULT = 0x02
|
|
248
|
+
|
|
249
|
+
# Calculate a language id
|
|
250
|
+
def self.make_lang_id(primary_language_id, sub_language_id)
|
|
251
|
+
(sub_language_id << 10) | primary_language_id
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
# Creates a Message Box
|
|
255
|
+
def self.message_box(message, title = 'Error', options = 0)
|
|
256
|
+
Win32API.new('user32', 'MessageBox', ['L', 'P', 'P', 'L'], 'I').call(0, message, title, options)
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# Gets the window handle for the foreground window or NULL
|
|
260
|
+
def self.get_foreground_window
|
|
261
|
+
Win32API.new('user32', 'GetForegroundWindow', [], 'I').call()
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
# Gets the error code of the most recent error
|
|
265
|
+
def self.get_last_error
|
|
266
|
+
Win32API.new("Kernel32", "GetLastError", [], "I").call
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
# Formats a message
|
|
270
|
+
def self.format_message(flags, source, message_id, language_id)
|
|
271
|
+
buffer = ' ' * 1024
|
|
272
|
+
api = Win32API.new('Kernel32', 'FormatMessage', [DWORD, LP, DWORD, DWORD, LP, DWORD, LP], DWORD)
|
|
273
|
+
buffer_length = api.call(flags, source, message_id, language_id, buffer, buffer.length, NULL)
|
|
274
|
+
if buffer_length == 0
|
|
275
|
+
''
|
|
276
|
+
else
|
|
277
|
+
buffer[0..(buffer_length - 1)]
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Gets the error message from the last error
|
|
282
|
+
def self.get_last_error_message
|
|
283
|
+
last_error = Win32.get_last_error
|
|
284
|
+
language_id = Win32.make_lang_id(LANG_NEUTRAL, SUBLANG_DEFAULT)
|
|
285
|
+
Win32.format_message(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, last_error, language_id)
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Returns the computer name
|
|
289
|
+
def self.computer_name
|
|
290
|
+
name = ' ' * 128
|
|
291
|
+
size = [name.length].pack('i')
|
|
292
|
+
Win32API.new('kernel32', 'GetComputerName', ['P', 'P'], 'I').call(name, size)
|
|
293
|
+
name.unpack('A*')[0]
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Returns current logged in Windows user name
|
|
297
|
+
def self.user_name
|
|
298
|
+
name = ' ' * 128
|
|
299
|
+
size = [name.length].pack('i')
|
|
300
|
+
Win32API.new('advapi32', 'GetUserName', ['P', 'P'], 'I').call(name, size)
|
|
301
|
+
name.unpack('A*')[0]
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# Get the Process's Heap Handle
|
|
305
|
+
def self.get_process_heap
|
|
306
|
+
Win32API.new('Kernel32', 'GetProcessHeap', [], 'i').call
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
# Set Heap Information
|
|
310
|
+
def self.heap_set_information(heap_handle, heap_information_type, value)
|
|
311
|
+
heap_info = [value].pack('i')
|
|
312
|
+
api = Win32API.new('Kernel32', 'HeapSetInformation', ['i', 'i', 'P', 'i'], 'i')
|
|
313
|
+
return_value = api.call(heap_handle, heap_information_type, heap_info, heap_info.length)
|
|
314
|
+
raise "HeapSetInformation Error: #{get_last_error_message()}" if return_value == 0
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
# Get Heap Information
|
|
318
|
+
def self.heap_query_information(heap_handle, heap_information_type)
|
|
319
|
+
heap_info = ' ' * 8
|
|
320
|
+
size = ' ' * 8
|
|
321
|
+
api = Win32API.new('Kernel32', 'HeapQueryInformation', ['i', 'i', 'P', 'i', 'P'], 'i')
|
|
322
|
+
api.call(heap_handle, heap_information_type, heap_info, heap_info.length, size)
|
|
323
|
+
heap_info.unpack("i")[0]
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# Enable the Low Fragmentation Heap
|
|
327
|
+
def self.enable_low_fragmentation_heap(heap_handle)
|
|
328
|
+
heap_set_information(heap_handle, HEAP_COMPATIBILITY_INFORMATION, HEAP_LOW_FRAGMENTATION)
|
|
329
|
+
heap_info = heap_query_information(heap_handle, HEAP_COMPATIBILITY_INFORMATION)
|
|
330
|
+
raise "Unable to enable Low Fragmentation Heap" if heap_info != HEAP_LOW_FRAGMENTATION
|
|
331
|
+
end
|
|
332
|
+
end # class Win32
|
|
333
|
+
end
|
data/lib/openc3.rb
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
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 sets up using the OpenC3 framework
|
|
21
|
+
|
|
22
|
+
# Set default encodings
|
|
23
|
+
saved_verbose = $VERBOSE; $VERBOSE = nil
|
|
24
|
+
Encoding.default_external = Encoding::ASCII_8BIT
|
|
25
|
+
Encoding.default_internal = Encoding::ASCII_8BIT
|
|
26
|
+
$VERBOSE = saved_verbose
|
|
27
|
+
|
|
28
|
+
# Add OpenC3 bin folder to PATH
|
|
29
|
+
require 'openc3/core_ext/kernel'
|
|
30
|
+
if Kernel.is_windows?
|
|
31
|
+
ENV['PATH'] = File.join(File.dirname(__FILE__), '../bin') + ';' + ENV['PATH']
|
|
32
|
+
else
|
|
33
|
+
ENV['PATH'] = File.join(File.dirname(__FILE__), '../bin') + ':' + ENV['PATH']
|
|
34
|
+
end
|
|
35
|
+
require 'openc3/ext/platform' if RUBY_ENGINE == 'ruby' and !ENV['OPENC3_NO_EXT']
|
|
36
|
+
require 'openc3/version'
|
|
37
|
+
require 'openc3/top_level'
|
|
38
|
+
require 'openc3/core_ext'
|
|
39
|
+
require 'openc3/utilities'
|
|
40
|
+
require 'openc3/conversions'
|
|
41
|
+
require 'openc3/interfaces'
|
|
42
|
+
require 'openc3/processors'
|
|
43
|
+
require 'openc3/packets/packet'
|
|
44
|
+
require 'openc3/logs'
|
|
45
|
+
require 'openc3/system'
|
|
46
|
+
|
|
47
|
+
# OpenC3 services need to die if something goes wrong so they can be restarted
|
|
48
|
+
require 'thread'
|
|
49
|
+
Thread.abort_on_exception = true
|
|
@@ -0,0 +1,113 @@
|
|
|
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
|
+
desc 'Create a picture of gemfile downloads'
|
|
21
|
+
task :gemfile_stats do
|
|
22
|
+
require 'gems'
|
|
23
|
+
require 'win32ole'
|
|
24
|
+
|
|
25
|
+
def get_latest_gem_data
|
|
26
|
+
gem_data = []
|
|
27
|
+
# This is the only API call to Rubygems
|
|
28
|
+
versions = Gems.versions 'openc3'
|
|
29
|
+
versions.each do |version|
|
|
30
|
+
version_no = version['number']
|
|
31
|
+
next if version_no.split('.')[0] < '3' # anything before 3 is another gem
|
|
32
|
+
|
|
33
|
+
month = version['built_at'].split('-')[0..1].join('-')
|
|
34
|
+
downloads = version['downloads_count'].to_i
|
|
35
|
+
if gem_data.length > 0 && gem_data[-1][1] == version_no
|
|
36
|
+
gem_data[-1][2] += downloads
|
|
37
|
+
else
|
|
38
|
+
gem_data << [month, version_no, downloads]
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
gem_data
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# This is useful for testing to prevent server round trips
|
|
45
|
+
# Simply comment out this line when working on the formatting below (after first running once)
|
|
46
|
+
File.open("gemdata.marshall", 'w') { |file| file.write(Marshal.dump(get_latest_gem_data())) }
|
|
47
|
+
gem_data = Marshal.load(File.read("gemdata.marshall"))
|
|
48
|
+
|
|
49
|
+
# Convert all the date text into Ruby Dates
|
|
50
|
+
gem_data.map! { |x| [Date.strptime(x[0], "%Y-%m"), x[1], x[2]] }
|
|
51
|
+
# Sort first by date and then version number
|
|
52
|
+
gem_data.sort_by! { |x| [x[0], x[1]] }
|
|
53
|
+
|
|
54
|
+
excel = WIN32OLE.new('excel.application')
|
|
55
|
+
excel.visible = true
|
|
56
|
+
book = excel.Workbooks.Add
|
|
57
|
+
sheet = book.Worksheets(1)
|
|
58
|
+
|
|
59
|
+
# Build up date labels
|
|
60
|
+
labels = {} # Must be hash with integer keys and label value
|
|
61
|
+
index = 0
|
|
62
|
+
start_date = gem_data[0][0]
|
|
63
|
+
end_date = gem_data[-1][0]
|
|
64
|
+
while start_date <= end_date
|
|
65
|
+
labels[index] = start_date.strftime("%m/%y")
|
|
66
|
+
index += 1
|
|
67
|
+
start_date = start_date >> 1
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Create an array of 0s the size of the labels which will hold the D/L counts
|
|
71
|
+
counts = Array.new(labels.length, 0)
|
|
72
|
+
dataset = {}
|
|
73
|
+
gem_data.each do |full_date, full_version, count|
|
|
74
|
+
# Build up just the major minor version: 1.0
|
|
75
|
+
version = full_version.split('.')[0..1].join('.')
|
|
76
|
+
date = full_date.strftime("%m/%y")
|
|
77
|
+
# Find the location in the count array to start adding counts
|
|
78
|
+
index = labels.key(date)
|
|
79
|
+
dataset[version] ||= counts.clone
|
|
80
|
+
# We fill in the count array starting at the first location
|
|
81
|
+
# and going until the end because this is a stacked area graph
|
|
82
|
+
# and all the counts are additive over time
|
|
83
|
+
(index...counts.length).each do |i|
|
|
84
|
+
dataset[version][i] += count
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Put dates in rows as there are more dates than there are releases
|
|
89
|
+
# Force the date column to be text
|
|
90
|
+
sheet.Columns(1).NumberFormat = "\@"
|
|
91
|
+
labels.values.each_with_index do |val, x|
|
|
92
|
+
sheet.Cells((x + 2), 1).Value = val
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
col = 2
|
|
96
|
+
dataset.each do |version, data|
|
|
97
|
+
# Set the version (e.g. 3.0) in the top row
|
|
98
|
+
sheet.Cells(1, col).Value = version
|
|
99
|
+
# The download values by date appear below the version in the same column
|
|
100
|
+
data.each_with_index do |val, x|
|
|
101
|
+
sheet.Cells((x + 2), col).Value = val
|
|
102
|
+
end
|
|
103
|
+
col += 1
|
|
104
|
+
end
|
|
105
|
+
# Excel column name lookup, 4 sets of alphabets gives us 104 versions to work with
|
|
106
|
+
letters = ('A'..'Z').to_a.concat(('AA'..'AZ').to_a).concat(('BA'..'BZ').to_a).concat(('CA'..'CZ').to_a)
|
|
107
|
+
chart = book.Charts.Add
|
|
108
|
+
chart.Name = "OpenC3 Downloads"
|
|
109
|
+
chart.SetSourceData(sheet.Range("A1:#{letters[dataset.length]}#{labels.length + 1}"))
|
|
110
|
+
chart.HasTitle = true
|
|
111
|
+
chart.ChartTitle.Characters.Text = "OpenC3 Downloads"
|
|
112
|
+
chart.ChartType = 76 # AreaStacked
|
|
113
|
+
end
|
data/tasks/spec.rake
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
begin
|
|
21
|
+
require 'rspec/core/rake_task'
|
|
22
|
+
|
|
23
|
+
desc 'Run all specs with basic output'
|
|
24
|
+
RSpec::Core::RakeTask.new do |t|
|
|
25
|
+
t.pattern = ['spec/*_spec.rb']
|
|
26
|
+
t.rspec_opts = '-f d --warnings'
|
|
27
|
+
end
|
|
28
|
+
rescue LoadError
|
|
29
|
+
puts "rspec not loaded. gem install rspec"
|
|
30
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# OpenC3 Configuration
|
|
2
|
+
|
|
3
|
+
See the [OpenC3](https://openc3.com) documentation for all things OpenC3.
|
|
4
|
+
|
|
5
|
+
## Building the plugin
|
|
6
|
+
|
|
7
|
+
1. <Path to OpenC3 installation>\openc3.bat openc3 rake VERSION=X.Y.Z
|
|
8
|
+
- VERSION is required
|
|
9
|
+
- gem file will be built locally
|
|
10
|
+
|
|
11
|
+
## Upload plugin
|
|
12
|
+
|
|
13
|
+
1. Go to localhost:2900/tools/admin
|
|
14
|
+
1. Click the paperclip icon and choose your plugin.gem file
|
|
15
|
+
1. Click Upload
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
PLUGIN_NAME = Dir['*.gemspec'][0].split('.')[0..-2].join('.')
|
|
2
|
+
|
|
3
|
+
task :require_version do
|
|
4
|
+
unless ENV['VERSION']
|
|
5
|
+
puts "VERSION is required: rake build VERSION=X.Y.Z"
|
|
6
|
+
exit 1
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
task :build => [:require_version] do
|
|
11
|
+
system("gem build #{PLUGIN_NAME}")
|
|
12
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# encoding: ascii-8bit
|
|
2
|
+
|
|
3
|
+
# Create the overall gemspec
|
|
4
|
+
spec = Gem::Specification.new do |s|
|
|
5
|
+
s.name = '<%= plugin_name %>'
|
|
6
|
+
s.summary = 'OpenC3 <%= plugin_name %> plugin'
|
|
7
|
+
s.description = <<-EOF
|
|
8
|
+
<%= plugin_name %> plugin for deployment to OpenC3
|
|
9
|
+
EOF
|
|
10
|
+
s.license = 'AGPL-3.0-only'
|
|
11
|
+
s.authors = ['Anonymous']
|
|
12
|
+
s.email = ['name@domain.com']
|
|
13
|
+
s.homepage = 'https://github.com/OpenC3/openc3'
|
|
14
|
+
s.platform = Gem::Platform::RUBY
|
|
15
|
+
|
|
16
|
+
time = Time.now.strftime("%Y%m%d%H%M%S")
|
|
17
|
+
if ENV['VERSION']
|
|
18
|
+
s.version = ENV['VERSION'].dup + ".#{time}"
|
|
19
|
+
else
|
|
20
|
+
s.version = '0.0.0' + ".#{time}"
|
|
21
|
+
end
|
|
22
|
+
s.files = Dir.glob("{targets,lib,procedures,tools,microservices}/**/*") + %w(Rakefile README.md plugin.txt)
|
|
23
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Set VARIABLEs here to allow variation in your plugin
|
|
2
|
+
# See https://openc3.com/docs/v5/plugins for more information
|
|
3
|
+
VARIABLE <%= target_name.downcase %>_target_name <%= target_name %>
|
|
4
|
+
|
|
5
|
+
# Modify this according to your actual target connection
|
|
6
|
+
# See https://openc3.com/docs/v5/interfaces for more information
|
|
7
|
+
TARGET <%= target_name %> <%%= <%= target_name.downcase %>_target_name %>
|
|
8
|
+
INTERFACE <%%= <%= target_name.downcase %>_target_name %>_INT tcpip_client_interface.rb host.docker.internal 8080 8081 10.0 nil BURST
|
|
9
|
+
MAP_TARGET <%%= <%= target_name.downcase %>_target_name %>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
COMMAND <%= target_name %> EXAMPLE BIG_ENDIAN "Packet description"
|
|
2
|
+
# Keyword Name BitSize Type Min Max Default Description
|
|
3
|
+
APPEND_ID_PARAMETER ID 16 INT 1 1 1 "Identifier"
|
|
4
|
+
APPEND_PARAMETER VALUE 32 FLOAT 0 10.5 2.5 "Value"
|
|
5
|
+
APPEND_PARAMETER BOOL 8 UINT MIN MAX 0 "Boolean"
|
|
6
|
+
STATE FALSE 0
|
|
7
|
+
STATE TRUE 1
|
|
8
|
+
APPEND_PARAMETER LABEL 0 STRING "OpenC3" "The label to apply"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
TELEMETRY <%= target_name %> STATUS BIG_ENDIAN "Telemetry description"
|
|
2
|
+
# Keyword Name BitSize Type ID Description
|
|
3
|
+
APPEND_ID_ITEM ID 16 INT 1 "Identifier"
|
|
4
|
+
APPEND_ITEM VALUE 32 FLOAT "Value"
|
|
5
|
+
APPEND_ITEM BOOL 8 UINT "Boolean"
|
|
6
|
+
STATE FALSE 0
|
|
7
|
+
STATE TRUE 1
|
|
8
|
+
APPEND_ITEM LABEL 0 STRING "The label to apply"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# This class can be used in your scripts like so:
|
|
2
|
+
# require '<%= target_lib_filename %>'
|
|
3
|
+
# <%= target_object %> = <%= target_class %>.new
|
|
4
|
+
# <%= target_object %>.utility
|
|
5
|
+
# For more information see the OpenC3 scripting guide
|
|
6
|
+
|
|
7
|
+
class <%= target_class %>
|
|
8
|
+
def utility
|
|
9
|
+
end
|
|
10
|
+
end
|