Sha256: 51623aea87a32129c6ba9f306ad53a3f30167d54b1aea3b28665279072f9ce50

Contents?: true

Size: 786 Bytes

Versions: 7

Compression:

Stored size: 786 Bytes

Contents

require 'tamashii/agent/common'
module Tamashii
  module Agent
    module Device
      class FakeCardReader
        include Common::Loggable

        def initialize(*args)
          logger.debug "Initialized"
          @last_time = Time.now
        end

        def picc_request(*args)
          if Time.now - @last_time > 2
            @last_time = Time.now
            if rand > 0.5
              logger.debug "Fake Card Generated"
              return true
            else
              return false
            end
          else
            return false
          end
        end

        def picc_select(*args)
          [Array.new(4){ rand(256)}, "sak"]
        end

        def picc_halt(*args)
        end

        def shutdown(*args)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tamashii-agent-0.3.0 lib/tamashii/agent/device/fake_card_reader.rb
tamashii-agent-0.2.8 lib/tamashii/agent/device/fake_card_reader.rb
tamashii-agent-0.2.7 lib/tamashii/agent/device/fake_card_reader.rb
tamashii-agent-0.2.6 lib/tamashii/agent/device/fake_card_reader.rb
tamashii-agent-0.2.5 lib/tamashii/agent/device/fake_card_reader.rb
tamashii-agent-0.2.4 lib/tamashii/agent/device/fake_card_reader.rb
tamashii-agent-0.2.3 lib/tamashii/agent/device/fake_card_reader.rb