Class: ProconBypassMan::DeviceConnection::OutputReportWatcher

Inherits:
Object
  • Object
show all
Includes:
OutputReportMarkerable
Defined in:
lib/procon_bypass_man/device_connection/output_report_watcher.rb

Constant Summary

Constants included from OutputReportMarkerable

ProconBypassMan::DeviceConnection::OutputReportMarkerable::INPUT_REPORT_FORMAT, ProconBypassMan::DeviceConnection::OutputReportMarkerable::OUTPUT_REPORT_FORMAT

Instance Method Summary collapse

Methods included from OutputReportMarkerable

#mark_as_receive, #mark_as_send

Constructor Details

#initializeOutputReportWatcher

Returns a new instance of OutputReportWatcher.



4
5
6
7
# File 'lib/procon_bypass_man/device_connection/output_report_watcher.rb', line 4

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

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/procon_bypass_man/device_connection/output_report_watcher.rb', line 24

def completed?
  @hid_sub_command_request_table.completed?
end

#received?(sub_command:, sub_command_arg:) ⇒ Boolean

Parameters:

  • sub_command (String)
  • sub_command_arg (String)

Returns:

  • (Boolean)


19
20
21
# File 'lib/procon_bypass_man/device_connection/output_report_watcher.rb', line 19

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

#sent?(sub_command:, sub_command_arg:) ⇒ Boolean

Parameters:

  • sub_command (String)
  • sub_command_arg (String)

Returns:

  • (Boolean)


12
13
14
# File 'lib/procon_bypass_man/device_connection/output_report_watcher.rb', line 12

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

#timeout_or_completed?Boolean

Returns:

  • (Boolean)

Raises:

  • (Timeout::Error)


30
31
32
33
34
35
36
37
38
39
40
# File 'lib/procon_bypass_man/device_connection/output_report_watcher.rb', line 30

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