Sha256: 7cf31de6f8397e2d4c77c47827bbd59ca93bc7ebc7fe5bb9090a7d59f50f441b

Contents?: true

Size: 1.28 KB

Versions: 19

Compression:

Stored size: 1.28 KB

Contents

class ProconBypassMan::DeviceConnection::OutputReportWatcher
  include ProconBypassMan::DeviceConnection::OutputReportMarkerable

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

  # @param [String] sub_command
  # @param [String] sub_command_arg
  # @return [Boolean]
  def sent?(sub_command: , sub_command_arg: )
    @hid_sub_command_request_table.has_key?(sub_command: sub_command, sub_command_arg: sub_command_arg)
  end

  # @param [String] sub_command
  # @param [String] sub_command_arg
  # @return [Boolean]
  def received?(sub_command: , sub_command_arg: )
    @hid_sub_command_request_table.has_value?(sub_command: sub_command, sub_command_arg: sub_command_arg)
  end

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

  # @return [Boolean]
  # @raise [Timeout::Error]
  def timeout_or_completed?
    if @timer.timeout?
      ProconBypassMan::SendErrorCommand.execute(error: "[pre_bypass] pre_bypassフェーズがタイムアウトしました")
      return true
    end

    if completed?
      ProconBypassMan.logger.info "[pre_bypass] pre_bypassフェーズが想定通り終了しました"
      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/output_report_watcher.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.2 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.1 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.3.0 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.2.3 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.2.2 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.2.1 lib/procon_bypass_man/device_connection/output_report_watcher.rb
procon_bypass_man-0.2.0 lib/procon_bypass_man/device_connection/output_report_watcher.rb