Sha256: fbc36daf07650ca1c1d07259ed0d3931ed1a9a299024a6ac96cc77333db58bfb

Contents?: true

Size: 799 Bytes

Versions: 4

Compression:

Stored size: 799 Bytes

Contents

require 'tamashii/agent/device/card_reader/base'

module Tamashii
  module Agent
    module Device
      module CardReader
        class Dummy < Base
          def initialize(*args)
            super
            logger.debug "Initialized"
            @last_time = Time.now
          end

          def poll_uid
            if Time.now - @last_time > 2
              @last_time = Time.now
              if rand > 0.5
                uid = Array.new(4){ rand(256)}
                logger.debug "Fake Card Generated: #{uid}"
                return uid
              else
                return nil
              end
            else
              return nil
            end
          end

          def shutdown
            logger.debug "Stopped"
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tamashii-agent-0.4.0 lib/tamashii/agent/device/card_reader/dummy.rb
tamashii-agent-0.3.4 lib/tamashii/agent/device/card_reader/dummy.rb
tamashii-agent-0.3.3 lib/tamashii/agent/device/card_reader/dummy.rb
tamashii-agent-0.3.1 lib/tamashii/agent/device/card_reader/dummy.rb