Sha256: adac124cfd78b28fcc0a1ec6acab37d95b82d71d64ffb3bc4a2c042784cb48ba

Contents?: true

Size: 911 Bytes

Versions: 1

Compression:

Stored size: 911 Bytes

Contents

class ProconBypassMan::Bypass
  module UsbHidLogger
    extend ProconBypassMan::Callbacks::ClassMethods
    include ProconBypassMan::Callbacks

    define_callbacks :send_gadget_to_procon
    define_callbacks :send_procon_to_gadget

    set_callback :send_gadget_to_procon, :after, :log_send_gadget_to_procon
    set_callback :send_procon_to_gadget, :after, :log_procon_to_gadget

    def log_send_gadget_to_procon
      ProconBypassMan.logger.debug { ">>> #{bypass_status.to_text}" }
    end

    def log_procon_to_gadget
      ProconBypassMan.logger.debug { "<<< #{bypass_status.to_text}" }

      ProconBypassMan.cache.fetch key: 'reporter', expires_in: 5 do
        ProconBypassMan::Background::Reporter.push({
          data: ProconBypassMan::ReadonlyProcon.new(binary: bypass_status.binary).to_hash,
          reporter_class: ProconBypassMan::PressedButtonsReporter
        })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
procon_bypass_man-0.1.11 lib/procon_bypass_man/bypass/usb_hid_logger.rb