Class: ProconBypassMan::DeviceConnection::SpoofingOutputReportWatcher

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

Constant Summary

Constants included from OutputReportMarkerable

OutputReportMarkerable::INPUT_REPORT_FORMAT, OutputReportMarkerable::OUTPUT_REPORT_FORMAT

Instance Method Summary collapse

Methods included from OutputReportMarkerable

#mark_as_receive, #mark_as_send

Constructor Details

#initialize(expected_sub_commands:) ⇒ SpoofingOutputReportWatcher

Returns a new instance of SpoofingOutputReportWatcher.



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

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

Instance Method Details

#completed?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb', line 21

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

#has_unreceived_command?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb', line 11

def has_unreceived_command?
  @hid_sub_command_request_table.has_unreceived_command?
end

#timeout_or_completed?Boolean

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb', line 28

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

#unreceived_sub_command_with_argString, NilClass

Returns:

  • (String, NilClass)


16
17
18
# File 'lib/procon_bypass_man/device_connection/spoofing_output_report_watcher.rb', line 16

def unreceived_sub_command_with_arg
  @hid_sub_command_request_table.unreceived_sub_command_with_arg
end