procon_bypass_man 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +3 -2
  3. data/.github/workflows/ruby.yml +5 -4
  4. data/.ruby-version +1 -1
  5. data/CHANGELOG.md +7 -1
  6. data/Gemfile +4 -0
  7. data/Gemfile.lock +52 -2
  8. data/README.md +11 -0
  9. data/Steepfile +39 -0
  10. data/bin/report_receive_server.rb +11 -0
  11. data/docs/setup_raspi.mitamae.rb +12 -0
  12. data/lib/procon_bypass_man/analog_stick_position.rb +14 -0
  13. data/lib/procon_bypass_man/boot_message.rb +40 -0
  14. data/lib/procon_bypass_man/bypass.rb +20 -7
  15. data/lib/procon_bypass_man/configuration/layer.rb +33 -3
  16. data/lib/procon_bypass_man/configuration.rb +22 -8
  17. data/lib/procon_bypass_man/device_connector.rb +10 -27
  18. data/lib/procon_bypass_man/error_reporter.rb +44 -0
  19. data/lib/procon_bypass_man/io_monitor.rb +7 -4
  20. data/lib/procon_bypass_man/on_memory_cache.rb +34 -0
  21. data/lib/procon_bypass_man/procon/analog_stick_cap.rb +88 -0
  22. data/lib/procon_bypass_man/procon/button_collection.rb +14 -6
  23. data/lib/procon_bypass_man/procon/debug_dumper.rb +17 -0
  24. data/lib/procon_bypass_man/procon/mode_registry.rb +2 -2
  25. data/lib/procon_bypass_man/procon/press_button_aware.rb +13 -0
  26. data/lib/procon_bypass_man/procon/pressed_button_helper.rb +0 -10
  27. data/lib/procon_bypass_man/procon/user_operation.rb +10 -3
  28. data/lib/procon_bypass_man/procon.rb +15 -1
  29. data/lib/procon_bypass_man/reporter.rb +42 -0
  30. data/lib/procon_bypass_man/runner.rb +34 -46
  31. data/lib/procon_bypass_man/uptime.rb +1 -1
  32. data/lib/procon_bypass_man/version.rb +1 -1
  33. data/lib/procon_bypass_man.rb +43 -2
  34. data/project_template/app.rb +3 -1
  35. data/sig/README.rb +4 -0
  36. data/sig/main.rbs +467 -0
  37. metadata +15 -3
data/sig/main.rbs ADDED
@@ -0,0 +1,467 @@
1
+ interface _Symolize
2
+ def to_sym: () -> ::Symbol
3
+ end
4
+
5
+ interface _Pluginable
6
+ def name: () -> _Symolize
7
+ def respond_to?: (::Symbol) -> bool
8
+ end
9
+
10
+ module ProconBypassMan
11
+ class ProConRejected < StandardError
12
+ end
13
+
14
+ class CouldNotLoadConfigError < StandardError
15
+ end
16
+
17
+ class FirstConnectionError < StandardError
18
+ end
19
+
20
+ class EternalConnectionError < StandardError
21
+ end
22
+
23
+ def self.configure: (?setting_path: untyped? setting_path) { () -> untyped } -> untyped
24
+
25
+ def self.run: (?setting_path: untyped? setting_path) { () -> untyped } -> untyped
26
+
27
+ def self.logger=: (untyped logger) -> untyped
28
+
29
+ # @return [Logger]
30
+ def self.logger: () -> untyped
31
+
32
+ def self.pid_path: () -> untyped
33
+
34
+ def self.reset!: () -> untyped
35
+
36
+ def self.root: () -> untyped
37
+
38
+ def self.root=: (untyped path) -> untyped
39
+
40
+ def self.digest_path: () -> ::String
41
+ end
42
+
43
+ class ProconBypassMan::Bypass
44
+ attr_accessor gadget: untyped
45
+
46
+ attr_accessor procon: untyped
47
+
48
+ attr_accessor monitor: untyped
49
+
50
+ def initialize: (gadget: untyped gadget, procon: untyped procon, monitor: untyped monitor) -> untyped
51
+
52
+ # ゆっくりでいい
53
+ def send_gadget_to_procon!: () -> (nil | untyped)
54
+
55
+ def send_procon_to_gadget!: () -> (nil | untyped)
56
+ end
57
+
58
+ class AnalogStickPosition
59
+ attr_accessor x: Integer
60
+ attr_accessor y: Integer
61
+
62
+ def initialize: (x: Integer, y: Integer) -> untyped
63
+ end
64
+
65
+ module ProconBypassMan
66
+ class Configuration
67
+ attr_accessor layers: untyped
68
+
69
+ attr_accessor setting_path: untyped
70
+
71
+ attr_accessor mode_plugins: untyped
72
+
73
+ attr_accessor macro_plugins: untyped
74
+
75
+ attr_accessor context: untyped
76
+
77
+ attr_accessor current_context_key: untyped
78
+
79
+ attr_accessor neutral_position: AnalogStickPosition
80
+
81
+ def self.instance: () -> untyped
82
+
83
+ def self.switch_new_context: (untyped key) { (untyped) -> untyped } -> untyped
84
+
85
+ def initialize: () -> untyped
86
+
87
+ MODES: ::Array[untyped]
88
+
89
+ def layer: (untyped direction, ?mode: (_Pluginable) mode) { () -> untyped } -> untyped
90
+
91
+ def install_mode_plugin: (untyped klass) -> untyped
92
+
93
+ def install_macro_plugin: (untyped klass) -> untyped
94
+
95
+ def prefix_keys_for_changing_layer: (untyped buttons) -> untyped
96
+
97
+ def prefix_keys: () -> untyped
98
+
99
+ def reset!: () -> untyped
100
+ end
101
+ end
102
+
103
+ module ProconBypassMan
104
+ class Configuration
105
+ class Layer
106
+ attr_accessor mode: untyped
107
+
108
+ attr_accessor flips: untyped
109
+
110
+ attr_accessor macros: untyped
111
+
112
+ attr_accessor remaps: untyped
113
+
114
+ def initialize: (?mode: ::Symbol mode) -> untyped
115
+
116
+ # @param [Symbol] button
117
+ def flip: (untyped button, ?if_pressed: bool if_pressed, ?force_neutral: untyped? force_neutral, ?flip_interval: untyped? flip_interval) -> untyped
118
+
119
+ PRESET_MACROS: ::Array[untyped]
120
+
121
+ def macro: (untyped name, if_pressed: untyped if_pressed) -> untyped
122
+
123
+ def remap: (untyped button, to: untyped to) -> untyped
124
+
125
+ # @return [Array]
126
+ def flip_buttons: () -> untyped
127
+
128
+ def instance_eval: ()?{ () -> nil } -> untyped
129
+ end
130
+ end
131
+ end
132
+
133
+ module ProconBypassMan
134
+ class Configuration
135
+ module Loader
136
+ def self.load: (setting_path: untyped setting_path) -> untyped
137
+
138
+ def self.reload_setting: () -> untyped
139
+ end
140
+ end
141
+ end
142
+
143
+ module ProconBypassMan
144
+ class Configuration
145
+ class Validator
146
+ def initialize: (untyped config) -> untyped
147
+
148
+ # @return [Boolean]
149
+ def valid?: () -> untyped
150
+
151
+ # @return [Boolean]
152
+ def invalid?: () -> untyped
153
+
154
+ # @return [Hash]
155
+ def errors: () -> untyped
156
+
157
+ private
158
+
159
+ def validate_config_of_button_lonely: () -> untyped
160
+
161
+ def validate_require_prefix_keys: () -> untyped
162
+
163
+ def validate_verify_button_existence: () -> untyped
164
+
165
+ def validate_flip_and_remap_are_hate_each_other: () -> untyped
166
+ end
167
+ end
168
+ end
169
+
170
+ class ProconBypassMan::DeviceConnector
171
+ class BytesMismatchError < StandardError
172
+ end
173
+
174
+ class Value
175
+ attr_accessor read_from: untyped
176
+
177
+ attr_accessor values: untyped
178
+
179
+ def initialize: (values: untyped values, read_from: untyped read_from) -> untyped
180
+ end
181
+
182
+ PROCON_PATH: ::String
183
+
184
+ PROCON2_PATH: ::String
185
+
186
+ # 画面で再接続ができたが状況は変わらない
187
+ def self.reset_connection!: () -> untyped
188
+
189
+ def self.connect: () -> ::Array[untyped]
190
+
191
+ def initialize: (?throw_error_if_timeout: bool throw_error_if_timeout, ?throw_error_if_mismatch: bool throw_error_if_mismatch, ?enable_at_exit: bool enable_at_exit) -> untyped
192
+
193
+ def add: (untyped values, read_from: untyped read_from) -> untyped
194
+
195
+ def drain_all: () -> untyped
196
+
197
+ # switchに任意の命令を入力して、switchから読み取る
198
+ def write_switch: (untyped data, ?only_write: bool only_write) -> untyped
199
+
200
+ def write_procon: (untyped data, ?only_write: bool only_write) -> untyped
201
+
202
+ def read_procon: (?only_read: bool only_read) -> untyped
203
+
204
+ def read_switch: (?only_read: bool only_read) -> untyped
205
+
206
+ def from_device: (untyped item) -> untyped
207
+
208
+ # fromの対になる
209
+ def to_device: (untyped item) -> untyped
210
+
211
+ def switch: () -> untyped
212
+
213
+ def procon: () -> untyped
214
+
215
+ def is_available_device?: (untyped path) -> (::FalseClass | ::TrueClass | untyped)
216
+
217
+ def to_bin: (untyped string) -> untyped
218
+
219
+ def init_devices: () -> untyped
220
+ end
221
+
222
+ module ProconBypassMan
223
+ class Counter
224
+ attr_accessor label: untyped
225
+
226
+ attr_accessor table: untyped
227
+
228
+ attr_accessor previous_table: untyped
229
+
230
+ def initialize: (label: untyped label) -> untyped
231
+
232
+ # アクティブなバケットは1つだけ
233
+ def record: (untyped event_name) -> untyped
234
+
235
+ def formated_previous_table: () -> ::String
236
+ end
237
+
238
+ module IOMonitor
239
+ def self.new: (label: untyped label) -> untyped
240
+
241
+ # @return [Array<Counter>]
242
+ def self.targets: () -> untyped
243
+
244
+ # ここで集計する
245
+ def self.start!: () -> untyped
246
+
247
+ def self.reset!: () -> untyped
248
+ end
249
+ end
250
+
251
+ class ProconBypassMan::Processor
252
+ # @return [String] binary
253
+ def initialize: (untyped binary) -> untyped
254
+
255
+ # @return [String] 加工後の入力データ
256
+ def process: () -> untyped
257
+ end
258
+
259
+ class ProconBypassMan::Procon
260
+ attr_accessor user_operation: untyped
261
+
262
+ def self.reset!: () -> untyped
263
+
264
+ def initialize: (untyped binary) -> untyped
265
+
266
+ def status: () -> untyped
267
+
268
+ def ongoing_macro: () -> untyped
269
+
270
+ def ongoing_mode: () -> untyped
271
+
272
+ def current_layer_key: () -> untyped
273
+
274
+ def current_layer: () -> untyped
275
+
276
+ def apply!: () -> (nil | untyped)
277
+
278
+ # @return [String<binary>]
279
+ def to_binary: () -> untyped
280
+
281
+ private
282
+
283
+ def method_missing: (untyped name) -> untyped
284
+ end
285
+
286
+ class ProconBypassMan::Procon::ButtonCollection
287
+ class Button
288
+ attr_accessor byte_position: untyped
289
+
290
+ attr_accessor bit_position: untyped
291
+
292
+ def initialize: (untyped key) -> untyped
293
+ end
294
+
295
+ # ) ZR R SR(right) SL(right) A B X Y
296
+ # ) Grip (none) Cap Home ThumbL ThumbR + -
297
+ # ) ZL L SL(left) SR(left) Left Right Up Down
298
+ # ) analog[0]
299
+ # ) analog[1]
300
+ # ) analog[2]
301
+ # ) analog[3]
302
+ # ) analog[4]
303
+ # ) analog[5]
304
+ BYTES_MAP: untyped
305
+
306
+ BUTTONS_MAP: untyped
307
+
308
+ BUTTONS: untyped
309
+
310
+ def self.load: (untyped button_key) -> untyped
311
+ end
312
+
313
+ class ProconBypassMan::Procon
314
+ module Data
315
+ NO_ACTION: untyped
316
+ end
317
+ end
318
+
319
+ class ProconBypassMan::Procon
320
+ class FlipCache
321
+ def self.fetch: (key: untyped key, expires_in: untyped expires_in) { () -> untyped } -> untyped
322
+
323
+ # for testing
324
+ def self.reset!: () -> untyped
325
+ end
326
+ end
327
+
328
+ module ProconBypassMan::Procon::LayerChangeable
329
+ def next_layer_key: () -> untyped
330
+
331
+ def change_layer?: () -> untyped
332
+
333
+ def pressed_next_layer?: () -> untyped
334
+ end
335
+
336
+ class ProconBypassMan::Procon::MacroRegistry
337
+ class Macro
338
+ attr_accessor name: untyped
339
+
340
+ attr_accessor steps: untyped
341
+
342
+ def initialize: (name: untyped name, steps: untyped steps) -> untyped
343
+
344
+ def next_step: () -> untyped
345
+
346
+ def finished?: () -> untyped
347
+
348
+ def ongoing?: () -> untyped
349
+ end
350
+
351
+ PRESETS: ::Hash[untyped, untyped]
352
+
353
+ def self.install_plugin: (untyped klass) -> untyped
354
+
355
+ def self.load: (untyped name) -> untyped
356
+
357
+ def self.reset!: () -> untyped
358
+
359
+ def self.plugins: () -> untyped
360
+ end
361
+
362
+ class ProconBypassMan::Procon::ModeRegistry
363
+ class Mode
364
+ attr_accessor name: untyped
365
+
366
+ attr_accessor binaries: untyped
367
+
368
+ attr_accessor source_binaries: untyped
369
+
370
+ def initialize: (name: untyped name, binaries: untyped binaries) -> untyped
371
+
372
+ def next_binary: () -> untyped
373
+ end
374
+
375
+ PRESETS: ::Hash[untyped, untyped]
376
+
377
+ def self.install_plugin: (untyped klass) -> untyped
378
+
379
+ def self.load: (untyped name) -> untyped
380
+
381
+ def self.reset!: () -> untyped
382
+
383
+ def self.plugins: () -> untyped
384
+ end
385
+
386
+ module ProconBypassMan::Procon::PushedButtonHelper
387
+ module Static
388
+ def pressed_button?: (untyped button) -> untyped
389
+ end
390
+
391
+ module Dynamic
392
+ def compile_if_not_compile_yet!: () -> untyped
393
+ end
394
+ end
395
+
396
+ class ProconBypassMan::Procon
397
+ class UserOperation
398
+ include LayerChangeable
399
+
400
+ include PushedButtonHelper::Static
401
+
402
+ extend PushedButtonHelper::Dynamic
403
+
404
+ attr_reader binary: untyped
405
+
406
+ def initialize: (untyped binary) -> untyped
407
+
408
+ ZERO_BIT: untyped
409
+
410
+ ASCII_ENCODING: ::String
411
+
412
+ # @depilicate
413
+ def binary=: (untyped binary) -> untyped
414
+
415
+ def set_no_action!: () -> untyped
416
+
417
+ def unpress_button: (untyped button) -> untyped
418
+
419
+ def press_button: (untyped button) -> untyped
420
+
421
+ def press_button_only: (untyped button) -> untyped
422
+
423
+ def merge: (target_binary: untyped target_binary) -> untyped
424
+ end
425
+ end
426
+
427
+ class ProconBypassMan::Runner
428
+ class InterruptForRestart < StandardError
429
+ end
430
+
431
+ def initialize: () -> untyped
432
+
433
+ def run: () -> untyped
434
+
435
+ private
436
+
437
+ def main_loop: () -> untyped
438
+
439
+ def first_negotiation: () -> untyped
440
+
441
+ def handle_signal: (untyped sig) -> untyped
442
+
443
+ # @return [void]
444
+ def print_booted_message: () -> untyped
445
+ end
446
+
447
+ module ProconBypassMan
448
+ class Timer
449
+ class Timeout < StandardError
450
+ end
451
+
452
+ # 5秒後がタイムアウト
453
+ def initialize: (?timeout: untyped timeout) -> untyped
454
+
455
+ def throw_if_timeout!: () -> untyped
456
+ end
457
+ end
458
+
459
+ module ProconBypassMan
460
+ class Uptime
461
+ def self.from_boot: () -> untyped
462
+ end
463
+ end
464
+
465
+ module ProconBypassMan
466
+ VERSION: ::String
467
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procon_bypass_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-19 00:00:00.000000000 Z
11
+ date: 2021-10-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: extension for Nintendo Switch Pro Controller
14
14
  email:
@@ -29,7 +29,9 @@ files:
29
29
  - LICENSE.txt
30
30
  - README.md
31
31
  - Rakefile
32
+ - Steepfile
32
33
  - bin/console
34
+ - bin/report_receive_server.rb
33
35
  - bin/setup
34
36
  - docs/how_to_connect_procon.md
35
37
  - docs/setup_raspi.md
@@ -38,23 +40,31 @@ files:
38
40
  - examples/practical/app.rb
39
41
  - examples/practical/setting.yml
40
42
  - lib/procon_bypass_man.rb
43
+ - lib/procon_bypass_man/analog_stick_position.rb
44
+ - lib/procon_bypass_man/boot_message.rb
41
45
  - lib/procon_bypass_man/bypass.rb
42
46
  - lib/procon_bypass_man/configuration.rb
43
47
  - lib/procon_bypass_man/configuration/layer.rb
44
48
  - lib/procon_bypass_man/configuration/loader.rb
45
49
  - lib/procon_bypass_man/configuration/validator.rb
46
50
  - lib/procon_bypass_man/device_connector.rb
51
+ - lib/procon_bypass_man/error_reporter.rb
47
52
  - lib/procon_bypass_man/io_monitor.rb
53
+ - lib/procon_bypass_man/on_memory_cache.rb
48
54
  - lib/procon_bypass_man/processor.rb
49
55
  - lib/procon_bypass_man/procon.rb
56
+ - lib/procon_bypass_man/procon/analog_stick_cap.rb
50
57
  - lib/procon_bypass_man/procon/button_collection.rb
51
58
  - lib/procon_bypass_man/procon/data.rb
59
+ - lib/procon_bypass_man/procon/debug_dumper.rb
52
60
  - lib/procon_bypass_man/procon/flip_cache.rb
53
61
  - lib/procon_bypass_man/procon/layer_changeable.rb
54
62
  - lib/procon_bypass_man/procon/macro_registry.rb
55
63
  - lib/procon_bypass_man/procon/mode_registry.rb
64
+ - lib/procon_bypass_man/procon/press_button_aware.rb
56
65
  - lib/procon_bypass_man/procon/pressed_button_helper.rb
57
66
  - lib/procon_bypass_man/procon/user_operation.rb
67
+ - lib/procon_bypass_man/reporter.rb
58
68
  - lib/procon_bypass_man/runner.rb
59
69
  - lib/procon_bypass_man/timer.rb
60
70
  - lib/procon_bypass_man/uptime.rb
@@ -64,6 +74,8 @@ files:
64
74
  - project_template/app.rb
65
75
  - project_template/setting.yml
66
76
  - project_template/systemd_units/pbm.service
77
+ - sig/README.rb
78
+ - sig/main.rbs
67
79
  homepage: https://github.com/splaplapla/procon_bypass_man
68
80
  licenses:
69
81
  - MIT
@@ -85,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
97
  - !ruby/object:Gem::Version
86
98
  version: '0'
87
99
  requirements: []
88
- rubygems_version: 3.2.15
100
+ rubygems_version: 3.2.22
89
101
  signing_key:
90
102
  specification_version: 4
91
103
  summary: extension for Nintendo Switch Pro Controller