procon_bypass_man 0.1.11 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +33 -0
  3. data/.gitignore +1 -0
  4. data/CHANGELOG.md +13 -0
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +14 -12
  7. data/README.md +11 -7
  8. data/bin/dev_api_server.rb +1 -1
  9. data/lib/procon_bypass_man/background/job_performer.rb +16 -0
  10. data/lib/procon_bypass_man/background/{report_thread.rb → job_runner.rb} +13 -10
  11. data/lib/procon_bypass_man/background/jobs/base_job.rb +7 -0
  12. data/lib/procon_bypass_man/background/jobs/concerns/has_external_api_setting.rb +5 -0
  13. data/lib/procon_bypass_man/background/jobs/concerns/has_internal_api_setting.rb +5 -0
  14. data/lib/procon_bypass_man/background/jobs/concerns/job_runnable.rb +16 -0
  15. data/lib/procon_bypass_man/background/jobs/fetch_and_run_remote_pbm_action_job.rb +29 -0
  16. data/lib/procon_bypass_man/background/jobs/report_boot_job.rb +12 -0
  17. data/lib/procon_bypass_man/background/jobs/report_error_job.rb +11 -0
  18. data/lib/procon_bypass_man/background/jobs/report_event_base_job.rb +5 -0
  19. data/lib/procon_bypass_man/background/jobs/report_load_config_job.rb +11 -0
  20. data/lib/procon_bypass_man/background/jobs/report_pressed_buttons_job.rb +15 -0
  21. data/lib/procon_bypass_man/background/jobs/report_reload_config_job.rb +11 -0
  22. data/lib/procon_bypass_man/background/jobs/sync_device_stats_job.rb +16 -0
  23. data/lib/procon_bypass_man/background.rb +14 -0
  24. data/lib/procon_bypass_man/boot_message.rb +16 -8
  25. data/lib/procon_bypass_man/{configuration → buttons_setting_configuration}/layer.rb +34 -29
  26. data/lib/procon_bypass_man/{configuration → buttons_setting_configuration}/loader.rb +5 -4
  27. data/lib/procon_bypass_man/{configuration → buttons_setting_configuration}/validator.rb +0 -0
  28. data/lib/procon_bypass_man/buttons_setting_configuration.rb +6 -7
  29. data/lib/procon_bypass_man/bypass/usb_hid_logger.rb +18 -7
  30. data/lib/procon_bypass_man/bypass.rb +15 -14
  31. data/lib/procon_bypass_man/commands/bypass_command.rb +86 -0
  32. data/lib/procon_bypass_man/commands/connect_device_command.rb +16 -0
  33. data/lib/procon_bypass_man/commands/print_boot_message_command.rb +9 -0
  34. data/lib/procon_bypass_man/commands/run_local_shell_command.rb +6 -0
  35. data/lib/procon_bypass_man/commands/run_remote_pbm_action_dispatch_command.rb +21 -0
  36. data/lib/procon_bypass_man/commands/send_error_command.rb +19 -0
  37. data/lib/procon_bypass_man/commands/send_reload_config_event_command.rb +11 -0
  38. data/lib/procon_bypass_man/commands/write_device_id_command.rb +12 -0
  39. data/lib/procon_bypass_man/commands/write_session_id_command.rb +7 -0
  40. data/lib/procon_bypass_man/commands.rb +8 -0
  41. data/lib/procon_bypass_man/configuration.rb +47 -6
  42. data/lib/procon_bypass_man/device_connector.rb +33 -26
  43. data/lib/procon_bypass_man/device_status.rb +44 -0
  44. data/lib/procon_bypass_man/io_monitor.rb +9 -4
  45. data/lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb +17 -0
  46. data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb +17 -0
  47. data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb +17 -0
  48. data/lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb +17 -0
  49. data/lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb +59 -0
  50. data/lib/procon_bypass_man/plugin/splatoon2/version.rb +9 -0
  51. data/lib/procon_bypass_man/plugin.rb +11 -0
  52. data/lib/procon_bypass_man/procon/analog_stick_cap.rb +1 -1
  53. data/lib/procon_bypass_man/procon/{data.rb → consts.rb} +1 -1
  54. data/lib/procon_bypass_man/procon/layer_changer.rb +40 -0
  55. data/lib/procon_bypass_man/procon/user_operation.rb +11 -17
  56. data/lib/procon_bypass_man/procon.rb +6 -12
  57. data/lib/procon_bypass_man/{readonly_procon.rb → procon_reader.rb} +3 -4
  58. data/lib/procon_bypass_man/remote_pbm_action/base_action.rb +53 -0
  59. data/lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb +25 -0
  60. data/lib/procon_bypass_man/remote_pbm_action/lib/update_remote_pbm_action_status_command.rb +24 -0
  61. data/lib/procon_bypass_man/remote_pbm_action/reboot_os_action.rb +21 -0
  62. data/lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb +28 -0
  63. data/lib/procon_bypass_man/remote_pbm_action/stop_pbm_action.rb +21 -0
  64. data/lib/procon_bypass_man/remote_pbm_action.rb +32 -0
  65. data/lib/procon_bypass_man/runner.rb +14 -115
  66. data/lib/procon_bypass_man/scheduler.rb +92 -0
  67. data/lib/procon_bypass_man/{callbacks.rb → support/callbacks.rb} +0 -0
  68. data/lib/procon_bypass_man/support/compress_array.rb +56 -0
  69. data/lib/procon_bypass_man/support/http_client.rb +102 -0
  70. data/lib/procon_bypass_man/{on_memory_cache.rb → support/on_memory_cache.rb} +0 -0
  71. data/lib/procon_bypass_man/support/report_http_client.rb +19 -0
  72. data/lib/procon_bypass_man/{timer.rb → support/safe_timeout.rb} +1 -1
  73. data/lib/procon_bypass_man/support/send_device_stats_http_client.rb +9 -0
  74. data/lib/procon_bypass_man/support/server_pool.rb +42 -0
  75. data/lib/procon_bypass_man/support/signal_handler.rb +11 -0
  76. data/lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb +9 -0
  77. data/lib/procon_bypass_man/support/uptime.rb +25 -0
  78. data/lib/procon_bypass_man/value_objects/remote_pbm_action_object.rb +38 -0
  79. data/lib/procon_bypass_man/version.rb +1 -1
  80. data/lib/procon_bypass_man.rb +71 -36
  81. data/procon_bypass_man.gemspec +3 -3
  82. data/project_template/README.md +18 -11
  83. data/project_template/app.rb +2 -3
  84. data/project_template/setting.yml +8 -8
  85. data/sig/{README.rb → README.md} +0 -0
  86. data/sig/main.rbs +10 -11
  87. metadata +85 -26
  88. data/lib/procon_bypass_man/outbound/base.rb +0 -53
  89. data/lib/procon_bypass_man/outbound/error_reporter.rb +0 -13
  90. data/lib/procon_bypass_man/outbound/pressed_buttons_reporter.rb +0 -13
  91. data/lib/procon_bypass_man/outbound/reporter.rb +0 -12
  92. data/lib/procon_bypass_man/procon/layer_changeable.rb +0 -28
  93. data/lib/procon_bypass_man/procon/pressed_button_helper.rb +0 -15
  94. data/lib/procon_bypass_man/uptime.rb +0 -15
@@ -0,0 +1,42 @@
1
+ module ProconBypassMan
2
+ class ServerPool
3
+ def initialize(servers: )
4
+ if servers.nil? || servers.empty?
5
+ return
6
+ end
7
+
8
+ @servers = servers
9
+ if @servers.size >= 1
10
+ @index = 0
11
+ else
12
+ @index = nil
13
+ end
14
+ end
15
+
16
+ def pick
17
+ if @index.nil?
18
+ return @servers&.first
19
+ end
20
+ @servers[@index] or raise "bug!!!"
21
+ end
22
+ def server; pick; end
23
+
24
+ def next!
25
+ inc_index
26
+ if @servers[@index].nil?
27
+ reset
28
+ return
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def reset
35
+ @index = 0
36
+ end
37
+
38
+ def inc_index
39
+ @index = @index + 1
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,11 @@
1
+ module ProconBypassMan::SignalHandler
2
+ def handle_signal(sig)
3
+ ProconBypassMan.logger.info "#{$$}で#{sig}を受け取りました"
4
+ case sig
5
+ when 'USR2'
6
+ raise ProconBypassMan::Runner::InterruptForRestart
7
+ when 'INT', 'TERM'
8
+ raise Interrupt
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module ProconBypassMan
2
+ class UpdateRemotePbmActionStatusHttpClient < HttpClient
3
+ def put(to_status: )
4
+ super(request_body: {
5
+ body: { status: to_status },
6
+ })
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ require "time"
2
+
3
+ module ProconBypassMan
4
+ class Uptime
5
+ # @return [Integer]
6
+ def self.from_boot
7
+ new(uptime_cmd_result: `uptime -s`.chomp).from_boot
8
+ end
9
+
10
+ # @param [String] uptime_cmd_result
11
+ def initialize(uptime_cmd_result: )
12
+ @result = uptime_cmd_result
13
+ end
14
+
15
+ # @return [Integer]
16
+ def from_boot
17
+ return -1 if @result == '' # darwin系だとsオプションが使えない
18
+ boot_time = Time.parse(@result).to_i
19
+ return Time.now.to_i - boot_time.to_i
20
+ rescue => e
21
+ ProconBypassMan.logger.error(e)
22
+ return -1
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,38 @@
1
+ module ProconBypassMan
2
+ class RemotePbmActionObject
3
+ # valueobjectがvalidatorの責務も持っている. 今度分離する
4
+ class ValidationError < StandardError; end
5
+ class MustBeNotNilError < ValidationError; end
6
+ class NonSupportAction < ValidationError; end
7
+
8
+ attr_accessor :action, :status, :uuid, :created_at, :job_args
9
+
10
+ # @param [String] action
11
+ # @param [String] status
12
+ # @param [String] #uuid
13
+ # @param [Time] created_at
14
+ # @return [Hash] job_args
15
+ def initialize(action: , status:, uuid:, created_at:, job_args: )
16
+ self.action = action
17
+ self.status = status
18
+ self.uuid = uuid
19
+ self.created_at = created_at
20
+ self.job_args = job_args
21
+
22
+ freeze
23
+ end
24
+
25
+ # @raise [MustBeNotNilError]
26
+ # @raise [NonSupportAction]
27
+ # @return [void]
28
+ def validate!
29
+ self.action or raise MustBeNotNilError, "actionは値が必須です"
30
+ self.status or raise MustBeNotNilError, "statusは値が必須です"
31
+ self.uuid or raise MustBeNotNilError, "uuidは値が必須です"
32
+
33
+ unless ProconBypassMan::RemotePbmAction::ACTIONS.include?(action)
34
+ raise NonSupportAction, "知らないアクションです"
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ProconBypassMan
4
- VERSION = "0.1.11"
4
+ VERSION = "0.1.15"
5
5
  end
@@ -3,68 +3,85 @@ require 'yaml'
3
3
  require "json"
4
4
  require "net/http"
5
5
  require "fileutils"
6
+ require "securerandom"
6
7
 
7
8
  require_relative "procon_bypass_man/version"
8
- require_relative "procon_bypass_man/callbacks"
9
- require_relative "procon_bypass_man/timer"
9
+ require_relative "procon_bypass_man/remote_pbm_action"
10
+ require_relative "procon_bypass_man/support/signal_handler"
11
+ require_relative "procon_bypass_man/support/callbacks"
12
+ require_relative "procon_bypass_man/support/safe_timeout"
13
+ require_relative "procon_bypass_man/support/compress_array"
14
+ require_relative "procon_bypass_man/support/uptime"
15
+ require_relative "procon_bypass_man/support/on_memory_cache"
16
+ require_relative "procon_bypass_man/support/http_client"
17
+ require_relative "procon_bypass_man/support/report_http_client"
18
+ require_relative "procon_bypass_man/support/update_remote_pbm_action_status_http_client"
19
+ require_relative "procon_bypass_man/support/send_device_stats_http_client"
20
+ require_relative "procon_bypass_man/support/server_pool"
21
+ require_relative "procon_bypass_man/background"
22
+ require_relative "procon_bypass_man/commands"
10
23
  require_relative "procon_bypass_man/bypass"
11
24
  require_relative "procon_bypass_man/device_connector"
25
+ require_relative "procon_bypass_man/device_status"
12
26
  require_relative "procon_bypass_man/runner"
13
27
  require_relative "procon_bypass_man/processor"
14
28
  require_relative "procon_bypass_man/configuration"
15
29
  require_relative "procon_bypass_man/buttons_setting_configuration"
16
- require_relative "procon_bypass_man/readonly_procon"
17
30
  require_relative "procon_bypass_man/procon"
31
+ require_relative "procon_bypass_man/procon_reader"
18
32
  require_relative "procon_bypass_man/procon/analog_stick"
19
33
  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"
34
+ require_relative "procon_bypass_man/value_objects/remote_pbm_action_object"
35
+ require_relative "procon_bypass_man/scheduler"
36
+ require_relative "procon_bypass_man/plugin"
24
37
 
25
38
  STDOUT.sync = true
26
39
  Thread.abort_on_exception = true
27
40
 
28
41
  module ProconBypassMan
29
- extend ProconBypassMan::Configuration::ClassAttributes
42
+ extend ProconBypassMan::Configuration::ClassMethods
30
43
 
31
- class ProConRejected < StandardError; end
32
44
  class CouldNotLoadConfigError < StandardError; end
33
- class FirstConnectionError < StandardError; end
34
- class EternalConnectionError < StandardError; end
45
+ class NotFoundProconError < StandardError; end
46
+ class ConnectionError < StandardError; end
47
+ class FirstConnectionError < ConnectionError; end
48
+ class EternalConnectionError < ConnectionError; end
35
49
 
36
- def self.buttons_setting_configure(setting_path: nil, &block)
37
- unless setting_path
38
- logger.warn "setting_pathが未設定です。設定ファイルのライブリロードが使えません。"
39
- end
50
+ # @return [void]
51
+ def self.run(setting_path: nil)
52
+ ProconBypassMan::Scheduler.start!
53
+ ProconBypassMan::Background::JobRunner.start!
40
54
 
41
- if block_given?
42
- ProconBypassMan::ButtonsSettingConfiguration.instance.instance_eval(&block)
43
- else
44
- ProconBypassMan::ButtonsSettingConfiguration::Loader.load(setting_path: setting_path)
45
- end
46
- end
47
-
48
- def self.run(setting_path: nil, &block)
49
55
  ProconBypassMan.logger.info "PBMを起動しています"
50
56
  puts "PBMを起動しています"
51
- buttons_setting_configure(setting_path: setting_path, &block)
52
- File.write(pid_path, $$)
53
- Runner.new.run
54
- rescue CouldNotLoadConfigError
55
- ProconBypassMan.logger.error "設定ファイルが不正です。設定ファイルの読み込みに失敗しました"
56
- puts "設定ファイルが不正です。設定ファイルの読み込みに失敗しました"
57
+ ProconBypassMan::ButtonsSettingConfiguration::Loader.load(setting_path: setting_path)
58
+ initialize_pbm
59
+ gadget, procon = ProconBypassMan::ConnectDeviceCommand.execute!
60
+ Runner.new(gadget: gadget, procon: procon).run
61
+ rescue ProconBypassMan::CouldNotLoadConfigError
62
+ ProconBypassMan::SendErrorCommand.execute(error: "設定ファイルが不正です。設定ファイルの読み込みに失敗しました")
63
+ ProconBypassMan::DeviceStatus.change_to_setting_syntax_error_and_shutdown!
57
64
  FileUtils.rm_rf(ProconBypassMan.pid_path)
58
65
  FileUtils.rm_rf(ProconBypassMan.digest_path)
59
66
  exit 1
60
- rescue EternalConnectionError
61
- ProconBypassMan.logger.error "接続の見込みがないのでsleepしまくります"
62
- puts "接続の見込みがないのでsleepしまくります"
67
+ rescue ProconBypassMan::NotFoundProconError
68
+ ProconBypassMan::SendErrorCommand.execute(error: "プロコンが見つかりませんでした。終了します。")
69
+ ProconBypassMan::DeviceStatus.change_to_procon_not_found_error!
63
70
  FileUtils.rm_rf(ProconBypassMan.pid_path)
64
- sleep(999999999)
65
- rescue FirstConnectionError
66
- puts "接続を確立できませんでした。やりなおします。"
67
- retry
71
+ FileUtils.rm_rf(ProconBypassMan.digest_path)
72
+ exit 1
73
+ rescue ProconBypassMan::ConnectionError
74
+ begin
75
+ raise
76
+ rescue ProconBypassMan::EternalConnectionError
77
+ ProconBypassMan::SendErrorCommand.execute(error: "接続の見込みがないのでsleepしまくります")
78
+ ProconBypassMan::DeviceStatus.change_to_connected_but_sleeping!
79
+ FileUtils.rm_rf(ProconBypassMan.pid_path)
80
+ eternal_sleep
81
+ rescue ProconBypassMan::FirstConnectionError
82
+ ProconBypassMan::SendErrorCommand.execute(error: "接続を確立できませんでした。やりなおします。")
83
+ retry
84
+ end
68
85
  end
69
86
 
70
87
  def self.configure(&block)
@@ -73,10 +90,12 @@ module ProconBypassMan
73
90
  @@configuration
74
91
  end
75
92
 
93
+ # @return [ProconBypassMan::Configuration]
76
94
  def self.config
77
95
  @@configuration ||= ProconBypassMan::Configuration.new
78
96
  end
79
97
 
98
+ # @return [void]
80
99
  def self.reset!
81
100
  ProconBypassMan::Procon::MacroRegistry.reset!
82
101
  ProconBypassMan::Procon::ModeRegistry.reset!
@@ -84,4 +103,20 @@ module ProconBypassMan
84
103
  ProconBypassMan::ButtonsSettingConfiguration.instance.reset!
85
104
  ProconBypassMan::IOMonitor.reset!
86
105
  end
106
+
107
+ def self.initialize_pbm
108
+ ProconBypassMan::WriteDeviceIdCommand.execute
109
+ ProconBypassMan::WriteSessionIdCommand.execute
110
+ File.write(pid_path, $$)
111
+ ProconBypassMan::DeviceStatus.change_to_running!
112
+ end
113
+
114
+ def self.eternal_sleep
115
+ sleep(999999999)
116
+ end
117
+
118
+ # @return [Void]
119
+ def self.hot_reload!
120
+ Process.kill(:USR2, pid)
121
+ end
87
122
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["jiikko"]
9
9
  spec.email = ["n905i.1214@gmail.com"]
10
10
 
11
- spec.summary = "extension for Nintendo Switch Pro Controller"
11
+ spec.summary = "An extension for Nintendo Switch Pro Controller"
12
12
  spec.description = spec.summary
13
13
  spec.homepage = "https://github.com/splaplapla/procon_bypass_man"
14
14
  spec.license = "MIT"
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
- # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
19
+ spec.metadata["changelog_uri"] = "https://github.com/splaplapla/procon_bypass_man/blob/master/CHANGELOG.md"
20
20
 
21
21
  # Specify which files should be added to the gem when it is released.
22
22
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ["lib"]
29
29
 
30
30
  # Uncomment to register a new dependency of your gem
31
- # spec.add_dependency "example-gem", "~> 1.0"
31
+ spec.add_dependency "pbmenv"
32
32
 
33
33
  # For more information and examples about making a new gem, checkout our
34
34
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -1,17 +1,24 @@
1
1
  # Project Template
2
- https://github.com/splaplapla/pbmenv で使っているファイルです
2
+ これらは https://github.com/splaplapla/pbmenv がinstallするときに配備するファイルです
3
3
 
4
- ## systemd
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
8
- * systemctl daemon-reload
9
- * systemctl enable pbm.service
10
- * systemctl disable pbm.service
11
- * systemctl start pbm.service
12
- * systemctl status pbm.service
13
- * systemctl restart pbm.service
14
- * systemctl list-unit-files --type=service
7
+ * sudo systemctl enable pbm.service
8
+ * sudo systemctl enable pbm_web.service
15
9
 
16
- ### ログ
10
+ ## systemdを使ってサービスから解除する方法
11
+ * sudo systemctl disable pbm.service
12
+ * sudo systemctl disable pbm_web.service
13
+
14
+ ### CheatSheet
15
+ * systemctl daemon-reload
16
+ * systemctl enable pbm.service
17
+ * systemctl disable pbm.service
18
+ * systemctl start pbm.service
19
+ * systemctl status pbm.service
20
+ * systemctl restart pbm.service
21
+ * systemctl list-unit-files --type=service
22
+
23
+ ### デバッグ
17
24
  * journalctl -xe -f
@@ -5,15 +5,14 @@ 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.11'
9
- gem 'procon_bypass_man-splatoon2', github: 'splaplapla/procon_bypass_man-splatoon2', tag: "0.1.1"
8
+ gem 'procon_bypass_man', '0.1.15'
10
9
  end
11
10
 
12
11
  ProconBypassMan.configure do |config|
13
12
  config.root = File.expand_path(__dir__)
14
13
  config.logger = Logger.new("#{ProconBypassMan.root}/app.log", 5, 1024 * 1024 * 10)
15
14
  config.logger.level = :debug
16
- # pbm.api_server = 'https://...'
15
+ # config.api_servers = ['https://...']
17
16
  config.enable_critical_error_logging = true
18
17
  end
19
18
 
@@ -1,12 +1,12 @@
1
1
  version: 1.0
2
2
  setting: |-
3
- fast_return = ProconBypassMan::Splatoon2::Macro::FastReturn
4
- guruguru = ProconBypassMan::Splatoon2::Mode::Guruguru
3
+ fast_return = ProconBypassMan::Plugin::Splatoon2::Macro::FastReturn
4
+ guruguru = ProconBypassMan::Plugin::Splatoon2::Mode::Guruguru
5
5
 
6
6
  install_macro_plugin fast_return
7
- install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToUpKey
8
- install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToRightKey
9
- install_macro_plugin ProconBypassMan::Splatoon2::Macro::JumpToLeftKey
7
+ install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToUpKey
8
+ install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToRightKey
9
+ install_macro_plugin ProconBypassMan::Plugin::Splatoon2::Macro::JumpToLeftKey
10
10
  install_mode_plugin guruguru
11
11
 
12
12
  prefix_keys_for_changing_layer [:zr, :zl, :l]
@@ -18,9 +18,9 @@ setting: |-
18
18
  flip :a, if_pressed: [:a]
19
19
  flip :down, if_pressed: :down
20
20
  macro fast_return.name, if_pressed: [:y, :b, :down]
21
- macro ProconBypassMan::Splatoon2::Macro::JumpToUpKey, if_pressed: [:y, :b, :up]
22
- macro ProconBypassMan::Splatoon2::Macro::JumpToRightKey, if_pressed: [:y, :b, :right]
23
- macro ProconBypassMan::Splatoon2::Macro::JumpToLeftKey, if_pressed: [:y, :b, :left]
21
+ macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToUpKey, if_pressed: [:y, :b, :up]
22
+ macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToRightKey, if_pressed: [:y, :b, :right]
23
+ macro ProconBypassMan::Plugin::Splatoon2::Macro::JumpToLeftKey, if_pressed: [:y, :b, :left]
24
24
  remap :l, to: :zr
25
25
  end
26
26
  layer :right, mode: guruguru.name
File without changes
data/sig/main.rbs CHANGED
@@ -8,9 +8,6 @@ interface _Pluginable
8
8
  end
9
9
 
10
10
  module ProconBypassMan
11
- class ProConRejected < StandardError
12
- end
13
-
14
11
  class CouldNotLoadConfigError < StandardError
15
12
  end
16
13
 
@@ -168,7 +165,7 @@ module ProconBypassMan
168
165
  end
169
166
 
170
167
  class ProconBypassMan::Configuration
171
- module ClassAttributes
168
+ module ClassMethods
172
169
  def root: () -> untyped
173
170
 
174
171
  def logger: () -> untyped
@@ -185,6 +182,7 @@ class ProconBypassMan::Configuration
185
182
  end
186
183
 
187
184
  attr_reader api_server: untyped
185
+ attr_reader api_servers: untyped
188
186
 
189
187
  attr_accessor enable_critical_error_logging: untyped
190
188
 
@@ -427,10 +425,6 @@ module ProconBypassMan::Procon::PressedButtonHelper
427
425
  module Static
428
426
  def pressed_button?: (untyped button) -> untyped
429
427
  end
430
-
431
- module Dynamic
432
- def compile_if_not_compile_yet!: () -> untyped
433
- end
434
428
  end
435
429
 
436
430
  class ProconBypassMan::Procon
@@ -439,8 +433,6 @@ class ProconBypassMan::Procon
439
433
 
440
434
  include PressedButtonHelper::Static
441
435
 
442
- extend PressedButtonHelper::Dynamic
443
-
444
436
  attr_reader binary: untyped
445
437
 
446
438
  def initialize: (untyped binary) -> untyped
@@ -498,7 +490,14 @@ end
498
490
 
499
491
  module ProconBypassMan
500
492
  class Uptime
501
- def self.from_boot: () -> untyped
493
+ # @return [Integer]
494
+ def self.from_boot: () -> Integer
495
+
496
+ # @param [String] uptime_cmd_result
497
+ def initialize: (uptime_cmd_result: String uptime_cmd_result) -> void
498
+
499
+ # @return [Integer]
500
+ def from_boot: () -> Integer
502
501
  end
503
502
  end
504
503
 
metadata CHANGED
@@ -1,16 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procon_bypass_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - jiikko
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-04 00:00:00.000000000 Z
12
- dependencies: []
13
- description: extension for Nintendo Switch Pro Controller
11
+ date: 2021-12-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pbmenv
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: An extension for Nintendo Switch Pro Controller
14
28
  email:
15
29
  - n905i.1214@gmail.com
16
30
  executables: []
@@ -18,6 +32,7 @@ extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
20
34
  - ".circleci/config.yml"
35
+ - ".github/workflows/release.yml"
21
36
  - ".github/workflows/ruby.yml"
22
37
  - ".gitignore"
23
38
  - ".rspec"
@@ -38,40 +53,83 @@ files:
38
53
  - docs/setup_raspi.mitamae.rb
39
54
  - docs/setup_raspi_by_mitamae.md
40
55
  - lib/procon_bypass_man.rb
41
- - lib/procon_bypass_man/background/report_thread.rb
56
+ - lib/procon_bypass_man/background.rb
57
+ - lib/procon_bypass_man/background/job_performer.rb
58
+ - lib/procon_bypass_man/background/job_runner.rb
59
+ - lib/procon_bypass_man/background/jobs/base_job.rb
60
+ - lib/procon_bypass_man/background/jobs/concerns/has_external_api_setting.rb
61
+ - lib/procon_bypass_man/background/jobs/concerns/has_internal_api_setting.rb
62
+ - lib/procon_bypass_man/background/jobs/concerns/job_runnable.rb
63
+ - lib/procon_bypass_man/background/jobs/fetch_and_run_remote_pbm_action_job.rb
64
+ - lib/procon_bypass_man/background/jobs/report_boot_job.rb
65
+ - lib/procon_bypass_man/background/jobs/report_error_job.rb
66
+ - lib/procon_bypass_man/background/jobs/report_event_base_job.rb
67
+ - lib/procon_bypass_man/background/jobs/report_load_config_job.rb
68
+ - lib/procon_bypass_man/background/jobs/report_pressed_buttons_job.rb
69
+ - lib/procon_bypass_man/background/jobs/report_reload_config_job.rb
70
+ - lib/procon_bypass_man/background/jobs/sync_device_stats_job.rb
42
71
  - lib/procon_bypass_man/boot_message.rb
43
72
  - lib/procon_bypass_man/buttons_setting_configuration.rb
73
+ - lib/procon_bypass_man/buttons_setting_configuration/layer.rb
74
+ - lib/procon_bypass_man/buttons_setting_configuration/loader.rb
75
+ - lib/procon_bypass_man/buttons_setting_configuration/validator.rb
44
76
  - lib/procon_bypass_man/bypass.rb
45
77
  - lib/procon_bypass_man/bypass/usb_hid_logger.rb
46
- - lib/procon_bypass_man/callbacks.rb
78
+ - lib/procon_bypass_man/commands.rb
79
+ - lib/procon_bypass_man/commands/bypass_command.rb
80
+ - lib/procon_bypass_man/commands/connect_device_command.rb
81
+ - lib/procon_bypass_man/commands/print_boot_message_command.rb
82
+ - lib/procon_bypass_man/commands/run_local_shell_command.rb
83
+ - lib/procon_bypass_man/commands/run_remote_pbm_action_dispatch_command.rb
84
+ - lib/procon_bypass_man/commands/send_error_command.rb
85
+ - lib/procon_bypass_man/commands/send_reload_config_event_command.rb
86
+ - lib/procon_bypass_man/commands/write_device_id_command.rb
87
+ - lib/procon_bypass_man/commands/write_session_id_command.rb
47
88
  - lib/procon_bypass_man/configuration.rb
48
- - lib/procon_bypass_man/configuration/layer.rb
49
- - lib/procon_bypass_man/configuration/loader.rb
50
- - lib/procon_bypass_man/configuration/validator.rb
51
89
  - lib/procon_bypass_man/device_connector.rb
90
+ - lib/procon_bypass_man/device_status.rb
52
91
  - lib/procon_bypass_man/io_monitor.rb
53
- - lib/procon_bypass_man/on_memory_cache.rb
54
- - lib/procon_bypass_man/outbound/base.rb
55
- - lib/procon_bypass_man/outbound/error_reporter.rb
56
- - lib/procon_bypass_man/outbound/pressed_buttons_reporter.rb
57
- - lib/procon_bypass_man/outbound/reporter.rb
92
+ - lib/procon_bypass_man/plugin.rb
93
+ - lib/procon_bypass_man/plugin/splatoon2/macro/fast_return.rb
94
+ - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_left_key.rb
95
+ - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_right_key.rb
96
+ - lib/procon_bypass_man/plugin/splatoon2/macro/jump_to_up_key.rb
97
+ - lib/procon_bypass_man/plugin/splatoon2/mode/guruguru.rb
98
+ - lib/procon_bypass_man/plugin/splatoon2/version.rb
58
99
  - lib/procon_bypass_man/processor.rb
59
100
  - lib/procon_bypass_man/procon.rb
60
101
  - lib/procon_bypass_man/procon/analog_stick.rb
61
102
  - lib/procon_bypass_man/procon/analog_stick_cap.rb
62
103
  - lib/procon_bypass_man/procon/button_collection.rb
63
- - lib/procon_bypass_man/procon/data.rb
104
+ - lib/procon_bypass_man/procon/consts.rb
64
105
  - lib/procon_bypass_man/procon/flip_cache.rb
65
- - lib/procon_bypass_man/procon/layer_changeable.rb
106
+ - lib/procon_bypass_man/procon/layer_changer.rb
66
107
  - lib/procon_bypass_man/procon/macro_registry.rb
67
108
  - lib/procon_bypass_man/procon/mode_registry.rb
68
109
  - lib/procon_bypass_man/procon/press_button_aware.rb
69
- - lib/procon_bypass_man/procon/pressed_button_helper.rb
70
110
  - lib/procon_bypass_man/procon/user_operation.rb
71
- - lib/procon_bypass_man/readonly_procon.rb
111
+ - lib/procon_bypass_man/procon_reader.rb
112
+ - lib/procon_bypass_man/remote_pbm_action.rb
113
+ - lib/procon_bypass_man/remote_pbm_action/base_action.rb
114
+ - lib/procon_bypass_man/remote_pbm_action/change_pbm_version_action.rb
115
+ - lib/procon_bypass_man/remote_pbm_action/lib/update_remote_pbm_action_status_command.rb
116
+ - lib/procon_bypass_man/remote_pbm_action/reboot_os_action.rb
117
+ - lib/procon_bypass_man/remote_pbm_action/restore_pbm_setting.rb
118
+ - lib/procon_bypass_man/remote_pbm_action/stop_pbm_action.rb
72
119
  - lib/procon_bypass_man/runner.rb
73
- - lib/procon_bypass_man/timer.rb
74
- - lib/procon_bypass_man/uptime.rb
120
+ - lib/procon_bypass_man/scheduler.rb
121
+ - lib/procon_bypass_man/support/callbacks.rb
122
+ - lib/procon_bypass_man/support/compress_array.rb
123
+ - lib/procon_bypass_man/support/http_client.rb
124
+ - lib/procon_bypass_man/support/on_memory_cache.rb
125
+ - lib/procon_bypass_man/support/report_http_client.rb
126
+ - lib/procon_bypass_man/support/safe_timeout.rb
127
+ - lib/procon_bypass_man/support/send_device_stats_http_client.rb
128
+ - lib/procon_bypass_man/support/server_pool.rb
129
+ - lib/procon_bypass_man/support/signal_handler.rb
130
+ - lib/procon_bypass_man/support/update_remote_pbm_action_status_http_client.rb
131
+ - lib/procon_bypass_man/support/uptime.rb
132
+ - lib/procon_bypass_man/value_objects/remote_pbm_action_object.rb
75
133
  - lib/procon_bypass_man/version.rb
76
134
  - procon_bypass_man.gemspec
77
135
  - project_template/README.md
@@ -80,7 +138,7 @@ files:
80
138
  - project_template/systemd_units/pbm.service
81
139
  - project_template/systemd_units/pbm_web.service
82
140
  - project_template/web.rb
83
- - sig/README.rb
141
+ - sig/README.md
84
142
  - sig/main.rbs
85
143
  homepage: https://github.com/splaplapla/procon_bypass_man
86
144
  licenses:
@@ -88,7 +146,8 @@ licenses:
88
146
  metadata:
89
147
  homepage_uri: https://github.com/splaplapla/procon_bypass_man
90
148
  source_code_uri: https://github.com/splaplapla/procon_bypass_man
91
- post_install_message:
149
+ changelog_uri: https://github.com/splaplapla/procon_bypass_man/blob/master/CHANGELOG.md
150
+ post_install_message:
92
151
  rdoc_options: []
93
152
  require_paths:
94
153
  - lib
@@ -103,8 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
162
  - !ruby/object:Gem::Version
104
163
  version: '0'
105
164
  requirements: []
106
- rubygems_version: 3.2.30
107
- signing_key:
165
+ rubygems_version: 3.0.3.1
166
+ signing_key:
108
167
  specification_version: 4
109
- summary: extension for Nintendo Switch Pro Controller
168
+ summary: An extension for Nintendo Switch Pro Controller
110
169
  test_files: []