Sha256: 7f361bf1b4df3d15b2e16cd2102a80683ccfa321e72c8c066e262c9b6616bdb1

Contents?: true

Size: 1.01 KB

Versions: 17

Compression:

Stored size: 1.01 KB

Contents

module Extface
  class Driver::Posiflex::Aura80 < Extface::Driver::Base::Print
    NAME = 'Posiflex (Aura 80mm)'.freeze
    
    DEVELOPMENT = true #driver is not ready for production (not passing all tests or has major bugs)
    
    CHAR_COLUMNS = 49

    include Extface::Driver::Posiflex::AuraCommands
    
    def handle(buffer)
      #expecting only 1 status byte, move it to receive_buffer
      rpush buffer
      return buffer.length # return number of bytes processed
    end
    
    def autocut(partial = true)
      push "\r\n\r\n\r\n"
      push Printer::PAPER_CUT
    end
    
    def check_status
      flush
      push Info::GET_PAPER_STATUS
      if status = pull(3) #wait 3 sec for data
        human_status_errors(status)
        return errors.empty?
      else
        errors.add :base, "No data received from device"
        return false
      end
    end
    
    private
    
      def human_status_errors(status_byte)
        errors.add :base, "Paper out" unless (status_byte.ord & 0x0C).zero?
      end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
extface-0.7.3 app/models/extface/driver/posiflex/aura80.rb
extface-0.7.2 app/models/extface/driver/posiflex/aura80.rb
extface-0.7.1 app/models/extface/driver/posiflex/aura80.rb
extface-0.7.0 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.9 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.8 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.7 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.6 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.5 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.4 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.3 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.2 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.1 app/models/extface/driver/posiflex/aura80.rb
extface-0.6.0 app/models/extface/driver/posiflex/aura80.rb
extface-0.5.9 app/models/extface/driver/posiflex/aura80.rb
extface-0.5.8 app/models/extface/driver/posiflex/aura80.rb
extface-0.5.7 app/models/extface/driver/posiflex/aura80.rb