cosmos 3.2.1 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +195 -0
- data/README.md +3 -3
- data/data/crc.txt +52 -52
- data/lib/cosmos.rb +1 -1
- data/lib/cosmos/core_ext/time.rb +11 -9
- data/lib/cosmos/gui/choosers/telemetry_chooser.rb +0 -2
- data/lib/cosmos/gui/dialogs/about_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/exception_dialog.rb +2 -2
- data/lib/cosmos/gui/dialogs/progress_dialog.rb +11 -5
- data/lib/cosmos/gui/dialogs/splash.rb +32 -10
- data/lib/cosmos/gui/dialogs/tlm_details_dialog.rb +1 -1
- data/lib/cosmos/gui/line_graph/line_graph_drawing.rb +2 -2
- data/lib/cosmos/gui/qt.rb +22 -22
- data/lib/cosmos/io/json_drb.rb +4 -4
- data/lib/cosmos/io/json_rpc.rb +21 -21
- data/lib/cosmos/packet_logs/packet_log_writer.rb +18 -20
- data/lib/cosmos/packets/commands.rb +8 -6
- data/lib/cosmos/packets/limits.rb +3 -2
- data/lib/cosmos/packets/packet.rb +14 -11
- data/lib/cosmos/packets/parsers/limits_parser.rb +1 -1
- data/lib/cosmos/packets/parsers/macro_parser.rb +4 -4
- data/lib/cosmos/packets/parsers/state_parser.rb +1 -1
- data/lib/cosmos/packets/structure.rb +2 -2
- data/lib/cosmos/packets/telemetry.rb +5 -4
- data/lib/cosmos/script/script.rb +6 -6
- data/lib/cosmos/streams/tcpip_socket_stream.rb +2 -1
- data/lib/cosmos/streams/template_stream_protocol.rb +1 -1
- data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +1 -1
- data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server_gui.rb +5 -8
- data/lib/cosmos/tools/cmd_tlm_server/gui/interfaces_tab.rb +4 -3
- data/lib/cosmos/tools/cmd_tlm_server/gui/packets_tab.rb +9 -3
- data/lib/cosmos/tools/cmd_tlm_server/gui/status_tab.rb +15 -11
- data/lib/cosmos/tools/data_viewer/data_viewer.rb +1 -1
- data/lib/cosmos/tools/data_viewer/data_viewer_component.rb +2 -2
- data/lib/cosmos/tools/handbook_creator/handbook_creator.rb +2 -2
- data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +0 -2
- data/lib/cosmos/tools/limits_monitor/limits_monitor.rb +1 -1
- data/lib/cosmos/tools/replay/replay.rb +2 -2
- data/lib/cosmos/tools/script_runner/script_audit.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner.rb +1 -1
- data/lib/cosmos/tools/script_runner/script_runner_frame.rb +3 -7
- data/lib/cosmos/tools/table_manager/table_config.rb +1 -1
- data/lib/cosmos/tools/test_runner/results_writer.rb +1 -1
- data/lib/cosmos/tools/test_runner/test_runner.rb +2 -2
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor.rb +2 -1
- data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +1 -1
- data/lib/cosmos/tools/tlm_grapher/data_object_adders/xy_data_object_adder.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/housekeeping_data_object_editor.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/data_object_editors/xy_data_object_editor.rb +1 -0
- data/lib/cosmos/tools/tlm_grapher/tabbed_plots/overview_tabbed_plots.rb +3 -3
- data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +1 -3
- data/lib/cosmos/top_level.rb +2 -6
- data/lib/cosmos/utilities/ruby_lex_utils.rb +1 -1
- data/lib/cosmos/version.rb +5 -5
- data/lib/cosmos/win32/win32_main.rb +11 -7
- data/spec/ccsds/ccsds_packet_spec.rb +28 -28
- data/spec/ccsds/ccsds_parser_spec.rb +27 -27
- data/spec/config/config_parser_spec.rb +88 -88
- data/spec/conversions/conversion_spec.rb +3 -3
- data/spec/conversions/generic_conversion_spec.rb +9 -9
- data/spec/conversions/new_packet_log_conversion_spec.rb +4 -4
- data/spec/conversions/polynomial_conversion_spec.rb +7 -7
- data/spec/conversions/processor_conversion_spec.rb +9 -9
- data/spec/conversions/received_count_conversion_spec.rb +7 -7
- data/spec/conversions/received_time_formatted_conversion_spec.rb +9 -9
- data/spec/conversions/received_time_seconds_conversion_spec.rb +9 -9
- data/spec/conversions/segmented_polynomial_conversion_spec.rb +11 -11
- data/spec/conversions/unix_time_formatted_conversion_spec.rb +13 -13
- data/spec/conversions/unix_time_seconds_conversion_spec.rb +13 -13
- data/spec/core_ext/array_spec.rb +76 -76
- data/spec/core_ext/class_spec.rb +3 -3
- data/spec/core_ext/cosmos_io_spec.rb +16 -16
- data/spec/core_ext/exception_spec.rb +19 -19
- data/spec/core_ext/file_spec.rb +16 -16
- data/spec/core_ext/hash_spec.rb +3 -3
- data/spec/core_ext/io_spec.rb +2 -2
- data/spec/core_ext/kernel_spec.rb +2 -2
- data/spec/core_ext/math_spec.rb +43 -43
- data/spec/core_ext/matrix_spec.rb +22 -22
- data/spec/core_ext/objectspace_spec.rb +6 -6
- data/spec/core_ext/range_spec.rb +2 -2
- data/spec/core_ext/socket_spec.rb +4 -4
- data/spec/core_ext/string_spec.rb +67 -67
- data/spec/core_ext/stringio_spec.rb +2 -2
- data/spec/core_ext/time_spec.rb +82 -82
- data/spec/gui/line_graph/line_clip_spec.rb +34 -34
- data/spec/interfaces/interface_spec.rb +46 -46
- data/spec/interfaces/linc_interface_spec.rb +26 -26
- data/spec/interfaces/serial_interface_spec.rb +16 -16
- data/spec/interfaces/simulated_target_interface_spec.rb +21 -21
- data/spec/interfaces/stream_interface_spec.rb +22 -22
- data/spec/interfaces/tcpip_client_interface_spec.rb +14 -14
- data/spec/interfaces/tcpip_server_interface_spec.rb +41 -41
- data/spec/interfaces/udp_interface_spec.rb +46 -46
- data/spec/io/buffered_file_spec.rb +50 -50
- data/spec/io/io_multiplexer_spec.rb +9 -9
- data/spec/io/json_drb_object_spec.rb +7 -7
- data/spec/io/json_drb_spec.rb +55 -55
- data/spec/io/json_rpc_spec.rb +68 -68
- data/spec/io/raw_logger_pair_spec.rb +28 -28
- data/spec/io/raw_logger_spec.rb +22 -22
- data/spec/io/serial_driver_spec.rb +3 -3
- data/spec/io/stderr_spec.rb +2 -2
- data/spec/io/stdout_spec.rb +2 -2
- data/spec/io/tcpip_server_spec.rb +62 -62
- data/spec/io/udp_sockets_spec.rb +19 -19
- data/spec/io/win32_serial_driver_spec.rb +10 -10
- data/spec/packet_logs/meta_packet_log_writer_spec.rb +32 -32
- data/spec/packet_logs/packet_log_reader_spec.rb +138 -138
- data/spec/packet_logs/packet_log_writer_pair_spec.rb +3 -3
- data/spec/packet_logs/packet_log_writer_spec.rb +26 -26
- data/spec/packets/binary_accessor_spec.rb +672 -672
- data/spec/packets/commands_spec.rb +123 -123
- data/spec/packets/limits_response_spec.rb +1 -1
- data/spec/packets/limits_spec.rb +69 -69
- data/spec/packets/packet_config_spec.rb +93 -93
- data/spec/packets/packet_item_limits_spec.rb +46 -46
- data/spec/packets/packet_item_spec.rb +108 -108
- data/spec/packets/packet_spec.rb +364 -348
- data/spec/packets/parsers/format_string_parser_spec.rb +13 -13
- data/spec/packets/parsers/limits_parser_spec.rb +8 -8
- data/spec/packets/parsers/limits_response_parser_spec.rb +9 -9
- data/spec/packets/parsers/macro_parser_spec.rb +34 -6
- data/spec/packets/parsers/packet_parser_spec.rb +6 -6
- data/spec/packets/parsers/processor_parser_spec.rb +7 -7
- data/spec/packets/parsers/state_parser_spec.rb +23 -23
- data/spec/packets/structure_item_spec.rb +62 -62
- data/spec/packets/structure_spec.rb +183 -183
- data/spec/packets/telemetry_spec.rb +174 -174
- data/spec/processors/new_packet_log_processor_spec.rb +4 -4
- data/spec/processors/processor_spec.rb +9 -9
- data/spec/processors/statistics_processor_spec.rb +21 -21
- data/spec/processors/watermark_processor_spec.rb +12 -12
- data/spec/script/script_spec.rb +158 -158
- data/spec/spec_helper.rb +44 -13
- data/spec/streams/burst_stream_protocol_spec.rb +8 -8
- data/spec/streams/fixed_stream_protocol_spec.rb +26 -26
- data/spec/streams/length_stream_protocol_spec.rb +27 -27
- data/spec/streams/preidentified_stream_protocol_spec.rb +25 -25
- data/spec/streams/serial_stream_spec.rb +19 -19
- data/spec/streams/stream_protocol_spec.rb +52 -52
- data/spec/streams/stream_spec.rb +1 -1
- data/spec/streams/tcpip_client_stream_spec.rb +7 -7
- data/spec/streams/tcpip_socket_stream_spec.rb +84 -49
- data/spec/streams/template_stream_protocol_spec.rb +17 -17
- data/spec/streams/terminated_stream_protocol_spec.rb +19 -19
- data/spec/system/system_spec.rb +95 -95
- data/spec/system/target_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/api_spec.rb +386 -386
- data/spec/tools/cmd_tlm_server/background_task_spec.rb +3 -3
- data/spec/tools/cmd_tlm_server/background_tasks_spec.rb +8 -8
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_config_spec.rb +57 -57
- data/spec/tools/cmd_tlm_server/cmd_tlm_server_spec.rb +85 -85
- data/spec/tools/cmd_tlm_server/commanding_spec.rb +11 -11
- data/spec/tools/cmd_tlm_server/connections_spec.rb +23 -23
- data/spec/tools/cmd_tlm_server/interface_thread_spec.rb +57 -57
- data/spec/tools/cmd_tlm_server/interfaces_spec.rb +32 -32
- data/spec/tools/cmd_tlm_server/packet_logging_spec.rb +17 -17
- data/spec/tools/cmd_tlm_server/router_thread_spec.rb +15 -15
- data/spec/tools/cmd_tlm_server/routers_spec.rb +36 -36
- data/spec/top_level/top_level_spec.rb +60 -60
- data/spec/utilities/crc_spec.rb +6 -6
- data/spec/utilities/csv_spec.rb +13 -13
- data/spec/utilities/logger_spec.rb +20 -20
- data/spec/utilities/message_log_spec.rb +13 -13
- data/spec/utilities/quaternion_spec.rb +30 -30
- data/spec/utilities/ruby_lex_utils_spec.rb +14 -14
- data/test/benchmarks/binary_accessor_benchmark.rb +14 -0
- data/test/benchmarks/gsub_benchmark.rb +114 -0
- data/test/performance/PACKETS.bat +1 -0
- data/test/performance/Rakefile +77 -0
- data/test/performance/THREADS.bat +1 -0
- data/test/performance/config/data/attitude.bin +0 -0
- data/test/performance/config/data/crc.txt +206 -0
- data/test/performance/config/data/diamond.STL +58 -0
- data/test/performance/config/data/groundoff.gif +0 -0
- data/test/performance/config/data/groundon.gif +0 -0
- data/test/performance/config/data/hselectoff.gif +0 -0
- data/test/performance/config/data/hselecton.gif +0 -0
- data/test/performance/config/data/hswitchoff.gif +0 -0
- data/test/performance/config/data/hswitchon.gif +0 -0
- data/test/performance/config/data/meta_init.txt +4 -0
- data/test/performance/config/data/position.bin +0 -0
- data/test/performance/config/data/poweroff.gif +0 -0
- data/test/performance/config/data/poweron.gif +0 -0
- data/test/performance/config/data/satellite.gif +0 -0
- data/test/performance/config/data/tada.wav +0 -0
- data/test/performance/config/data/vswitchoff.gif +0 -0
- data/test/performance/config/data/vswitchon.gif +0 -0
- data/test/performance/config/system/system_packets.txt +39 -0
- data/test/performance/config/system/system_threads.txt +59 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_cmds.txt +41 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm/cosmos_server_tlm.txt +15 -0
- data/test/performance/config/targets/COSMOS/cmd_tlm_server.txt +6 -0
- data/test/performance/config/targets/COSMOS/screens/limits_change.txt +20 -0
- data/test/performance/config/targets/COSMOS/screens/version.txt +19 -0
- data/test/performance/config/targets/COSMOS/target.txt +11 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_cmds.txt +17 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm/example_tlm.txt +18 -0
- data/test/performance/config/targets/EXAMPLE/cmd_tlm_server.txt +6 -0
- data/test/performance/config/targets/EXAMPLE/lib/example_interface.rb +22 -0
- data/test/performance/config/targets/EXAMPLE/target.txt +7 -0
- data/test/performance/config/targets/SYSTEM/screens/status.txt +12 -0
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_packets.txt +34 -0
- data/test/performance/config/tools/cmd_tlm_server/cmd_tlm_server_threads.txt +68 -0
- data/test/performance/config/tools/data_viewer/data_viewer.txt +11 -0
- data/test/performance/config/tools/handbook_creator/default_toc.xsl +59 -0
- data/test/performance/config/tools/handbook_creator/handbook_creator.txt +66 -0
- data/test/performance/config/tools/handbook_creator/templates/command_packets.html.erb +86 -0
- data/test/performance/config/tools/handbook_creator/templates/command_toc.html.erb +38 -0
- data/test/performance/config/tools/handbook_creator/templates/footer.html.erb +9 -0
- data/test/performance/config/tools/handbook_creator/templates/header.html.erb +25 -0
- data/test/performance/config/tools/handbook_creator/templates/limits_groups.html.erb +13 -0
- data/test/performance/config/tools/handbook_creator/templates/nav.html.erb +27 -0
- data/test/performance/config/tools/handbook_creator/templates/overview.html.erb +1 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_cover.html.erb +23 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_footer.html.erb +33 -0
- data/test/performance/config/tools/handbook_creator/templates/pdf_header.html.erb +41 -0
- data/test/performance/config/tools/handbook_creator/templates/telemetry_packets.html.erb +80 -0
- data/test/performance/config/tools/handbook_creator/templates/telemetry_toc.html.erb +38 -0
- data/test/performance/config/tools/handbook_creator/templates/title.html.erb +1 -0
- data/test/performance/config/tools/launcher/launcher_packets.txt +29 -0
- data/test/performance/config/tools/launcher/launcher_threads.txt +70 -0
- data/test/performance/config/tools/limits_monitor/README.txt +1 -0
- data/test/performance/config/tools/opengl_builder/README.txt +1 -0
- data/test/performance/config/tools/script_runner/script_runner.txt +3 -0
- data/test/performance/config/tools/table_manager/ConfigTables_def.txt +8 -0
- data/test/performance/config/tools/table_manager/ExampleTableDefinition.txt +24 -0
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw1_def.txt +25 -0
- data/test/performance/config/tools/table_manager/MCConfigurationTable_fsw2_def.txt +25 -0
- data/test/performance/config/tools/table_manager/PPSSelectionTable_def.txt +8 -0
- data/test/performance/config/tools/table_manager/TLMMonitoringTable_def.txt +248 -0
- data/test/performance/config/tools/test_runner/test_runner.txt +17 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor.txt +13 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor2.txt +2 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor3.txt +2 -0
- data/test/performance/config/tools/tlm_extractor/tlm_extractor4.txt +2 -0
- data/test/performance/config/tools/tlm_grapher/README.txt +1 -0
- data/test/performance/config/tools/tlm_viewer/tlm_viewer.txt +41 -0
- data/test/performance/lib/example_background_task.rb +57 -0
- data/test/performance/lib/example_target.rb +120 -0
- data/test/performance/lib/scpi_target.rb +74 -0
- data/test/performance/lib/user_version.rb +3 -0
- data/test/performance/outputs/handbooks/README.txt +1 -0
- data/test/performance/outputs/logs/README.txt +1 -0
- data/test/performance/outputs/saved_config/README.txt +1 -0
- data/test/performance/outputs/tables/README.txt +1 -0
- data/test/performance/outputs/tmp/README.txt +1 -0
- data/test/performance/procedures/checks.rb +11 -0
- data/test/performance/procedures/clear_util.rb +7 -0
- data/test/performance/procedures/collect.rb +18 -0
- data/test/performance/procedures/collect_util.rb +14 -0
- data/test/performance/procedures/cosmos_api_test.rb +293 -0
- data/test/performance/procedures/disconnect.rb +29 -0
- data/test/performance/procedures/example_test.rb +182 -0
- data/test/performance/procedures/plot_test.rb +8 -0
- data/test/performance/procedures/procedure.rb +3 -0
- data/test/performance/procedures/run_example_test.rb +3 -0
- data/test/performance/procedures/test.rb +51 -0
- data/test/performance/tools/CmdExtractor +14 -0
- data/test/performance/tools/CmdExtractor.bat +59 -0
- data/test/performance/tools/CmdSender +14 -0
- data/test/performance/tools/CmdSender.bat +59 -0
- data/test/performance/tools/CmdTlmServer +16 -0
- data/test/performance/tools/CmdTlmServer.bat +59 -0
- data/test/performance/tools/CmdTlmServerMemProf +20 -0
- data/test/performance/tools/CmdTlmServerMemProf.bat +59 -0
- data/test/performance/tools/DataViewer +14 -0
- data/test/performance/tools/DataViewer.bat +59 -0
- data/test/performance/tools/ExampleTarget +14 -0
- data/test/performance/tools/ExampleTarget.bat +59 -0
- data/test/performance/tools/HandbookCreator +14 -0
- data/test/performance/tools/HandbookCreator.bat +61 -0
- data/test/performance/tools/Launcher +14 -0
- data/test/performance/tools/Launcher.bat +59 -0
- data/test/performance/tools/LimitsMonitor +14 -0
- data/test/performance/tools/LimitsMonitor.bat +59 -0
- data/test/performance/tools/OpenGLBuilder +14 -0
- data/test/performance/tools/OpenGLBuilder.bat +59 -0
- data/test/performance/tools/PacketViewer +14 -0
- data/test/performance/tools/PacketViewer.bat +59 -0
- data/test/performance/tools/Replay +14 -0
- data/test/performance/tools/Replay.bat +59 -0
- data/test/performance/tools/ScpiTarget +14 -0
- data/test/performance/tools/ScpiTarget.bat +59 -0
- data/test/performance/tools/ScriptRunner +14 -0
- data/test/performance/tools/ScriptRunner.bat +59 -0
- data/test/performance/tools/TableManager +14 -0
- data/test/performance/tools/TableManager.bat +59 -0
- data/test/performance/tools/TestRunner +14 -0
- data/test/performance/tools/TestRunner.bat +59 -0
- data/test/performance/tools/TlmExtractor +14 -0
- data/test/performance/tools/TlmExtractor.bat +59 -0
- data/test/performance/tools/TlmGrapher +14 -0
- data/test/performance/tools/TlmGrapher.bat +59 -0
- data/test/performance/tools/TlmViewer +14 -0
- data/test/performance/tools/TlmViewer.bat +59 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/CmdExtractor.rb +15 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdExtractor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/CmdSender.rb +15 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdSender.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/CmdTlmServer.rb +15 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/CmdTlmServer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/DataViewer.rb +15 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/DataViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/HandbookCreator.rb +15 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/HandbookCreator.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/Launcher.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/Launcher.rb +15 -0
- data/test/performance/tools/mac/Launcher.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/Launcher.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/LimitsMonitor.rb +15 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/LimitsMonitor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/OpenGLBuilder.rb +15 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/OpenGLBuilder.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/PacketViewer.rb +15 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/PacketViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/Replay.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/Replay.rb +15 -0
- data/test/performance/tools/mac/Replay.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/Replay.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/ScriptRunner.rb +15 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/ScriptRunner.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TableManager.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/TableManager.rb +15 -0
- data/test/performance/tools/mac/TableManager.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TableManager.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/TestRunner.rb +15 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TestRunner.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/TlmExtractor.rb +15 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmExtractor.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/TlmGrapher.rb +15 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmGrapher.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/Info.plist +38 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/TlmViewer.rb +15 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/MacOS/main.sh +6 -0
- data/test/performance/tools/mac/TlmViewer.app/Contents/Resources/appIcon.icns +0 -0
- data/test/performance/userpath.txt +1 -0
- metadata +197 -2
data/lib/cosmos.rb
CHANGED
data/lib/cosmos/core_ext/time.rb
CHANGED
@@ -78,27 +78,27 @@ class Time
|
|
78
78
|
dd, hh = hh.divmod(24)
|
79
79
|
if dd != 0
|
80
80
|
if dd == 1
|
81
|
-
result
|
81
|
+
result << "%d day, " % dd
|
82
82
|
else
|
83
|
-
result
|
83
|
+
result << "%d days, " % dd
|
84
84
|
end
|
85
85
|
end
|
86
86
|
if hh != 0
|
87
87
|
if hh == 1
|
88
|
-
result
|
88
|
+
result << "%d hour, " % hh
|
89
89
|
else
|
90
|
-
result
|
90
|
+
result << "%d hours, " % hh
|
91
91
|
end
|
92
92
|
end
|
93
93
|
if mm != 0
|
94
94
|
if mm == 1
|
95
|
-
result
|
95
|
+
result << "%d minute, " % mm
|
96
96
|
else
|
97
|
-
result
|
97
|
+
result << "%d minutes, " % mm
|
98
98
|
end
|
99
99
|
end
|
100
100
|
if ss > 0
|
101
|
-
result
|
101
|
+
result << "%.2f seconds" % ss
|
102
102
|
else
|
103
103
|
result = result[0..-3]
|
104
104
|
end
|
@@ -353,14 +353,16 @@ class Time
|
|
353
353
|
# @param ms [Integer] CCSDS milliseconds
|
354
354
|
# @param us [Integer] CCSDS microseconds
|
355
355
|
# @param sec_epoch_jd [Float] Epoch to convert seconds from as a julian date
|
356
|
-
|
356
|
+
# @return [Float] The number of seconds from the given epoch to the given
|
357
|
+
# CCSDS day, milliseconds, and microseconds.
|
358
|
+
def self.ccsds2sec(day, ms, us, sec_epoch_jd = JULIAN_DATE_OF_CCSDS_EPOCH)
|
357
359
|
(self.ccsds2julian(day, ms, us) - sec_epoch_jd) * SEC_PER_DAY_FLOAT
|
358
360
|
end
|
359
361
|
|
360
362
|
# @param seconds [Float]
|
361
363
|
# @param sec_epoch_jd [Float] Epoch to of seconds value
|
362
364
|
# @return [Array<day, ms, us>] CCSDS date
|
363
|
-
def self.sec2ccsds
|
365
|
+
def self.sec2ccsds(sec, sec_epoch_jd = JULIAN_DATE_OF_CCSDS_EPOCH)
|
364
366
|
self.julian2ccsds((sec / SEC_PER_DAY_FLOAT) + sec_epoch_jd)
|
365
367
|
end
|
366
368
|
|
@@ -134,7 +134,6 @@ module Cosmos
|
|
134
134
|
@item_changed_callback = nil
|
135
135
|
@select_button_callback = nil
|
136
136
|
@support_latest = support_latest
|
137
|
-
update()
|
138
137
|
end
|
139
138
|
|
140
139
|
# Update items
|
@@ -249,7 +248,6 @@ module Cosmos
|
|
249
248
|
def update_targets
|
250
249
|
@target_combobox.clearItems()
|
251
250
|
target_names = System.telemetry.target_names
|
252
|
-
target_names.delete('UNKNOWN')
|
253
251
|
|
254
252
|
# Delete targets with only hidden packets
|
255
253
|
target_names_to_delete = []
|
@@ -67,9 +67,9 @@ module Cosmos
|
|
67
67
|
configurable_about_text = File.read(filename)
|
68
68
|
configurable_about_text.gsub!("\r", '') unless Kernel.is_windows?
|
69
69
|
if Kernel.is_windows?
|
70
|
-
configurable_about_text
|
70
|
+
configurable_about_text << "\n" + "Main Application x:#{parent.x} y:#{parent.y} width:#{parent.frameGeometry.width + 16} height:#{parent.frameGeometry.height + 38}\n\n" + ABOUT_COSMOS
|
71
71
|
else
|
72
|
-
configurable_about_text
|
72
|
+
configurable_about_text << "\n" + "Main Application x:#{parent.x} y:#{parent.y} width:#{parent.frameGeometry.width} height:#{parent.frameGeometry.height}\n\n" + ABOUT_COSMOS end
|
73
73
|
|
74
74
|
# Set the application about text
|
75
75
|
about = Qt::Label.new(about_string + "\n\n" + configurable_about_text)
|
@@ -61,9 +61,9 @@ module Cosmos
|
|
61
61
|
rescue
|
62
62
|
end
|
63
63
|
text = "The following error occurred:<br/>#{message}"
|
64
|
-
text
|
64
|
+
text << "<br/><br/>Please contact your local COSMOS expert.<br/><br/>This error has been logged:<br/>#{log_file}<br/><br/> <a href='mailto:rmelton@ball.com;jmthomas@ball.com?subject=COSMOS exception&body=#{file_contents}'>Click here</a> to email this log to the COSMOS developers." if log_file
|
65
65
|
end
|
66
|
-
text
|
66
|
+
text << "<br/><br/>NOTE!: The application will exit once you accept or dismiss this dialog!" if exit_afterwards
|
67
67
|
msg.setText(text)
|
68
68
|
if log_file
|
69
69
|
open_button = Qt::PushButton.new("Open Exception Log in Text Editor")
|
@@ -93,7 +93,7 @@ module Cosmos
|
|
93
93
|
# Create Progress Text Notifications
|
94
94
|
@progress_text = Qt::PlainTextEdit.new
|
95
95
|
@progress_text.setReadOnly(true)
|
96
|
-
@progress_text.setMaximumBlockCount(
|
96
|
+
@progress_text.setMaximumBlockCount(100)
|
97
97
|
end
|
98
98
|
|
99
99
|
@button_layout = Qt::HBoxLayout.new
|
@@ -125,6 +125,8 @@ module Cosmos
|
|
125
125
|
|
126
126
|
@thread = nil
|
127
127
|
@cancel_callback = nil
|
128
|
+
@overall_progress = 0
|
129
|
+
@step_progress = 0
|
128
130
|
end
|
129
131
|
|
130
132
|
def self.canceled?
|
@@ -199,17 +201,21 @@ module Cosmos
|
|
199
201
|
end
|
200
202
|
|
201
203
|
def set_step_progress (value)
|
202
|
-
|
204
|
+
progress_int = (value * 100).to_i
|
205
|
+
if !@complete and @step_progress != progress_int
|
206
|
+
@step_progress = progress_int
|
203
207
|
Qt.execute_in_main_thread(false) do
|
204
|
-
@step_bar.setValue(
|
208
|
+
@step_bar.setValue(progress_int) if @step_bar
|
205
209
|
end
|
206
210
|
end
|
207
211
|
end
|
208
212
|
|
209
213
|
def set_overall_progress (value)
|
210
|
-
|
214
|
+
progress_int = (value * 100).to_i
|
215
|
+
if !@complete and @overall_progress != progress_int
|
216
|
+
@overall_progress = progress_int
|
211
217
|
Qt.execute_in_main_thread(false) do
|
212
|
-
@overall_bar.setValue(
|
218
|
+
@overall_bar.setValue(progress_int) if @overall_bar
|
213
219
|
end
|
214
220
|
end
|
215
221
|
end
|
@@ -37,19 +37,27 @@ module Cosmos
|
|
37
37
|
layout.addWidget(@message_box)
|
38
38
|
@progress_bar = Qt::ProgressBar.new
|
39
39
|
layout.addWidget(@progress_bar)
|
40
|
-
|
41
40
|
setLayout(layout)
|
41
|
+
|
42
|
+
@progress = 0
|
43
|
+
@complete = false
|
42
44
|
end
|
43
45
|
|
44
46
|
def message=(message)
|
45
|
-
|
46
|
-
|
47
|
+
unless @complete
|
48
|
+
Qt.execute_in_main_thread(false) do
|
49
|
+
@message_box.setText(message)
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
50
54
|
def progress=(progress)
|
51
|
-
|
52
|
-
|
55
|
+
progress_int = (progress * 100).to_i
|
56
|
+
if !@complete and @progress != progress_int
|
57
|
+
@progress = progress_int
|
58
|
+
Qt.execute_in_main_thread(false) do
|
59
|
+
@progress_bar.setValue(progress_int)
|
60
|
+
end
|
53
61
|
end
|
54
62
|
end
|
55
63
|
|
@@ -82,7 +90,6 @@ module Cosmos
|
|
82
90
|
# Qt.execute_in_main_thread(true) do
|
83
91
|
# < Update the GUI >
|
84
92
|
# end
|
85
|
-
complete = false
|
86
93
|
Thread.new do
|
87
94
|
error = nil
|
88
95
|
begin
|
@@ -91,6 +98,8 @@ module Cosmos
|
|
91
98
|
error = e
|
92
99
|
end
|
93
100
|
|
101
|
+
@complete = true
|
102
|
+
|
94
103
|
# If the block threw an error show it before allowing the application to crash
|
95
104
|
if error
|
96
105
|
Qt.execute_in_main_thread(true) do
|
@@ -101,12 +110,25 @@ module Cosmos
|
|
101
110
|
Qt.execute_in_main_thread(true) do
|
102
111
|
# Once the block has completed we hide and dispose the dialog to allow the main application to take over
|
103
112
|
dialog.hide
|
104
|
-
|
113
|
+
|
114
|
+
unless wait_for_complete
|
115
|
+
# Need to make sure all Qt.execute_in_main_thread() have completed before disposing or
|
116
|
+
# we will segfault
|
117
|
+
Qt::RubyThreadFix.queue.pop.call until Qt::RubyThreadFix.queue.empty?
|
118
|
+
|
119
|
+
dialog.dispose
|
120
|
+
end
|
105
121
|
end
|
106
|
-
complete = true
|
107
122
|
end
|
108
|
-
|
109
|
-
|
123
|
+
if wait_for_complete
|
124
|
+
dialog.exec
|
125
|
+
|
126
|
+
# Need to make sure all Qt.execute_in_main_thread() have completed before disposing or
|
127
|
+
# we will segfault
|
128
|
+
Qt::RubyThreadFix.queue.pop.call until Qt::RubyThreadFix.queue.empty?
|
129
|
+
|
130
|
+
dialog.dispose
|
131
|
+
end
|
110
132
|
end
|
111
133
|
end
|
112
134
|
|
@@ -146,7 +146,7 @@ module Cosmos
|
|
146
146
|
if limits_settings[0]
|
147
147
|
label_text = "RL/#{limits_settings[0][0]} YL/#{limits_settings[0][1]} YH/#{limits_settings[0][2]} RH/#{limits_settings[0][3]}"
|
148
148
|
if limits_settings[0][4] and limits_settings[0][5]
|
149
|
-
label_text
|
149
|
+
label_text << " GL/#{limits_settings[0][4]} GH/#{limits_settings[0][5]}"
|
150
150
|
end
|
151
151
|
if @limits_labels[limits_set]
|
152
152
|
@limits_labels[limits_set].text = label_text
|
@@ -360,7 +360,7 @@ module Cosmos
|
|
360
360
|
right_text_x = text_x + (legend_width / 2)
|
361
361
|
left_text_y = text_y
|
362
362
|
right_text_y = text_y
|
363
|
-
@lines.legend.
|
363
|
+
@lines.legend.reverse_each do |legend_text, color, axis|
|
364
364
|
if axis == :LEFT
|
365
365
|
dc.addSimpleTextAt(legend_text, left_text_x, left_text_y, color)
|
366
366
|
left_text_y -= metrics.height
|
@@ -375,7 +375,7 @@ module Cosmos
|
|
375
375
|
text_y = right_text_y
|
376
376
|
end
|
377
377
|
else
|
378
|
-
@lines.legend.
|
378
|
+
@lines.legend.reverse_each do |legend_text, color, axis|
|
379
379
|
dc.addSimpleTextAt(legend_text, text_x, text_y, color)
|
380
380
|
text_y -= metrics.height
|
381
381
|
end
|
data/lib/cosmos/gui/qt.rb
CHANGED
@@ -428,6 +428,8 @@ class Qt::LineEdit
|
|
428
428
|
end
|
429
429
|
|
430
430
|
class Qt::PlainTextEdit
|
431
|
+
@@color_cache = {}
|
432
|
+
|
431
433
|
def add_formatted_text(text, color = nil)
|
432
434
|
if text =~ /[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F-\xFF]/
|
433
435
|
text.chomp!
|
@@ -435,16 +437,16 @@ class Qt::PlainTextEdit
|
|
435
437
|
text << "\n"
|
436
438
|
end
|
437
439
|
if text =~ /<G>/ or color == Cosmos::GREEN
|
438
|
-
text.gsub!(
|
440
|
+
text.gsub!(/<G>/, '')
|
439
441
|
addText(text, Cosmos::GREEN)
|
440
442
|
elsif text =~ /<Y>/ or color == Cosmos::YELLOW
|
441
|
-
text.gsub!(
|
443
|
+
text.gsub!(/<Y>/, '')
|
442
444
|
addText(text, Cosmos::YELLOW)
|
443
445
|
elsif text =~ /<R>/ or color == Cosmos::RED
|
444
|
-
text.gsub!(
|
446
|
+
text.gsub!(/<R>/, '')
|
445
447
|
addText(text, Cosmos::RED)
|
446
448
|
elsif text =~ /<B>/ or color == Cosmos::BLUE
|
447
|
-
text.gsub!(
|
449
|
+
text.gsub!(/<B>/, '')
|
448
450
|
addText(text, Cosmos::BLUE)
|
449
451
|
else
|
450
452
|
addText(text) # default is Cosmos::BLACK
|
@@ -452,30 +454,17 @@ class Qt::PlainTextEdit
|
|
452
454
|
end
|
453
455
|
|
454
456
|
def addText(text, color = Cosmos::BLACK)
|
455
|
-
@current_text
|
456
|
-
|
457
|
-
text.gsub!("\n", '')
|
458
|
-
text.gsub!(' ', ' ')
|
459
|
-
text.gsub!(">", ">")
|
460
|
-
text.gsub!("<", "<")
|
461
|
-
rgb_color = "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
462
|
-
@current_text +="<font color=\"#{rgb_color}\">#{text}</font><br/>"
|
457
|
+
@current_text ||= ''
|
458
|
+
@current_text << escape_text(text.chomp, color) << '<br/>'.freeze
|
463
459
|
end
|
464
460
|
|
465
461
|
def flush
|
466
462
|
appendHtml(@current_text)
|
467
|
-
@current_text
|
463
|
+
@current_text.clear
|
468
464
|
end
|
469
465
|
|
470
466
|
def appendText(text, color = Cosmos::BLACK)
|
471
|
-
text
|
472
|
-
text.gsub!(/\n/, '<br/>') # replace newlines with html breaks
|
473
|
-
text.gsub!("&", "&")
|
474
|
-
text.gsub!(' ', ' ')
|
475
|
-
text.gsub!(">", ">")
|
476
|
-
text.gsub!("<", "<")
|
477
|
-
rgb_color = "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
478
|
-
appendHtml("<font color=\"#{rgb_color}\">#{text}</font>")
|
467
|
+
appendHtml(escape_text(text.chomp, color))
|
479
468
|
end
|
480
469
|
|
481
470
|
# Return the selected lines. If a partial line is selected the entire line will be returned.
|
@@ -522,6 +511,17 @@ class Qt::PlainTextEdit
|
|
522
511
|
cursor.setPosition(textCursor.selectionEnd)
|
523
512
|
cursor.blockNumber
|
524
513
|
end
|
514
|
+
|
515
|
+
private
|
516
|
+
|
517
|
+
def escape_text(text, color)
|
518
|
+
# You might think gsub! would use less memory but benchmarking proves gsub
|
519
|
+
# with a regular express argument is the fastest and uses the least memory.
|
520
|
+
# However, this is still an expensive operation due to how many times it is called.
|
521
|
+
text = text.gsub(/&/,'&'.freeze).gsub(/\n/,'<br/>'.freeze).gsub(/\s/, ' '.freeze).gsub(/>/,'>'.freeze).gsub(/</,'<'.freeze)
|
522
|
+
@@color_cache[color] ||= "#%02X%02X%02X" % [color.red, color.green, color.blue]
|
523
|
+
"<font color=\"#{@@color_cache[color]}\">#{text}</font>"
|
524
|
+
end
|
525
525
|
end
|
526
526
|
|
527
527
|
class Qt::TextEdit
|
@@ -533,7 +533,7 @@ end
|
|
533
533
|
class Qt::ComboBox
|
534
534
|
# Helper method to remove all items from a ComboBox
|
535
535
|
def clearItems
|
536
|
-
(0...count).to_a.
|
536
|
+
(0...count).to_a.reverse_each do |index|
|
537
537
|
removeItem(index)
|
538
538
|
end
|
539
539
|
end
|
data/lib/cosmos/io/json_drb.rb
CHANGED
@@ -72,7 +72,7 @@ module Cosmos
|
|
72
72
|
def start_service(hostname = nil, port = nil, object = nil)
|
73
73
|
if hostname and port and object
|
74
74
|
@object = object
|
75
|
-
hostname = '127.0.0.1' if (hostname.to_s.upcase == 'LOCALHOST')
|
75
|
+
hostname = '127.0.0.1'.freeze if (hostname.to_s.upcase == 'LOCALHOST'.freeze)
|
76
76
|
|
77
77
|
# Create a socket to accept connections from clients
|
78
78
|
begin
|
@@ -171,7 +171,7 @@ module Cosmos
|
|
171
171
|
def self.receive_message(socket, data)
|
172
172
|
self.get_at_least_x_bytes_of_data(socket, data, 4)
|
173
173
|
if data.length >= 4
|
174
|
-
length = data[0..3].unpack('N')[0]
|
174
|
+
length = data[0..3].unpack('N'.freeze)[0]
|
175
175
|
data.replace(data[4..-1])
|
176
176
|
else
|
177
177
|
return nil
|
@@ -200,7 +200,7 @@ module Cosmos
|
|
200
200
|
return
|
201
201
|
end
|
202
202
|
current_data << data
|
203
|
-
rescue
|
203
|
+
rescue IO::WaitReadable
|
204
204
|
IO.fast_select([socket], nil, nil, nil)
|
205
205
|
retry
|
206
206
|
end
|
@@ -215,7 +215,7 @@ module Cosmos
|
|
215
215
|
num_bytes_to_send = data.length + 4
|
216
216
|
total_bytes_sent = 0
|
217
217
|
bytes_sent = 0
|
218
|
-
data_to_send = [data.length].pack('N') << data.clone
|
218
|
+
data_to_send = [data.length].pack('N'.freeze) << data.clone
|
219
219
|
|
220
220
|
loop do
|
221
221
|
begin
|
data/lib/cosmos/io/json_rpc.rb
CHANGED
@@ -183,28 +183,28 @@ module Cosmos
|
|
183
183
|
# @param id [Integer] The identifier which will be matched to the response
|
184
184
|
def initialize(method_name, method_params, id)
|
185
185
|
super()
|
186
|
-
@hash['jsonrpc'] = "2.0"
|
187
|
-
@hash['method'] = method_name.to_s
|
186
|
+
@hash['jsonrpc'.freeze] = "2.0".freeze
|
187
|
+
@hash['method'.freeze] = method_name.to_s
|
188
188
|
if method_params and method_params.length != 0
|
189
|
-
@hash['params'] = method_params
|
189
|
+
@hash['params'.freeze] = method_params
|
190
190
|
end
|
191
|
-
@hash['id'] = id.to_i
|
191
|
+
@hash['id'.freeze] = id.to_i
|
192
192
|
end
|
193
193
|
|
194
194
|
# @return [String] The method to call
|
195
195
|
def method
|
196
|
-
@hash['method']
|
196
|
+
@hash['method'.freeze]
|
197
197
|
end
|
198
198
|
|
199
199
|
# @return [Array<String>] Array of strings which represent the
|
200
200
|
# parameters to send to the method
|
201
201
|
def params
|
202
|
-
@hash['params'] || []
|
202
|
+
@hash['params'.freeze] || []
|
203
203
|
end
|
204
204
|
|
205
205
|
# @return [Integer] The request identifier
|
206
206
|
def id
|
207
|
-
@hash['id']
|
207
|
+
@hash['id'.freeze]
|
208
208
|
end
|
209
209
|
|
210
210
|
# Creates a JsonRpcRequest object from a JSON encoded String. The version
|
@@ -216,7 +216,7 @@ module Cosmos
|
|
216
216
|
begin
|
217
217
|
hash = JSON.parse(request_data, :allow_nan => true, :create_additions => true)
|
218
218
|
# Verify the jsonrpc version is correct and there is a method and id
|
219
|
-
raise unless (hash['jsonrpc'] == "2.0" && hash['method'] && hash['id'])
|
219
|
+
raise unless (hash['jsonrpc'.freeze] == "2.0".freeze && hash['method'.freeze] && hash['id'.freeze])
|
220
220
|
self.from_hash(hash)
|
221
221
|
rescue
|
222
222
|
raise "Invalid JSON-RPC 2.0 Request"
|
@@ -229,7 +229,7 @@ module Cosmos
|
|
229
229
|
# and id
|
230
230
|
# @return [JsonRpcRequest]
|
231
231
|
def self.from_hash(hash)
|
232
|
-
self.new(hash['method'], hash['params'], hash['id'])
|
232
|
+
self.new(hash['method'.freeze], hash['params'.freeze], hash['id'.freeze])
|
233
233
|
end
|
234
234
|
end
|
235
235
|
|
@@ -239,8 +239,8 @@ module Cosmos
|
|
239
239
|
# @param id [Integer] The identifier which will be matched to the request
|
240
240
|
def initialize(id)
|
241
241
|
super()
|
242
|
-
@hash['jsonrpc'] = "2.0"
|
243
|
-
@hash['id'] = id
|
242
|
+
@hash['jsonrpc'.freeze] = "2.0".freeze
|
243
|
+
@hash['id'.freeze] = id
|
244
244
|
end
|
245
245
|
|
246
246
|
# Creates a JsonRpcResponse object from a JSON encoded String. The version
|
@@ -258,13 +258,13 @@ module Cosmos
|
|
258
258
|
end
|
259
259
|
|
260
260
|
# Verify the jsonrpc version is correct and there is an ID
|
261
|
-
raise msg unless hash['jsonrpc'] == "2.0" and hash.key?('id')
|
261
|
+
raise msg unless hash['jsonrpc'.freeze] == "2.0".freeze and hash.key?('id'.freeze)
|
262
262
|
# If there is a result this is probably a good response
|
263
|
-
if hash.key?('result')
|
263
|
+
if hash.key?('result'.freeze)
|
264
264
|
# Can't have an error key in a good response
|
265
|
-
raise msg if hash.key?('error')
|
265
|
+
raise msg if hash.key?('error'.freeze)
|
266
266
|
JsonRpcSuccessResponse.from_hash(hash)
|
267
|
-
elsif hash.key?('error')
|
267
|
+
elsif hash.key?('error'.freeze)
|
268
268
|
# There was an error key so create an error response
|
269
269
|
JsonRpcErrorResponse.from_hash(hash)
|
270
270
|
else
|
@@ -280,12 +280,12 @@ module Cosmos
|
|
280
280
|
# @param id [Integer] The identifier which will be matched to the request
|
281
281
|
def initialize(result, id)
|
282
282
|
super(id)
|
283
|
-
@hash['result'] = result
|
283
|
+
@hash['result'.freeze] = result
|
284
284
|
end
|
285
285
|
|
286
286
|
# @return [Object] The result of the method request
|
287
287
|
def result
|
288
|
-
@hash['result']
|
288
|
+
@hash['result'.freeze]
|
289
289
|
end
|
290
290
|
|
291
291
|
# Creates a JsonRpcSuccessResponse object from a Hash
|
@@ -293,7 +293,7 @@ module Cosmos
|
|
293
293
|
# @param hash [Hash] Hash containing the following keys: result and id
|
294
294
|
# @return [JsonRpcSuccessResponse]
|
295
295
|
def self.from_hash(hash)
|
296
|
-
self.new(hash['result'], hash['id'])
|
296
|
+
self.new(hash['result'.freeze], hash['id'.freeze])
|
297
297
|
end
|
298
298
|
end
|
299
299
|
|
@@ -304,12 +304,12 @@ module Cosmos
|
|
304
304
|
# @param id [Integer] The identifier which will be matched to the request
|
305
305
|
def initialize(error, id)
|
306
306
|
super(id)
|
307
|
-
@hash['error'] = error
|
307
|
+
@hash['error'.freeze] = error
|
308
308
|
end
|
309
309
|
|
310
310
|
# @return [JsonRpcError] The error object
|
311
311
|
def error
|
312
|
-
@hash['error']
|
312
|
+
@hash['error'.freeze]
|
313
313
|
end
|
314
314
|
|
315
315
|
# Creates a JsonRpcErrorResponse object from a Hash
|
@@ -317,7 +317,7 @@ module Cosmos
|
|
317
317
|
# @param hash [Hash] Hash containing the following keys: error and id
|
318
318
|
# @return [JsonRpcErrorResponse]
|
319
319
|
def self.from_hash(hash)
|
320
|
-
self.new(JsonRpcError.from_hash(hash['error']), hash['id'])
|
320
|
+
self.new(JsonRpcError.from_hash(hash['error'.freeze]), hash['id'.freeze])
|
321
321
|
end
|
322
322
|
end
|
323
323
|
|