Sha256: 9ac65b878d2d8501972e5eb0b71017ffa25a49b09a0037676a9da2f873c72179

Contents?: true

Size: 1.26 KB

Versions: 19

Compression:

Stored size: 1.26 KB

Contents

class ProconBypassMan::DeviceConnection::SpoofingOutputReportWatcher
  include ProconBypassMan::DeviceConnection::OutputReportMarkerable

  def initialize(expected_sub_commands: )
    @timer = ProconBypassMan::SafeTimeout.new
    @hid_sub_command_request_table = ProconBypassMan::DeviceConnection::OutputReportSubCommandTable.new
    @expected_sub_commands = expected_sub_commands
  end

  # @return [Boolean]
  def has_unreceived_command?
    @hid_sub_command_request_table.has_unreceived_command?
  end

  # @return [String, NilClass]
  def unreceived_sub_command_with_arg
    @hid_sub_command_request_table.unreceived_sub_command_with_arg
  end

  # @return [Boolean]
  def completed?
    @expected_sub_commands.all? do |sub_command, sub_command_arg|
      @hid_sub_command_request_table.has_value?(sub_command: sub_command, sub_command_arg: sub_command_arg)
    end
  end

  # @return [Boolean]
  def timeout_or_completed?
    if @timer.timeout?
      ProconBypassMan.logger.info "[procon setting override] プロコンの設定上書き処理がタイムアウトしました"
      return true
    end

    if completed?
      ProconBypassMan.logger.info "[procon setting override] プロコンの設定上書き処理が想定通り終了しました"
      return true
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.2.3 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.2.2 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.2.1 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb
procon_bypass_man-0.2.0 lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb