cosmos 4.4.2 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/Dockerfile +6 -2
  3. data/Manifest.txt +25 -0
  4. data/README.md +4 -0
  5. data/Rakefile +3 -8
  6. data/bin/rubysloc +73 -28
  7. data/cosmos.gemspec +1 -1
  8. data/data/config/interface_modifiers.yaml +3 -2
  9. data/data/config/system.yaml +81 -24
  10. data/data/crc.txt +426 -426
  11. data/demo/config/data/crc.txt +233 -233
  12. data/demo/config/system/system.txt +15 -7
  13. data/demo/config/system/system2.txt +15 -7
  14. data/demo/config/system/system_alt_ports.txt +15 -7
  15. data/demo/config/targets/INST/cmd_tlm/inst_cmds.txt +1 -1
  16. data/extensions/vscode/.gitignore +4 -0
  17. data/extensions/vscode/.vscode/launch.json +32 -0
  18. data/extensions/vscode/.vscode/settings.json +13 -0
  19. data/extensions/vscode/.vscode/tasks.json +79 -0
  20. data/extensions/vscode/License.txt +879 -0
  21. data/extensions/vscode/README.md +9 -0
  22. data/extensions/vscode/client/License.txt +879 -0
  23. data/extensions/vscode/client/README.md +39 -0
  24. data/extensions/vscode/client/cosmos.configuration.json +23 -0
  25. data/extensions/vscode/client/images/icon.png +0 -0
  26. data/extensions/vscode/client/package-lock.json +414 -0
  27. data/extensions/vscode/client/package.json +105 -0
  28. data/extensions/vscode/client/src/extension.ts +132 -0
  29. data/extensions/vscode/client/src/screen_preview.rb +25 -0
  30. data/extensions/vscode/client/syntaxes/cosmos.tmLanguage.json +219 -0
  31. data/extensions/vscode/client/tsconfig.json +17 -0
  32. data/extensions/vscode/package-lock.json +26 -0
  33. data/extensions/vscode/package.json +35 -0
  34. data/extensions/vscode/server/License.txt +879 -0
  35. data/extensions/vscode/server/package-lock.json +236 -0
  36. data/extensions/vscode/server/package.json +29 -0
  37. data/extensions/vscode/server/src/server.ts +59 -0
  38. data/extensions/vscode/server/tsconfig.json +16 -0
  39. data/install/config/data/crc.txt +132 -132
  40. data/install/config/system/system.txt +15 -7
  41. data/lib/cosmos/core_ext/time.rb +3 -1
  42. data/lib/cosmos/dart/examples/dart_decom_client.rb +1 -1
  43. data/lib/cosmos/dart/lib/dart_decommutator.rb +4 -4
  44. data/lib/cosmos/dart/processes/dart_decom_server.rb +1 -1
  45. data/lib/cosmos/dart/processes/dart_master.rb +1 -1
  46. data/lib/cosmos/gui/qt_tool.rb +10 -12
  47. data/lib/cosmos/gui/widgets/dart_meta_frame.rb +1 -1
  48. data/lib/cosmos/interfaces/dart_status_interface.rb +1 -1
  49. data/lib/cosmos/interfaces/serial_interface.rb +7 -1
  50. data/lib/cosmos/io/json_drb.rb +2 -2
  51. data/lib/cosmos/io/json_drb_object.rb +7 -2
  52. data/lib/cosmos/io/json_drb_rack.rb +25 -5
  53. data/lib/cosmos/io/json_rpc.rb +1 -1
  54. data/lib/cosmos/io/posix_serial_driver.rb +60 -22
  55. data/lib/cosmos/io/serial_driver.rb +11 -8
  56. data/lib/cosmos/io/win32_serial_driver.rb +8 -1
  57. data/lib/cosmos/packets/structure.rb +11 -2
  58. data/lib/cosmos/script/api_shared.rb +8 -1
  59. data/lib/cosmos/script/script.rb +2 -9
  60. data/lib/cosmos/streams/serial_stream.rb +11 -6
  61. data/lib/cosmos/system/system.rb +43 -12
  62. data/lib/cosmos/tools/cmd_sender/cmd_param_table_item_delegate.rb +15 -0
  63. data/lib/cosmos/tools/cmd_sender/cmd_params.rb +25 -3
  64. data/lib/cosmos/tools/cmd_sender/cmd_sender.rb +7 -0
  65. data/lib/cosmos/tools/cmd_sequence/sequence_item.rb +0 -5
  66. data/lib/cosmos/tools/cmd_tlm_server/cmd_tlm_server.rb +2 -2
  67. data/lib/cosmos/tools/cmd_tlm_server/router_thread.rb +5 -0
  68. data/lib/cosmos/tools/config_editor/config_editor.rb +1 -1
  69. data/lib/cosmos/tools/handbook_creator/handbook_creator_config.rb +1 -1
  70. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_config.rb +1 -4
  71. data/lib/cosmos/tools/tlm_extractor/tlm_extractor_processor.rb +3 -3
  72. data/lib/cosmos/tools/tlm_grapher/tabbed_plots_tool/tabbed_plots_dart_thread.rb +1 -1
  73. data/lib/cosmos/tools/tlm_viewer/tlm_viewer.rb +2 -2
  74. data/lib/cosmos/version.rb +5 -5
  75. data/spec/core_ext/time_spec.rb +4 -0
  76. data/spec/io/json_drb_rack_spec.rb +166 -0
  77. data/spec/io/json_rpc_spec.rb +4 -5
  78. data/spec/io/posix_serial_driver_spec.rb +81 -0
  79. data/spec/io/win32_serial_driver_spec.rb +17 -1
  80. data/spec/system/system_spec.rb +108 -0
  81. data/spec/tools/cmd_tlm_server/router_thread_spec.rb +2 -3
  82. metadata +31 -6
@@ -0,0 +1,105 @@
1
+ {
2
+ "name": "cosmos",
3
+ "description": "Language support for COSMOS configuration files",
4
+ "author": "Ball Aerospace",
5
+ "license": "BALL GPL",
6
+ "version": "0.0.8",
7
+ "icon": "images/icon.png",
8
+ "homepage": "https://cosmosrb.com/",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/BallAerospace/COSMOS"
12
+ },
13
+ "publisher": "BallAero",
14
+ "categories": [
15
+ "Programming Languages",
16
+ "Other"
17
+ ],
18
+ "keywords": [
19
+ "ball aerospace cosmos"
20
+ ],
21
+ "engines": {
22
+ "vscode": "^1.23.0"
23
+ },
24
+ "activationEvents": [
25
+ "onLanguage:cosmos",
26
+ "onLanguage:cosmosScreen"
27
+ ],
28
+ "main": "./out/extension",
29
+ "contributes": {
30
+ "languages": [
31
+ {
32
+ "id": "cosmos",
33
+ "aliases": [
34
+ "COSMOS",
35
+ "Cosmos"
36
+ ],
37
+ "filenamePatterns": [
38
+ "**/config/system/*.txt",
39
+ "**/config/targets/*/cmdtlm/*.txt",
40
+ "**/config/targets/*/cmd_tlm/*.txt",
41
+ "**/config/targets/*/screens/*.txt",
42
+ "**/config/targets/*/cmd_tlm_server.txt",
43
+ "**/config/targets/*/target.txt",
44
+ "**/config/targets/tools/*/*.txt",
45
+ "**/config/tools/*/*.txt"
46
+ ],
47
+ "configuration": "./cosmos.configuration.json"
48
+ },
49
+ {
50
+ "id": "cosmosScreen",
51
+ "aliases": [
52
+ "COSMOS",
53
+ "Cosmos"
54
+ ],
55
+ "filenamePatterns": [
56
+ "**/config/targets/*/screens/*.txt"
57
+ ],
58
+ "configuration": "./cosmos.configuration.json"
59
+ }
60
+ ],
61
+ "grammars": [
62
+ {
63
+ "language": "cosmos",
64
+ "scopeName": "source.cosmos",
65
+ "path": "./syntaxes/cosmos.tmLanguage.json"
66
+ },
67
+ {
68
+ "language": "cosmosScreen",
69
+ "scopeName": "source.cosmos",
70
+ "path": "./syntaxes/cosmos.tmLanguage.json"
71
+ }
72
+ ],
73
+ "commands": [
74
+ {
75
+ "command": "cosmos.showGuiPreview",
76
+ "title": "Show Screen Preview",
77
+ "category": "COSMOS"
78
+ }
79
+ ],
80
+ "menus": {
81
+ "editor/title": [
82
+ {
83
+ "when": "resourceLangId == cosmosScreen",
84
+ "command": "cosmos.showGuiPreview",
85
+ "group": "navigation"
86
+ }
87
+ ]
88
+ }
89
+ },
90
+ "scripts": {
91
+ "vscode:prepublish": "tsc -p ./",
92
+ "compile": "tsc -p ./",
93
+ "watch": "tsc -watch -p ./",
94
+ "update-vscode": "node ./node_modules/vscode/bin/install",
95
+ "postinstall": "node ./node_modules/vscode/bin/install"
96
+ },
97
+ "dependencies": {
98
+ "@types/node": "^10.17.26",
99
+ "typescript": "^2.9.2",
100
+ "vscode-languageclient": "^3.5.1"
101
+ },
102
+ "devDependencies": {
103
+ "vscode": "^1.1.37"
104
+ }
105
+ }
@@ -0,0 +1,132 @@
1
+ import * as path from 'path';
2
+ import { commands, ExtensionContext, window, workspace } from 'vscode';
3
+
4
+ import {
5
+ LanguageClient,
6
+ LanguageClientOptions,
7
+ ServerOptions,
8
+ TransportKind
9
+ } from 'vscode-languageclient';
10
+
11
+ let client: LanguageClient;
12
+
13
+ export function activate(context: ExtensionContext) {
14
+
15
+ // The server is implemented in node
16
+ let serverModule = context.asAbsolutePath(
17
+ path.join('server', 'server.js')
18
+ );
19
+
20
+ // The debug options for the server
21
+ // --inspect=6009: runs the server in Node's Inspector mode so VS Code can attach to the server for debugging
22
+ let debugOptions = { execArgv: ['--nolazy', '--inspect=6009'] };
23
+
24
+ // If the extension is launched in debug mode then the debug server options are used
25
+ // Otherwise the run options are used
26
+ let serverOptions: ServerOptions = {
27
+ run: { module: serverModule, transport: TransportKind.ipc },
28
+ debug: {
29
+ module: serverModule,
30
+ transport: TransportKind.ipc,
31
+ options: debugOptions
32
+ }
33
+ };
34
+
35
+ // Options to control the language client
36
+ let clientOptions: LanguageClientOptions = {
37
+ // Register the server for cosmos documents
38
+ documentSelector: ['cosmos' ],
39
+ synchronize: {
40
+ // Notify the server about file changes to '.clientrc files contained in the workspace
41
+ fileEvents: [
42
+ workspace.createFileSystemWatcher('**/config/targets/*/cmdtlm/*.txt', false, false, false),
43
+ workspace.createFileSystemWatcher('**/config/targets/*/cmd_tlm/*.txt', false, false, false),
44
+ workspace.createFileSystemWatcher('**/config/targets/*/screens/*.txt', false, false, false),
45
+ workspace.createFileSystemWatcher('**/config/targets/*/cmd_tlm_server.txt', false, false, false),
46
+ workspace.createFileSystemWatcher('**/config/targets/*/target.txt', false, false, false),
47
+ workspace.createFileSystemWatcher('**/config/targets/tools/*/*.txt', false, false, false),
48
+ workspace.createFileSystemWatcher('**/lib/*.rb', false, false, false),
49
+ workspace.createFileSystemWatcher('**/procedures/*.rb', false, false, false),
50
+ ]
51
+ }
52
+ };
53
+
54
+ // Create the language client and start the client.
55
+ let disposableLangCl = new LanguageClient('cosmos', 'Language Server Cosmos', serverOptions, clientOptions).start();
56
+ context.subscriptions.push(disposableLangCl);
57
+
58
+ // create a telemetry screen viewer
59
+ let screenViewer = new CosmosScreenViewer(context.extensionPath);
60
+
61
+ // Use Console to log diagnostic info
62
+ console.log('COSMOS Extension!');
63
+
64
+ let disposable = commands.registerCommand('cosmos.showGuiPreview', () => {
65
+ screenViewer.previewScreen();
66
+ });
67
+
68
+ // Add to a list of disposables which are disposed when this extension is deactivated.
69
+ context.subscriptions.push(screenViewer);
70
+ context.subscriptions.push(disposable);
71
+ }
72
+
73
+ class CosmosScreenViewer {
74
+
75
+ extPath: string;
76
+
77
+ constructor(extensionPath: string) {
78
+ this.extPath = extensionPath;
79
+ }
80
+
81
+ public previewScreen () {
82
+
83
+ // Get the current text editor
84
+ let editor = window.activeTextEditor;
85
+ if (!editor) {
86
+ return;
87
+ }
88
+
89
+ // Get required modules
90
+ const exec = require("child_process").exec;
91
+
92
+ // Store current working directory
93
+ let currDir = process.cwd();
94
+ // Change to directory where current file is because cosmos depends on directories
95
+ try {
96
+ process.chdir(path.dirname(editor.document.fileName));
97
+ }
98
+ catch (err) {
99
+ console.log(err)
100
+ }
101
+
102
+ // Build up Ruby Command
103
+ let rubyCmd = 'ruby ' + this.extPath + '/src/screen_preview.rb ' + editor.document.fileName;
104
+
105
+ // Execute Ruby Command
106
+ exec(rubyCmd, {env: {'PATH': process.env.path}}, function(err, stdout, stderr) {
107
+ if (err != null && err != "")
108
+ {
109
+ console.log(err)
110
+ }
111
+ if (stderr != null && stderr != "")
112
+ {
113
+ console.log(stderr)
114
+ }
115
+ if (stdout != null && stdout != "")
116
+ {
117
+ console.log(stdout)
118
+ }
119
+ });
120
+
121
+ // Change back to directory current working directory
122
+ try {
123
+ process.chdir(currDir);
124
+ }
125
+ catch (err) {
126
+ console.log(err)
127
+ }
128
+ }
129
+
130
+ dispose() {
131
+ }
132
+ }
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require 'cosmos'
4
+ require 'cosmos/gui/qt'
5
+ require 'cosmos/gui/qt_tool'
6
+ require 'cosmos/gui/utilities/classification_banner'
7
+ require 'cosmos/script'
8
+ require 'cosmos/tools/tlm_viewer/widgets'
9
+ require 'cosmos/tools/tlm_viewer/screen'
10
+
11
+ begin
12
+ v1 = ARGV[0]
13
+
14
+ app = Qt::Application.new(ARGV)
15
+ window = Cosmos::Screen.new("preview", v1, nil, :REALTIME, nil, nil, nil, nil, false, true, nil)
16
+ app.exec
17
+ rescue Exception
18
+ # Don't care what we do here because the error is always:
19
+ #
20
+ # uninitialized class variable @@redirect_io_thread_sleeper in Cosmos::QtTool
21
+ # Did you mean? @@redirect_io_thread
22
+ #
23
+ # This is because its looking for another Cosmos thread that doesn't exist
24
+ # since we are running this screen standalone to just view the screen
25
+ end
@@ -0,0 +1,219 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3
+ "name": "cosmos",
4
+ "scopeName": "source.cosmos",
5
+ "patterns": [
6
+ { "include": "#rubyStatements" },
7
+ { "include": "#comments" },
8
+ { "include": "#strings" },
9
+ { "include": "#numbers" },
10
+ { "include": "#systemConfig" },
11
+ { "include": "#packetDef"},
12
+ { "include": "#packetItem"},
13
+ { "include": "#itemProperties" }
14
+ ],
15
+ "repository":{
16
+ "comments": {
17
+ "begin": "(^\\s+)?(?=#)",
18
+ "beginCaptures": {
19
+ "1": {
20
+ "name": "punctuation.whitespace.comment.leading"
21
+ }
22
+ },
23
+ "end": "(?!\\G)",
24
+ "patterns": [
25
+ {
26
+ "begin": "#",
27
+ "beginCaptures": {
28
+ "0": {
29
+ "name": "punctuation.definition.comment"
30
+ }
31
+ },
32
+ "end": "\\n",
33
+ "name": "comment.line.number-sign",
34
+ "patterns": [
35
+ {
36
+ "match": "\\\\\\n",
37
+ "name": "constant.character.escape.continuation"
38
+ }
39
+ ]
40
+ }
41
+ ]
42
+ },
43
+ "strings": {
44
+ "patterns": [
45
+ {
46
+ "description": "Single Quoted String",
47
+ "begin": "'",
48
+ "end": "'",
49
+ "name": "string.quoted.single"
50
+ },
51
+ {
52
+ "description": "Double Quoted String",
53
+ "begin": "\"",
54
+ "end": "\"",
55
+ "name": "string.quoted.double"
56
+ },
57
+ {
58
+ "match": "(?<=UNITS\\s)\\b\\S+\\s\\S+\\s*$",
59
+ "name": "string.unquoted"
60
+ }
61
+ ]
62
+ },
63
+ "numbers": {
64
+ "patterns": [
65
+ {
66
+ "match": "[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}",
67
+ "name": "constant.numeric"
68
+ },
69
+ {
70
+ "match": "0x[a-zA-Z0-9]+",
71
+ "name": "constant.numeric"
72
+ },
73
+ {
74
+ "match": "-?[0-9]+\\.[0-9]+",
75
+ "name": "constant.numeric"
76
+ },
77
+ {
78
+ "match": "[0-9]",
79
+ "name": "constant.numeric"
80
+ }
81
+ ]
82
+ },
83
+ "rubyStatements": {
84
+ "patterns": [
85
+ {
86
+ "begin": "<%",
87
+ "end": "%>",
88
+ "patterns":[
89
+ {
90
+ "match": ".*",
91
+ "include": "source.ruby"
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "begin": "(?<=GENERIC_READ_CONVERSION_START)",
97
+ "include": "source.ruby",
98
+ "end": "(?=GENERIC_READ_CONVERSION_END)"
99
+ },
100
+ {
101
+ "begin": "(?<=GENERIC_WRITE_CONVERSION_START)",
102
+ "include": "source.ruby",
103
+ "end": "(?=GENERIC_WRITE_CONVERSION_END)"
104
+ }
105
+ ]
106
+ },
107
+ "systemConfig": {
108
+ "patterns": [
109
+ { "include": "#declareTarget" }
110
+ ],
111
+ "repository":{
112
+ "declareTarget": {
113
+ "patterns": [
114
+ {
115
+ "match": "^\\s*(DECLARE_TARGET)\\b",
116
+ "name": "storage.type"
117
+ },
118
+ {
119
+ "match": "(?<=DECLARE_TARGET\\s)\\b\\S+(?=\\s)",
120
+ "name": "support.class"
121
+ }
122
+ ]
123
+ }
124
+ }
125
+ },
126
+ "packetDef": {
127
+ "patterns": [
128
+ {
129
+ "match": "^(TELEMETRY|COMMAND)\\b",
130
+ "name": "storage.type"
131
+ },
132
+ {
133
+ "match": "(?<=TELEMETRY\\s)\\b\\S+(?=\\s)",
134
+ "name": "support.class"
135
+ },
136
+ {
137
+ "match": "(?<=COMMAND\\s)\\b\\S+(?=\\s)",
138
+ "name": "support.class"
139
+ },
140
+ {
141
+ "match": "(?<=\\s)\\b\\S+(?=\\sBIG_ENDIAN)",
142
+ "name": "variable.other"
143
+ },
144
+ {
145
+ "match": "(?<=\\s)\\b\\S+(?=\\sLITTLE_ENDIAN)",
146
+ "name": "variable.other"
147
+ },
148
+ {
149
+ "match": "\\b(BIG_ENDIAN|LITTLE_ENDIAN)\\b",
150
+ "name": "keyword.control"
151
+ }
152
+ ]
153
+ },
154
+ "packetItem": {
155
+ "patterns": [
156
+ {
157
+ "match": "^\\s*(APPEND_ID_|ID_)(ITEM|PARAMETER)\\b",
158
+ "name": "support.function"
159
+ },
160
+ {
161
+ "match": "^\\s*APPEND_(ITEM|PARAMETER)\\b",
162
+ "name": "storage.modifer"
163
+ },
164
+ {
165
+ "match": "^\\s*(ITEM|PARAMETER)\\b",
166
+ "name": "storage.modifer"
167
+ },
168
+ {
169
+ "match": "(?<=ITEM\\s)\\b\\S+(?=\\s)",
170
+ "name": "variable.parameter"
171
+ },
172
+ {
173
+ "match": "(?<=APPEND_ITEM\\s)\\b\\S+(?=\\s)",
174
+ "name": "variable.parameter"
175
+ },
176
+ {
177
+ "match": "(?<=PARAMETER\\s)\\b\\S+(?=\\s)",
178
+ "name": "variable.parameter"
179
+ },
180
+ {
181
+ "match": "(?<=APPEND_PARAMETER\\s)\\b\\S+(?=\\s)",
182
+ "name": "variable.parameter"
183
+ },
184
+ {
185
+ "match": "\\b(INT|UINT|FLOAT|DERIVED|STRING|BLOCK)\\b",
186
+ "name": "storage.type"
187
+ }
188
+ ]
189
+ },
190
+ "itemProperties": {
191
+ "patterns": [
192
+ {
193
+ "match": "\\b(HAZARDOUS)\\b",
194
+ "name": "invalid.deprecated"
195
+ },
196
+ {
197
+ "match": "^\\s*(FORMAT_STRING|UNITS|DESCRIPTION|META|REQUIRED|MINIMUM_VALUE|MAXIMUM_VALUE|DEFAULT_VALUE|STATE|WRITE_CONVERSION|POLY_WRITE_CONVERSION|SEG_POLY_WRITE_CONVERSION|GENERIC_WRITE_CONVERSION_START|GENERIC_WRITE_CONVERSION_END|OVERFLOW)\\b",
198
+ "name": "keyword.control"
199
+ },
200
+ {
201
+ "match": "^\\s*(FORMAT_STRING|UNITS|DESCRIPTION|META|STATE|READ_CONVERSION|POLY_READ_CONVERSION|SEG_POLY_READ_CONVERSION|GENERIC_READ_CONVERSION_START|GENERIC_READ_CONVERSION_END|LIMITS|LIMITS_RESPONSE)\\b",
202
+ "name": "keyword.control"
203
+ },
204
+ {
205
+ "match": "(?:(?<=STATE\\s)|(?<=META\\s)|(?<=LIMITS\\s))\\b\\S+(?=\\s)",
206
+ "name": "variable.parameter"
207
+ },
208
+ {
209
+ "match": "META\\K\\s\\S+\\s+\\K.*",
210
+ "name": "support.variable"
211
+ },
212
+ {
213
+ "match": "(?<=\\s)(ENABLED|DISABLED)",
214
+ "name": "support.type"
215
+ }
216
+ ]
217
+ }
218
+ }
219
+ }