Sha256: 77f87b28b9832a6aca0bdb0552fad792ffb8fd2e0c90d39d8c9b9df636f0730d
Contents?: true
Size: 874 Bytes
Versions: 19
Compression:
Stored size: 874 Bytes
Contents
class ProconBypassMan::DeviceConnection::OutputReportGenerator def initialize @counter = 0 end # @return [String] def generate_by_step(step) sub_command_with_arg = ProconBypassMan::DeviceConnection::ProconSettingOverrider::ALL_SETTINGS[step]&.join or raise("Unsupport step") raw_data = generate(sub_command_with_arg) count_up raw_data end # @return [String] def generate_by_sub_command_with_arg(sub_command_with_arg) raw_data = generate(sub_command_with_arg) count_up raw_data end private # @return [String] def generate(sub_command_with_arg) [ ["01", counter, "00" * 8, sub_command_with_arg].join ].pack("H*") end def count_up @counter = @counter + 1 if @counter >= 256 @counter = 0 else @counter end end def counter @counter.to_s(16).rjust(2, "0") end end
Version data entries
19 entries across 19 versions & 1 rubygems