procon_bypass_man 0.1.7 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -2
- data/.github/workflows/ruby.yml +34 -0
- data/.gitignore +4 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -1
- data/CHANGELOG.md +17 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +54 -2
- data/README.md +13 -8
- data/Rakefile +10 -1
- data/Steepfile +39 -0
- data/bin/console +4 -0
- data/bin/dev_api_server.rb +18 -0
- data/docs/setup_raspi.mitamae.rb +17 -2
- data/docs/setup_raspi_by_mitamae.md +2 -1
- data/lib/procon_bypass_man/background/report_thread.rb +42 -0
- data/lib/procon_bypass_man/boot_message.rb +40 -0
- data/lib/procon_bypass_man/buttons_setting_configuration.rb +102 -0
- data/lib/procon_bypass_man/bypass/usb_hid_logger.rb +27 -0
- data/lib/procon_bypass_man/bypass.rb +60 -29
- data/lib/procon_bypass_man/callbacks.rb +70 -0
- data/lib/procon_bypass_man/configuration/layer.rb +50 -4
- data/lib/procon_bypass_man/configuration/loader.rb +8 -8
- data/lib/procon_bypass_man/configuration/validator.rb +1 -1
- data/lib/procon_bypass_man/configuration.rb +67 -64
- data/lib/procon_bypass_man/device_connector.rb +13 -30
- data/lib/procon_bypass_man/io_monitor.rb +7 -4
- data/lib/procon_bypass_man/on_memory_cache.rb +34 -0
- data/lib/procon_bypass_man/outbound/base.rb +53 -0
- data/lib/procon_bypass_man/outbound/error_reporter.rb +13 -0
- data/lib/procon_bypass_man/outbound/pressed_buttons_reporter.rb +13 -0
- data/lib/procon_bypass_man/outbound/reporter.rb +12 -0
- data/lib/procon_bypass_man/procon/analog_stick.rb +31 -0
- data/lib/procon_bypass_man/procon/analog_stick_cap.rb +65 -0
- data/lib/procon_bypass_man/procon/button_collection.rb +15 -6
- data/lib/procon_bypass_man/procon/layer_changeable.rb +2 -2
- data/lib/procon_bypass_man/procon/macro_registry.rb +2 -2
- data/lib/procon_bypass_man/procon/mode_registry.rb +4 -4
- data/lib/procon_bypass_man/procon/press_button_aware.rb +13 -0
- data/lib/procon_bypass_man/procon/pressed_button_helper.rb +1 -11
- data/lib/procon_bypass_man/procon/user_operation.rb +15 -4
- data/lib/procon_bypass_man/procon.rb +25 -5
- data/lib/procon_bypass_man/readonly_procon.rb +32 -0
- data/lib/procon_bypass_man/runner.rb +39 -48
- data/lib/procon_bypass_man/uptime.rb +15 -0
- data/lib/procon_bypass_man/version.rb +1 -1
- data/lib/procon_bypass_man.rb +26 -33
- data/project_template/README.md +3 -2
- data/project_template/app.rb +8 -6
- data/project_template/systemd_units/pbm.service +1 -1
- data/project_template/systemd_units/pbm_web.service +11 -0
- data/project_template/web.rb +16 -0
- data/sig/README.rb +4 -0
- data/sig/main.rbs +507 -0
- metadata +25 -5
- data/examples/practical/app.rb +0 -21
- data/examples/practical/setting.yml +0 -24
data/lib/procon_bypass_man.rb
CHANGED
@@ -1,39 +1,54 @@
|
|
1
1
|
require "logger"
|
2
2
|
require 'yaml'
|
3
|
+
require "json"
|
4
|
+
require "net/http"
|
3
5
|
require "fileutils"
|
4
6
|
|
5
7
|
require_relative "procon_bypass_man/version"
|
8
|
+
require_relative "procon_bypass_man/callbacks"
|
6
9
|
require_relative "procon_bypass_man/timer"
|
7
10
|
require_relative "procon_bypass_man/bypass"
|
8
11
|
require_relative "procon_bypass_man/device_connector"
|
9
12
|
require_relative "procon_bypass_man/runner"
|
10
13
|
require_relative "procon_bypass_man/processor"
|
11
14
|
require_relative "procon_bypass_man/configuration"
|
15
|
+
require_relative "procon_bypass_man/buttons_setting_configuration"
|
16
|
+
require_relative "procon_bypass_man/readonly_procon"
|
12
17
|
require_relative "procon_bypass_man/procon"
|
18
|
+
require_relative "procon_bypass_man/procon/analog_stick"
|
19
|
+
require_relative "procon_bypass_man/procon/analog_stick_cap"
|
20
|
+
require_relative "procon_bypass_man/outbound/reporter"
|
21
|
+
require_relative "procon_bypass_man/outbound/error_reporter"
|
22
|
+
require_relative "procon_bypass_man/outbound/pressed_buttons_reporter"
|
23
|
+
require_relative "procon_bypass_man/on_memory_cache"
|
13
24
|
|
14
25
|
STDOUT.sync = true
|
15
26
|
Thread.abort_on_exception = true
|
16
27
|
|
17
28
|
module ProconBypassMan
|
29
|
+
extend ProconBypassMan::Configuration::ClassAttributes
|
30
|
+
|
18
31
|
class ProConRejected < StandardError; end
|
19
32
|
class CouldNotLoadConfigError < StandardError; end
|
20
33
|
class FirstConnectionError < StandardError; end
|
21
34
|
class EternalConnectionError < StandardError; end
|
22
35
|
|
23
|
-
def self.
|
36
|
+
def self.buttons_setting_configure(setting_path: nil, &block)
|
24
37
|
unless setting_path
|
25
38
|
logger.warn "setting_pathが未設定です。設定ファイルのライブリロードが使えません。"
|
26
39
|
end
|
27
40
|
|
28
41
|
if block_given?
|
29
|
-
ProconBypassMan::
|
42
|
+
ProconBypassMan::ButtonsSettingConfiguration.instance.instance_eval(&block)
|
30
43
|
else
|
31
|
-
ProconBypassMan::
|
44
|
+
ProconBypassMan::ButtonsSettingConfiguration::Loader.load(setting_path: setting_path)
|
32
45
|
end
|
33
46
|
end
|
34
47
|
|
35
48
|
def self.run(setting_path: nil, &block)
|
36
|
-
|
49
|
+
ProconBypassMan.logger.info "PBMを起動しています"
|
50
|
+
puts "PBMを起動しています"
|
51
|
+
buttons_setting_configure(setting_path: setting_path, &block)
|
37
52
|
File.write(pid_path, $$)
|
38
53
|
Runner.new.run
|
39
54
|
rescue CouldNotLoadConfigError
|
@@ -52,43 +67,21 @@ module ProconBypassMan
|
|
52
67
|
retry
|
53
68
|
end
|
54
69
|
|
55
|
-
def self.
|
56
|
-
@@
|
70
|
+
def self.configure(&block)
|
71
|
+
@@configuration = ProconBypassMan::Configuration.new
|
72
|
+
@@configuration.instance_eval(&block)
|
73
|
+
@@configuration
|
57
74
|
end
|
58
75
|
|
59
|
-
def self.
|
60
|
-
|
61
|
-
@@logger
|
62
|
-
else
|
63
|
-
Logger.new(nil)
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def self.pid_path
|
68
|
-
@@pid_path ||= File.expand_path("#{root}/pbm_pid", __dir__).freeze
|
76
|
+
def self.config
|
77
|
+
@@configuration ||= ProconBypassMan::Configuration.new
|
69
78
|
end
|
70
79
|
|
71
80
|
def self.reset!
|
72
81
|
ProconBypassMan::Procon::MacroRegistry.reset!
|
73
82
|
ProconBypassMan::Procon::ModeRegistry.reset!
|
74
83
|
ProconBypassMan::Procon.reset!
|
75
|
-
ProconBypassMan::
|
84
|
+
ProconBypassMan::ButtonsSettingConfiguration.instance.reset!
|
76
85
|
ProconBypassMan::IOMonitor.reset!
|
77
86
|
end
|
78
|
-
|
79
|
-
def self.root
|
80
|
-
if defined?(@@root)
|
81
|
-
@@root
|
82
|
-
else
|
83
|
-
File.expand_path('..', __dir__).freeze
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def self.root=(path)
|
88
|
-
@@root = path
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.digest_path
|
92
|
-
"#{root}/.setting_yaml_digest"
|
93
|
-
end
|
94
87
|
end
|
data/project_template/README.md
CHANGED
@@ -3,14 +3,15 @@ https://github.com/splaplapla/pbmenv で使っているファイルです
|
|
3
3
|
|
4
4
|
## systemd
|
5
5
|
* sudo ln -s /usr/share/pbm/current/systemd_units/pbm.service /etc/systemd/system/pbm.service
|
6
|
-
*
|
6
|
+
* sudo ln -s /usr/share/pbm/current/systemd_units/pbm_web.service /etc/systemd/system/pbm_web.service
|
7
|
+
* commands
|
7
8
|
* systemctl daemon-reload
|
8
9
|
* systemctl enable pbm.service
|
9
10
|
* systemctl disable pbm.service
|
10
11
|
* systemctl start pbm.service
|
11
12
|
* systemctl status pbm.service
|
12
13
|
* systemctl restart pbm.service
|
14
|
+
* systemctl list-unit-files --type=service
|
13
15
|
|
14
16
|
### ログ
|
15
17
|
* journalctl -xe -f
|
16
|
-
|
data/project_template/app.rb
CHANGED
@@ -5,14 +5,16 @@ require 'bundler/inline'
|
|
5
5
|
gemfile do
|
6
6
|
source 'https://rubygems.org'
|
7
7
|
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
8
|
-
gem 'procon_bypass_man', '0.1.
|
8
|
+
gem 'procon_bypass_man', '0.1.11'
|
9
9
|
gem 'procon_bypass_man-splatoon2', github: 'splaplapla/procon_bypass_man-splatoon2', tag: "0.1.1"
|
10
10
|
end
|
11
11
|
|
12
|
-
ProconBypassMan.
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
ProconBypassMan.configure do |config|
|
13
|
+
config.root = File.expand_path(__dir__)
|
14
|
+
config.logger = Logger.new("#{ProconBypassMan.root}/app.log", 5, 1024 * 1024 * 10)
|
15
|
+
config.logger.level = :debug
|
16
|
+
# pbm.api_server = 'https://...'
|
17
|
+
config.enable_critical_error_logging = true
|
16
18
|
end
|
17
19
|
|
18
|
-
ProconBypassMan.run(setting_path: "
|
20
|
+
ProconBypassMan.run(setting_path: "/usr/share/pbm/current/setting.yml")
|
@@ -5,7 +5,7 @@ After=network.target
|
|
5
5
|
[Service]
|
6
6
|
Type=simple
|
7
7
|
WorkingDirectory=/usr/share/pbm/current
|
8
|
-
ExecStart=/bin/bash -c "ruby /usr/share/pbm/current/app.rb"
|
8
|
+
ExecStart=/bin/bash -c "/home/pi/.rbenv/versions/3.0.1/bin/ruby /usr/share/pbm/current/app.rb"
|
9
9
|
Restart=always
|
10
10
|
Nice=-19
|
11
11
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
[Unit]
|
2
|
+
Description=PBM WEB
|
3
|
+
|
4
|
+
[Service]
|
5
|
+
Type=simple
|
6
|
+
WorkingDirectory=/home/pi/src/procon_bypass_man_sample
|
7
|
+
ExecStart=/bin/bash -c "/home/pi/.rbenv/versions/3.0.1/bin/ruby /usr/share/pbm/current/web.rb"
|
8
|
+
Restart=always
|
9
|
+
|
10
|
+
[Install]
|
11
|
+
WantedBy=multi-user.target
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/inline'
|
4
|
+
|
5
|
+
gemfile do
|
6
|
+
source 'https://rubygems.org'
|
7
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
8
|
+
gem 'procon_bypass_man-web', '0.1.3'
|
9
|
+
end
|
10
|
+
|
11
|
+
ProconBypassMan::Web.configure do |config|
|
12
|
+
config.root = File.expand_path(__dir__)
|
13
|
+
config.logger = Logger.new("#{ProconBypassMan::Web.root}/web.log", 1, 1024 * 1024 * 10)
|
14
|
+
end
|
15
|
+
|
16
|
+
ProconBypassMan::Web::Server.start
|
data/sig/README.rb
ADDED
data/sig/main.rbs
ADDED
@@ -0,0 +1,507 @@
|
|
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 ButtonsSettingConfiguration
|
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 ButtonsSettingConfiguration
|
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 ButtonsSettingConfiguration
|
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 ButtonsSettingConfiguration
|
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::Configuration
|
171
|
+
module ClassAttributes
|
172
|
+
def root: () -> untyped
|
173
|
+
|
174
|
+
def logger: () -> untyped
|
175
|
+
|
176
|
+
def error_logger: () -> untyped
|
177
|
+
|
178
|
+
def pid_path: () -> untyped
|
179
|
+
|
180
|
+
def digest_path: () -> untyped
|
181
|
+
|
182
|
+
def cache: () -> untyped
|
183
|
+
|
184
|
+
def config: () -> untyped
|
185
|
+
end
|
186
|
+
|
187
|
+
attr_reader api_server: untyped
|
188
|
+
|
189
|
+
attr_accessor enable_critical_error_logging: untyped
|
190
|
+
|
191
|
+
def root=: (untyped path) -> untyped
|
192
|
+
|
193
|
+
def root: () -> untyped
|
194
|
+
|
195
|
+
def api_server=: (untyped api_server) -> untyped
|
196
|
+
|
197
|
+
def logger=: (untyped logger) -> untyped
|
198
|
+
|
199
|
+
def logger: () -> untyped
|
200
|
+
|
201
|
+
def error_logger: () -> untyped
|
202
|
+
|
203
|
+
def digest_path: () -> ::String
|
204
|
+
|
205
|
+
# @return [String] pbm-webの接続先
|
206
|
+
def internal_api_servers: () -> untyped
|
207
|
+
end
|
208
|
+
|
209
|
+
|
210
|
+
class ProconBypassMan::DeviceConnector
|
211
|
+
class BytesMismatchError < StandardError
|
212
|
+
end
|
213
|
+
|
214
|
+
class Value
|
215
|
+
attr_accessor read_from: untyped
|
216
|
+
|
217
|
+
attr_accessor values: untyped
|
218
|
+
|
219
|
+
def initialize: (values: untyped values, read_from: untyped read_from) -> untyped
|
220
|
+
end
|
221
|
+
|
222
|
+
PROCON_PATH: ::String
|
223
|
+
|
224
|
+
PROCON2_PATH: ::String
|
225
|
+
|
226
|
+
# 画面で再接続ができたが状況は変わらない
|
227
|
+
def self.reset_connection!: () -> untyped
|
228
|
+
|
229
|
+
def self.connect: () -> ::Array[untyped]
|
230
|
+
|
231
|
+
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
|
232
|
+
|
233
|
+
def add: (untyped values, read_from: untyped read_from) -> untyped
|
234
|
+
|
235
|
+
def drain_all: () -> untyped
|
236
|
+
|
237
|
+
# switchに任意の命令を入力して、switchから読み取る
|
238
|
+
def write_switch: (untyped data, ?only_write: bool only_write) -> untyped
|
239
|
+
|
240
|
+
def write_procon: (untyped data, ?only_write: bool only_write) -> untyped
|
241
|
+
|
242
|
+
def read_procon: (?only_read: bool only_read) -> untyped
|
243
|
+
|
244
|
+
def read_switch: (?only_read: bool only_read) -> untyped
|
245
|
+
|
246
|
+
def from_device: (untyped item) -> untyped
|
247
|
+
|
248
|
+
# fromの対になる
|
249
|
+
def to_device: (untyped item) -> untyped
|
250
|
+
|
251
|
+
def switch: () -> untyped
|
252
|
+
|
253
|
+
def procon: () -> untyped
|
254
|
+
|
255
|
+
def is_available_device?: (untyped path) -> (::FalseClass | ::TrueClass | untyped)
|
256
|
+
|
257
|
+
def to_bin: (untyped string) -> untyped
|
258
|
+
|
259
|
+
def init_devices: () -> untyped
|
260
|
+
end
|
261
|
+
|
262
|
+
module ProconBypassMan
|
263
|
+
class Counter
|
264
|
+
attr_accessor label: untyped
|
265
|
+
|
266
|
+
attr_accessor table: untyped
|
267
|
+
|
268
|
+
attr_accessor previous_table: untyped
|
269
|
+
|
270
|
+
def initialize: (label: untyped label) -> untyped
|
271
|
+
|
272
|
+
# アクティブなバケットは1つだけ
|
273
|
+
def record: (untyped event_name) -> untyped
|
274
|
+
|
275
|
+
def formated_previous_table: () -> ::String
|
276
|
+
end
|
277
|
+
|
278
|
+
module IOMonitor
|
279
|
+
def self.new: (label: untyped label) -> untyped
|
280
|
+
|
281
|
+
# @return [Array<Counter>]
|
282
|
+
def self.targets: () -> untyped
|
283
|
+
|
284
|
+
# ここで集計する
|
285
|
+
def self.start!: () -> untyped
|
286
|
+
|
287
|
+
def self.reset!: () -> untyped
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
class ProconBypassMan::Processor
|
292
|
+
# @return [String] binary
|
293
|
+
def initialize: (untyped binary) -> untyped
|
294
|
+
|
295
|
+
# @return [String] 加工後の入力データ
|
296
|
+
def process: () -> untyped
|
297
|
+
end
|
298
|
+
|
299
|
+
class ProconBypassMan::Procon
|
300
|
+
attr_accessor user_operation: untyped
|
301
|
+
|
302
|
+
def self.reset!: () -> untyped
|
303
|
+
|
304
|
+
def initialize: (untyped binary) -> untyped
|
305
|
+
|
306
|
+
def status: () -> untyped
|
307
|
+
|
308
|
+
def ongoing_macro: () -> untyped
|
309
|
+
|
310
|
+
def ongoing_mode: () -> untyped
|
311
|
+
|
312
|
+
def current_layer_key: () -> untyped
|
313
|
+
|
314
|
+
def current_layer: () -> untyped
|
315
|
+
|
316
|
+
def apply!: () -> (nil | untyped)
|
317
|
+
|
318
|
+
# @return [String<binary>]
|
319
|
+
def to_binary: () -> untyped
|
320
|
+
|
321
|
+
private
|
322
|
+
|
323
|
+
def method_missing: (untyped name) -> untyped
|
324
|
+
end
|
325
|
+
|
326
|
+
class ProconBypassMan::Procon::ButtonCollection
|
327
|
+
class Button
|
328
|
+
attr_accessor byte_position: untyped
|
329
|
+
|
330
|
+
attr_accessor bit_position: untyped
|
331
|
+
|
332
|
+
def initialize: (untyped key) -> untyped
|
333
|
+
end
|
334
|
+
|
335
|
+
# ) ZR R SR(right) SL(right) A B X Y
|
336
|
+
# ) Grip (none) Cap Home ThumbL ThumbR + -
|
337
|
+
# ) ZL L SL(left) SR(left) Left Right Up Down
|
338
|
+
# ) analog[0]
|
339
|
+
# ) analog[1]
|
340
|
+
# ) analog[2]
|
341
|
+
# ) analog[3]
|
342
|
+
# ) analog[4]
|
343
|
+
# ) analog[5]
|
344
|
+
BYTES_MAP: untyped
|
345
|
+
|
346
|
+
BUTTONS_MAP: untyped
|
347
|
+
|
348
|
+
BUTTONS: untyped
|
349
|
+
|
350
|
+
def self.load: (untyped button_key) -> untyped
|
351
|
+
end
|
352
|
+
|
353
|
+
class ProconBypassMan::Procon
|
354
|
+
module Data
|
355
|
+
NO_ACTION: untyped
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
class ProconBypassMan::Procon
|
360
|
+
class FlipCache
|
361
|
+
def self.fetch: (key: untyped key, expires_in: untyped expires_in) { () -> untyped } -> untyped
|
362
|
+
|
363
|
+
# for testing
|
364
|
+
def self.reset!: () -> untyped
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
module ProconBypassMan::Procon::LayerChangeable
|
369
|
+
def next_layer_key: () -> untyped
|
370
|
+
|
371
|
+
def change_layer?: () -> untyped
|
372
|
+
|
373
|
+
def pressed_next_layer?: () -> untyped
|
374
|
+
end
|
375
|
+
|
376
|
+
class ProconBypassMan::Procon::MacroRegistry
|
377
|
+
class Macro
|
378
|
+
attr_accessor name: untyped
|
379
|
+
|
380
|
+
attr_accessor steps: untyped
|
381
|
+
|
382
|
+
def initialize: (name: untyped name, steps: untyped steps) -> untyped
|
383
|
+
|
384
|
+
def next_step: () -> untyped
|
385
|
+
|
386
|
+
def finished?: () -> untyped
|
387
|
+
|
388
|
+
def ongoing?: () -> untyped
|
389
|
+
end
|
390
|
+
|
391
|
+
PRESETS: ::Hash[untyped, untyped]
|
392
|
+
|
393
|
+
def self.install_plugin: (untyped klass) -> untyped
|
394
|
+
|
395
|
+
def self.load: (untyped name) -> untyped
|
396
|
+
|
397
|
+
def self.reset!: () -> untyped
|
398
|
+
|
399
|
+
def self.plugins: () -> untyped
|
400
|
+
end
|
401
|
+
|
402
|
+
class ProconBypassMan::Procon::ModeRegistry
|
403
|
+
class Mode
|
404
|
+
attr_accessor name: untyped
|
405
|
+
|
406
|
+
attr_accessor binaries: untyped
|
407
|
+
|
408
|
+
attr_accessor source_binaries: untyped
|
409
|
+
|
410
|
+
def initialize: (name: untyped name, binaries: untyped binaries) -> untyped
|
411
|
+
|
412
|
+
def next_binary: () -> untyped
|
413
|
+
end
|
414
|
+
|
415
|
+
PRESETS: ::Hash[untyped, untyped]
|
416
|
+
|
417
|
+
def self.install_plugin: (untyped klass) -> untyped
|
418
|
+
|
419
|
+
def self.load: (untyped name) -> untyped
|
420
|
+
|
421
|
+
def self.reset!: () -> untyped
|
422
|
+
|
423
|
+
def self.plugins: () -> untyped
|
424
|
+
end
|
425
|
+
|
426
|
+
module ProconBypassMan::Procon::PressedButtonHelper
|
427
|
+
module Static
|
428
|
+
def pressed_button?: (untyped button) -> untyped
|
429
|
+
end
|
430
|
+
|
431
|
+
module Dynamic
|
432
|
+
def compile_if_not_compile_yet!: () -> untyped
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
class ProconBypassMan::Procon
|
437
|
+
class UserOperation
|
438
|
+
include LayerChangeable
|
439
|
+
|
440
|
+
include PressedButtonHelper::Static
|
441
|
+
|
442
|
+
extend PressedButtonHelper::Dynamic
|
443
|
+
|
444
|
+
attr_reader binary: untyped
|
445
|
+
|
446
|
+
def initialize: (untyped binary) -> untyped
|
447
|
+
|
448
|
+
ZERO_BIT: untyped
|
449
|
+
|
450
|
+
ASCII_ENCODING: ::String
|
451
|
+
|
452
|
+
# @depilicate
|
453
|
+
def binary=: (untyped binary) -> untyped
|
454
|
+
|
455
|
+
def set_no_action!: () -> untyped
|
456
|
+
|
457
|
+
def unpress_button: (untyped button) -> untyped
|
458
|
+
|
459
|
+
def press_button: (untyped button) -> untyped
|
460
|
+
|
461
|
+
def press_button_only: (untyped button) -> untyped
|
462
|
+
|
463
|
+
def merge: (target_binary: untyped target_binary) -> untyped
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
class ProconBypassMan::Runner
|
468
|
+
class InterruptForRestart < StandardError
|
469
|
+
end
|
470
|
+
|
471
|
+
def initialize: () -> untyped
|
472
|
+
|
473
|
+
def run: () -> untyped
|
474
|
+
|
475
|
+
private
|
476
|
+
|
477
|
+
def main_loop: () -> untyped
|
478
|
+
|
479
|
+
def first_negotiation: () -> untyped
|
480
|
+
|
481
|
+
def handle_signal: (untyped sig) -> untyped
|
482
|
+
|
483
|
+
# @return [void]
|
484
|
+
def print_booted_message: () -> untyped
|
485
|
+
end
|
486
|
+
|
487
|
+
module ProconBypassMan
|
488
|
+
class Timer
|
489
|
+
class Timeout < StandardError
|
490
|
+
end
|
491
|
+
|
492
|
+
# 5秒後がタイムアウト
|
493
|
+
def initialize: (?timeout: untyped timeout) -> untyped
|
494
|
+
|
495
|
+
def throw_if_timeout!: () -> untyped
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
module ProconBypassMan
|
500
|
+
class Uptime
|
501
|
+
def self.from_boot: () -> untyped
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
module ProconBypassMan
|
506
|
+
VERSION: ::String
|
507
|
+
end
|